diff --git a/.globalconfig b/.globalconfig new file mode 100644 index 0000000000..6cdb1eefae --- /dev/null +++ b/.globalconfig @@ -0,0 +1,13 @@ +# .NET code analysis rule set +is_global = true + +# Current +dotnet_diagnostic.CDX1000.severity = error # DontConvertExceptionToObject +dotnet_diagnostic.CDX1001.severity = error # DontUseExceptionInInterpolation +dotnet_diagnostic.CDX1002.severity = error # DontUseExceptionStackTrace +dotnet_diagnostic.CDX1003.severity = error # DontUseExceptionToString + +# 📊 Experimental Analyzer Features +dotnet_diagnostic.CDX1004.severity = suggestion # Experimental - DontCreateNestedExceptions +dotnet_diagnostic.CDX1005.severity = suggestion # Experimental - DontThrowExceptions +dotnet_diagnostic.CDX1006.severity = suggestion # Experimental - DontCatchGenericExceptions \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props index dc3c105290..7aa6ac0668 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,14 +1,14 @@ - 3.47.1 - 3.48.0 + 3.52.1 + 3.53.0 preview.1 - 3.37.10 + 3.39.1 1.0.0 beta.0 - 2.0.4 + 2.0.5 2.1.0 - preview4 + preview5 1.0.0-preview08 1.1.0-preview3 10.0 diff --git a/Microsoft.Azure.Cosmos.Encryption.Custom/src/Microsoft.Azure.Cosmos.Encryption.Custom.csproj b/Microsoft.Azure.Cosmos.Encryption.Custom/src/Microsoft.Azure.Cosmos.Encryption.Custom.csproj index a9d6be5f76..7477cc3ce3 100644 --- a/Microsoft.Azure.Cosmos.Encryption.Custom/src/Microsoft.Azure.Cosmos.Encryption.Custom.csproj +++ b/Microsoft.Azure.Cosmos.Encryption.Custom/src/Microsoft.Azure.Cosmos.Encryption.Custom.csproj @@ -13,7 +13,7 @@ Microsoft Azure Cosmos DB client-side encryption library for multi-tenant Microsoft.Azure.Cosmos.Encryption.Custom true - LICENSE + MIT https://github.com/Azure/azure-cosmos-dotnet-v3 true true @@ -32,10 +32,6 @@ - - - - diff --git a/Microsoft.Azure.Cosmos.Encryption.Custom/tests/Microsoft.Azure.Cosmos.Encryption.Custom.Tests/Contracts/DotNetSDKEncryptionCustomAPI.json b/Microsoft.Azure.Cosmos.Encryption.Custom/tests/Microsoft.Azure.Cosmos.Encryption.Custom.Tests/Contracts/DotNetSDKEncryptionCustomAPI.json index 924605107c..280be12c65 100644 --- a/Microsoft.Azure.Cosmos.Encryption.Custom/tests/Microsoft.Azure.Cosmos.Encryption.Custom.Tests/Contracts/DotNetSDKEncryptionCustomAPI.json +++ b/Microsoft.Azure.Cosmos.Encryption.Custom/tests/Microsoft.Azure.Cosmos.Encryption.Custom.Tests/Contracts/DotNetSDKEncryptionCustomAPI.json @@ -1386,6 +1386,22 @@ }, "NestedTypes": {} }, + "Microsoft.Azure.Cosmos.Encryption.Custom.JsonProcessor;System.Enum;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:True;IsClass:False;IsValueType:True;IsNested:False;IsGenericType:False;IsSerializable:True": { + "Subclasses": {}, + "Members": { + "Int32 value__": { + "Type": "Field", + "Attributes": [], + "MethodInfo": "Int32 value__;IsInitOnly:False;IsStatic:False;" + }, + "Microsoft.Azure.Cosmos.Encryption.Custom.JsonProcessor Newtonsoft": { + "Type": "Field", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.Encryption.Custom.JsonProcessor Newtonsoft;IsInitOnly:False;IsStatic:True;" + } + }, + "NestedTypes": {} + }, "Microsoft.Azure.Cosmos.Encryption.Custom.JsonProcessor;System.Enum;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:True;IsClass:False;IsValueType:True;IsNested:False;IsGenericType:False;IsSerializable:True": { "Subclasses": {}, "Members": { diff --git a/Microsoft.Azure.Cosmos.Encryption/changelog.md b/Microsoft.Azure.Cosmos.Encryption/changelog.md index 791f512aea..a719faa43f 100644 --- a/Microsoft.Azure.Cosmos.Encryption/changelog.md +++ b/Microsoft.Azure.Cosmos.Encryption/changelog.md @@ -3,6 +3,18 @@ Preview features are treated as a separate branch and will not be included in th The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +### [2.0.5](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption/2.0.5) - 2025-05-23 + +#### Added +- [#5215](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5215) Adds support for Microsoft.Azure.Cosmos from version 3.37.1 to 3.51.0 + +### [2.1.0-preview5](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption/2.1.0-preview5) - 2025-05-23 + +#### Added +- [#5215](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5215) Adds support for Microsoft.Azure.Cosmos 3.52.0-preview.0 + +### [2.0.3](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption/2.0.3) - 2023-07-12 + ### [2.0.4](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption/2.0.4) - 2023-12-12 #### Added diff --git a/Microsoft.Azure.Cosmos.Encryption/src/EncryptionContainer.cs b/Microsoft.Azure.Cosmos.Encryption/src/EncryptionContainer.cs index b064da247c..f46282f59c 100644 --- a/Microsoft.Azure.Cosmos.Encryption/src/EncryptionContainer.cs +++ b/Microsoft.Azure.Cosmos.Encryption/src/EncryptionContainer.cs @@ -753,6 +753,22 @@ public override Task> GetPartitionKeyRangesAsync( { return this.Container.GetPartitionKeyRangesAsync(feedRange, cancellationToken); } + + public override ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes(string processorName, ChangeFeedHandler> onChangesDelegate) + { + throw new NotImplementedException(); + } +#endif + +#if SDKPROJECTREF + + public override Task IsFeedRangePartOfAsync( + Cosmos.FeedRange x, + Cosmos.FeedRange y, + CancellationToken cancellationToken = default) + { + throw new NotImplementedException(); + } #endif #if SDKPROJECTREF diff --git a/Microsoft.Azure.Cosmos.Encryption/src/Microsoft.Azure.Cosmos.Encryption.csproj b/Microsoft.Azure.Cosmos.Encryption/src/Microsoft.Azure.Cosmos.Encryption.csproj index be4c854f0b..c43d1be458 100644 --- a/Microsoft.Azure.Cosmos.Encryption/src/Microsoft.Azure.Cosmos.Encryption.csproj +++ b/Microsoft.Azure.Cosmos.Encryption/src/Microsoft.Azure.Cosmos.Encryption.csproj @@ -17,7 +17,7 @@ Microsoft Azure Cosmos DB client-side encryption library Microsoft.Azure.Cosmos.Encryption true - LICENSE + MIT https://github.com/Azure/azure-cosmos-dotnet-v3 false true @@ -29,19 +29,15 @@ - + - - - - - + diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/BenchmarkConfig.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/BenchmarkConfig.cs index 6d02c40f79..fbb6ee51e3 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/BenchmarkConfig.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/BenchmarkConfig.cs @@ -31,6 +31,20 @@ public class BenchmarkConfig [JsonIgnore] public string Key { get; set; } + [Option("isthinclientenabled", Required = false, HelpText = "ThinClient enabled")] + public string IsThinClientEnabledRaw { get; set; } + public bool IsThinClientEnabled => string.Equals(this.IsThinClientEnabledRaw, "true", StringComparison.OrdinalIgnoreCase); + + [Option("isgatewaymodeenabled", Required = false, HelpText = "Gateway mode enabled")] + public string IsGatewayModeEnabledRaw { get; set; } + public bool IsGatewayModeEnabled => string.Equals(this.IsGatewayModeEnabledRaw, "true", StringComparison.OrdinalIgnoreCase); + + [Option("isdirectmodeenabled", Required = false, HelpText = "Direct mode enabled")] + public string IsDirectModeEnabledRaw { get; set; } + public bool IsDirectModeEnabled => string.Equals(this.IsDirectModeEnabledRaw, "true", StringComparison.OrdinalIgnoreCase); + + + [Option(Required = false, HelpText = "Workload Name, it will override the workloadType value in published results")] public string WorkloadName { get; set; } @@ -209,7 +223,7 @@ private string GetUserAgentPrefix() return this.WorkloadName ?? this.WorkloadType ?? BenchmarkConfig.UserAgentSuffix; } - internal Microsoft.Azure.Cosmos.CosmosClient CreateCosmosClient(string accountKey) + internal Microsoft.Azure.Cosmos.CosmosClient CreateCosmosClient() { // Overwrite the default timespan if configured if(this.TelemetryScheduleInSec > 0) @@ -223,6 +237,7 @@ internal Microsoft.Azure.Cosmos.CosmosClient CreateCosmosClient(string accountKe MaxRetryAttemptsOnRateLimitedRequests = 0, MaxRequestsPerTcpConnection = this.MaxRequestsPerTcpConnection, MaxTcpConnectionsPerEndpoint = this.MaxTcpConnectionsPerEndpoint, + ConnectionMode = (this.IsThinClientEnabled || this.IsGatewayModeEnabled) ? Microsoft.Azure.Cosmos.ConnectionMode.Gateway: Microsoft.Azure.Cosmos.ConnectionMode.Direct, CosmosClientTelemetryOptions = new Microsoft.Azure.Cosmos.CosmosClientTelemetryOptions() { DisableSendingMetricsToService = !this.EnableTelemetry, @@ -243,7 +258,7 @@ internal Microsoft.Azure.Cosmos.CosmosClient CreateCosmosClient(string accountKe return new Microsoft.Azure.Cosmos.CosmosClient( this.EndPoint, - accountKey, + this.Key, clientOptions); } diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Program.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Program.cs index a3f2f2dfa9..a407f47a87 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Program.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Program.cs @@ -35,6 +35,8 @@ public static async Task Main(string[] args) try { BenchmarkConfig config = BenchmarkConfig.From(args); + Environment.SetEnvironmentVariable("AZURE_COSMOS_THIN_CLIENT_ENABLED", config.IsThinClientEnabled.ToString()); + await AddAzureInfoToRunSummary(); MeterProvider meterProvider = BuildMeterProvider(config); @@ -71,6 +73,8 @@ public static async Task Main(string[] args) } finally { + Environment.SetEnvironmentVariable("AZURE_COSMOS_THIN_CLIENT_ENABLED", "False"); + Utility.TeeTraceInformation($"{nameof(CosmosBenchmark)} completed successfully."); if (Debugger.IsAttached) { @@ -144,7 +148,8 @@ private static async Task AddAzureInfoToRunSummary() private async Task ExecuteAsync(BenchmarkConfig config) { // V3 SDK client initialization - using (CosmosClient cosmosClient = config.CreateCosmosClient(config.Key)) + + using (CosmosClient cosmosClient = config.CreateCosmosClient()) { Microsoft.Azure.Cosmos.Database database = cosmosClient.GetDatabase(config.Database); if (config.CleanupOnStart) @@ -219,8 +224,8 @@ private async Task ExecuteAsync(BenchmarkConfig config) Utility.TeeTraceInformation("Publishing results"); runSummary.Diagnostics = CosmosDiagnosticsLogger.GetDiagnostics(); await this.PublishResults( - config, - runSummary, + config, + runSummary, cosmosClient); } @@ -376,7 +381,7 @@ private static async Task GetResultContainer(BenchmarkConfig config, private static void ClearCoreSdkListeners() { - Type defaultTrace = Type.GetType("Microsoft.Azure.Cosmos.Core.Trace.DefaultTrace,Microsoft.Azure.Cosmos.Client"); + Type defaultTrace = Type.GetType("Microsoft.Azure.Cosmos.Core.Trace.DefaultTrace,Microsoft.Azure.Cosmos.Direct"); TraceSource traceSource = (TraceSource)defaultTrace.GetProperty("TraceSource").GetValue(null); traceSource.Switch.Level = SourceLevels.All; traceSource.Listeners.Clear(); diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/RunSummary.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/RunSummary.cs index 4f84322554..cf799cb97b 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/RunSummary.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/RunSummary.cs @@ -28,7 +28,6 @@ public RunSummary( public string Commit => this.BenchmarkConfig.CommitId; public string CommitDate => this.BenchmarkConfig.CommitDate; public string CommitTime => this.BenchmarkConfig.CommitTime; - public string Remarks { get; set; } public string Date { get; } public string Time { get; } @@ -59,8 +58,7 @@ public RunSummary( [JsonProperty] public static string Location { get; set; } [JsonProperty] - public static JObject AzureVmInfo { get; set; } - + public static JObject AzureVmInfo { get; set; } public double Top10PercentAverageRps { get; set; } public double Top20PercentAverageRps { get; set; } public double Top30PercentAverageRps { get; set; } diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/loop.sh b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/loop.sh index 11ff4ebf8a..1dd0b1ae35 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/loop.sh +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/loop.sh @@ -8,7 +8,7 @@ export PL=18 export ACCOUNT_ENDPOINT= export ACCOUNT_KEY= -#Loop forever +# Loop forever i=0 while : do @@ -16,6 +16,25 @@ do pkill -f run.sh git pull origin master + # Distribute workload between modes + mode=$((i % 3)) + if [ $mode -eq 0 ]; then + echo "Running in THINCLIENT mode" + export THINCLIENT_ENABLED=true + export GATEWAYMODE_ENABLED=false + export DIRECTMODE_ENABLED=false + elif [ $mode -eq 1 ]; then + echo "Running in GATEWAY mode" + export THINCLIENT_ENABLED=false + export GATEWAYMODE_ENABLED=true + export DIRECTMODE_ENABLED=false + else + echo "Running in DIRECT mode" + export THINCLIENT_ENABLED=false + export GATEWAYMODE_ENABLED=false + export DIRECTMODE_ENABLED=true + fi + # Query operations take a long time # Only run them once every 10 runs if [ $(($i % 10)) -eq 0 ]; then @@ -30,5 +49,5 @@ do echo "====== Waiting for 10Sec =================" sleep 10 #Wait for 10sec - + done \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/run.sh b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/run.sh index 81cafc4a4a..0d6e001743 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/run.sh +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/run.sh @@ -1,5 +1,6 @@ #!/bin/bash + if [ -z "$ACCOUNT_ENDPOINT" ] then echo "Missing ACCOUNT_ENDPOINT" @@ -24,12 +25,6 @@ then exit -1 fi -if [ -z "$TELEMETRY_ENDPOINT" ] -then - echo "Missing TELEMETRY_ENDPOINT" - exit -1 -fi - if [ -z "$INCLUDE_QUERY" ] then echo "Missing INCLUDE_QUERY" @@ -46,37 +41,78 @@ echo $COMMIT_DATE echo $COMMIT_TIME echo $BRANCH_NAME -# Client telemetry disabled ReadStreamExistsV3 -dotnet run -c Release -- -n 2000000 -w ReadStreamExistsV3 --tcp 10 --pl $PL -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk -sleep 10 #Wait +MODE_FLAGS="--isthinclientenabled=${THINCLIENT_ENABLED:-false} \ +--isgatewaymodeenabled=${GATEWAYMODE_ENABLED:-false} \ +--isdirectmodeenabled=${DIRECTMODE_ENABLED:-false}" -# Client telemetry enabled ReadStreamExistsV3. This is needed to see the impact of client telemetry. -dotnet run -c Release -- -n 2000000 -w ReadStreamExistsV3 --WorkloadName ReadStreamExistsV3WithTelemetry --enableTelemetry --telemetryScheduleInSec 60 --telemetryEndpoint $TELEMETRY_ENDPOINT --tcp 10 --pl $PL -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk -sleep 10 #Wait + # ---------- 1) ALWAYS RUN THESE 10 WORKLOADS ---------- +for WORKLOAD_NAME in \ + CreateItemV3BenchmarkOperation \ + InsertV3BenchmarkOperation \ + ReadItemV3BenchmarkOperation \ + ReadStreamExistsV3BenchmarkOperation \ + ReplaceItemV3BenchmarkOperation \ + ReplaceItemStreamV3BenchmarkOperation \ + UpsertItemV3BenchmarkOperation \ + UpsertItemStreamV3BenchmarkOperation \ + DeleteItemV3BenchmarkOperation \ + DeleteItemStreamV3BenchmarkOperation +do + dotnet run -c Release \ + -- -n 2000000 \ + -w $WORKLOAD_NAME \ + $MODE_FLAGS \ + --pl $PL \ + -e $ACCOUNT_ENDPOINT \ + -k $ACCOUNT_KEY \ + --enablelatencypercentiles \ + --disablecoresdklogging \ + --publishresults \ + --resultspartitionkeyvalue $RESULTS_PK \ + --commitid $COMMIT_ID \ + --commitdate $COMMIT_DATE \ + --committime $COMMIT_TIME \ + --branchname $BRANCH_NAME \ + --database testdb \ + --container testcol \ + --partitionkeypath /pk + sleep 10 +done -# Open telemetry enabled ReadStreamExistsV3. This is needed to see the impact of distributed tracing (without listener) -dotnet run -c Release -- -n 2000000 -w ReadStreamExistsV3 --WorkloadName ReadStreamExistsV3WithDistributedTracingWOListener --enableDistributedTracing --tcp 10 --pl $PL -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk -sleep 10 #Wait +# ---------- 2) ADDITIONAL SCENARIOS DIRECT-ONLY ---------- +if [ "${DIRECTMODE_ENABLED:-false}" = true ]; then + # Client telemetry disabled ReadStreamExistsV3 + dotnet run -c Release -- -n 2000000 -w ReadStreamExistsV3 $MODE_FLAGS --tcp 10 --pl $PL -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk + sleep 10 #Wait -#Point read operations -for WORKLOAD_NAME in ReadNotExistsV3 ReadTExistsV3 ReadStreamExistsWithDiagnosticsV3 -do - dotnet run -c Release -- -n 2000000 -w $WORKLOAD_NAME --pl $PL --enableTelemetry --telemetryScheduleInSec 60 --telemetryEndpoint $TELEMETRY_ENDPOINT --tcp 10 -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk + # Client telemetry enabled ReadStreamExistsV3. This is needed to see the impact of client telemetry. + dotnet run -c Release -- -n 2000000 -w ReadStreamExistsV3 $MODE_FLAGS --WorkloadName ReadStreamExistsV3WithTelemetry --enableTelemetry --telemetryScheduleInSec 60 --telemetryEndpoint $TELEMETRY_ENDPOINT --tcp 10 --pl $PL -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk sleep 10 #Wait -done -#Insert operation -dotnet run -c Release -- -n 2000000 -w InsertV3 --pl 30 --enableTelemetry --telemetryScheduleInSec 60 --telemetryEndpoint $TELEMETRY_ENDPOINT --tcp 1 -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk -sleep 45 #Wait + # Open telemetry enabled ReadStreamExistsV3. This is needed to see the impact of distributed tracing (without listener) + dotnet run -c Release -- -n 2000000 -w ReadStreamExistsV3 $MODE_FLAGS --WorkloadName ReadStreamExistsV3WithDistributedTracingWOListener --enableDistributedTracing --tcp 10 --pl $PL -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk + sleep 10 #Wait -if [ "$INCLUDE_QUERY" = true ] -then - #Query operations - # n value is lowered to 200000 because queries are significantly slower. This prevents the runs from taking to long. - # pl is 16 because 18 was casuing a small amount of thorrtles. - for WORKLOAD_NAME in ReadFeedStreamV3 QueryTSinglePkV3 QueryTSinglePkOrderByWithPaginationV3 QueryTSinglePkOrderByFullDrainV3 QueryTCrossPkV3 QueryTCrossPkOrderByWithPaginationV3 QueryTCrossPkOrderByFullDrainV3 QueryStreamSinglePkV3 QueryStreamSinglePkOrderByWithPaginationV3 QueryStreamSinglePkOrderByFullDrainV3 QueryStreamCrossPkV3 QueryStreamCrossPkOrderByWithPaginationV3 QueryStreamCrossPkOrderByFullDrainV3 + #Point read operations + for WORKLOAD_NAME in ReadNotExistsV3 ReadTExistsV3 ReadStreamExistsWithDiagnosticsV3 do - dotnet run -c Release -- -n 200000 -w $WORKLOAD_NAME --pl 16 --enableTelemetry --telemetryScheduleInSec 60 --telemetryEndpoint $TELEMETRY_ENDPOINT --tcp 10 -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk + dotnet run -c Release -- -n 2000000 -w $WORKLOAD_NAME $MODE_FLAGS --pl $PL --enableTelemetry --telemetryScheduleInSec 60 --telemetryEndpoint $TELEMETRY_ENDPOINT --tcp 10 -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk sleep 10 #Wait done + + #Insert operation + dotnet run -c Release -- -n 2000000 -w InsertV3 $MODE_FLAGS --pl 30 --enableTelemetry --telemetryScheduleInSec 60 --telemetryEndpoint $TELEMETRY_ENDPOINT --tcp 1 -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk + sleep 45 #Wait + + if [ "$INCLUDE_QUERY" = true ] + then + #Query operations + # n value is lowered to 200000 because queries are significantly slower. This prevents the runs from taking to long. + # pl is 16 because 18 was casuing a small amount of thorrtles. + for WORKLOAD_NAME in ReadFeedStreamV3 QueryTSinglePkV3 QueryTSinglePkOrderByWithPaginationV3 QueryTSinglePkOrderByFullDrainV3 QueryTCrossPkV3 QueryTCrossPkOrderByWithPaginationV3 QueryTCrossPkOrderByFullDrainV3 QueryStreamSinglePkV3 QueryStreamSinglePkOrderByWithPaginationV3 QueryStreamSinglePkOrderByFullDrainV3 QueryStreamCrossPkV3 QueryStreamCrossPkOrderByWithPaginationV3 QueryStreamCrossPkOrderByFullDrainV3 + do + dotnet run -c Release -- -n 200000 -w $WORKLOAD_NAME $MODE_FLAGS --pl 16 --enableTelemetry --telemetryScheduleInSec 60 --telemetryEndpoint $TELEMETRY_ENDPOINT --tcp 10 -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk + sleep 10 #Wait + done + fi fi \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/CreateItemV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/CreateItemV3BenchmarkOperation.cs new file mode 100644 index 0000000000..950e4a4be3 --- /dev/null +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/CreateItemV3BenchmarkOperation.cs @@ -0,0 +1,60 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace CosmosBenchmark +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos; + + internal class CreateItemV3BenchmarkOperation : IBenchmarkOperation + { + private readonly Container container; + private readonly string partitionKeyPath; + private readonly Dictionary sampleJObject; + private readonly string databaseName; + private readonly string containerName; + + public CreateItemV3BenchmarkOperation( + CosmosClient cosmosClient, + string dbName, + string containerName, + string partitionKeyPath, + string sampleJson) + { + this.databaseName = dbName; + this.containerName = containerName; + this.container = cosmosClient.GetContainer(this.databaseName, this.containerName); + this.partitionKeyPath = partitionKeyPath.Replace("/", ""); + this.sampleJObject = JsonHelper.Deserialize>(sampleJson); + } + + public BenchmarkOperationType OperationType => BenchmarkOperationType.Insert; + + public Task PrepareAsync() + { + this.sampleJObject["id"] = Guid.NewGuid().ToString(); + this.sampleJObject[this.partitionKeyPath] = Guid.NewGuid().ToString(); + return Task.CompletedTask; + } + + public async Task ExecuteOnceAsync() + { + PartitionKey partitionKey = new PartitionKey(this.sampleJObject[this.partitionKeyPath].ToString()); + ItemResponse> response = await this.container.CreateItemAsync(this.sampleJObject, partitionKey: partitionKey); + + return new OperationResult + { + DatabseName = this.databaseName, + ContainerName = this.containerName, + OperationType = this.OperationType, + RuCharges = response.RequestCharge, + CosmosDiagnostics = response.Diagnostics, + LazyDiagnostics = () => response.Diagnostics.ToString(), + }; + } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/DeleteItemStreamV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/DeleteItemStreamV3BenchmarkOperation.cs new file mode 100644 index 0000000000..7ee5322656 --- /dev/null +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/DeleteItemStreamV3BenchmarkOperation.cs @@ -0,0 +1,66 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ +namespace CosmosBenchmark +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos; + + internal class DeleteItemStreamV3BenchmarkOperation : IBenchmarkOperation + { + private readonly Container container; + private readonly string partitionKeyPath; + private readonly Dictionary sampleJObject; + private readonly string databaseName; + private readonly string containerName; + private string itemId; + private string itemPk; + + public DeleteItemStreamV3BenchmarkOperation( + CosmosClient cosmosClient, + string dbName, + string containerName, + string partitionKeyPath, + string sampleJson) + { + this.databaseName = dbName; + this.containerName = containerName; + this.container = cosmosClient.GetContainer(this.databaseName, this.containerName); + this.partitionKeyPath = partitionKeyPath.Replace("/", ""); + this.sampleJObject = JsonHelper.Deserialize>(sampleJson); + } + + public BenchmarkOperationType OperationType => BenchmarkOperationType.Read; + + public async Task PrepareAsync() + { + this.itemId = Guid.NewGuid().ToString(); + this.itemPk = Guid.NewGuid().ToString(); + this.sampleJObject["id"] = this.itemId; + this.sampleJObject[this.partitionKeyPath] = this.itemPk; + + using (MemoryStream input = JsonHelper.ToStream(this.sampleJObject)) + { + ResponseMessage itemResponse = await this.container.CreateItemStreamAsync(input, new PartitionKey(this.itemPk)); + System.Buffers.ArrayPool.Shared.Return(input.GetBuffer()); + } + } + + public async Task ExecuteOnceAsync() + { + ResponseMessage response = await this.container.DeleteItemStreamAsync(this.itemId, new PartitionKey(this.itemPk)); + return new OperationResult + { + DatabseName = this.databaseName, + ContainerName = this.containerName, + OperationType = this.OperationType, + RuCharges = response.Headers.RequestCharge, + CosmosDiagnostics = response.Diagnostics, + LazyDiagnostics = () => response.Diagnostics.ToString(), + }; + } + } +} diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/DeleteItemV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/DeleteItemV3BenchmarkOperation.cs new file mode 100644 index 0000000000..c2baaa1609 --- /dev/null +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/DeleteItemV3BenchmarkOperation.cs @@ -0,0 +1,66 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ +namespace CosmosBenchmark +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos; + + internal class DeleteItemV3BenchmarkOperation : IBenchmarkOperation + { + private readonly Container container; + private readonly string partitionKeyPath; + private readonly Dictionary sampleJObject; + private readonly string databaseName; + private readonly string containerName; + private string itemId; + private string itemPk; + + public DeleteItemV3BenchmarkOperation( + CosmosClient cosmosClient, + string dbName, + string containerName, + string partitionKeyPath, + string sampleJson) + { + this.databaseName = dbName; + this.containerName = containerName; + this.container = cosmosClient.GetContainer(this.databaseName, this.containerName); + this.partitionKeyPath = partitionKeyPath.Replace("/", ""); + this.sampleJObject = JsonHelper.Deserialize>(sampleJson); + } + + public BenchmarkOperationType OperationType => BenchmarkOperationType.Read; + + public async Task PrepareAsync() + { + this.itemId = Guid.NewGuid().ToString(); + this.itemPk = Guid.NewGuid().ToString(); + this.sampleJObject["id"] = this.itemId; + this.sampleJObject[this.partitionKeyPath] = this.itemPk; + + using (MemoryStream input = JsonHelper.ToStream(this.sampleJObject)) + { + ResponseMessage itemResponse = await this.container.CreateItemStreamAsync(input, new PartitionKey(this.itemPk)); + System.Buffers.ArrayPool.Shared.Return(input.GetBuffer()); + } + } + + public async Task ExecuteOnceAsync() + { + ItemResponse> response = await this.container.DeleteItemAsync>(this.itemId, new PartitionKey(this.itemPk)); + return new OperationResult + { + DatabseName = this.databaseName, + ContainerName = this.containerName, + OperationType = this.OperationType, + RuCharges = response.RequestCharge, + CosmosDiagnostics = response.Diagnostics, + LazyDiagnostics = () => response.Diagnostics.ToString(), + }; + } + } +} diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadItemV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadItemV3BenchmarkOperation.cs new file mode 100644 index 0000000000..f8ad218508 --- /dev/null +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadItemV3BenchmarkOperation.cs @@ -0,0 +1,66 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ +namespace CosmosBenchmark +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos; + + internal class ReadItemV3BenchmarkOperation : IBenchmarkOperation + { + private readonly Container container; + private readonly string partitionKeyPath; + private readonly Dictionary sampleJObject; + private readonly string databaseName; + private readonly string containerName; + private string itemId; + private string itemPk; + + public ReadItemV3BenchmarkOperation( + CosmosClient cosmosClient, + string dbName, + string containerName, + string partitionKeyPath, + string sampleJson) + { + this.databaseName = dbName; + this.containerName = containerName; + this.container = cosmosClient.GetContainer(this.databaseName, this.containerName); + this.partitionKeyPath = partitionKeyPath.Replace("/", ""); + this.sampleJObject = JsonHelper.Deserialize>(sampleJson); + } + + public BenchmarkOperationType OperationType => BenchmarkOperationType.Read; + + public async Task PrepareAsync() + { + this.itemId = Guid.NewGuid().ToString(); + this.itemPk = Guid.NewGuid().ToString(); + this.sampleJObject["id"] = this.itemId; + this.sampleJObject[this.partitionKeyPath] = this.itemPk; + + using (MemoryStream input = JsonHelper.ToStream(this.sampleJObject)) + { + ResponseMessage itemResponse = await this.container.CreateItemStreamAsync(input, new PartitionKey(this.itemPk)); + System.Buffers.ArrayPool.Shared.Return(input.GetBuffer()); + } + } + + public async Task ExecuteOnceAsync() + { + ItemResponse> response = await this.container.ReadItemAsync>(this.itemId, new PartitionKey(this.itemPk)); + return new OperationResult + { + DatabseName = this.databaseName, + ContainerName = this.containerName, + OperationType = this.OperationType, + RuCharges = response.RequestCharge, + CosmosDiagnostics = response.Diagnostics, + LazyDiagnostics = () => response.Diagnostics.ToString(), + }; + } + } +} diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReplaceItemStreamV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReplaceItemStreamV3BenchmarkOperation.cs new file mode 100644 index 0000000000..03ca79cbe1 --- /dev/null +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReplaceItemStreamV3BenchmarkOperation.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ +namespace CosmosBenchmark +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos; + + internal class ReplaceItemStreamV3BenchmarkOperation : IBenchmarkOperation + { + private readonly Container container; + private readonly string partitionKeyPath; + private readonly Dictionary sampleJObject; + private readonly string databaseName; + private readonly string containerName; + private string itemId; + private string itemPk; + + public ReplaceItemStreamV3BenchmarkOperation( + CosmosClient cosmosClient, + string dbName, + string containerName, + string partitionKeyPath, + string sampleJson) + { + this.databaseName = dbName; + this.containerName = containerName; + this.container = cosmosClient.GetContainer(this.databaseName, this.containerName); + this.partitionKeyPath = partitionKeyPath.Replace("/", ""); + this.sampleJObject = JsonHelper.Deserialize>(sampleJson); + } + + public BenchmarkOperationType OperationType => BenchmarkOperationType.Read; + + public async Task PrepareAsync() + { + this.itemId = Guid.NewGuid().ToString(); + this.itemPk = Guid.NewGuid().ToString(); + this.sampleJObject["id"] = this.itemId; + this.sampleJObject[this.partitionKeyPath] = this.itemPk; + this.sampleJObject["other"] = "Original"; + + using (MemoryStream input = JsonHelper.ToStream(this.sampleJObject)) + { + ResponseMessage itemResponse = await this.container.CreateItemStreamAsync(input, new PartitionKey(this.itemPk)); + System.Buffers.ArrayPool.Shared.Return(input.GetBuffer()); + } + } + + public async Task ExecuteOnceAsync() + { + this.sampleJObject["other"] = "Updated Stream Other"; + using (MemoryStream input = JsonHelper.ToStream(this.sampleJObject)) + { + ResponseMessage response = await this.container.ReplaceItemStreamAsync(input, this.itemId, new PartitionKey(this.itemPk)); + return new OperationResult + { + DatabseName = this.databaseName, + ContainerName = this.containerName, + OperationType = this.OperationType, + RuCharges = response.Headers.RequestCharge, + CosmosDiagnostics = response.Diagnostics, + LazyDiagnostics = () => response.Diagnostics.ToString(), + }; + } + } + } +} diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReplaceItemV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReplaceItemV3BenchmarkOperation.cs new file mode 100644 index 0000000000..de4f2677cc --- /dev/null +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReplaceItemV3BenchmarkOperation.cs @@ -0,0 +1,68 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ +namespace CosmosBenchmark +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos; + + internal class ReplaceItemV3BenchmarkOperation : IBenchmarkOperation + { + private readonly Container container; + private readonly string partitionKeyPath; + private readonly Dictionary sampleJObject; + private readonly string databaseName; + private readonly string containerName; + private string itemId; + private string itemPk; + + public ReplaceItemV3BenchmarkOperation( + CosmosClient cosmosClient, + string dbName, + string containerName, + string partitionKeyPath, + string sampleJson) + { + this.databaseName = dbName; + this.containerName = containerName; + this.container = cosmosClient.GetContainer(this.databaseName, this.containerName); + this.partitionKeyPath = partitionKeyPath.Replace("/", ""); + this.sampleJObject = JsonHelper.Deserialize>(sampleJson); + } + + public BenchmarkOperationType OperationType => BenchmarkOperationType.Read; + + public async Task PrepareAsync() + { + this.itemId = Guid.NewGuid().ToString(); + this.itemPk = Guid.NewGuid().ToString(); + this.sampleJObject["id"] = this.itemId; + this.sampleJObject[this.partitionKeyPath] = this.itemPk; + this.sampleJObject["other"] = "Original"; + + using (MemoryStream input = JsonHelper.ToStream(this.sampleJObject)) + { + ResponseMessage itemResponse = await this.container.CreateItemStreamAsync(input, new PartitionKey(this.itemPk)); + System.Buffers.ArrayPool.Shared.Return(input.GetBuffer()); + } + } + + public async Task ExecuteOnceAsync() + { + this.sampleJObject["other"] = "Updated Other"; + ItemResponse> response = await this.container.ReplaceItemAsync(this.sampleJObject, this.itemId, new PartitionKey(this.itemPk)); + return new OperationResult + { + DatabseName = this.databaseName, + ContainerName = this.containerName, + OperationType = this.OperationType, + RuCharges = response.RequestCharge, + CosmosDiagnostics = response.Diagnostics, + LazyDiagnostics = () => response.Diagnostics.ToString(), + }; + } + } +} diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/UpsertItemStreamV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/UpsertItemStreamV3BenchmarkOperation.cs new file mode 100644 index 0000000000..611c9a8a65 --- /dev/null +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/UpsertItemStreamV3BenchmarkOperation.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace CosmosBenchmark +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos; + + internal class UpsertItemStreamV3BenchmarkOperation : IBenchmarkOperation + { + private readonly Container container; + private readonly string partitionKeyPath; + private readonly Dictionary sampleJObject; + private readonly string databaseName; + private readonly string containerName; + + public UpsertItemStreamV3BenchmarkOperation( + CosmosClient cosmosClient, + string dbName, + string containerName, + string partitionKeyPath, + string sampleJson) + { + this.databaseName = dbName; + this.containerName = containerName; + this.container = cosmosClient.GetContainer(this.databaseName, this.containerName); + this.partitionKeyPath = partitionKeyPath.Replace("/", ""); + this.sampleJObject = JsonHelper.Deserialize>(sampleJson); + } + + public BenchmarkOperationType OperationType => BenchmarkOperationType.Read; + + public Task PrepareAsync() + { + this.sampleJObject["id"] = Guid.NewGuid().ToString(); + this.sampleJObject[this.partitionKeyPath] = Guid.NewGuid().ToString(); + this.sampleJObject["other"] = "Upserted Stream"; + return Task.CompletedTask; + } + + public async Task ExecuteOnceAsync() + { + PartitionKey partitionKey = new PartitionKey(this.sampleJObject[this.partitionKeyPath].ToString()); + using (MemoryStream input = JsonHelper.ToStream(this.sampleJObject)) + { + ResponseMessage response = await this.container.UpsertItemStreamAsync(input, partitionKey); + return new OperationResult + { + DatabseName = this.databaseName, + ContainerName = this.containerName, + OperationType = this.OperationType, + RuCharges = response.Headers.RequestCharge, + CosmosDiagnostics = response.Diagnostics, + LazyDiagnostics = () => response.Diagnostics.ToString(), + }; + } + } + } +} diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/UpsertItemV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/UpsertItemV3BenchmarkOperation.cs new file mode 100644 index 0000000000..151876b758 --- /dev/null +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/UpsertItemV3BenchmarkOperation.cs @@ -0,0 +1,59 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ +namespace CosmosBenchmark +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos; + + internal class UpsertItemV3BenchmarkOperation : IBenchmarkOperation + { + private readonly Container container; + private readonly string partitionKeyPath; + private readonly Dictionary sampleJObject; + private readonly string databaseName; + private readonly string containerName; + + public UpsertItemV3BenchmarkOperation( + CosmosClient cosmosClient, + string dbName, + string containerName, + string partitionKeyPath, + string sampleJson) + { + this.databaseName = dbName; + this.containerName = containerName; + this.container = cosmosClient.GetContainer(this.databaseName, this.containerName); + this.partitionKeyPath = partitionKeyPath.Replace("/", ""); + this.sampleJObject = JsonHelper.Deserialize>(sampleJson); + } + + public BenchmarkOperationType OperationType => BenchmarkOperationType.Read; + + public Task PrepareAsync() + { + this.sampleJObject["id"] = Guid.NewGuid().ToString(); + this.sampleJObject[this.partitionKeyPath] = Guid.NewGuid().ToString(); + this.sampleJObject["other"] = "Upserted"; + return Task.CompletedTask; + } + + public async Task ExecuteOnceAsync() + { + PartitionKey partitionKey = new PartitionKey(this.sampleJObject[this.partitionKeyPath].ToString()); + ItemResponse> response = await this.container.UpsertItemAsync(this.sampleJObject, partitionKey: partitionKey); + return new OperationResult + { + DatabseName = this.databaseName, + ContainerName = this.containerName, + OperationType = this.OperationType, + RuCharges = response.RequestCharge, + CosmosDiagnostics = response.Diagnostics, + LazyDiagnostics = () => response.Diagnostics.ToString(), + }; + } + } +} diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/Hedging/ReadRequestDiagnosticsExample.json b/Microsoft.Azure.Cosmos.Samples/Usage/Hedging/ReadRequestDiagnosticsExample.json new file mode 100644 index 0000000000..beac4c6014 --- /dev/null +++ b/Microsoft.Azure.Cosmos.Samples/Usage/Hedging/ReadRequestDiagnosticsExample.json @@ -0,0 +1,329 @@ +{ + "Summary": { + "DirectCalls": { + "(200, 0)": 1 + }, + "GatewayCalls": { + "(200, 0)": 1 + } + }, + "name": "ReadItemAsync", + "start datetime": "2025-05-09T16:15:21.287Z", + "duration in milliseconds": 1131.2238, + "data": { + "Client Configuration": { + "Client Created Time Utc": "2025-05-09T16:15:19.8917662Z", + "MachineId": "hashedMachineName:94d755e6-4bd9-6d68-c9d4-22b4d44d5b96", + "NumberOfClientsCreated": 1, + "NumberOfActiveClients": 1, + "ConnectionMode": "Direct", + "User Agent": "cosmos-netstandard-sdk/3.49.0|2|X64|Microsoft Windows 10.0.26100|.NET 6.0.36|L|", + "ConnectionConfig": { + "gw": "(cps:50, urto:6, p:False, httpf: False)", + "rntbd": "(cto: 5, icto: -1, mrpc: 30, mcpe: 65535, erd: True, pr: ReuseUnicastPort)", + "other": "(ed:False, be:False)" + }, + "ConsistencyConfig": "(consistency: NotSet, prgns:[West US 3, West US], apprgn: )", + "ProcessorCount": 12 + }, + "Hedge Config": "t:100ms, s:50ms, w:False", + "Hedge Context": [ + "West US 3", + "West US" + ] + }, + "children": [ + { + "name": "Microsoft.Azure.Cosmos.Handlers.RequestInvokerHandler", + "duration in milliseconds": 1129.3323, + "children": [ + { + "name": "Get Collection Cache", + "duration in milliseconds": 0.007 + }, + { + "name": "Microsoft.Azure.Cosmos.Handlers.DiagnosticsHandler", + "duration in milliseconds": 1151.0061, + "children": [ + { + "name": "Microsoft.Azure.Cosmos.Handlers.TelemetryHandler", + "duration in milliseconds": 1151.004, + "children": [ + { + "name": "Microsoft.Azure.Cosmos.Handlers.RetryHandler", + "duration in milliseconds": 1151.0058, + "children": [ + { + "name": "Microsoft.Azure.Cosmos.Handlers.RouterHandler", + "duration in milliseconds": 1151.0004, + "children": [ + { + "name": "Microsoft.Azure.Cosmos.Handlers.TransportHandler", + "duration in milliseconds": 1151.002, + "children": [ + { + "name": "Microsoft.Azure.Documents.ServerStoreModel Transport Request", + "duration in milliseconds": 1150.9186, + "data": { + "Client Side Request Stats": { + "Id": "AggregatedClientSideRequestStatistics", + "ContactedReplicas": [], + "RegionsContacted": [], + "FailedReplicas": [], + "AddressResolutionStatistics": [], + "StoreResponseStatistics": [] + } + } + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "name": "Microsoft.Azure.Cosmos.Handlers.DiagnosticsHandler", + "duration in milliseconds": 992.2633, + "data": { + "System Info": { + "systemHistory": [ + { + "dateUtc": "2025-05-09T16:14:24.8037599Z", + "cpu": 47.922, + "memory": 594752.000, + "threadInfo": { + "isThreadStarving": "False", + "threadWaitIntervalInMs": 0.9073, + "availableThreads": 32765, + "minThreads": 12, + "maxThreads": 32767 + }, + "numberOfOpenTcpConnection": 3 + }, + { + "dateUtc": "2025-05-09T16:14:34.8179966Z", + "cpu": 38.084, + "memory": 607580.000, + "threadInfo": { + "isThreadStarving": "False", + "threadWaitIntervalInMs": 0.167, + "availableThreads": 32765, + "minThreads": 12, + "maxThreads": 32767 + }, + "numberOfOpenTcpConnection": 3 + }, + { + "dateUtc": "2025-05-09T16:14:44.8294121Z", + "cpu": 42.072, + "memory": 1054836.000, + "threadInfo": { + "isThreadStarving": "False", + "threadWaitIntervalInMs": 0.074, + "availableThreads": 32765, + "minThreads": 12, + "maxThreads": 32767 + }, + "numberOfOpenTcpConnection": 3 + }, + { + "dateUtc": "2025-05-09T16:14:54.8360653Z", + "cpu": 36.015, + "memory": 1038760.000, + "threadInfo": { + "isThreadStarving": "False", + "threadWaitIntervalInMs": 0.1299, + "availableThreads": 32765, + "minThreads": 12, + "maxThreads": 32767 + }, + "numberOfOpenTcpConnection": 3 + }, + { + "dateUtc": "2025-05-09T16:15:04.8435121Z", + "cpu": 43.817, + "memory": 1616568.000, + "threadInfo": { + "isThreadStarving": "False", + "threadWaitIntervalInMs": 0.1434, + "availableThreads": 32765, + "minThreads": 12, + "maxThreads": 32767 + }, + "numberOfOpenTcpConnection": 3 + }, + { + "dateUtc": "2025-05-09T16:15:14.8453053Z", + "cpu": 35.239, + "memory": 1629004.000, + "threadInfo": { + "isThreadStarving": "False", + "threadWaitIntervalInMs": 0.1103, + "availableThreads": 32765, + "minThreads": 12, + "maxThreads": 32767 + }, + "numberOfOpenTcpConnection": 3 + } + ] + } + }, + "children": [ + { + "name": "Microsoft.Azure.Cosmos.Handlers.TelemetryHandler", + "duration in milliseconds": 992.2298, + "children": [ + { + "name": "Microsoft.Azure.Cosmos.Handlers.RetryHandler", + "duration in milliseconds": 992.1824, + "children": [ + { + "name": "Microsoft.Azure.Cosmos.Handlers.RouterHandler", + "duration in milliseconds": 992.1503, + "children": [ + { + "name": "Microsoft.Azure.Cosmos.Handlers.TransportHandler", + "duration in milliseconds": 992.1449, + "children": [ + { + "name": "Microsoft.Azure.Documents.ServerStoreModel Transport Request", + "duration in milliseconds": 991.3114, + "data": { + "Client Side Request Stats": { + "Id": "AggregatedClientSideRequestStatistics", + "ContactedReplicas": [ + { + "Count": 1, + "Uri": "rntbd://cdb-ms-prod-westus1-be169.documents.azure.com:14031/apps/81e4cdc8-2da0-416c-beb1-394af2e72180/services/2844fd18-25a1-46e3-896e-898a02c31a8a/partitions/1e954280-38c1-4e0c-b4bf-3e63bdfc3615/replicas/133888881810264235p/" + } + ], + "RegionsContacted": [], + "FailedReplicas": [], + "AddressResolutionStatistics": [ + { + "StartTimeUTC": "2025-05-09T16:15:21.4249712Z", + "EndTimeUTC": "2025-05-09T16:15:21.8670316Z", + "TargetEndpoint": "https://hedging-example-westus.documents.azure.com//addresses/?$resolveFor=dbs%2fZWUNAA%3d%3d%2fcolls%2fZWUNALftZ78%3d%2fdocs&$filter=protocol eq rntbd&$partitionKeyRangeIds=0" + } + ], + "StoreResponseStatistics": [ + { + "ResponseTimeUTC": "2025-05-09T16:15:22.4138215Z", + "DurationInMs": 546.1124, + "ResourceType": "Document", + "OperationType": "Read", + "RequestSessionToken": "0:0#5#7=-1#8=-1", + "LocationEndpoint": "https://hedging-example-westus.documents.azure.com/", + "StoreResult": { + "ActivityId": "a1cfa80c-cb67-4ef5-b96a-dac4a7247429", + "StatusCode": "Ok", + "SubStatusCode": "Unknown", + "LSN": 8, + "PartitionKeyRangeId": "0", + "GlobalCommittedLSN": 5, + "ItemLSN": 6, + "UsingLocalLSN": true, + "QuorumAckedLSN": 8, + "SessionToken": "0#5#7=-1#8=-1", + "CurrentWriteQuorum": 3, + "CurrentReplicaSetSize": 4, + "NumberOfReadRegions": 2, + "IsValid": true, + "StorePhysicalAddress": "rntbd://cdb-ms-prod-westus1-be169.documents.azure.com:14031/apps/81e4cdc8-2da0-416c-beb1-394af2e72180/services/2844fd18-25a1-46e3-896e-898a02c31a8a/partitions/1e954280-38c1-4e0c-b4bf-3e63bdfc3615/replicas/133888881810264235p/", + "RequestCharge": 1, + "RetryAfterInMs": null, + "BELatencyInMs": "0.293", + "ReplicaHealthStatuses": [ + "(port: 14031 | status: Unknown | lkt: 5/9/2025 4:15:21 PM)", + "(port: 14184 | status: Unknown | lkt: 5/9/2025 4:15:21 PM)", + "(port: 14356 | status: Unknown | lkt: 5/9/2025 4:15:21 PM)", + "(port: 14405 | status: Unknown | lkt: 5/9/2025 4:15:21 PM)" + ], + "transportRequestTimeline": { + "requestTimeline": [ + { + "event": "Created", + "startTimeUtc": "2025-05-09T16:15:21.8675967Z", + "durationInMs": 0.0123 + }, + { + "event": "ChannelAcquisitionStarted", + "startTimeUtc": "2025-05-09T16:15:21.8676090Z", + "durationInMs": 455.3481 + }, + { + "event": "Pipelined", + "startTimeUtc": "2025-05-09T16:15:22.3229571Z", + "durationInMs": 0.4602 + }, + { + "event": "Transit Time", + "startTimeUtc": "2025-05-09T16:15:22.3234173Z", + "durationInMs": 90.0714 + }, + { + "event": "Received", + "startTimeUtc": "2025-05-09T16:15:22.4134887Z", + "durationInMs": 0.3431 + }, + { + "event": "Completed", + "startTimeUtc": "2025-05-09T16:15:22.4138318Z", + "durationInMs": 0 + } + ], + "serviceEndpointStats": { + "inflightRequests": 1, + "openConnections": 1 + }, + "connectionStats": { + "waitforConnectionInit": "True", + "callsPendingReceive": 0, + "lastSendAttempt": "2025-05-09T16:15:22.2294194Z", + "lastSend": "2025-05-09T16:15:22.2300082Z", + "lastReceive": "2025-05-09T16:15:22.3219096Z" + }, + "requestSizeInBytes": 475, + "responseMetadataSizeInBytes": 489, + "responseBodySizeInBytes": 230 + }, + "TransportException": null + } + } + ], + "HttpResponseStats": [ + { + "StartTimeUTC": "2025-05-09T16:15:21.4250207Z", + "DurationInMs": 441.9028, + "RequestUri": "https://hedging-example-westus.documents.azure.com//addresses/?$resolveFor=dbs%2fZWUNAA%3d%3d%2fcolls%2fZWUNALftZ78%3d%2fdocs&$filter=protocol eq rntbd&$partitionKeyRangeIds=0", + "ResourceType": "Document", + "HttpMethod": "GET", + "ActivityId": "a1cfa80c-cb67-4ef5-b96a-dac4a7247429", + "StatusCode": "OK" + } + ] + } + } + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "name": "Response Serialization", + "duration in milliseconds": 0.177 + } + ] +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/ReEncryption/Program.cs b/Microsoft.Azure.Cosmos.Samples/Usage/ReEncryption/Program.cs index 65235ae88d..e032122eb2 100644 --- a/Microsoft.Azure.Cosmos.Samples/Usage/ReEncryption/Program.cs +++ b/Microsoft.Azure.Cosmos.Samples/Usage/ReEncryption/Program.cs @@ -7,7 +7,6 @@ using Azure.Identity; using Microsoft.Azure.Cosmos; using Microsoft.Azure.Cosmos.Encryption; - using Microsoft.Data.Encryption.AzureKeyVaultProvider; using Microsoft.Extensions.Configuration; using System.Collections.Generic; using System.Net; diff --git a/Microsoft.Azure.Cosmos.sln b/Microsoft.Azure.Cosmos.sln index caafa0b41a..b40d139617 100644 --- a/Microsoft.Azure.Cosmos.sln +++ b/Microsoft.Azure.Cosmos.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29123.88 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36301.6 d17.14 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Cosmos", "Microsoft.Azure.Cosmos\src\Microsoft.Azure.Cosmos.csproj", "{36F6F6A8-CEC8-4261-9948-903495BC3C25}" EndProject @@ -22,6 +22,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{804C595B-D0DA-48F1-A40D-97BB014736CB}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig + .globalconfig = .globalconfig EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Encryption.Custom", "Encryption.Custom", "{51F858D8-707E-4F21-BCC6-4D6123832E4F}" @@ -180,6 +181,18 @@ Global {021DDC27-02EF-42C4-9A9E-AA600833C2EE}.Release|Any CPU.Build.0 = Release|Any CPU {021DDC27-02EF-42C4-9A9E-AA600833C2EE}.Release|x64.ActiveCfg = Release|Any CPU {021DDC27-02EF-42C4-9A9E-AA600833C2EE}.Release|x64.Build.0 = Release|Any CPU + {D744906A-1091-403F-B0B6-794DE045169A}.Cover|Any CPU.ActiveCfg = Debug|Any CPU + {D744906A-1091-403F-B0B6-794DE045169A}.Cover|Any CPU.Build.0 = Debug|Any CPU + {D744906A-1091-403F-B0B6-794DE045169A}.Cover|x64.ActiveCfg = Debug|Any CPU + {D744906A-1091-403F-B0B6-794DE045169A}.Cover|x64.Build.0 = Debug|Any CPU + {D744906A-1091-403F-B0B6-794DE045169A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D744906A-1091-403F-B0B6-794DE045169A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D744906A-1091-403F-B0B6-794DE045169A}.Debug|x64.ActiveCfg = Debug|Any CPU + {D744906A-1091-403F-B0B6-794DE045169A}.Debug|x64.Build.0 = Debug|Any CPU + {D744906A-1091-403F-B0B6-794DE045169A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D744906A-1091-403F-B0B6-794DE045169A}.Release|Any CPU.Build.0 = Release|Any CPU + {D744906A-1091-403F-B0B6-794DE045169A}.Release|x64.ActiveCfg = Release|Any CPU + {D744906A-1091-403F-B0B6-794DE045169A}.Release|x64.Build.0 = Release|Any CPU {CE4D6DA8-148D-4A98-943B-D8C2D532E1DC}.Cover|Any CPU.ActiveCfg = Debug|Any CPU {CE4D6DA8-148D-4A98-943B-D8C2D532E1DC}.Cover|Any CPU.Build.0 = Debug|Any CPU {CE4D6DA8-148D-4A98-943B-D8C2D532E1DC}.Cover|x64.ActiveCfg = Debug|Any CPU diff --git a/Microsoft.Azure.Cosmos/FaultInjection/README.md b/Microsoft.Azure.Cosmos/FaultInjection/README.md index 7f43976791..82e2c3d0c2 100644 --- a/Microsoft.Azure.Cosmos/FaultInjection/README.md +++ b/Microsoft.Azure.Cosmos/FaultInjection/README.md @@ -90,6 +90,9 @@ The `FaultInjectionConnectionType` specifies the type of connection that the fau | `Gateway` | | `All` | +The `Gateway` connection type also supports connection to the `ThinProxy`. + + #### Other `FaultInjectionRule` Properties When creating a `FaultInjectionRule`, you can also specify the following properties: diff --git a/Microsoft.Azure.Cosmos/FaultInjection/src/AssemblyInfo.cs b/Microsoft.Azure.Cosmos/FaultInjection/src/AssemblyInfo.cs index d44b531839..821fe9bee9 100644 --- a/Microsoft.Azure.Cosmos/FaultInjection/src/AssemblyInfo.cs +++ b/Microsoft.Azure.Cosmos/FaultInjection/src/AssemblyInfo.cs @@ -3,6 +3,7 @@ //------------------------------------------------------------ using System.Runtime.CompilerServices; +using Microsoft.Azure.Cosmos.Direct; [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2" + AssemblyKeys.MoqPublicKey)] [assembly: InternalsVisibleTo("Microsoft.Azure.Cosmos.FaultInjection.Tests" + AssemblyKeys.ProductPublicKey)] diff --git a/Microsoft.Azure.Cosmos/FaultInjection/src/FaultInjection.csproj b/Microsoft.Azure.Cosmos/FaultInjection/src/FaultInjection.csproj index a22a006090..f2589db30a 100644 --- a/Microsoft.Azure.Cosmos/FaultInjection/src/FaultInjection.csproj +++ b/Microsoft.Azure.Cosmos/FaultInjection/src/FaultInjection.csproj @@ -36,13 +36,9 @@ portable false false - LICENSE + MIT - - - - @@ -65,8 +61,8 @@ - - + + true true ..\..\..\35MSSharedLib1024.snk diff --git a/Microsoft.Azure.Cosmos/FaultInjection/src/FaultInjectionRuleBuilder.cs b/Microsoft.Azure.Cosmos/FaultInjection/src/FaultInjectionRuleBuilder.cs index efa166166b..dd512366a1 100644 --- a/Microsoft.Azure.Cosmos/FaultInjection/src/FaultInjectionRuleBuilder.cs +++ b/Microsoft.Azure.Cosmos/FaultInjection/src/FaultInjectionRuleBuilder.cs @@ -149,7 +149,11 @@ private void ValidateGatewayConnection() { if (serverErrorResult?.GetServerErrorType() != FaultInjectionServerErrorType.TooManyRequests && serverErrorResult?.GetServerErrorType() != FaultInjectionServerErrorType.ResponseDelay - && serverErrorResult?.GetServerErrorType() != FaultInjectionServerErrorType.SendDelay) + && serverErrorResult?.GetServerErrorType() != FaultInjectionServerErrorType.SendDelay + && serverErrorResult?.GetServerErrorType() != FaultInjectionServerErrorType.DatabaseAccountNotFound + && serverErrorResult?.GetServerErrorType() != FaultInjectionServerErrorType.ServiceUnavailable + && serverErrorResult?.GetServerErrorType() != FaultInjectionServerErrorType.InternalServerError + && serverErrorResult?.GetServerErrorType() != FaultInjectionServerErrorType.LeaseNotFound) { throw new ArgumentException($"{serverErrorResult?.GetServerErrorType()} is not supported for metadata requests."); } diff --git a/Microsoft.Azure.Cosmos/FaultInjection/src/FaultInjectionServerErrorType.cs b/Microsoft.Azure.Cosmos/FaultInjection/src/FaultInjectionServerErrorType.cs index bb3f7dae2d..12045d1155 100644 --- a/Microsoft.Azure.Cosmos/FaultInjection/src/FaultInjectionServerErrorType.cs +++ b/Microsoft.Azure.Cosmos/FaultInjection/src/FaultInjectionServerErrorType.cs @@ -72,8 +72,13 @@ public enum FaultInjectionServerErrorType ServiceUnavailable, /// - /// 404:1008 Database account not found from gateway + /// 403:1008 Database account not found from gateway /// DatabaseAccountNotFound, + + /// + /// 410:1022 Lease not Found + /// + LeaseNotFound, } } diff --git a/Microsoft.Azure.Cosmos/FaultInjection/src/implementation/ChaosInterceptor.cs b/Microsoft.Azure.Cosmos/FaultInjection/src/implementation/ChaosInterceptor.cs index 365b7fd001..9e4a4694e3 100644 --- a/Microsoft.Azure.Cosmos/FaultInjection/src/implementation/ChaosInterceptor.cs +++ b/Microsoft.Azure.Cosmos/FaultInjection/src/implementation/ChaosInterceptor.cs @@ -240,7 +240,7 @@ internal FaultInjectionDynamicChannelStore GetChannelStore() return this.channelStore; } - public async Task<(bool, HttpResponseMessage?)> OnHttpRequestCallAsync(DocumentServiceRequest request) + public async Task<(bool, HttpResponseMessage?)> OnHttpRequestCallAsync(DocumentServiceRequest request, CancellationToken token) { HttpResponseMessage faultyResponse; FaultInjectionServerErrorRule? serverResponseErrorRule = this.ruleStore?.FindHttpServerResponseErrorRule(request); @@ -259,7 +259,7 @@ internal FaultInjectionDynamicChannelStore GetChannelStore() if (serverResponseErrorRule.GetInjectedServerErrorType() == FaultInjectionServerErrorType.Timeout) { - await Task.Delay(this.requestTimeout); + await Task.Delay(this.requestTimeout, token); } return (true, faultyResponse); @@ -268,7 +268,7 @@ internal FaultInjectionDynamicChannelStore GetChannelStore() return (false, null); } - public async Task OnBeforeHttpSendAsync(DocumentServiceRequest request) + public async Task OnBeforeHttpSendAsync(DocumentServiceRequest request, CancellationToken token) { FaultInjectionServerErrorRule? serverSendDelayRule = this.ruleStore?.FindHttpServerSendDelayRule(request); @@ -285,11 +285,11 @@ public async Task OnBeforeHttpSendAsync(DocumentServiceRequest request) delay, request.Headers.Get(ChaosInterceptor.FaultInjectionId)); - await Task.Delay(delay); + await Task.Delay(delay, token); } } - public async Task OnAfterHttpSendAsync(DocumentServiceRequest request) + public async Task OnAfterHttpSendAsync(DocumentServiceRequest request, CancellationToken token) { FaultInjectionServerErrorRule? serverResponseDelayRule = this.ruleStore?.FindHttpServerResponseDelayRule(request); @@ -306,7 +306,7 @@ public async Task OnAfterHttpSendAsync(DocumentServiceRequest request) delay, request.Headers.Get(ChaosInterceptor.FaultInjectionId)); - await Task.Delay(delay); + await Task.Delay(delay, token); } } } diff --git a/Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionConditionInternal.cs b/Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionConditionInternal.cs index 8bdbe29a4f..18a12ed117 100644 --- a/Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionConditionInternal.cs +++ b/Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionConditionInternal.cs @@ -6,20 +6,23 @@ namespace Microsoft.Azure.Cosmos.FaultInjection using System; using System.Collections.Generic; using System.Linq; + using Microsoft.Azure.Cosmos.Routing; using Microsoft.Azure.Documents; using Microsoft.Azure.Documents.Rntbd; internal class FaultInjectionConditionInternal { private readonly List validators; + private readonly GlobalEndpointManager globalEndpointManager; private string containerResourceId = string.Empty; private OperationType? operationType = null; private List regionEndpoints = new List{ }; private List physicalAddresses = new List { }; - public FaultInjectionConditionInternal() + public FaultInjectionConditionInternal(GlobalEndpointManager globalEndpointManager) { + this.globalEndpointManager = globalEndpointManager; this.validators = new List(); } @@ -201,8 +204,8 @@ public bool IsApplicable(string ruleId, ChannelCallArguments args) public bool IsApplicable(string ruleId, DocumentServiceRequest request) { bool isApplicable = this.regionEndpoints.Any(uri => - request.RequestContext.LocationEndpointToRoute.AbsoluteUri - .StartsWith(uri.AbsoluteUri)); + request.RequestContext.LocationEndpointToRoute.Host + .StartsWith(uri.Host)); return isApplicable; } diff --git a/Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionRuleProcessor.cs b/Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionRuleProcessor.cs index 02413d1183..6fa1c6e56d 100644 --- a/Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionRuleProcessor.cs +++ b/Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionRuleProcessor.cs @@ -93,7 +93,7 @@ private async Task GetEffectiveRule(FaultInjectionR private async Task GetEffectiveServerErrorRule(FaultInjectionRule rule) { FaultInjectionServerErrorType errorType = ((FaultInjectionServerErrorResult)rule.GetResult()).GetServerErrorType(); - FaultInjectionConditionInternal effectiveCondition = new FaultInjectionConditionInternal(); + FaultInjectionConditionInternal effectiveCondition = new FaultInjectionConditionInternal(this.globalEndpointManager); FaultInjectionOperationType operationType = rule.GetCondition().GetOperationType(); if ((operationType != FaultInjectionOperationType.All) && this.CanErrorLimitToOperation(errorType)) diff --git a/Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionServerErrorResultInternal.cs b/Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionServerErrorResultInternal.cs index de5d6f7d60..6cac1ccbd1 100644 --- a/Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionServerErrorResultInternal.cs +++ b/Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionServerErrorResultInternal.cs @@ -461,7 +461,7 @@ public HttpResponseMessage GetInjectedServerError(DocumentServiceRequest dsr, st httpResponse.Headers.Add( WFConstants.BackendHeaders.SubStatus, - ((int)SubStatusCodes.RUBudgetExceeded).ToString(CultureInfo.InvariantCulture)); + ((int)SubStatusCodes.Unknown).ToString(CultureInfo.InvariantCulture)); httpResponse.Headers.Add(WFConstants.BackendHeaders.LocalLSN, lsn); return httpResponse; @@ -470,7 +470,7 @@ public HttpResponseMessage GetInjectedServerError(DocumentServiceRequest dsr, st httpResponse = new HttpResponseMessage { - StatusCode = HttpStatusCode.NotFound, + StatusCode = HttpStatusCode.Forbidden, Content = new FauntInjectionHttpContent( new MemoryStream( FaultInjectionResponseEncoding.GetBytes($"Fault Injection Server Error: DatabaseAccountNotFound, rule: {ruleId}"))), @@ -488,6 +488,28 @@ public HttpResponseMessage GetInjectedServerError(DocumentServiceRequest dsr, st return httpResponse; + case FaultInjectionServerErrorType.LeaseNotFound: + + httpResponse = new HttpResponseMessage + { + StatusCode = HttpStatusCode.Gone, + Content = new FauntInjectionHttpContent( + new MemoryStream( + FaultInjectionResponseEncoding.GetBytes($"Fault Injection Server Error: LeaseNotFound, rule: {ruleId}"))), + }; + + foreach (string header in headers.AllKeys()) + { + httpResponse.Headers.Add(header, headers.Get(header)); + } + + httpResponse.Headers.Add( + WFConstants.BackendHeaders.SubStatus, + ((int)SubStatusCodes.LeaseNotFound).ToString(CultureInfo.InvariantCulture)); + httpResponse.Headers.Add(WFConstants.BackendHeaders.LocalLSN, lsn); + + return httpResponse; + default: throw new ArgumentException($"Server error type {this.serverErrorType} is not supported"); } diff --git a/Microsoft.Azure.Cosmos/FaultInjection/tests/FaultInjectionProxyTests.cs b/Microsoft.Azure.Cosmos/FaultInjection/tests/FaultInjectionProxyTests.cs new file mode 100644 index 0000000000..dbc0c99f86 --- /dev/null +++ b/Microsoft.Azure.Cosmos/FaultInjection/tests/FaultInjectionProxyTests.cs @@ -0,0 +1,1022 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ +namespace Microsoft.Azure.Cosmos.FaultInjection.Tests +{ + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Linq; + using System.Net; + using System.Text.Json; + using System.Text.Json.Serialization; + using System.Threading; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos; + using Microsoft.Azure.Cosmos.FaultInjection.Tests.Utils; + using Microsoft.Azure.Cosmos.Routing; + using Microsoft.Azure.Documents; + using static Microsoft.Azure.Cosmos.FaultInjection.Tests.Utils.TestCommon; + using ConsistencyLevel = ConsistencyLevel; + using CosmosSystemTextJsonSerializer = Utils.TestCommon.CosmosSystemTextJsonSerializer; + using Database = Database; + using PartitionKey = PartitionKey; + + [TestClass] + public class FaultInjectionProxyTests + { + private const int Timeout = 66000; + + private string connectionString; + private CosmosSystemTextJsonSerializer serializer; + + private CosmosClient client; + private Database database; + private Container container; + + private CosmosClient fiClient; + private Database fiDatabase; + private Container fiContainer; + private Container highThroughputContainer; + + + [TestInitialize] + public async Task Initialize() + { + //tests use a live account with multi-region enabled + this.connectionString = TestCommon.GetThinClientConnectionString(); + + if (string.IsNullOrEmpty(this.connectionString)) + { + Assert.Fail("Set environment variable COSMOSDB_THIN_CLIENT to run the tests"); + } + + //serializer settings, not needed for fault injection but used for test objects + JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions() + { + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + }; + + this.serializer = new CosmosSystemTextJsonSerializer(jsonSerializerOptions); + + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConsistencyLevel = ConsistencyLevel.Session, + ConnectionMode = ConnectionMode.Gateway, + Serializer = this.serializer, + }; + + this.client = new CosmosClient(this.connectionString, cosmosClientOptions); + + //create a database and container if they do not already exist on test account + //SDK test account uses strong consistency so haivng pre existing databases helps shorten test time with global replication lag + (this.database, this.container) = await TestCommon.GetOrCreateMultiRegionFIDatabaseAndContainersAsync(this.client); + } + + [TestCleanup] + public async Task Cleanup() + { + //deletes the high throughput container if it was created to save costs + if (this.highThroughputContainer != null) + { + await this.highThroughputContainer.DeleteContainerAsync(); + } + this.client?.Dispose(); + this.fiClient?.Dispose(); + } + + // + //Tests to to see if fault injection rules are applied to the correct regions + // + [TestMethod] + [Timeout(Timeout)] + [Description("Test Region rule filtering")] + [Owner("ntripician")] + public async Task FIProxyRegion() + { + //Get regions for testing + List preferredRegions = new List() { }; + List readRegions; + ReadOnlyDictionary readEndpoints = new ReadOnlyDictionary(new Dictionary()); + + GlobalEndpointManager globalEndpointManager = this.client.ClientContext.DocumentClient.GlobalEndpointManager; + if (globalEndpointManager != null) + { + readEndpoints = globalEndpointManager.GetAvailableReadEndpointsByLocation(); + (_, readRegions) = await this.GetReadWriteEndpoints(globalEndpointManager); + + preferredRegions = new List(readRegions); + } + + //create fault injection rule for local region + string localRegionRuleId = "localRegionRule-" + Guid.NewGuid().ToString(); + FaultInjectionRule localRegionRule = new FaultInjectionRuleBuilder( + id: localRegionRuleId, + condition: + new FaultInjectionConditionBuilder() + .WithRegion(preferredRegions[0]) + .WithConnectionType(FaultInjectionConnectionType.Gateway) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.Gone) + .WithTimes(1) + .Build()) + .WithDuration(TimeSpan.FromMinutes(5)) + .Build(); + + //create fault injection rule for remote region + string remoteRegionRuleId = "remoteRegionRule-" + Guid.NewGuid().ToString(); + FaultInjectionRule remoteRegionRule = new FaultInjectionRuleBuilder( + id: remoteRegionRuleId, + condition: + new FaultInjectionConditionBuilder() + .WithRegion(preferredRegions[1]) + .WithConnectionType(FaultInjectionConnectionType.Gateway) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.Gone) + .WithTimes(1) + .Build()) + .WithDuration(TimeSpan.FromMinutes(5)) + .Build(); + + //disable rules until ready to test + localRegionRule.Disable(); + remoteRegionRule.Disable(); + + try + { + //create client with fault injection + List rules = new List { localRegionRule, remoteRegionRule }; + FaultInjector faultInjector = new FaultInjector(rules); + + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConsistencyLevel = ConsistencyLevel.Session, + ConnectionMode = ConnectionMode.Gateway, + Serializer = this.serializer + }; + + this.fiClient = new CosmosClient( + this.connectionString, + faultInjector.GetFaultInjectionClientOptions(cosmosClientOptions)); + + this.fiDatabase = this.fiClient.GetDatabase(TestCommon.FaultInjectionDatabaseName); + this.fiContainer = this.fiDatabase.GetContainer(TestCommon.FaultInjectionContainerName); + + globalEndpointManager = this.fiClient.ClientContext.DocumentClient.GlobalEndpointManager; + + localRegionRule.Enable(); + remoteRegionRule.Enable(); + + try + { + //test that request to local region fails + ItemResponse response = await this.fiContainer.ReadItemAsync( + "testId2", + new PartitionKey("pk2")); + } + catch (DocumentClientException ex) + { + this.ValidateHitCount(localRegionRule, 1); + this.ValidateHitCount(remoteRegionRule, 0); + this.ValidateFaultInjectionRuleApplication( + ex, + (int)HttpStatusCode.Gone, + localRegionRule); + } + catch (CosmosException ex) + { + this.ValidateHitCount(localRegionRule, 1); + this.ValidateHitCount(remoteRegionRule, 0); + this.ValidateFaultInjectionRuleApplication( + ex, + (int)HttpStatusCode.Gone, + localRegionRule); + } + } + finally + { + //ensure rules are created with proper regions + //must check here since the rules are initialized on first request call + if (globalEndpointManager != null) + { + Assert.AreEqual(1, localRegionRule.GetRegionEndpoints().Count); + Assert.AreEqual(readEndpoints[preferredRegions[0]], localRegionRule.GetRegionEndpoints()[0]); + + Assert.AreEqual(1, remoteRegionRule.GetRegionEndpoints().Count); + Assert.AreEqual(readEndpoints[preferredRegions[1]], remoteRegionRule.GetRegionEndpoints()[0]); + } + + localRegionRule.Disable(); + remoteRegionRule.Disable(); + } + } + + // + //Tests to to see if fault injection rules are applied to the correct partitions + //We will create a container with a split physical partition (which will happen when a container is provisioned with >10k RU/s) + //We will then create a rule for one of the partitions and ensure it is only applied to requests to that partition + //Test scenario with >2 partitions is not needed as we only need to test that the rule is applied to the correct partition regardless of number of partitions + // + [TestMethod] + [Timeout(Timeout)] + [Description("Test Partition rule filtering")] + [Owner("ntripician")] + public async Task FIProxyPartitionTest() + { + //create container with high throughput to create multiple feed ranges + await this.InitializeHighThroughputContainerAsync(); + + List feedRanges = (List)await this.highThroughputContainer.GetFeedRangesAsync(); + Assert.IsTrue(feedRanges.Count > 1); + + string query = "SELECT * FROM c"; + + FeedIterator feedIterator = this.highThroughputContainer.GetItemQueryIterator(query); + + //get one item from each feed range, since it will be a cross partition query, each page will contain items from different partitions + FaultInjectionTestObject result1 = (await feedIterator.ReadNextAsync()).First(); + FaultInjectionTestObject result2 = (await feedIterator.ReadNextAsync()).First(); + + //create fault injection rule for one of the partitions + string serverErrorFeedRangeRuleId = "serverErrorFeedRangeRule-" + Guid.NewGuid().ToString(); + FaultInjectionRule serverErrorFeedRangeRule = new FaultInjectionRuleBuilder( + id: serverErrorFeedRangeRuleId, + condition: + new FaultInjectionConditionBuilder() + .WithEndpoint( + new FaultInjectionEndpointBuilder( + TestCommon.FaultInjectionDatabaseName, + TestCommon.FaultInjectionHTPContainerName, + feedRanges[0]) + .Build()) + .WithConnectionType(FaultInjectionConnectionType.Gateway) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.TooManyRequests) + .WithTimes(100) + .Build()) + .Build(); + + //disable rule until ready to test + serverErrorFeedRangeRule.Disable(); + + //create client with fault injection + List rules = new List { serverErrorFeedRangeRule }; + FaultInjector faultInjector = new FaultInjector(rules); + + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConsistencyLevel = ConsistencyLevel.Session, + ConnectionMode = ConnectionMode.Gateway, + Serializer = this.serializer, + MaxRetryAttemptsOnRateLimitedRequests = 0, + }; + + this.fiClient = new CosmosClient( + this.connectionString, + faultInjector.GetFaultInjectionClientOptions(cosmosClientOptions)); + this.fiDatabase = this.fiClient.GetDatabase(TestCommon.FaultInjectionDatabaseName); + this.fiContainer = this.fiDatabase.GetContainer(TestCommon.FaultInjectionHTPContainerName); + + serverErrorFeedRangeRule.Enable(); + + //Test that rule is applied to the correct partition + ItemResponse response; + try + { + response = await this.fiContainer.ReadItemAsync( + result1.Id, + new PartitionKey(result1.Pk)); + } + catch (CosmosException ex) + { + this.ValidateHitCount(serverErrorFeedRangeRule, 1); + this.ValidateFaultInjectionRuleApplication( + ex, + (int)HttpStatusCode.TooManyRequests, + serverErrorFeedRangeRule); + } + + //test that rule is not applied to other partition + try + { + response = await this.fiContainer.ReadItemAsync( + result2.Id, + new PartitionKey(result2.Pk)); + + Assert.IsNotNull(response.Diagnostics); + this.ValidateFaultInjectionRuleNotApplied(response, serverErrorFeedRangeRule, 1); + this.ValidateHitCount(serverErrorFeedRangeRule, 1); + } + finally + { + serverErrorFeedRangeRule.Disable(); + } + } + + private async Task InitializeHighThroughputContainerAsync() + { + if (this.database != null) + { + ContainerResponse cr = await this.database.CreateContainerIfNotExistsAsync( + id: TestCommon.FaultInjectionHTPContainerName, + partitionKeyPath: "/pk", + throughput: 11000); + + if (cr.StatusCode == HttpStatusCode.Created) + { + this.highThroughputContainer = cr.Container; + List tasks = new List() + { + this.highThroughputContainer.CreateItemAsync( + new FaultInjectionTestObject { Id = "testId", Pk = "pk" }), + this.highThroughputContainer.CreateItemAsync( + new FaultInjectionTestObject { Id = "testId2", Pk = "pk2" }), + this.highThroughputContainer.CreateItemAsync( + new FaultInjectionTestObject { Id = "testId3", Pk = "pk3" }), + this.highThroughputContainer.CreateItemAsync( + new FaultInjectionTestObject { Id = "testId4", Pk = "pk4" }), + this.highThroughputContainer.CreateItemAsync( + //unsued but needed to create multiple feed ranges + new FaultInjectionTestObject { Id = "testId5", Pk = "qwertyuiop" }), + this.highThroughputContainer.CreateItemAsync( + new FaultInjectionTestObject { Id = "testId6", Pk = "asdfghjkl" }), + this.highThroughputContainer.CreateItemAsync( + new FaultInjectionTestObject { Id = "testId7", Pk = "zxcvbnm" }), + this.highThroughputContainer.CreateItemAsync( + new FaultInjectionTestObject { Id = "testId8", Pk = "2wsx3edc" }), + this.highThroughputContainer.CreateItemAsync( + new FaultInjectionTestObject { Id = "testId9", Pk = "5tgb6yhn" }), + this.highThroughputContainer.CreateItemAsync( + new FaultInjectionTestObject { Id = "testId10", Pk = "7ujm8ik" }), + this.highThroughputContainer.CreateItemAsync( + new FaultInjectionTestObject { Id = "testId11", Pk = "9ol" }), + this.highThroughputContainer.CreateItemAsync( + new FaultInjectionTestObject { Id = "testId12", Pk = "1234567890" }) + }; + + await Task.WhenAll(tasks); + } + else + { + this.highThroughputContainer = this.database.GetContainer(TestCommon.FaultInjectionHTPContainerName); + } + } + } + + // + //Tests to see if response delay rule is applied, note that here the request should reach the backend + // + [TestMethod] + [Timeout(Timeout)] + [Description("Test response delay, request should be sent")] + [Owner("ntripician")] + public async Task FIProxyResponseDelay() + { + //id and partitionkey of item that is to be created, will want to delete after test + string id = "id"; + string pk = "deleteMe"; + + //create rule + string responseDelayRuleId = "responseDelayRule-" + Guid.NewGuid().ToString(); + FaultInjectionRule delayRule = new FaultInjectionRuleBuilder( + id: responseDelayRuleId, + condition: + new FaultInjectionConditionBuilder() + .WithOperationType(FaultInjectionOperationType.CreateItem) + .WithConnectionType(FaultInjectionConnectionType.Gateway) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.ResponseDelay) + .WithDelay(TimeSpan.FromSeconds(10)) + .WithTimes(1) + .Build()) + .WithDuration(TimeSpan.FromMinutes(5)) + .Build(); + + delayRule.Disable(); + + try + { + //create client with fault injection + FaultInjector faultInjector = new FaultInjector(new List { delayRule }); + + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConsistencyLevel = ConsistencyLevel.Session, + ConnectionMode = ConnectionMode.Gateway, + Serializer = this.serializer, + EnableContentResponseOnWrite = true, + }; + + this.fiClient = new CosmosClient( + this.connectionString, + faultInjector.GetFaultInjectionClientOptions(cosmosClientOptions)); + this.fiDatabase = this.fiClient.GetDatabase(TestCommon.FaultInjectionDatabaseName); + this.fiContainer = this.fiDatabase.GetContainer(TestCommon.FaultInjectionContainerName); + + delayRule.Enable(); + + ValueStopwatch stopwatch = ValueStopwatch.StartNew(); + TimeSpan elapsed; + + FaultInjectionTestObject createdItem = new FaultInjectionTestObject + { + Id = id, + Pk = pk + }; + + await this.fiContainer.CreateItemAsync( + createdItem, + new PartitionKey(pk)); + + elapsed = stopwatch.Elapsed; + stopwatch.Stop(); + delayRule.Disable(); + + this.ValidateHitCount(delayRule, 1); + + ItemResponse readResponse = await this.fiContainer.ReadItemAsync( + id, + new PartitionKey(pk)); + + //Check the create time is at least as long as the delay in the rule + Assert.IsTrue(elapsed.TotalSeconds >= 6); + this.ValidateHitCount(delayRule, 1); + Assert.IsTrue(readResponse.StatusCode == HttpStatusCode.OK); + } + finally + { + delayRule.Disable(); + try + { + await this.container.DeleteItemAsync(id, new PartitionKey(pk)); + } + catch (CosmosException) + { + // Ignore the exception + } + } + } + + // + //Tests to see if response delay rule is applied, note that here the request should NOT reach the backend as delay is applied before sending request + // + [TestMethod] + [Timeout(Timeout)] + [Description("Test send delay, request should not be sent")] + [Owner("ntripician")] + public async Task FIProxySendDelay() + { + //id and partitionkey of item that is to be created, will want to delete after test + string id = "id"; + string pk = "deleteMe"; + + //create rule + string sendDelayRuleId = "sendDelayRule-" + Guid.NewGuid().ToString(); + FaultInjectionRule delayRule = new FaultInjectionRuleBuilder( + id: sendDelayRuleId, + condition: + new FaultInjectionConditionBuilder() + .WithOperationType(FaultInjectionOperationType.CreateItem) + .WithConnectionType(FaultInjectionConnectionType.Gateway) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.SendDelay) + .WithDelay(TimeSpan.FromSeconds(6))//request timeout is 65s + .WithTimes(10) + .Build()) + .WithDuration(TimeSpan.FromMinutes(5)) + .Build(); + + delayRule.Disable(); + + try + { + //create client with fault injection + FaultInjector faultInjector = new FaultInjector(new List { delayRule }); + + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConsistencyLevel = ConsistencyLevel.Session, + ConnectionMode = ConnectionMode.Gateway, + Serializer = this.serializer, + EnableContentResponseOnWrite = true, + RequestTimeout = TimeSpan.FromSeconds(10) + }; + + this.fiClient = new CosmosClient( + this.connectionString, + faultInjector.GetFaultInjectionClientOptions(cosmosClientOptions)); + this.fiDatabase = this.fiClient.GetDatabase(TestCommon.FaultInjectionDatabaseName); + this.fiContainer = this.fiDatabase.GetContainer(TestCommon.FaultInjectionContainerName); + + delayRule.Enable(); + ValueStopwatch stopwatch = ValueStopwatch.StartNew(); + TimeSpan elapsed; + + FaultInjectionTestObject createdItem = new FaultInjectionTestObject + { + Id = id, + Pk = pk + }; + + try + { + ItemResponse ir = await this.fiContainer.CreateItemAsync( + createdItem, + new PartitionKey(pk)); + } + catch (CosmosException ex) + { + Assert.AreEqual(HttpStatusCode.RequestTimeout, ex.StatusCode); + } + + elapsed = stopwatch.Elapsed; + stopwatch.Stop(); + delayRule.Disable(); + + this.ValidateHitCount(delayRule, 1); + + //Check the create time is at least as long as the delay in the rule + Assert.IsTrue(elapsed.TotalSeconds >= 6); + } + finally + { + delayRule.Disable(); + try + { + await this.container.DeleteItemAsync(id, new PartitionKey(pk)); + } + catch (CosmosException) + { + // Ignore the exception + } + } + } + + + // + //Tests to see if specific server error responses are applied, tests read and create item + // + [TestMethod] + [Timeout(Timeout * 100)] + [Description("Test server error responses")] + [Owner("ntripician")] + [DataRow(FaultInjectionOperationType.ReadItem, FaultInjectionServerErrorType.Gone, (int)StatusCodes.Gone, (int)SubStatusCodes.ServerGenerated410, DisplayName = "Gone")] + [DataRow(FaultInjectionOperationType.ReadItem, FaultInjectionServerErrorType.InternalServerError, (int)StatusCodes.InternalServerError, (int)SubStatusCodes.Unknown, DisplayName = "InternalServerError")] + [DataRow(FaultInjectionOperationType.ReadItem, FaultInjectionServerErrorType.TooManyRequests, (int)StatusCodes.TooManyRequests, (int)SubStatusCodes.RUBudgetExceeded, DisplayName = "TooManyRequests")] + [DataRow(FaultInjectionOperationType.ReadItem, FaultInjectionServerErrorType.ReadSessionNotAvailable, (int)StatusCodes.NotFound, (int)SubStatusCodes.ReadSessionNotAvailable, DisplayName = "ReadSessionNotAvailable")] + [DataRow(FaultInjectionOperationType.ReadItem, FaultInjectionServerErrorType.Timeout, (int)StatusCodes.RequestTimeout, (int)SubStatusCodes.Unknown, DisplayName = "Timeout")] + [DataRow(FaultInjectionOperationType.ReadItem, FaultInjectionServerErrorType.PartitionIsMigrating, (int)StatusCodes.Gone, (int)SubStatusCodes.CompletingPartitionMigration, DisplayName = "PartitionIsMigrating")] + [DataRow(FaultInjectionOperationType.ReadItem, FaultInjectionServerErrorType.PartitionIsSplitting, (int)StatusCodes.Gone, (int)SubStatusCodes.CompletingSplit, DisplayName = "PartitionIsSplitting")] + [DataRow(FaultInjectionOperationType.CreateItem, FaultInjectionServerErrorType.Gone, (int)StatusCodes.Gone, (int)SubStatusCodes.ServerGenerated410, DisplayName = "Gone - write")] + [DataRow(FaultInjectionOperationType.CreateItem, FaultInjectionServerErrorType.InternalServerError, (int)StatusCodes.InternalServerError, (int)SubStatusCodes.Unknown, DisplayName = "InternalServerError - write")] + [DataRow(FaultInjectionOperationType.CreateItem, FaultInjectionServerErrorType.TooManyRequests, (int)StatusCodes.TooManyRequests, (int)SubStatusCodes.RUBudgetExceeded, DisplayName = "TooManyRequests - write")] + [DataRow(FaultInjectionOperationType.CreateItem, FaultInjectionServerErrorType.ReadSessionNotAvailable, (int)StatusCodes.NotFound, (int)SubStatusCodes.ReadSessionNotAvailable, DisplayName = "ReadSessionNotAvailable - write")] + [DataRow(FaultInjectionOperationType.CreateItem, FaultInjectionServerErrorType.Timeout, (int)StatusCodes.RequestTimeout, (int)SubStatusCodes.Unknown, DisplayName = "Timeout - write")] + [DataRow(FaultInjectionOperationType.CreateItem, FaultInjectionServerErrorType.PartitionIsMigrating, (int)StatusCodes.Gone, (int)SubStatusCodes.CompletingPartitionMigration, DisplayName = "PartitionIsMigrating - write")] + [DataRow(FaultInjectionOperationType.CreateItem, FaultInjectionServerErrorType.PartitionIsSplitting, (int)StatusCodes.Gone, (int)SubStatusCodes.CompletingSplit, DisplayName = "PartitionIsSplitting - write")] + public async Task FIProxyServerResponse( + FaultInjectionOperationType faultInjectionOperationType, + FaultInjectionServerErrorType faultInjectionServerErrorType, + int statusCodes, + int subStatusCode) + { + //id and partitionkey of item that is to be created, will want to delete after test + string id = "id"; + string pk = "deleteMe"; + + string serverErrorResponseRuleId = "serverErrorResponseRule-" + Guid.NewGuid().ToString(); + FaultInjectionRule serverErrorResponseRule = new FaultInjectionRuleBuilder( + id: serverErrorResponseRuleId, + condition: + new FaultInjectionConditionBuilder() + .WithOperationType(faultInjectionOperationType) + .WithConnectionType(FaultInjectionConnectionType.Gateway) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(faultInjectionServerErrorType) + .WithTimes(1) + .Build()) + .WithDuration(TimeSpan.FromMinutes(5)) + .Build(); + serverErrorResponseRule.Disable(); + + try + { + FaultInjector faultInjector = new FaultInjector(new List { serverErrorResponseRule }); + + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConsistencyLevel = ConsistencyLevel.Session, + ConnectionMode = ConnectionMode.Gateway, + Serializer = this.serializer, + MaxRetryAttemptsOnRateLimitedRequests = 0, + }; + + if (subStatusCode == (int)SubStatusCodes.ReadSessionNotAvailable) + { + cosmosClientOptions.LimitToEndpoint = true; + } + + this.fiClient = new CosmosClient( + this.connectionString, + faultInjector.GetFaultInjectionClientOptions(cosmosClientOptions)); + this.fiDatabase = this.fiClient.GetDatabase(TestCommon.FaultInjectionDatabaseName); + this.fiContainer = this.fiDatabase.GetContainer(TestCommon.FaultInjectionContainerName); + + serverErrorResponseRule.Enable(); + + ItemResponse response; + + ValueStopwatch stopwatch = ValueStopwatch.StartNew(); + TimeSpan elapsed; + + + try + { + if (faultInjectionOperationType == FaultInjectionOperationType.CreateItem) + { + FaultInjectionTestObject createdItem = new FaultInjectionTestObject + { + Id = id, + Pk = pk + }; + + response = await this.fiContainer.CreateItemAsync( + createdItem, + new PartitionKey(pk)); + } + else + { + response = await this.fiContainer.ReadItemAsync( + "testId", + new PartitionKey("/pk")); + } + } + catch (CosmosException ex) + { + this.ValidateRuleHit(serverErrorResponseRule, 1); + this.ValidateFaultInjectionRuleApplication( + ex, + statusCodes, + subStatusCode, + serverErrorResponseRule); + } + catch (DocumentClientException ex) + { + this.ValidateRuleHit(serverErrorResponseRule, 1); + this.ValidateFaultInjectionRuleApplication( + ex, + statusCodes, + subStatusCode, + serverErrorResponseRule); + } + + + elapsed = stopwatch.Elapsed; + stopwatch.Stop(); + + if (faultInjectionServerErrorType == FaultInjectionServerErrorType.Timeout) + { + ChaosInterceptor interceptor = faultInjector.GetChaosInterceptor() as ChaosInterceptor; + + Assert.IsNotNull(interceptor); + Assert.IsTrue( + elapsed.TotalSeconds + >= interceptor.GetRequestTimeout().TotalSeconds); + } + } + finally + { + serverErrorResponseRule.Disable(); + if (this.container != null && faultInjectionOperationType == FaultInjectionOperationType.CreateItem) + { + try + { + await this.container.DeleteItemAsync(id, new PartitionKey(pk)); + } + catch (CosmosException) + { + // Ignore the exception + } + } + } + } + + /// + /// Tests to see if fault injection rules are applied the correct number of times when a hit limit is set + /// + [TestMethod] + [Timeout(Timeout)] + [Description("Test hit limit")] + [Owner("ntripician")] + public async Task FIProxyHitLimit() + { + string hitCountRuleId = "hitCountRule-" + Guid.NewGuid().ToString(); + FaultInjectionRule hitCountRule = new FaultInjectionRuleBuilder( + id: hitCountRuleId, + condition: + new FaultInjectionConditionBuilder() + .WithConnectionType(FaultInjectionConnectionType.Gateway) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.Gone) + .WithTimes(1) + .Build()) + .WithHitLimit(2) + .WithDuration(TimeSpan.FromMinutes(5)) + .Build(); + hitCountRule.Disable(); + + try + { + FaultInjector faultInjector = new FaultInjector(new List { hitCountRule }); + + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConsistencyLevel = ConsistencyLevel.Session, + ConnectionMode = ConnectionMode.Gateway, + Serializer = this.serializer + }; + + this.fiClient = new CosmosClient( + this.connectionString, + faultInjector.GetFaultInjectionClientOptions(cosmosClientOptions)); + this.fiDatabase = this.fiClient.GetDatabase(TestCommon.FaultInjectionDatabaseName); + this.fiContainer = this.fiDatabase.GetContainer(TestCommon.FaultInjectionContainerName); + + hitCountRule.Enable(); + + ItemResponse response; + + //Since the hit limit is 2, the rule should be applied twice and then become invalid + for (int i = 0; i < 3; i++) + { + try + { + response = await this.fiContainer.ReadItemAsync( + "testId", + new PartitionKey("pk")); + Assert.IsNotNull(response); + + if (i > 2) + { + this.ValidateFaultInjectionRuleNotApplied(response, hitCountRule, 2); + } + } + catch (DocumentClientException ex) + { + this.ValidateFaultInjectionRuleApplication(ex, (int)HttpStatusCode.Gone, hitCountRule); + this.ValidateHitCount(hitCountRule, i + 1); + } + catch (CosmosException ex) + { + this.ValidateFaultInjectionRuleApplication(ex, (int)HttpStatusCode.Gone, hitCountRule); + this.ValidateHitCount(hitCountRule, i + 1); + } + } + } + finally + { + hitCountRule.Disable(); + } + } + + /// + /// Injection rate is set to 0.5, so the rule should be applied ~50% of the time + /// This test will fail ~1.2% of the time due to the random nature of the test + /// 98.8% of the time the rule will be applied between 38 and 62 times out of 100 with an injection rate of 50% + /// + [TestMethod] + [Timeout(Timeout)] + [Description("Test injection rate")] + [Owner("ntripician")] + public async Task FIProxyInjectionRate() + { + string thresholdRuleId = "hitCountRule-" + Guid.NewGuid().ToString(); + FaultInjectionRule thresholdRule = new FaultInjectionRuleBuilder( + id: thresholdRuleId, + condition: + new FaultInjectionConditionBuilder() + .WithOperationType(FaultInjectionOperationType.ReadItem) + .WithConnectionType(FaultInjectionConnectionType.Gateway) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.Gone) + .WithInjectionRate(.5) + .WithTimes(1) + .Build()) + .WithDuration(TimeSpan.FromMinutes(5)) + .Build(); + thresholdRule.Disable(); + + try + { + FaultInjector faultInjector = new FaultInjector(new List { thresholdRule }); + + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConsistencyLevel = ConsistencyLevel.Session, + ConnectionMode = ConnectionMode.Gateway, + Serializer = this.serializer + }; + + this.fiClient = new CosmosClient( + this.connectionString, + faultInjector.GetFaultInjectionClientOptions(cosmosClientOptions)); + this.fiDatabase = this.fiClient.GetDatabase(TestCommon.FaultInjectionDatabaseName); + this.fiContainer = this.fiDatabase.GetContainer(TestCommon.FaultInjectionContainerName); + + ItemResponse response; + + thresholdRule.Enable(); + + for (int i = 0; i < 100; i++) + { + try + { + response = await this.fiContainer.ReadItemAsync( + "testId", + new PartitionKey("pk")); + + Assert.IsNotNull(response); + } + catch (Exception) + { + //ignore + } + + } + + Assert.IsTrue(thresholdRule.GetHitCount() >= 38, "This is Expected to fail 0.602% of the time"); + Assert.IsTrue(thresholdRule.GetHitCount() <= 62, "This is Expected to fail 0.602% of the time"); + } + finally + { + thresholdRule.Disable(); + } + } + + /// + /// Tests to see if fault injection rules are applied to the correct connection type + /// + [TestMethod] + public async Task FIOnlyGateway() + { + string ruleId = "Rule-" + Guid.NewGuid().ToString(); + FaultInjectionRule rule = new FaultInjectionRuleBuilder( + id: ruleId, + condition: + new FaultInjectionConditionBuilder() + .WithOperationType(FaultInjectionOperationType.ReadItem) + .WithConnectionType(FaultInjectionConnectionType.Gateway) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.InternalServerError) + .WithTimes(1) + .Build()) + .WithDuration(TimeSpan.FromMinutes(5)) + .Build(); + rule.Disable(); + + try + { + //Test on direct mode client + FaultInjector faultInjector = new FaultInjector(new List { rule }); + + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConsistencyLevel = ConsistencyLevel.Session, + ConnectionMode = ConnectionMode.Direct, + Serializer = this.serializer + }; + + this.fiClient = new CosmosClient( + this.connectionString, + faultInjector.GetFaultInjectionClientOptions(cosmosClientOptions)); + this.fiDatabase = this.fiClient.GetDatabase(TestCommon.FaultInjectionDatabaseName); + this.fiContainer = this.fiDatabase.GetContainer(TestCommon.FaultInjectionContainerName); + + ItemResponse response; + + rule.Enable(); + + response = await this.fiContainer.ReadItemAsync( + "testId", + new PartitionKey("pk")); + + this.ValidateFaultInjectionRuleNotApplied(response, rule); + + rule.Disable(); + this.fiClient.Dispose(); + + //Test on gateway mode client + cosmosClientOptions = new CosmosClientOptions() + { + ConsistencyLevel = ConsistencyLevel.Session, + ConnectionMode = ConnectionMode.Gateway, + Serializer = this.serializer + }; + + this.fiClient = new CosmosClient( + this.connectionString, + faultInjector.GetFaultInjectionClientOptions(cosmosClientOptions)); + this.fiDatabase = this.fiClient.GetDatabase(TestCommon.FaultInjectionDatabaseName); + this.fiContainer = this.fiDatabase.GetContainer(TestCommon.FaultInjectionContainerName); + + rule.Enable(); + + try + { + response = await this.fiContainer.ReadItemAsync( + "testId", + new PartitionKey("pk")); + } + catch (CosmosException ex) + { + this.ValidateFaultInjectionRuleApplication(ex, (int)HttpStatusCode.InternalServerError, rule); + } + } + finally + { + rule.Disable(); + } + } + + private async Task<(List, List)> GetReadWriteEndpoints(GlobalEndpointManager globalEndpointManager) + { + AccountProperties accountProperties = await globalEndpointManager.GetDatabaseAccountAsync(); + List writeRegions = accountProperties.WritableRegions.Select(region => region.Name).ToList(); + List readRegions = accountProperties.ReadableRegions.Select(region => region.Name).ToList(); + return (writeRegions, readRegions); + } + + private void ValidateHitCount(FaultInjectionRule rule, long expectedHitCount) + { + Assert.AreEqual(expectedHitCount, rule.GetHitCount()); + } + + private void ValidateRuleHit(FaultInjectionRule rule, long expectedHitCount) + { + Assert.IsTrue(expectedHitCount <= rule.GetHitCount()); + } + + private void ValidateFaultInjectionRuleNotApplied( + ItemResponse response, + FaultInjectionRule rule, + int expectedHitCount = 0) + { + Assert.AreEqual(expectedHitCount, rule.GetHitCount()); + Assert.AreEqual(0, response.Diagnostics.GetFailedRequestCount()); + Assert.IsTrue((int)response.StatusCode < 400); + } + + private void ValidateFaultInjectionRuleApplication( + DocumentClientException ex, + int statusCode, + FaultInjectionRule rule) + { + Assert.IsTrue(1 <= rule.GetHitCount()); + Assert.IsTrue(ex.Message.Contains(rule.GetId())); + Assert.AreEqual(statusCode, (int)ex.StatusCode); + } + + private void ValidateFaultInjectionRuleApplication( + CosmosException ex, + int statusCode, + FaultInjectionRule rule) + { + Assert.IsTrue(1 <= rule.GetHitCount()); + Assert.IsTrue(ex.Message.Contains(rule.GetId())); + Assert.AreEqual(statusCode, (int)ex.StatusCode); + } + + private void ValidateFaultInjectionRuleApplication( + DocumentClientException ex, + int statusCode, + int subStatusCode, + FaultInjectionRule rule) + { + Assert.IsTrue(1 <= rule.GetHitCount()); + Assert.IsTrue(ex.Message.Contains(rule.GetId())); + Assert.AreEqual(statusCode, (int)ex.StatusCode); + Assert.AreEqual(subStatusCode.ToString(), ex.Headers.Get(WFConstants.BackendHeaders.SubStatus)); + } + + private void ValidateFaultInjectionRuleApplication( + CosmosException ex, + int statusCode, + int subStatusCode, + FaultInjectionRule rule) + { + Assert.IsTrue(1 <= rule.GetHitCount()); + Assert.IsTrue(ex.Message.Contains(rule.GetId())); + Assert.AreEqual(statusCode, (int)ex.StatusCode); + Assert.AreEqual(subStatusCode, ex.SubStatusCode); + } + } +} diff --git a/Microsoft.Azure.Cosmos/FaultInjection/tests/Utils/TestCommon.cs b/Microsoft.Azure.Cosmos/FaultInjection/tests/Utils/TestCommon.cs index 97fb5fbd7d..d6b88b4b44 100644 --- a/Microsoft.Azure.Cosmos/FaultInjection/tests/Utils/TestCommon.cs +++ b/Microsoft.Azure.Cosmos/FaultInjection/tests/Utils/TestCommon.cs @@ -24,6 +24,11 @@ internal static string GetConnectionString() return ConfigurationManager.GetEnvironmentVariable("COSMOSDB_MULTI_REGION", string.Empty); } + internal static string GetThinClientConnectionString() + { + return ConfigurationManager.GetEnvironmentVariable("COSMOSDB_THIN_CLIENT", string.Empty); + } + internal static async Task<(Database, Container)> GetOrCreateMultiRegionFIDatabaseAndContainersAsync(CosmosClient client) { Database database; diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.47.2.txt b/Microsoft.Azure.Cosmos/contracts/API_3.47.2.txt new file mode 100644 index 0000000000..ce3c50ac41 --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.47.2.txt @@ -0,0 +1,1687 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public abstract class AvailabilityStrategy + { + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep); + public static AvailabilityStrategy DisabledStrategy(); + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode Incremental { get; } + public static ChangeFeedMode LatestVersion { get; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract FeedRange FeedRange { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public sealed class ComputedProperty + { + public ComputedProperty(); + public string Name { get; set; } + public string Query { get; set; } + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public virtual Task DeleteAllItemsByPartitionKeyStreamAsync(PartitionKey partitionKey, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public Collection ComputedProperties { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + public VectorEmbeddingPolicy VectorEmbeddingPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public IEnumerable AccountInitializationCustomEndpoints { get; set; } + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public CosmosClientTelemetryOptions CosmosClientTelemetryOptions { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public IFaultInjector FaultInjector { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public Nullable PriorityLevel { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public JsonSerializerOptions UseSystemTextJsonSerializerWithOptions { get; set; } + public IWebProxy WebProxy { get; set; } + } + public class CosmosClientTelemetryOptions + { + public CosmosClientTelemetryOptions(); + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public bool DisableDistributedTracing { get; set; } + public bool DisableSendingMetricsToService { get; set; } + public QueryTextMode QueryTextMode { get; set; } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual ServerSideCumulativeMetrics GetQueryMetrics(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public abstract class CosmosLinqSerializer : CosmosSerializer + { + protected CosmosLinqSerializer(); + public abstract string SerializeMemberName(MemberInfo memberInfo); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public class CosmosThresholdOptions + { + public CosmosThresholdOptions(); + public TimeSpan NonPointOperationLatencyThreshold { get; set; } + public Nullable PayloadSizeThresholdInBytes { get; set; } + public TimeSpan PointOperationLatencyThreshold { get; set; } + public Nullable RequestChargeThreshold { get; set; } + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable BypassIntegratedCache { get; set; } + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public enum DistanceFunction + { + Cosine = 1, + DotProduct = 2, + Euclidean = 0, + } + public class Embedding : IEquatable + { + public Embedding(); + public VectorDataType DataType { get; set; } + public int Dimensions { get; set; } + public DistanceFunction DistanceFunction { get; set; } + public string Path { get; set; } + public bool Equals(Embedding that); + public void ValidateEmbeddingPath(); + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + public Collection VectorIndexes { get; set; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public virtual string From { get; set; } + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Move(string from, string path); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Move = 5, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public enum PriorityLevel + { + High = 1, + Low = 2, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public bool EnableOptimisticDirectExecution { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public QueryTextMode QueryTextMode { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public enum QueryTextMode + { + All = 2, + None = 0, + ParameterizedOnly = 1, + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string AustriaEast = "Austria East"; + public const string BelgiumCentral = "Belgium Central"; + public const string BleuFranceCentral = "Bleu France Central"; + public const string BleuFranceSouth = "Bleu France South"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChileCentral = "Chile Central"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string DelosCloudGermanyCentral = "Delos Cloud Germany Central"; + public const string DelosCloudGermanyNorth = "Delos Cloud Germany North"; + public const string DenmarkEast = "Denmark East"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyNorth = "Germany North"; + public const string GermanyWestCentral = "Germany West Central"; + public const string IndonesiaCentral = "Indonesia Central"; + public const string IsraelCentral = "Israel Central"; + public const string IsraelNorthwest = "Israel Northwest"; + public const string ItalyNorth = "Italy North"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string MalaysiaSouth = "Malaysia South"; + public const string MalaysiaWest = "Malaysia West"; + public const string MexicoCentral = "Mexico Central"; + public const string NewZealandNorth = "New Zealand North"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SouthCentralUS2 = "South Central US 2"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SoutheastUS = "Southeast US"; + public const string SoutheastUS3 = "Southeast US 3"; + public const string SoutheastUS5 = "Southeast US 5"; + public const string SouthIndia = "South India"; + public const string SouthwestUS = "Southwest US"; + public const string SpainCentral = "Spain Central"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string TaiwanNorth = "Taiwan North"; + public const string TaiwanNorthwest = "Taiwan Northwest"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string USSecWestCentral = "USSec West Central"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public List ExcludeRegions { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public Nullable PriorityLevel { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public abstract class ServerSideCumulativeMetrics + { + protected ServerSideCumulativeMetrics(); + public abstract ServerSideMetrics CumulativeMetrics { get; } + public abstract IReadOnlyList PartitionedMetrics { get; } + public abstract double TotalRequestCharge { get; } + } + public abstract class ServerSideMetrics + { + protected ServerSideMetrics(); + public abstract TimeSpan DocumentLoadTime { get; } + public abstract TimeSpan DocumentWriteTime { get; } + public abstract double IndexHitRatio { get; } + public abstract TimeSpan IndexLookupTime { get; } + public abstract long OutputDocumentCount { get; } + public abstract long OutputDocumentSize { get; } + public abstract TimeSpan QueryPreparationTime { get; } + public abstract long RetrievedDocumentCount { get; } + public abstract long RetrievedDocumentSize { get; } + public abstract TimeSpan RuntimeExecutionTime { get; } + public abstract TimeSpan TotalTime { get; } + public abstract TimeSpan VMExecutionTime { get; } + } + public abstract class ServerSidePartitionedMetrics + { + protected ServerSidePartitionedMetrics(); + public abstract string FeedRange { get; } + public abstract Nullable PartitionKeyRangeId { get; } + public abstract double RequestCharge { get; } + public abstract ServerSideMetrics ServerSideMetrics { get; } + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } + public enum VectorDataType + { + Float32 = 0, + Int8 = 2, + Uint8 = 1, + } + public sealed class VectorEmbeddingPolicy + { + public readonly Collection Embeddings; + public VectorEmbeddingPolicy(Collection embeddings); + } + public sealed class VectorIndexPath + { + public VectorIndexPath(); + public string Path { get; set; } + public VectorIndexType Type { get; set; } + } + public enum VectorIndexType + { + DiskANN = 1, + Flat = 0, + QuantizedFlat = 2, + } +} +namespace Microsoft.Azure.Cosmos.FaultInjection +{ + public interface IFaultInjector + { + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ComputedPropertiesDefinition + { + public T Attach(); + public ComputedPropertiesDefinition WithComputedProperty(string name, string query); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public UniqueKeyDefinition WithUniqueKey(); + public VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(Collection embeddings); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public ComputedPropertiesDefinition WithComputedProperties(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptions options); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomAccountEndpoints(IEnumerable customAccountEndpoints); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithFaultInjection(IFaultInjector faultInjector); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithPriorityLevel(PriorityLevel priorityLevel); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithSystemTextJsonSerializerOptions(JsonSerializerOptions serializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + public VectorIndexDefinition> WithVectorIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } + public class VectorEmbeddingPolicyDefinition + { + public VectorEmbeddingPolicyDefinition(ContainerBuilder parent, Collection embeddings, Action attachCallback); + public ContainerBuilder Attach(); + } + public class VectorIndexDefinition + { + public VectorIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public VectorIndexDefinition Path(string path, VectorIndexType indexType); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static int DocumentId(this object obj); + public static bool IsArray(this object obj); + public static bool IsBool(this object obj); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsNumber(this object obj); + public static bool IsObject(this object obj); + public static bool IsPrimitive(this object obj); + public static bool IsString(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static bool RegexMatch(this object obj, string regularExpression); + public static bool RegexMatch(this object obj, string regularExpression, string searchModifier); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static FeedIterator ToStreamIterator(this IQueryable query); + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + Upsert = (short)5, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.48.0-preview.2.txt b/Microsoft.Azure.Cosmos/contracts/API_3.48.0-preview.2.txt new file mode 100644 index 0000000000..6a2bc84321 --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.48.0-preview.2.txt @@ -0,0 +1,1849 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public abstract class AvailabilityStrategy + { + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep); + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep, bool enableMultiWriteRegionHedge=false); + public static AvailabilityStrategy DisabledStrategy(); + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public class ChangeFeedItem + { + public ChangeFeedItem(); + public T Current { get; set; } + public ChangeFeedMetadata Metadata { get; set; } + public T Previous { get; set; } + } + public class ChangeFeedMetadata + { + public ChangeFeedMetadata(); + public DateTime ConflictResolutionTimestamp { get; } + public bool IsTimeToLiveExpired { get; } + public long Lsn { get; } + public ChangeFeedOperationType OperationType { get; } + public long PreviousLsn { get; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode AllVersionsAndDeletes { get; } + public static ChangeFeedMode Incremental { get; } + public static ChangeFeedMode LatestVersion { get; } + } + public enum ChangeFeedOperationType + { + Create = 0, + Delete = 2, + Replace = 1, + } + public sealed class ChangeFeedPolicy + { + public ChangeFeedPolicy(); + public static TimeSpan FullFidelityNoRetention { get; } + public TimeSpan FullFidelityRetention { get; set; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract FeedRange FeedRange { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public sealed class ComputedProperty + { + public ComputedProperty(); + public string Name { get; set; } + public string Query { get; set; } + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public virtual Task DeleteAllItemsByPartitionKeyStreamAsync(PartitionKey partitionKey, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes(string processorName, Container.ChangeFeedHandler> onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> GetPartitionKeyRangesAsync(FeedRange feedRange, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task IsFeedRangePartOfAsync(FeedRange x, FeedRange y, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ChangeFeedPolicy ChangeFeedPolicy { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public Collection ComputedProperties { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public FullTextPolicy FullTextPolicy { get; set; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + public VectorEmbeddingPolicy VectorEmbeddingPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public IEnumerable AccountInitializationCustomEndpoints { get; set; } + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public CosmosClientTelemetryOptions CosmosClientTelemetryOptions { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public IFaultInjector FaultInjector { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public Nullable PriorityLevel { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public JsonSerializerOptions UseSystemTextJsonSerializerWithOptions { get; set; } + public IWebProxy WebProxy { get; set; } + } + public class CosmosClientTelemetryOptions + { + public CosmosClientTelemetryOptions(); + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public bool DisableDistributedTracing { get; set; } + public bool DisableSendingMetricsToService { get; set; } + public bool IsClientMetricsEnabled { get; set; } + public NetworkMetricsOptions NetworkMetricsOptions { get; set; } + public OperationMetricsOptions OperationMetricsOptions { get; set; } + public QueryTextMode QueryTextMode { get; set; } + } + public sealed class CosmosDbClientMetrics + { + public CosmosDbClientMetrics(); + public static class HistogramBuckets + { + public static readonly double[] RequestLatencyBuckets; + public static readonly double[] RequestUnitBuckets; + public static readonly double[] RowCountBuckets; + } + public static class NetworkMetrics + { + public const string MeterName = "Azure.Cosmos.Client.Request"; + public const string Version = "1.0.0"; + public static class Description + { + public const string BackendLatency = "Backend Latency (for direct mode)."; + public const string ChannelAquisitionLatency = "The duration of the successfully established outbound TCP connections. i.e. Channel Aquisition Time (for direct mode)."; + public const string Latency = "Duration of client requests."; + public const string ReceivedTimeLatency = "Time spent on 'Received' stage (for direct mode)."; + public const string RequestBodySize = "Size of client request body."; + public const string ResponseBodySize = "Size of client response body."; + public const string TransitTimeLatency = "Time spent on the wire (for direct mode)."; + } + public static class Name + { + public const string BackendLatency = "azure.cosmosdb.client.request.service_duration"; + public const string ChannelAquisitionLatency = "azure.cosmosdb.client.request.channel_aquisition.duration"; + public const string Latency = "azure.cosmosdb.client.request.duration"; + public const string ReceivedTimeLatency = "azure.cosmosdb.client.request.received.duration"; + public const string RequestBodySize = "azure.cosmosdb.client.request.body.size"; + public const string ResponseBodySize = "azure.cosmosdb.client.response.body.size"; + public const string TransitTimeLatency = "azure.cosmosdb.client.request.transit.duration"; + } + public static class Unit + { + public const string Bytes = "bytes"; + public const string Sec = "s"; + } + } + public static class OperationMetrics + { + public const string MeterName = "Azure.Cosmos.Client.Operation"; + public const string Version = "1.0.0"; + public static class Description + { + public const string ActiveInstances = "Number of active SDK client instances."; + public const string Latency = "Total end-to-end duration of the operation"; + public const string RequestCharge = "Total request units per operation (sum of RUs for all requested needed when processing an operation)"; + public const string RowCount = "For feed operations (query, readAll, readMany, change feed) batch operations this meter capture the actual item count in responses from the service"; + } + public static class Name + { + public const string ActiveInstances = "azure.cosmosdb.client.active_instance.count"; + public const string Latency = "db.client.operation.duration"; + public const string RequestCharge = "azure.cosmosdb.client.operation.request_charge"; + public const string RowCount = "db.client.response.row_count"; + } + public static class Unit + { + public const string Count = "#"; + public const string RequestUnit = "# RU"; + public const string Sec = "s"; + } + } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual ServerSideCumulativeMetrics GetQueryMetrics(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public abstract class CosmosLinqSerializer : CosmosSerializer + { + protected CosmosLinqSerializer(); + public abstract string SerializeMemberName(MemberInfo memberInfo); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public class CosmosThresholdOptions + { + public CosmosThresholdOptions(); + public TimeSpan NonPointOperationLatencyThreshold { get; set; } + public Nullable PayloadSizeThresholdInBytes { get; set; } + public TimeSpan PointOperationLatencyThreshold { get; set; } + public Nullable RequestChargeThreshold { get; set; } + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable BypassIntegratedCache { get; set; } + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public enum DistanceFunction + { + Cosine = 1, + DotProduct = 2, + Euclidean = 0, + } + public class Embedding : IEquatable + { + public Embedding(); + public VectorDataType DataType { get; set; } + public int Dimensions { get; set; } + public DistanceFunction DistanceFunction { get; set; } + public string Path { get; set; } + public bool Equals(Embedding that); + public void ValidateEmbeddingPath(); + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class FullTextIndexPath + { + public FullTextIndexPath(); + public string Path { get; set; } + } + public sealed class FullTextPath : IEquatable + { + public FullTextPath(); + public string Language { get; set; } + public string Path { get; set; } + public bool Equals(FullTextPath that); + public void ValidateFullTextPath(); + } + public sealed class FullTextPolicy + { + public FullTextPolicy(); + public string DefaultLanguage { get; set; } + public Collection FullTextPaths { get; set; } + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection FullTextIndexes { get; set; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + public Collection VectorIndexes { get; set; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public class NetworkMetricsOptions + { + public NetworkMetricsOptions(); + public IDictionary CustomDimensions { get; set; } + public Nullable IncludeRoutingId { get; set; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public class OperationMetricsOptions + { + public OperationMetricsOptions(); + public IDictionary CustomDimensions { get; set; } + public Nullable IncludeRegion { get; set; } + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public virtual string From { get; set; } + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Move(string from, string path); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Move = 5, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public enum PriorityLevel + { + High = 1, + Low = 2, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public bool EnableOptimisticDirectExecution { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public QueryTextMode QueryTextMode { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public enum QueryTextMode + { + All = 2, + None = 0, + ParameterizedOnly = 1, + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string AustriaEast = "Austria East"; + public const string BelgiumCentral = "Belgium Central"; + public const string BleuFranceCentral = "Bleu France Central"; + public const string BleuFranceSouth = "Bleu France South"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChileCentral = "Chile Central"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string DelosCloudGermanyCentral = "Delos Cloud Germany Central"; + public const string DelosCloudGermanyNorth = "Delos Cloud Germany North"; + public const string DenmarkEast = "Denmark East"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyNorth = "Germany North"; + public const string GermanyWestCentral = "Germany West Central"; + public const string IndonesiaCentral = "Indonesia Central"; + public const string IsraelCentral = "Israel Central"; + public const string IsraelNorthwest = "Israel Northwest"; + public const string ItalyNorth = "Italy North"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string MalaysiaSouth = "Malaysia South"; + public const string MalaysiaWest = "Malaysia West"; + public const string MexicoCentral = "Mexico Central"; + public const string NewZealandNorth = "New Zealand North"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SouthCentralUS2 = "South Central US 2"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SoutheastUS = "Southeast US"; + public const string SoutheastUS3 = "Southeast US 3"; + public const string SoutheastUS5 = "Southeast US 5"; + public const string SouthIndia = "South India"; + public const string SouthwestUS = "Southwest US"; + public const string SpainCentral = "Spain Central"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string TaiwanNorth = "Taiwan North"; + public const string TaiwanNorthwest = "Taiwan Northwest"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string USSecWestCentral = "USSec West Central"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public List ExcludeRegions { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public NetworkMetricsOptions NetworkMetricsOptions { get; set; } + public OperationMetricsOptions OperationMetricsOptions { get; set; } + public Nullable PriorityLevel { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public abstract class ServerSideCumulativeMetrics + { + protected ServerSideCumulativeMetrics(); + public abstract ServerSideMetrics CumulativeMetrics { get; } + public abstract IReadOnlyList PartitionedMetrics { get; } + public abstract double TotalRequestCharge { get; } + } + public abstract class ServerSideMetrics + { + protected ServerSideMetrics(); + public abstract TimeSpan DocumentLoadTime { get; } + public abstract TimeSpan DocumentWriteTime { get; } + public abstract double IndexHitRatio { get; } + public abstract TimeSpan IndexLookupTime { get; } + public abstract long OutputDocumentCount { get; } + public abstract long OutputDocumentSize { get; } + public abstract TimeSpan QueryPreparationTime { get; } + public abstract long RetrievedDocumentCount { get; } + public abstract long RetrievedDocumentSize { get; } + public abstract TimeSpan RuntimeExecutionTime { get; } + public abstract TimeSpan TotalTime { get; } + public abstract TimeSpan VMExecutionTime { get; } + } + public abstract class ServerSidePartitionedMetrics + { + protected ServerSidePartitionedMetrics(); + public abstract string FeedRange { get; } + public abstract Nullable PartitionKeyRangeId { get; } + public abstract double RequestCharge { get; } + public abstract ServerSideMetrics ServerSideMetrics { get; } + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } + public enum VectorDataType + { + Float32 = 0, + Int8 = 2, + Uint8 = 1, + } + public sealed class VectorEmbeddingPolicy + { + public readonly Collection Embeddings; + public VectorEmbeddingPolicy(Collection embeddings); + } + public sealed class VectorIndexPath + { + public VectorIndexPath(); + public int IndexingSearchListSize { get; set; } + public string Path { get; set; } + public int QuantizationByteSize { get; set; } + public VectorIndexType Type { get; set; } + } + public enum VectorIndexType + { + DiskANN = 1, + Flat = 0, + QuantizedFlat = 2, + } +} +namespace Microsoft.Azure.Cosmos.FaultInjection +{ + public interface IFaultInjector + { + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public class ChangeFeedPolicyDefinition + { + public ContainerBuilder Attach(); + } + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ComputedPropertiesDefinition + { + public T Attach(); + public ComputedPropertiesDefinition WithComputedProperty(string name, string query); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ChangeFeedPolicyDefinition WithChangeFeedPolicy(TimeSpan retention); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public FullTextPolicyDefinition WithFullTextPolicy(string defaultLanguage, Collection fullTextPaths); + public UniqueKeyDefinition WithUniqueKey(); + public VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(Collection embeddings); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public ComputedPropertiesDefinition WithComputedProperties(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithAvailabilityStrategy(AvailabilityStrategy strategy); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptions options); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomAccountEndpoints(IEnumerable customAccountEndpoints); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithFaultInjection(IFaultInjector faultInjector); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithPriorityLevel(PriorityLevel priorityLevel); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithSystemTextJsonSerializerOptions(JsonSerializerOptions serializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + } + public class FullTextIndexDefinition + { + public FullTextIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public FullTextIndexDefinition Path(string path); + } + public class FullTextPolicyDefinition + { + public FullTextPolicyDefinition(ContainerBuilder parent, string defaultLanguage, Collection fullTextPaths, Action attachCallback); + public ContainerBuilder Attach(); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public FullTextIndexDefinition> WithFullTextIndex(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + public VectorIndexDefinition> WithVectorIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } + public class VectorEmbeddingPolicyDefinition + { + public VectorEmbeddingPolicyDefinition(ContainerBuilder parent, Collection embeddings, Action attachCallback); + public ContainerBuilder Attach(); + } + public class VectorIndexDefinition + { + public VectorIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public VectorIndexDefinition Path(string path, VectorIndexType indexType); + public VectorIndexDefinition WithIndexingSearchListSize(int indexingSearchListSize); + public VectorIndexDefinition WithQuantizationByteSize(int quantizationByteSize); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static int DocumentId(this object obj); + public static bool IsArray(this object obj); + public static bool IsBool(this object obj); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsNumber(this object obj); + public static bool IsObject(this object obj); + public static bool IsPrimitive(this object obj); + public static bool IsString(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static bool RegexMatch(this object obj, string regularExpression); + public static bool RegexMatch(this object obj, string regularExpression, string searchModifier); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query, IDictionary namedParameters); + public static FeedIterator ToStreamIterator(this IQueryable query); + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + Upsert = (short)5, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.48.0.txt b/Microsoft.Azure.Cosmos/contracts/API_3.48.0.txt new file mode 100644 index 0000000000..dafd0eedf5 --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.48.0.txt @@ -0,0 +1,1703 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public abstract class AvailabilityStrategy + { + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep); + public static AvailabilityStrategy DisabledStrategy(); + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode Incremental { get; } + public static ChangeFeedMode LatestVersion { get; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract FeedRange FeedRange { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public sealed class ComputedProperty + { + public ComputedProperty(); + public string Name { get; set; } + public string Query { get; set; } + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public virtual Task DeleteAllItemsByPartitionKeyStreamAsync(PartitionKey partitionKey, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public Collection ComputedProperties { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + public VectorEmbeddingPolicy VectorEmbeddingPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public IEnumerable AccountInitializationCustomEndpoints { get; set; } + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public CosmosClientTelemetryOptions CosmosClientTelemetryOptions { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public IFaultInjector FaultInjector { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public Nullable PriorityLevel { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public JsonSerializerOptions UseSystemTextJsonSerializerWithOptions { get; set; } + public IWebProxy WebProxy { get; set; } + } + public class CosmosClientTelemetryOptions + { + public CosmosClientTelemetryOptions(); + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public bool DisableDistributedTracing { get; set; } + public bool DisableSendingMetricsToService { get; set; } + public QueryTextMode QueryTextMode { get; set; } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual ServerSideCumulativeMetrics GetQueryMetrics(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public abstract class CosmosLinqSerializer : CosmosSerializer + { + protected CosmosLinqSerializer(); + public abstract string SerializeMemberName(MemberInfo memberInfo); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public class CosmosThresholdOptions + { + public CosmosThresholdOptions(); + public TimeSpan NonPointOperationLatencyThreshold { get; set; } + public Nullable PayloadSizeThresholdInBytes { get; set; } + public TimeSpan PointOperationLatencyThreshold { get; set; } + public Nullable RequestChargeThreshold { get; set; } + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable BypassIntegratedCache { get; set; } + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public enum DistanceFunction + { + Cosine = 1, + DotProduct = 2, + Euclidean = 0, + } + public class Embedding : IEquatable + { + public Embedding(); + public VectorDataType DataType { get; set; } + public int Dimensions { get; set; } + public DistanceFunction DistanceFunction { get; set; } + public string Path { get; set; } + public bool Equals(Embedding that); + public void ValidateEmbeddingPath(); + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + public Collection VectorIndexes { get; set; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public virtual string From { get; set; } + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Move(string from, string path); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Move = 5, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public enum PriorityLevel + { + High = 1, + Low = 2, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public bool EnableOptimisticDirectExecution { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public QueryTextMode QueryTextMode { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public enum QueryTextMode + { + All = 2, + None = 0, + ParameterizedOnly = 1, + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string AustriaEast = "Austria East"; + public const string BelgiumCentral = "Belgium Central"; + public const string BleuFranceCentral = "Bleu France Central"; + public const string BleuFranceSouth = "Bleu France South"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChileCentral = "Chile Central"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string DelosCloudGermanyCentral = "Delos Cloud Germany Central"; + public const string DelosCloudGermanyNorth = "Delos Cloud Germany North"; + public const string DenmarkEast = "Denmark East"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyNorth = "Germany North"; + public const string GermanyWestCentral = "Germany West Central"; + public const string IndonesiaCentral = "Indonesia Central"; + public const string IsraelCentral = "Israel Central"; + public const string IsraelNorthwest = "Israel Northwest"; + public const string ItalyNorth = "Italy North"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string MalaysiaSouth = "Malaysia South"; + public const string MalaysiaWest = "Malaysia West"; + public const string MexicoCentral = "Mexico Central"; + public const string NewZealandNorth = "New Zealand North"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SouthCentralUS2 = "South Central US 2"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SoutheastUS = "Southeast US"; + public const string SoutheastUS3 = "Southeast US 3"; + public const string SoutheastUS5 = "Southeast US 5"; + public const string SouthIndia = "South India"; + public const string SouthwestUS = "Southwest US"; + public const string SpainCentral = "Spain Central"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string TaiwanNorth = "Taiwan North"; + public const string TaiwanNorthwest = "Taiwan Northwest"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string USSecWestCentral = "USSec West Central"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public List ExcludeRegions { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public Nullable PriorityLevel { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public abstract class ServerSideCumulativeMetrics + { + protected ServerSideCumulativeMetrics(); + public abstract ServerSideMetrics CumulativeMetrics { get; } + public abstract IReadOnlyList PartitionedMetrics { get; } + public abstract double TotalRequestCharge { get; } + } + public abstract class ServerSideMetrics + { + protected ServerSideMetrics(); + public abstract TimeSpan DocumentLoadTime { get; } + public abstract TimeSpan DocumentWriteTime { get; } + public abstract double IndexHitRatio { get; } + public abstract TimeSpan IndexLookupTime { get; } + public abstract long OutputDocumentCount { get; } + public abstract long OutputDocumentSize { get; } + public abstract TimeSpan QueryPreparationTime { get; } + public abstract long RetrievedDocumentCount { get; } + public abstract long RetrievedDocumentSize { get; } + public abstract TimeSpan RuntimeExecutionTime { get; } + public abstract TimeSpan TotalTime { get; } + public abstract TimeSpan VMExecutionTime { get; } + } + public abstract class ServerSidePartitionedMetrics + { + protected ServerSidePartitionedMetrics(); + public abstract string FeedRange { get; } + public abstract Nullable PartitionKeyRangeId { get; } + public abstract double RequestCharge { get; } + public abstract ServerSideMetrics ServerSideMetrics { get; } + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } + public enum VectorDataType + { + Float32 = 0, + Int8 = 2, + Uint8 = 1, + } + public sealed class VectorEmbeddingPolicy + { + public readonly Collection Embeddings; + public VectorEmbeddingPolicy(Collection embeddings); + } + public sealed class VectorIndexPath + { + public VectorIndexPath(); + public string Path { get; set; } + public VectorIndexType Type { get; set; } + } + public enum VectorIndexType + { + DiskANN = 1, + Flat = 0, + QuantizedFlat = 2, + } +} +namespace Microsoft.Azure.Cosmos.FaultInjection +{ + public interface IFaultInjector + { + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ComputedPropertiesDefinition + { + public T Attach(); + public ComputedPropertiesDefinition WithComputedProperty(string name, string query); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public UniqueKeyDefinition WithUniqueKey(); + public VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(Collection embeddings); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public ComputedPropertiesDefinition WithComputedProperties(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithAvailabilityStrategy(AvailabilityStrategy strategy); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptions options); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomAccountEndpoints(IEnumerable customAccountEndpoints); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithFaultInjection(IFaultInjector faultInjector); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithPriorityLevel(PriorityLevel priorityLevel); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithSystemTextJsonSerializerOptions(JsonSerializerOptions serializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + public VectorIndexDefinition> WithVectorIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } + public class VectorEmbeddingPolicyDefinition + { + public VectorEmbeddingPolicyDefinition(ContainerBuilder parent, Collection embeddings, Action attachCallback); + public ContainerBuilder Attach(); + } + public class VectorIndexDefinition + { + public VectorIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public VectorIndexDefinition Path(string path, VectorIndexType indexType); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static int DocumentId(this object obj); + public static bool FullTextContains(this object obj, string search); + public static bool FullTextContainsAll(this object obj, params string[] searches); + public static bool FullTextContainsAny(this object obj, params string[] searches); + public static bool IsArray(this object obj); + public static bool IsBool(this object obj); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsNumber(this object obj); + public static bool IsObject(this object obj); + public static bool IsPrimitive(this object obj); + public static bool IsString(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static bool RegexMatch(this object obj, string regularExpression); + public static bool RegexMatch(this object obj, string regularExpression, string searchModifier); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static FeedIterator ToStreamIterator(this IQueryable query); + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + Upsert = (short)5, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.48.1.txt b/Microsoft.Azure.Cosmos/contracts/API_3.48.1.txt new file mode 100644 index 0000000000..dafd0eedf5 --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.48.1.txt @@ -0,0 +1,1703 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public abstract class AvailabilityStrategy + { + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep); + public static AvailabilityStrategy DisabledStrategy(); + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode Incremental { get; } + public static ChangeFeedMode LatestVersion { get; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract FeedRange FeedRange { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public sealed class ComputedProperty + { + public ComputedProperty(); + public string Name { get; set; } + public string Query { get; set; } + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public virtual Task DeleteAllItemsByPartitionKeyStreamAsync(PartitionKey partitionKey, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public Collection ComputedProperties { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + public VectorEmbeddingPolicy VectorEmbeddingPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public IEnumerable AccountInitializationCustomEndpoints { get; set; } + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public CosmosClientTelemetryOptions CosmosClientTelemetryOptions { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public IFaultInjector FaultInjector { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public Nullable PriorityLevel { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public JsonSerializerOptions UseSystemTextJsonSerializerWithOptions { get; set; } + public IWebProxy WebProxy { get; set; } + } + public class CosmosClientTelemetryOptions + { + public CosmosClientTelemetryOptions(); + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public bool DisableDistributedTracing { get; set; } + public bool DisableSendingMetricsToService { get; set; } + public QueryTextMode QueryTextMode { get; set; } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual ServerSideCumulativeMetrics GetQueryMetrics(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public abstract class CosmosLinqSerializer : CosmosSerializer + { + protected CosmosLinqSerializer(); + public abstract string SerializeMemberName(MemberInfo memberInfo); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public class CosmosThresholdOptions + { + public CosmosThresholdOptions(); + public TimeSpan NonPointOperationLatencyThreshold { get; set; } + public Nullable PayloadSizeThresholdInBytes { get; set; } + public TimeSpan PointOperationLatencyThreshold { get; set; } + public Nullable RequestChargeThreshold { get; set; } + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable BypassIntegratedCache { get; set; } + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public enum DistanceFunction + { + Cosine = 1, + DotProduct = 2, + Euclidean = 0, + } + public class Embedding : IEquatable + { + public Embedding(); + public VectorDataType DataType { get; set; } + public int Dimensions { get; set; } + public DistanceFunction DistanceFunction { get; set; } + public string Path { get; set; } + public bool Equals(Embedding that); + public void ValidateEmbeddingPath(); + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + public Collection VectorIndexes { get; set; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public virtual string From { get; set; } + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Move(string from, string path); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Move = 5, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public enum PriorityLevel + { + High = 1, + Low = 2, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public bool EnableOptimisticDirectExecution { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public QueryTextMode QueryTextMode { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public enum QueryTextMode + { + All = 2, + None = 0, + ParameterizedOnly = 1, + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string AustriaEast = "Austria East"; + public const string BelgiumCentral = "Belgium Central"; + public const string BleuFranceCentral = "Bleu France Central"; + public const string BleuFranceSouth = "Bleu France South"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChileCentral = "Chile Central"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string DelosCloudGermanyCentral = "Delos Cloud Germany Central"; + public const string DelosCloudGermanyNorth = "Delos Cloud Germany North"; + public const string DenmarkEast = "Denmark East"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyNorth = "Germany North"; + public const string GermanyWestCentral = "Germany West Central"; + public const string IndonesiaCentral = "Indonesia Central"; + public const string IsraelCentral = "Israel Central"; + public const string IsraelNorthwest = "Israel Northwest"; + public const string ItalyNorth = "Italy North"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string MalaysiaSouth = "Malaysia South"; + public const string MalaysiaWest = "Malaysia West"; + public const string MexicoCentral = "Mexico Central"; + public const string NewZealandNorth = "New Zealand North"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SouthCentralUS2 = "South Central US 2"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SoutheastUS = "Southeast US"; + public const string SoutheastUS3 = "Southeast US 3"; + public const string SoutheastUS5 = "Southeast US 5"; + public const string SouthIndia = "South India"; + public const string SouthwestUS = "Southwest US"; + public const string SpainCentral = "Spain Central"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string TaiwanNorth = "Taiwan North"; + public const string TaiwanNorthwest = "Taiwan Northwest"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string USSecWestCentral = "USSec West Central"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public List ExcludeRegions { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public Nullable PriorityLevel { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public abstract class ServerSideCumulativeMetrics + { + protected ServerSideCumulativeMetrics(); + public abstract ServerSideMetrics CumulativeMetrics { get; } + public abstract IReadOnlyList PartitionedMetrics { get; } + public abstract double TotalRequestCharge { get; } + } + public abstract class ServerSideMetrics + { + protected ServerSideMetrics(); + public abstract TimeSpan DocumentLoadTime { get; } + public abstract TimeSpan DocumentWriteTime { get; } + public abstract double IndexHitRatio { get; } + public abstract TimeSpan IndexLookupTime { get; } + public abstract long OutputDocumentCount { get; } + public abstract long OutputDocumentSize { get; } + public abstract TimeSpan QueryPreparationTime { get; } + public abstract long RetrievedDocumentCount { get; } + public abstract long RetrievedDocumentSize { get; } + public abstract TimeSpan RuntimeExecutionTime { get; } + public abstract TimeSpan TotalTime { get; } + public abstract TimeSpan VMExecutionTime { get; } + } + public abstract class ServerSidePartitionedMetrics + { + protected ServerSidePartitionedMetrics(); + public abstract string FeedRange { get; } + public abstract Nullable PartitionKeyRangeId { get; } + public abstract double RequestCharge { get; } + public abstract ServerSideMetrics ServerSideMetrics { get; } + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } + public enum VectorDataType + { + Float32 = 0, + Int8 = 2, + Uint8 = 1, + } + public sealed class VectorEmbeddingPolicy + { + public readonly Collection Embeddings; + public VectorEmbeddingPolicy(Collection embeddings); + } + public sealed class VectorIndexPath + { + public VectorIndexPath(); + public string Path { get; set; } + public VectorIndexType Type { get; set; } + } + public enum VectorIndexType + { + DiskANN = 1, + Flat = 0, + QuantizedFlat = 2, + } +} +namespace Microsoft.Azure.Cosmos.FaultInjection +{ + public interface IFaultInjector + { + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ComputedPropertiesDefinition + { + public T Attach(); + public ComputedPropertiesDefinition WithComputedProperty(string name, string query); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public UniqueKeyDefinition WithUniqueKey(); + public VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(Collection embeddings); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public ComputedPropertiesDefinition WithComputedProperties(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithAvailabilityStrategy(AvailabilityStrategy strategy); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptions options); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomAccountEndpoints(IEnumerable customAccountEndpoints); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithFaultInjection(IFaultInjector faultInjector); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithPriorityLevel(PriorityLevel priorityLevel); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithSystemTextJsonSerializerOptions(JsonSerializerOptions serializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + public VectorIndexDefinition> WithVectorIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } + public class VectorEmbeddingPolicyDefinition + { + public VectorEmbeddingPolicyDefinition(ContainerBuilder parent, Collection embeddings, Action attachCallback); + public ContainerBuilder Attach(); + } + public class VectorIndexDefinition + { + public VectorIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public VectorIndexDefinition Path(string path, VectorIndexType indexType); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static int DocumentId(this object obj); + public static bool FullTextContains(this object obj, string search); + public static bool FullTextContainsAll(this object obj, params string[] searches); + public static bool FullTextContainsAny(this object obj, params string[] searches); + public static bool IsArray(this object obj); + public static bool IsBool(this object obj); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsNumber(this object obj); + public static bool IsObject(this object obj); + public static bool IsPrimitive(this object obj); + public static bool IsString(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static bool RegexMatch(this object obj, string regularExpression); + public static bool RegexMatch(this object obj, string regularExpression, string searchModifier); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static FeedIterator ToStreamIterator(this IQueryable query); + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + Upsert = (short)5, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.49.0-preview.0.txt b/Microsoft.Azure.Cosmos/contracts/API_3.49.0-preview.0.txt new file mode 100644 index 0000000000..40fe2cf48f --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.49.0-preview.0.txt @@ -0,0 +1,1864 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public abstract class AvailabilityStrategy + { + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep); + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep, bool enableMultiWriteRegionHedge=false); + public static AvailabilityStrategy DisabledStrategy(); + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public class ChangeFeedItem + { + public ChangeFeedItem(); + public T Current { get; set; } + public ChangeFeedMetadata Metadata { get; set; } + public T Previous { get; set; } + } + public class ChangeFeedMetadata + { + public ChangeFeedMetadata(); + public DateTime ConflictResolutionTimestamp { get; } + public bool IsTimeToLiveExpired { get; } + public long Lsn { get; } + public ChangeFeedOperationType OperationType { get; } + public long PreviousLsn { get; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode AllVersionsAndDeletes { get; } + public static ChangeFeedMode Incremental { get; } + public static ChangeFeedMode LatestVersion { get; } + } + public enum ChangeFeedOperationType + { + Create = 0, + Delete = 2, + Replace = 1, + } + public sealed class ChangeFeedPolicy + { + public ChangeFeedPolicy(); + public static TimeSpan FullFidelityNoRetention { get; } + public TimeSpan FullFidelityRetention { get; set; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract FeedRange FeedRange { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public sealed class ComputedProperty + { + public ComputedProperty(); + public string Name { get; set; } + public string Query { get; set; } + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public virtual Task DeleteAllItemsByPartitionKeyStreamAsync(PartitionKey partitionKey, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes(string processorName, Container.ChangeFeedHandler> onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> GetPartitionKeyRangesAsync(FeedRange feedRange, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task IsFeedRangePartOfAsync(FeedRange x, FeedRange y, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ChangeFeedPolicy ChangeFeedPolicy { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public Collection ComputedProperties { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public FullTextPolicy FullTextPolicy { get; set; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + public VectorEmbeddingPolicy VectorEmbeddingPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public IEnumerable AccountInitializationCustomEndpoints { get; set; } + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public CosmosClientTelemetryOptions CosmosClientTelemetryOptions { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public IFaultInjector FaultInjector { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public Nullable PriorityLevel { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public JsonSerializerOptions UseSystemTextJsonSerializerWithOptions { get; set; } + public IWebProxy WebProxy { get; set; } + } + public class CosmosClientTelemetryOptions + { + public CosmosClientTelemetryOptions(); + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public bool DisableDistributedTracing { get; set; } + public bool DisableSendingMetricsToService { get; set; } + public bool IsClientMetricsEnabled { get; set; } + public NetworkMetricsOptions NetworkMetricsOptions { get; set; } + public OperationMetricsOptions OperationMetricsOptions { get; set; } + public QueryTextMode QueryTextMode { get; set; } + } + public sealed class CosmosDbClientMetrics + { + public CosmosDbClientMetrics(); + public static class HistogramBuckets + { + public static readonly double[] RequestLatencyBuckets; + public static readonly double[] RequestUnitBuckets; + public static readonly double[] RowCountBuckets; + } + public static class NetworkMetrics + { + public const string MeterName = "Azure.Cosmos.Client.Request"; + public const string Version = "1.0.0"; + public static class Description + { + public const string BackendLatency = "Backend Latency (for direct mode)."; + public const string ChannelAquisitionLatency = "The duration of the successfully established outbound TCP connections. i.e. Channel Aquisition Time (for direct mode)."; + public const string Latency = "Duration of client requests."; + public const string ReceivedTimeLatency = "Time spent on 'Received' stage (for direct mode)."; + public const string RequestBodySize = "Size of client request body."; + public const string ResponseBodySize = "Size of client response body."; + public const string TransitTimeLatency = "Time spent on the wire (for direct mode)."; + } + public static class Name + { + public const string BackendLatency = "azure.cosmosdb.client.request.service_duration"; + public const string ChannelAquisitionLatency = "azure.cosmosdb.client.request.channel_aquisition.duration"; + public const string Latency = "azure.cosmosdb.client.request.duration"; + public const string ReceivedTimeLatency = "azure.cosmosdb.client.request.received.duration"; + public const string RequestBodySize = "azure.cosmosdb.client.request.body.size"; + public const string ResponseBodySize = "azure.cosmosdb.client.response.body.size"; + public const string TransitTimeLatency = "azure.cosmosdb.client.request.transit.duration"; + } + public static class Unit + { + public const string Bytes = "bytes"; + public const string Sec = "s"; + } + } + public static class OperationMetrics + { + public const string MeterName = "Azure.Cosmos.Client.Operation"; + public const string Version = "1.0.0"; + public static class Description + { + public const string ActiveInstances = "Number of active SDK client instances."; + public const string Latency = "Total end-to-end duration of the operation"; + public const string RequestCharge = "Total request units per operation (sum of RUs for all requested needed when processing an operation)"; + public const string RowCount = "For feed operations (query, readAll, readMany, change feed) batch operations this meter capture the actual item count in responses from the service"; + } + public static class Name + { + public const string ActiveInstances = "azure.cosmosdb.client.active_instance.count"; + public const string Latency = "db.client.operation.duration"; + public const string RequestCharge = "azure.cosmosdb.client.operation.request_charge"; + public const string RowCount = "db.client.response.row_count"; + } + public static class Unit + { + public const string Count = "#"; + public const string RequestUnit = "# RU"; + public const string Sec = "s"; + } + } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual ServerSideCumulativeMetrics GetQueryMetrics(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public abstract class CosmosLinqSerializer : CosmosSerializer + { + protected CosmosLinqSerializer(); + public abstract string SerializeMemberName(MemberInfo memberInfo); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public class CosmosThresholdOptions + { + public CosmosThresholdOptions(); + public TimeSpan NonPointOperationLatencyThreshold { get; set; } + public Nullable PayloadSizeThresholdInBytes { get; set; } + public TimeSpan PointOperationLatencyThreshold { get; set; } + public Nullable RequestChargeThreshold { get; set; } + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable BypassIntegratedCache { get; set; } + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public enum DistanceFunction + { + Cosine = 1, + DotProduct = 2, + Euclidean = 0, + } + public class Embedding : IEquatable + { + public Embedding(); + public VectorDataType DataType { get; set; } + public int Dimensions { get; set; } + public DistanceFunction DistanceFunction { get; set; } + public string Path { get; set; } + public bool Equals(Embedding that); + public void ValidateEmbeddingPath(); + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class FullTextIndexPath + { + public FullTextIndexPath(); + public string Path { get; set; } + } + public sealed class FullTextPath : IEquatable + { + public FullTextPath(); + public string Language { get; set; } + public string Path { get; set; } + public bool Equals(FullTextPath that); + public void ValidateFullTextPath(); + } + public sealed class FullTextPolicy + { + public FullTextPolicy(); + public string DefaultLanguage { get; set; } + public Collection FullTextPaths { get; set; } + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection FullTextIndexes { get; set; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + public Collection VectorIndexes { get; set; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public class NetworkMetricsOptions + { + public NetworkMetricsOptions(); + public IDictionary CustomDimensions { get; set; } + public Nullable IncludeRoutingId { get; set; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public class OperationMetricsOptions + { + public OperationMetricsOptions(); + public IDictionary CustomDimensions { get; set; } + public Nullable IncludeRegion { get; set; } + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public virtual string From { get; set; } + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Move(string from, string path); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Move = 5, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public enum PriorityLevel + { + High = 1, + Low = 2, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public bool EnableOptimisticDirectExecution { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public QueryTextMode QueryTextMode { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public enum QueryTextMode + { + All = 2, + None = 0, + ParameterizedOnly = 1, + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string AustriaEast = "Austria East"; + public const string BelgiumCentral = "Belgium Central"; + public const string BleuFranceCentral = "Bleu France Central"; + public const string BleuFranceSouth = "Bleu France South"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChileCentral = "Chile Central"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string DelosCloudGermanyCentral = "Delos Cloud Germany Central"; + public const string DelosCloudGermanyNorth = "Delos Cloud Germany North"; + public const string DenmarkEast = "Denmark East"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyNorth = "Germany North"; + public const string GermanyWestCentral = "Germany West Central"; + public const string IndonesiaCentral = "Indonesia Central"; + public const string IsraelCentral = "Israel Central"; + public const string IsraelNorthwest = "Israel Northwest"; + public const string ItalyNorth = "Italy North"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string MalaysiaSouth = "Malaysia South"; + public const string MalaysiaWest = "Malaysia West"; + public const string MexicoCentral = "Mexico Central"; + public const string NewZealandNorth = "New Zealand North"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SouthCentralUS2 = "South Central US 2"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SoutheastUS = "Southeast US"; + public const string SoutheastUS3 = "Southeast US 3"; + public const string SoutheastUS5 = "Southeast US 5"; + public const string SouthIndia = "South India"; + public const string SouthwestUS = "Southwest US"; + public const string SpainCentral = "Spain Central"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string TaiwanNorth = "Taiwan North"; + public const string TaiwanNorthwest = "Taiwan Northwest"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string USSecWestCentral = "USSec West Central"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public List ExcludeRegions { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public NetworkMetricsOptions NetworkMetricsOptions { get; set; } + public OperationMetricsOptions OperationMetricsOptions { get; set; } + public Nullable PriorityLevel { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public abstract class ServerSideCumulativeMetrics + { + protected ServerSideCumulativeMetrics(); + public abstract ServerSideMetrics CumulativeMetrics { get; } + public abstract IReadOnlyList PartitionedMetrics { get; } + public abstract double TotalRequestCharge { get; } + } + public abstract class ServerSideMetrics + { + protected ServerSideMetrics(); + public abstract TimeSpan DocumentLoadTime { get; } + public abstract TimeSpan DocumentWriteTime { get; } + public abstract double IndexHitRatio { get; } + public abstract TimeSpan IndexLookupTime { get; } + public abstract long OutputDocumentCount { get; } + public abstract long OutputDocumentSize { get; } + public abstract TimeSpan QueryPreparationTime { get; } + public abstract long RetrievedDocumentCount { get; } + public abstract long RetrievedDocumentSize { get; } + public abstract TimeSpan RuntimeExecutionTime { get; } + public abstract TimeSpan TotalTime { get; } + public abstract TimeSpan VMExecutionTime { get; } + } + public abstract class ServerSidePartitionedMetrics + { + protected ServerSidePartitionedMetrics(); + public abstract string FeedRange { get; } + public abstract Nullable PartitionKeyRangeId { get; } + public abstract double RequestCharge { get; } + public abstract ServerSideMetrics ServerSideMetrics { get; } + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } + public enum VectorDataType + { + Float32 = 0, + Int8 = 2, + Uint8 = 1, + } + public sealed class VectorEmbeddingPolicy + { + public readonly Collection Embeddings; + public VectorEmbeddingPolicy(Collection embeddings); + } + public sealed class VectorIndexPath + { + public VectorIndexPath(); + public int IndexingSearchListSize { get; set; } + public string Path { get; set; } + public int QuantizationByteSize { get; set; } + public VectorIndexType Type { get; set; } + } + public enum VectorIndexType + { + DiskANN = 1, + Flat = 0, + QuantizedFlat = 2, + } +} +namespace Microsoft.Azure.Cosmos.FaultInjection +{ + public interface IFaultInjector + { + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public class ChangeFeedPolicyDefinition + { + public ContainerBuilder Attach(); + } + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ComputedPropertiesDefinition + { + public T Attach(); + public ComputedPropertiesDefinition WithComputedProperty(string name, string query); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ChangeFeedPolicyDefinition WithChangeFeedPolicy(TimeSpan retention); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public FullTextPolicyDefinition WithFullTextPolicy(string defaultLanguage, Collection fullTextPaths); + public UniqueKeyDefinition WithUniqueKey(); + public VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(Collection embeddings); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public ComputedPropertiesDefinition WithComputedProperties(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithAvailabilityStrategy(AvailabilityStrategy strategy); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptions options); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomAccountEndpoints(IEnumerable customAccountEndpoints); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithFaultInjection(IFaultInjector faultInjector); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithPriorityLevel(PriorityLevel priorityLevel); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithSystemTextJsonSerializerOptions(JsonSerializerOptions serializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + } + public class FullTextIndexDefinition + { + public FullTextIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public FullTextIndexDefinition Path(string path); + } + public class FullTextPolicyDefinition + { + public FullTextPolicyDefinition(ContainerBuilder parent, string defaultLanguage, Collection fullTextPaths, Action attachCallback); + public ContainerBuilder Attach(); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public FullTextIndexDefinition> WithFullTextIndex(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + public VectorIndexDefinition> WithVectorIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } + public class VectorEmbeddingPolicyDefinition + { + public VectorEmbeddingPolicyDefinition(ContainerBuilder parent, Collection embeddings, Action attachCallback); + public ContainerBuilder Attach(); + } + public class VectorIndexDefinition + { + public VectorIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public VectorIndexDefinition Path(string path, VectorIndexType indexType); + public VectorIndexDefinition WithIndexingSearchListSize(int indexingSearchListSize); + public VectorIndexDefinition WithQuantizationByteSize(int quantizationByteSize); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static int DocumentId(this object obj); + public static bool FullTextContains(this object obj, string search); + public static bool FullTextContainsAll(this object obj, params string[] searches); + public static bool FullTextContainsAny(this object obj, params string[] searches); + public static bool IsArray(this object obj); + public static bool IsBool(this object obj); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsNumber(this object obj); + public static bool IsObject(this object obj); + public static bool IsPrimitive(this object obj); + public static bool IsString(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static bool RegexMatch(this object obj, string regularExpression); + public static bool RegexMatch(this object obj, string regularExpression, string searchModifier); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query, IDictionary namedParameters); + public static FeedIterator ToStreamIterator(this IQueryable query); + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + Upsert = (short)5, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.49.0-preview.1.txt b/Microsoft.Azure.Cosmos/contracts/API_3.49.0-preview.1.txt new file mode 100644 index 0000000000..40fe2cf48f --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.49.0-preview.1.txt @@ -0,0 +1,1864 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public abstract class AvailabilityStrategy + { + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep); + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep, bool enableMultiWriteRegionHedge=false); + public static AvailabilityStrategy DisabledStrategy(); + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public class ChangeFeedItem + { + public ChangeFeedItem(); + public T Current { get; set; } + public ChangeFeedMetadata Metadata { get; set; } + public T Previous { get; set; } + } + public class ChangeFeedMetadata + { + public ChangeFeedMetadata(); + public DateTime ConflictResolutionTimestamp { get; } + public bool IsTimeToLiveExpired { get; } + public long Lsn { get; } + public ChangeFeedOperationType OperationType { get; } + public long PreviousLsn { get; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode AllVersionsAndDeletes { get; } + public static ChangeFeedMode Incremental { get; } + public static ChangeFeedMode LatestVersion { get; } + } + public enum ChangeFeedOperationType + { + Create = 0, + Delete = 2, + Replace = 1, + } + public sealed class ChangeFeedPolicy + { + public ChangeFeedPolicy(); + public static TimeSpan FullFidelityNoRetention { get; } + public TimeSpan FullFidelityRetention { get; set; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract FeedRange FeedRange { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public sealed class ComputedProperty + { + public ComputedProperty(); + public string Name { get; set; } + public string Query { get; set; } + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public virtual Task DeleteAllItemsByPartitionKeyStreamAsync(PartitionKey partitionKey, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes(string processorName, Container.ChangeFeedHandler> onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> GetPartitionKeyRangesAsync(FeedRange feedRange, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task IsFeedRangePartOfAsync(FeedRange x, FeedRange y, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ChangeFeedPolicy ChangeFeedPolicy { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public Collection ComputedProperties { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public FullTextPolicy FullTextPolicy { get; set; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + public VectorEmbeddingPolicy VectorEmbeddingPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public IEnumerable AccountInitializationCustomEndpoints { get; set; } + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public CosmosClientTelemetryOptions CosmosClientTelemetryOptions { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public IFaultInjector FaultInjector { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public Nullable PriorityLevel { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public JsonSerializerOptions UseSystemTextJsonSerializerWithOptions { get; set; } + public IWebProxy WebProxy { get; set; } + } + public class CosmosClientTelemetryOptions + { + public CosmosClientTelemetryOptions(); + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public bool DisableDistributedTracing { get; set; } + public bool DisableSendingMetricsToService { get; set; } + public bool IsClientMetricsEnabled { get; set; } + public NetworkMetricsOptions NetworkMetricsOptions { get; set; } + public OperationMetricsOptions OperationMetricsOptions { get; set; } + public QueryTextMode QueryTextMode { get; set; } + } + public sealed class CosmosDbClientMetrics + { + public CosmosDbClientMetrics(); + public static class HistogramBuckets + { + public static readonly double[] RequestLatencyBuckets; + public static readonly double[] RequestUnitBuckets; + public static readonly double[] RowCountBuckets; + } + public static class NetworkMetrics + { + public const string MeterName = "Azure.Cosmos.Client.Request"; + public const string Version = "1.0.0"; + public static class Description + { + public const string BackendLatency = "Backend Latency (for direct mode)."; + public const string ChannelAquisitionLatency = "The duration of the successfully established outbound TCP connections. i.e. Channel Aquisition Time (for direct mode)."; + public const string Latency = "Duration of client requests."; + public const string ReceivedTimeLatency = "Time spent on 'Received' stage (for direct mode)."; + public const string RequestBodySize = "Size of client request body."; + public const string ResponseBodySize = "Size of client response body."; + public const string TransitTimeLatency = "Time spent on the wire (for direct mode)."; + } + public static class Name + { + public const string BackendLatency = "azure.cosmosdb.client.request.service_duration"; + public const string ChannelAquisitionLatency = "azure.cosmosdb.client.request.channel_aquisition.duration"; + public const string Latency = "azure.cosmosdb.client.request.duration"; + public const string ReceivedTimeLatency = "azure.cosmosdb.client.request.received.duration"; + public const string RequestBodySize = "azure.cosmosdb.client.request.body.size"; + public const string ResponseBodySize = "azure.cosmosdb.client.response.body.size"; + public const string TransitTimeLatency = "azure.cosmosdb.client.request.transit.duration"; + } + public static class Unit + { + public const string Bytes = "bytes"; + public const string Sec = "s"; + } + } + public static class OperationMetrics + { + public const string MeterName = "Azure.Cosmos.Client.Operation"; + public const string Version = "1.0.0"; + public static class Description + { + public const string ActiveInstances = "Number of active SDK client instances."; + public const string Latency = "Total end-to-end duration of the operation"; + public const string RequestCharge = "Total request units per operation (sum of RUs for all requested needed when processing an operation)"; + public const string RowCount = "For feed operations (query, readAll, readMany, change feed) batch operations this meter capture the actual item count in responses from the service"; + } + public static class Name + { + public const string ActiveInstances = "azure.cosmosdb.client.active_instance.count"; + public const string Latency = "db.client.operation.duration"; + public const string RequestCharge = "azure.cosmosdb.client.operation.request_charge"; + public const string RowCount = "db.client.response.row_count"; + } + public static class Unit + { + public const string Count = "#"; + public const string RequestUnit = "# RU"; + public const string Sec = "s"; + } + } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual ServerSideCumulativeMetrics GetQueryMetrics(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public abstract class CosmosLinqSerializer : CosmosSerializer + { + protected CosmosLinqSerializer(); + public abstract string SerializeMemberName(MemberInfo memberInfo); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public class CosmosThresholdOptions + { + public CosmosThresholdOptions(); + public TimeSpan NonPointOperationLatencyThreshold { get; set; } + public Nullable PayloadSizeThresholdInBytes { get; set; } + public TimeSpan PointOperationLatencyThreshold { get; set; } + public Nullable RequestChargeThreshold { get; set; } + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable BypassIntegratedCache { get; set; } + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public enum DistanceFunction + { + Cosine = 1, + DotProduct = 2, + Euclidean = 0, + } + public class Embedding : IEquatable + { + public Embedding(); + public VectorDataType DataType { get; set; } + public int Dimensions { get; set; } + public DistanceFunction DistanceFunction { get; set; } + public string Path { get; set; } + public bool Equals(Embedding that); + public void ValidateEmbeddingPath(); + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class FullTextIndexPath + { + public FullTextIndexPath(); + public string Path { get; set; } + } + public sealed class FullTextPath : IEquatable + { + public FullTextPath(); + public string Language { get; set; } + public string Path { get; set; } + public bool Equals(FullTextPath that); + public void ValidateFullTextPath(); + } + public sealed class FullTextPolicy + { + public FullTextPolicy(); + public string DefaultLanguage { get; set; } + public Collection FullTextPaths { get; set; } + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection FullTextIndexes { get; set; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + public Collection VectorIndexes { get; set; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public class NetworkMetricsOptions + { + public NetworkMetricsOptions(); + public IDictionary CustomDimensions { get; set; } + public Nullable IncludeRoutingId { get; set; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public class OperationMetricsOptions + { + public OperationMetricsOptions(); + public IDictionary CustomDimensions { get; set; } + public Nullable IncludeRegion { get; set; } + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public virtual string From { get; set; } + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Move(string from, string path); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Move = 5, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public enum PriorityLevel + { + High = 1, + Low = 2, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public bool EnableOptimisticDirectExecution { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public QueryTextMode QueryTextMode { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public enum QueryTextMode + { + All = 2, + None = 0, + ParameterizedOnly = 1, + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string AustriaEast = "Austria East"; + public const string BelgiumCentral = "Belgium Central"; + public const string BleuFranceCentral = "Bleu France Central"; + public const string BleuFranceSouth = "Bleu France South"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChileCentral = "Chile Central"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string DelosCloudGermanyCentral = "Delos Cloud Germany Central"; + public const string DelosCloudGermanyNorth = "Delos Cloud Germany North"; + public const string DenmarkEast = "Denmark East"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyNorth = "Germany North"; + public const string GermanyWestCentral = "Germany West Central"; + public const string IndonesiaCentral = "Indonesia Central"; + public const string IsraelCentral = "Israel Central"; + public const string IsraelNorthwest = "Israel Northwest"; + public const string ItalyNorth = "Italy North"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string MalaysiaSouth = "Malaysia South"; + public const string MalaysiaWest = "Malaysia West"; + public const string MexicoCentral = "Mexico Central"; + public const string NewZealandNorth = "New Zealand North"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SouthCentralUS2 = "South Central US 2"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SoutheastUS = "Southeast US"; + public const string SoutheastUS3 = "Southeast US 3"; + public const string SoutheastUS5 = "Southeast US 5"; + public const string SouthIndia = "South India"; + public const string SouthwestUS = "Southwest US"; + public const string SpainCentral = "Spain Central"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string TaiwanNorth = "Taiwan North"; + public const string TaiwanNorthwest = "Taiwan Northwest"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string USSecWestCentral = "USSec West Central"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public List ExcludeRegions { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public NetworkMetricsOptions NetworkMetricsOptions { get; set; } + public OperationMetricsOptions OperationMetricsOptions { get; set; } + public Nullable PriorityLevel { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public abstract class ServerSideCumulativeMetrics + { + protected ServerSideCumulativeMetrics(); + public abstract ServerSideMetrics CumulativeMetrics { get; } + public abstract IReadOnlyList PartitionedMetrics { get; } + public abstract double TotalRequestCharge { get; } + } + public abstract class ServerSideMetrics + { + protected ServerSideMetrics(); + public abstract TimeSpan DocumentLoadTime { get; } + public abstract TimeSpan DocumentWriteTime { get; } + public abstract double IndexHitRatio { get; } + public abstract TimeSpan IndexLookupTime { get; } + public abstract long OutputDocumentCount { get; } + public abstract long OutputDocumentSize { get; } + public abstract TimeSpan QueryPreparationTime { get; } + public abstract long RetrievedDocumentCount { get; } + public abstract long RetrievedDocumentSize { get; } + public abstract TimeSpan RuntimeExecutionTime { get; } + public abstract TimeSpan TotalTime { get; } + public abstract TimeSpan VMExecutionTime { get; } + } + public abstract class ServerSidePartitionedMetrics + { + protected ServerSidePartitionedMetrics(); + public abstract string FeedRange { get; } + public abstract Nullable PartitionKeyRangeId { get; } + public abstract double RequestCharge { get; } + public abstract ServerSideMetrics ServerSideMetrics { get; } + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } + public enum VectorDataType + { + Float32 = 0, + Int8 = 2, + Uint8 = 1, + } + public sealed class VectorEmbeddingPolicy + { + public readonly Collection Embeddings; + public VectorEmbeddingPolicy(Collection embeddings); + } + public sealed class VectorIndexPath + { + public VectorIndexPath(); + public int IndexingSearchListSize { get; set; } + public string Path { get; set; } + public int QuantizationByteSize { get; set; } + public VectorIndexType Type { get; set; } + } + public enum VectorIndexType + { + DiskANN = 1, + Flat = 0, + QuantizedFlat = 2, + } +} +namespace Microsoft.Azure.Cosmos.FaultInjection +{ + public interface IFaultInjector + { + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public class ChangeFeedPolicyDefinition + { + public ContainerBuilder Attach(); + } + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ComputedPropertiesDefinition + { + public T Attach(); + public ComputedPropertiesDefinition WithComputedProperty(string name, string query); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ChangeFeedPolicyDefinition WithChangeFeedPolicy(TimeSpan retention); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public FullTextPolicyDefinition WithFullTextPolicy(string defaultLanguage, Collection fullTextPaths); + public UniqueKeyDefinition WithUniqueKey(); + public VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(Collection embeddings); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public ComputedPropertiesDefinition WithComputedProperties(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithAvailabilityStrategy(AvailabilityStrategy strategy); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptions options); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomAccountEndpoints(IEnumerable customAccountEndpoints); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithFaultInjection(IFaultInjector faultInjector); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithPriorityLevel(PriorityLevel priorityLevel); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithSystemTextJsonSerializerOptions(JsonSerializerOptions serializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + } + public class FullTextIndexDefinition + { + public FullTextIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public FullTextIndexDefinition Path(string path); + } + public class FullTextPolicyDefinition + { + public FullTextPolicyDefinition(ContainerBuilder parent, string defaultLanguage, Collection fullTextPaths, Action attachCallback); + public ContainerBuilder Attach(); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public FullTextIndexDefinition> WithFullTextIndex(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + public VectorIndexDefinition> WithVectorIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } + public class VectorEmbeddingPolicyDefinition + { + public VectorEmbeddingPolicyDefinition(ContainerBuilder parent, Collection embeddings, Action attachCallback); + public ContainerBuilder Attach(); + } + public class VectorIndexDefinition + { + public VectorIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public VectorIndexDefinition Path(string path, VectorIndexType indexType); + public VectorIndexDefinition WithIndexingSearchListSize(int indexingSearchListSize); + public VectorIndexDefinition WithQuantizationByteSize(int quantizationByteSize); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static int DocumentId(this object obj); + public static bool FullTextContains(this object obj, string search); + public static bool FullTextContainsAll(this object obj, params string[] searches); + public static bool FullTextContainsAny(this object obj, params string[] searches); + public static bool IsArray(this object obj); + public static bool IsBool(this object obj); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsNumber(this object obj); + public static bool IsObject(this object obj); + public static bool IsPrimitive(this object obj); + public static bool IsString(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static bool RegexMatch(this object obj, string regularExpression); + public static bool RegexMatch(this object obj, string regularExpression, string searchModifier); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query, IDictionary namedParameters); + public static FeedIterator ToStreamIterator(this IQueryable query); + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + Upsert = (short)5, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.49.0.txt b/Microsoft.Azure.Cosmos/contracts/API_3.49.0.txt new file mode 100644 index 0000000000..2f06be12e2 --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.49.0.txt @@ -0,0 +1,1705 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public abstract class AvailabilityStrategy + { + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep); + public static AvailabilityStrategy DisabledStrategy(); + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode Incremental { get; } + public static ChangeFeedMode LatestVersion { get; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract FeedRange FeedRange { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public sealed class ComputedProperty + { + public ComputedProperty(); + public string Name { get; set; } + public string Query { get; set; } + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public virtual Task DeleteAllItemsByPartitionKeyStreamAsync(PartitionKey partitionKey, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public Collection ComputedProperties { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + public VectorEmbeddingPolicy VectorEmbeddingPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public IEnumerable AccountInitializationCustomEndpoints { get; set; } + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public CosmosClientTelemetryOptions CosmosClientTelemetryOptions { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public IFaultInjector FaultInjector { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public Nullable PriorityLevel { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public JsonSerializerOptions UseSystemTextJsonSerializerWithOptions { get; set; } + public IWebProxy WebProxy { get; set; } + } + public class CosmosClientTelemetryOptions + { + public CosmosClientTelemetryOptions(); + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public bool DisableDistributedTracing { get; set; } + public bool DisableSendingMetricsToService { get; set; } + public QueryTextMode QueryTextMode { get; set; } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual ServerSideCumulativeMetrics GetQueryMetrics(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception, ICloneable + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public object Clone(); + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public abstract class CosmosLinqSerializer : CosmosSerializer + { + protected CosmosLinqSerializer(); + public abstract string SerializeMemberName(MemberInfo memberInfo); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException, ICloneable + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public object Clone(); + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public class CosmosThresholdOptions + { + public CosmosThresholdOptions(); + public TimeSpan NonPointOperationLatencyThreshold { get; set; } + public Nullable PayloadSizeThresholdInBytes { get; set; } + public TimeSpan PointOperationLatencyThreshold { get; set; } + public Nullable RequestChargeThreshold { get; set; } + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable BypassIntegratedCache { get; set; } + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public enum DistanceFunction + { + Cosine = 1, + DotProduct = 2, + Euclidean = 0, + } + public class Embedding : IEquatable + { + public Embedding(); + public VectorDataType DataType { get; set; } + public int Dimensions { get; set; } + public DistanceFunction DistanceFunction { get; set; } + public string Path { get; set; } + public bool Equals(Embedding that); + public void ValidateEmbeddingPath(); + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + public Collection VectorIndexes { get; set; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public virtual string From { get; set; } + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Move(string from, string path); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Move = 5, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public enum PriorityLevel + { + High = 1, + Low = 2, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public bool EnableOptimisticDirectExecution { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public QueryTextMode QueryTextMode { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public enum QueryTextMode + { + All = 2, + None = 0, + ParameterizedOnly = 1, + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string AustriaEast = "Austria East"; + public const string BelgiumCentral = "Belgium Central"; + public const string BleuFranceCentral = "Bleu France Central"; + public const string BleuFranceSouth = "Bleu France South"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChileCentral = "Chile Central"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string DelosCloudGermanyCentral = "Delos Cloud Germany Central"; + public const string DelosCloudGermanyNorth = "Delos Cloud Germany North"; + public const string DenmarkEast = "Denmark East"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyNorth = "Germany North"; + public const string GermanyWestCentral = "Germany West Central"; + public const string IndonesiaCentral = "Indonesia Central"; + public const string IsraelCentral = "Israel Central"; + public const string IsraelNorthwest = "Israel Northwest"; + public const string ItalyNorth = "Italy North"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string MalaysiaSouth = "Malaysia South"; + public const string MalaysiaWest = "Malaysia West"; + public const string MexicoCentral = "Mexico Central"; + public const string NewZealandNorth = "New Zealand North"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SouthCentralUS2 = "South Central US 2"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SoutheastUS = "Southeast US"; + public const string SoutheastUS3 = "Southeast US 3"; + public const string SoutheastUS5 = "Southeast US 5"; + public const string SouthIndia = "South India"; + public const string SouthwestUS = "Southwest US"; + public const string SpainCentral = "Spain Central"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string TaiwanNorth = "Taiwan North"; + public const string TaiwanNorthwest = "Taiwan Northwest"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string USSecWestCentral = "USSec West Central"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public List ExcludeRegions { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public Nullable PriorityLevel { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public abstract class ServerSideCumulativeMetrics + { + protected ServerSideCumulativeMetrics(); + public abstract ServerSideMetrics CumulativeMetrics { get; } + public abstract IReadOnlyList PartitionedMetrics { get; } + public abstract double TotalRequestCharge { get; } + } + public abstract class ServerSideMetrics + { + protected ServerSideMetrics(); + public abstract TimeSpan DocumentLoadTime { get; } + public abstract TimeSpan DocumentWriteTime { get; } + public abstract double IndexHitRatio { get; } + public abstract TimeSpan IndexLookupTime { get; } + public abstract long OutputDocumentCount { get; } + public abstract long OutputDocumentSize { get; } + public abstract TimeSpan QueryPreparationTime { get; } + public abstract long RetrievedDocumentCount { get; } + public abstract long RetrievedDocumentSize { get; } + public abstract TimeSpan RuntimeExecutionTime { get; } + public abstract TimeSpan TotalTime { get; } + public abstract TimeSpan VMExecutionTime { get; } + } + public abstract class ServerSidePartitionedMetrics + { + protected ServerSidePartitionedMetrics(); + public abstract string FeedRange { get; } + public abstract Nullable PartitionKeyRangeId { get; } + public abstract double RequestCharge { get; } + public abstract ServerSideMetrics ServerSideMetrics { get; } + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } + public enum VectorDataType + { + Float32 = 0, + Int8 = 2, + Uint8 = 1, + } + public sealed class VectorEmbeddingPolicy + { + public readonly Collection Embeddings; + public VectorEmbeddingPolicy(Collection embeddings); + } + public sealed class VectorIndexPath + { + public VectorIndexPath(); + public string Path { get; set; } + public VectorIndexType Type { get; set; } + } + public enum VectorIndexType + { + DiskANN = 1, + Flat = 0, + QuantizedFlat = 2, + } +} +namespace Microsoft.Azure.Cosmos.FaultInjection +{ + public interface IFaultInjector + { + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ComputedPropertiesDefinition + { + public T Attach(); + public ComputedPropertiesDefinition WithComputedProperty(string name, string query); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public UniqueKeyDefinition WithUniqueKey(); + public VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(Collection embeddings); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public ComputedPropertiesDefinition WithComputedProperties(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithAvailabilityStrategy(AvailabilityStrategy strategy); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptions options); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomAccountEndpoints(IEnumerable customAccountEndpoints); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithFaultInjection(IFaultInjector faultInjector); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithPriorityLevel(PriorityLevel priorityLevel); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithSystemTextJsonSerializerOptions(JsonSerializerOptions serializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + public VectorIndexDefinition> WithVectorIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } + public class VectorEmbeddingPolicyDefinition + { + public VectorEmbeddingPolicyDefinition(ContainerBuilder parent, Collection embeddings, Action attachCallback); + public ContainerBuilder Attach(); + } + public class VectorIndexDefinition + { + public VectorIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public VectorIndexDefinition Path(string path, VectorIndexType indexType); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static int DocumentId(this object obj); + public static bool FullTextContains(this object obj, string search); + public static bool FullTextContainsAll(this object obj, params string[] searches); + public static bool FullTextContainsAny(this object obj, params string[] searches); + public static bool IsArray(this object obj); + public static bool IsBool(this object obj); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsNumber(this object obj); + public static bool IsObject(this object obj); + public static bool IsPrimitive(this object obj); + public static bool IsString(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static bool RegexMatch(this object obj, string regularExpression); + public static bool RegexMatch(this object obj, string regularExpression, string searchModifier); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static FeedIterator ToStreamIterator(this IQueryable query); + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + Upsert = (short)5, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.49.1.txt b/Microsoft.Azure.Cosmos/contracts/API_3.49.1.txt new file mode 100644 index 0000000000..2f06be12e2 --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.49.1.txt @@ -0,0 +1,1705 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public abstract class AvailabilityStrategy + { + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep); + public static AvailabilityStrategy DisabledStrategy(); + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode Incremental { get; } + public static ChangeFeedMode LatestVersion { get; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract FeedRange FeedRange { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public sealed class ComputedProperty + { + public ComputedProperty(); + public string Name { get; set; } + public string Query { get; set; } + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public virtual Task DeleteAllItemsByPartitionKeyStreamAsync(PartitionKey partitionKey, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public Collection ComputedProperties { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + public VectorEmbeddingPolicy VectorEmbeddingPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public IEnumerable AccountInitializationCustomEndpoints { get; set; } + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public CosmosClientTelemetryOptions CosmosClientTelemetryOptions { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public IFaultInjector FaultInjector { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public Nullable PriorityLevel { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public JsonSerializerOptions UseSystemTextJsonSerializerWithOptions { get; set; } + public IWebProxy WebProxy { get; set; } + } + public class CosmosClientTelemetryOptions + { + public CosmosClientTelemetryOptions(); + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public bool DisableDistributedTracing { get; set; } + public bool DisableSendingMetricsToService { get; set; } + public QueryTextMode QueryTextMode { get; set; } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual ServerSideCumulativeMetrics GetQueryMetrics(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception, ICloneable + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public object Clone(); + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public abstract class CosmosLinqSerializer : CosmosSerializer + { + protected CosmosLinqSerializer(); + public abstract string SerializeMemberName(MemberInfo memberInfo); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException, ICloneable + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public object Clone(); + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public class CosmosThresholdOptions + { + public CosmosThresholdOptions(); + public TimeSpan NonPointOperationLatencyThreshold { get; set; } + public Nullable PayloadSizeThresholdInBytes { get; set; } + public TimeSpan PointOperationLatencyThreshold { get; set; } + public Nullable RequestChargeThreshold { get; set; } + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable BypassIntegratedCache { get; set; } + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public enum DistanceFunction + { + Cosine = 1, + DotProduct = 2, + Euclidean = 0, + } + public class Embedding : IEquatable + { + public Embedding(); + public VectorDataType DataType { get; set; } + public int Dimensions { get; set; } + public DistanceFunction DistanceFunction { get; set; } + public string Path { get; set; } + public bool Equals(Embedding that); + public void ValidateEmbeddingPath(); + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + public Collection VectorIndexes { get; set; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public virtual string From { get; set; } + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Move(string from, string path); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Move = 5, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public enum PriorityLevel + { + High = 1, + Low = 2, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public bool EnableOptimisticDirectExecution { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public QueryTextMode QueryTextMode { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public enum QueryTextMode + { + All = 2, + None = 0, + ParameterizedOnly = 1, + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string AustriaEast = "Austria East"; + public const string BelgiumCentral = "Belgium Central"; + public const string BleuFranceCentral = "Bleu France Central"; + public const string BleuFranceSouth = "Bleu France South"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChileCentral = "Chile Central"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string DelosCloudGermanyCentral = "Delos Cloud Germany Central"; + public const string DelosCloudGermanyNorth = "Delos Cloud Germany North"; + public const string DenmarkEast = "Denmark East"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyNorth = "Germany North"; + public const string GermanyWestCentral = "Germany West Central"; + public const string IndonesiaCentral = "Indonesia Central"; + public const string IsraelCentral = "Israel Central"; + public const string IsraelNorthwest = "Israel Northwest"; + public const string ItalyNorth = "Italy North"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string MalaysiaSouth = "Malaysia South"; + public const string MalaysiaWest = "Malaysia West"; + public const string MexicoCentral = "Mexico Central"; + public const string NewZealandNorth = "New Zealand North"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SouthCentralUS2 = "South Central US 2"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SoutheastUS = "Southeast US"; + public const string SoutheastUS3 = "Southeast US 3"; + public const string SoutheastUS5 = "Southeast US 5"; + public const string SouthIndia = "South India"; + public const string SouthwestUS = "Southwest US"; + public const string SpainCentral = "Spain Central"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string TaiwanNorth = "Taiwan North"; + public const string TaiwanNorthwest = "Taiwan Northwest"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string USSecWestCentral = "USSec West Central"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public List ExcludeRegions { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public Nullable PriorityLevel { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public abstract class ServerSideCumulativeMetrics + { + protected ServerSideCumulativeMetrics(); + public abstract ServerSideMetrics CumulativeMetrics { get; } + public abstract IReadOnlyList PartitionedMetrics { get; } + public abstract double TotalRequestCharge { get; } + } + public abstract class ServerSideMetrics + { + protected ServerSideMetrics(); + public abstract TimeSpan DocumentLoadTime { get; } + public abstract TimeSpan DocumentWriteTime { get; } + public abstract double IndexHitRatio { get; } + public abstract TimeSpan IndexLookupTime { get; } + public abstract long OutputDocumentCount { get; } + public abstract long OutputDocumentSize { get; } + public abstract TimeSpan QueryPreparationTime { get; } + public abstract long RetrievedDocumentCount { get; } + public abstract long RetrievedDocumentSize { get; } + public abstract TimeSpan RuntimeExecutionTime { get; } + public abstract TimeSpan TotalTime { get; } + public abstract TimeSpan VMExecutionTime { get; } + } + public abstract class ServerSidePartitionedMetrics + { + protected ServerSidePartitionedMetrics(); + public abstract string FeedRange { get; } + public abstract Nullable PartitionKeyRangeId { get; } + public abstract double RequestCharge { get; } + public abstract ServerSideMetrics ServerSideMetrics { get; } + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } + public enum VectorDataType + { + Float32 = 0, + Int8 = 2, + Uint8 = 1, + } + public sealed class VectorEmbeddingPolicy + { + public readonly Collection Embeddings; + public VectorEmbeddingPolicy(Collection embeddings); + } + public sealed class VectorIndexPath + { + public VectorIndexPath(); + public string Path { get; set; } + public VectorIndexType Type { get; set; } + } + public enum VectorIndexType + { + DiskANN = 1, + Flat = 0, + QuantizedFlat = 2, + } +} +namespace Microsoft.Azure.Cosmos.FaultInjection +{ + public interface IFaultInjector + { + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ComputedPropertiesDefinition + { + public T Attach(); + public ComputedPropertiesDefinition WithComputedProperty(string name, string query); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public UniqueKeyDefinition WithUniqueKey(); + public VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(Collection embeddings); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public ComputedPropertiesDefinition WithComputedProperties(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithAvailabilityStrategy(AvailabilityStrategy strategy); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptions options); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomAccountEndpoints(IEnumerable customAccountEndpoints); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithFaultInjection(IFaultInjector faultInjector); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithPriorityLevel(PriorityLevel priorityLevel); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithSystemTextJsonSerializerOptions(JsonSerializerOptions serializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + public VectorIndexDefinition> WithVectorIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } + public class VectorEmbeddingPolicyDefinition + { + public VectorEmbeddingPolicyDefinition(ContainerBuilder parent, Collection embeddings, Action attachCallback); + public ContainerBuilder Attach(); + } + public class VectorIndexDefinition + { + public VectorIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public VectorIndexDefinition Path(string path, VectorIndexType indexType); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static int DocumentId(this object obj); + public static bool FullTextContains(this object obj, string search); + public static bool FullTextContainsAll(this object obj, params string[] searches); + public static bool FullTextContainsAny(this object obj, params string[] searches); + public static bool IsArray(this object obj); + public static bool IsBool(this object obj); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsNumber(this object obj); + public static bool IsObject(this object obj); + public static bool IsPrimitive(this object obj); + public static bool IsString(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static bool RegexMatch(this object obj, string regularExpression); + public static bool RegexMatch(this object obj, string regularExpression, string searchModifier); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static FeedIterator ToStreamIterator(this IQueryable query); + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + Upsert = (short)5, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.50.0-preview.0.txt b/Microsoft.Azure.Cosmos/contracts/API_3.50.0-preview.0.txt new file mode 100644 index 0000000000..9587956e75 --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.50.0-preview.0.txt @@ -0,0 +1,1874 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public abstract class AvailabilityStrategy + { + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep); + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep, bool enableMultiWriteRegionHedge=false); + public static AvailabilityStrategy DisabledStrategy(); + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public class ChangeFeedItem + { + public ChangeFeedItem(); + public T Current { get; set; } + public ChangeFeedMetadata Metadata { get; set; } + public T Previous { get; set; } + } + public class ChangeFeedMetadata + { + public ChangeFeedMetadata(); + public DateTime ConflictResolutionTimestamp { get; } + public bool IsTimeToLiveExpired { get; } + public long Lsn { get; } + public ChangeFeedOperationType OperationType { get; } + public long PreviousLsn { get; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode AllVersionsAndDeletes { get; } + public static ChangeFeedMode Incremental { get; } + public static ChangeFeedMode LatestVersion { get; } + } + public enum ChangeFeedOperationType + { + Create = 0, + Delete = 2, + Replace = 1, + } + public sealed class ChangeFeedPolicy + { + public ChangeFeedPolicy(); + public static TimeSpan FullFidelityNoRetention { get; } + public TimeSpan FullFidelityRetention { get; set; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract FeedRange FeedRange { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public sealed class ComputedProperty + { + public ComputedProperty(); + public string Name { get; set; } + public string Query { get; set; } + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public virtual Task DeleteAllItemsByPartitionKeyStreamAsync(PartitionKey partitionKey, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes(string processorName, Container.ChangeFeedHandler> onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> GetPartitionKeyRangesAsync(FeedRange feedRange, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task IsFeedRangePartOfAsync(FeedRange x, FeedRange y, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ChangeFeedPolicy ChangeFeedPolicy { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public Collection ComputedProperties { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public FullTextPolicy FullTextPolicy { get; set; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + public VectorEmbeddingPolicy VectorEmbeddingPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public IEnumerable AccountInitializationCustomEndpoints { get; set; } + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public CosmosClientTelemetryOptions CosmosClientTelemetryOptions { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableRemoteRegionPreferredForSessionRetry { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public IFaultInjector FaultInjector { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public Nullable PriorityLevel { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable ThroughputBucket { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public JsonSerializerOptions UseSystemTextJsonSerializerWithOptions { get; set; } + public IWebProxy WebProxy { get; set; } + } + public class CosmosClientTelemetryOptions + { + public CosmosClientTelemetryOptions(); + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public bool DisableDistributedTracing { get; set; } + public bool DisableSendingMetricsToService { get; set; } + public bool IsClientMetricsEnabled { get; set; } + public NetworkMetricsOptions NetworkMetricsOptions { get; set; } + public OperationMetricsOptions OperationMetricsOptions { get; set; } + public QueryTextMode QueryTextMode { get; set; } + } + public sealed class CosmosDbClientMetrics + { + public CosmosDbClientMetrics(); + public static class HistogramBuckets + { + public static readonly double[] RequestLatencyBuckets; + public static readonly double[] RequestUnitBuckets; + public static readonly double[] RowCountBuckets; + } + public static class NetworkMetrics + { + public const string MeterName = "Azure.Cosmos.Client.Request"; + public const string Version = "1.0.0"; + public static class Description + { + public const string BackendLatency = "Backend Latency (for direct mode)."; + public const string ChannelAquisitionLatency = "The duration of the successfully established outbound TCP connections. i.e. Channel Aquisition Time (for direct mode)."; + public const string Latency = "Duration of client requests."; + public const string ReceivedTimeLatency = "Time spent on 'Received' stage (for direct mode)."; + public const string RequestBodySize = "Size of client request body."; + public const string ResponseBodySize = "Size of client response body."; + public const string TransitTimeLatency = "Time spent on the wire (for direct mode)."; + } + public static class Name + { + public const string BackendLatency = "azure.cosmosdb.client.request.service_duration"; + public const string ChannelAquisitionLatency = "azure.cosmosdb.client.request.channel_aquisition.duration"; + public const string Latency = "azure.cosmosdb.client.request.duration"; + public const string ReceivedTimeLatency = "azure.cosmosdb.client.request.received.duration"; + public const string RequestBodySize = "azure.cosmosdb.client.request.body.size"; + public const string ResponseBodySize = "azure.cosmosdb.client.response.body.size"; + public const string TransitTimeLatency = "azure.cosmosdb.client.request.transit.duration"; + } + public static class Unit + { + public const string Bytes = "bytes"; + public const string Sec = "s"; + } + } + public static class OperationMetrics + { + public const string MeterName = "Azure.Cosmos.Client.Operation"; + public const string Version = "1.0.0"; + public static class Description + { + public const string ActiveInstances = "Number of active SDK client instances."; + public const string Latency = "Total end-to-end duration of the operation"; + public const string RequestCharge = "Total request units per operation (sum of RUs for all requested needed when processing an operation)"; + public const string RowCount = "For feed operations (query, readAll, readMany, change feed) batch operations this meter capture the actual item count in responses from the service"; + } + public static class Name + { + public const string ActiveInstances = "azure.cosmosdb.client.active_instance.count"; + public const string Latency = "db.client.operation.duration"; + public const string RequestCharge = "azure.cosmosdb.client.operation.request_charge"; + public const string RowCount = "db.client.response.returned_rows"; + } + public static class Unit + { + public const string Instance = "{instance}"; + public const string Item = "{item}"; + public const string RequestUnit = "{request_unit}"; + public const string Sec = "s"; + } + } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual ServerSideCumulativeMetrics GetQueryMetrics(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception, ICloneable + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public object Clone(); + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public abstract class CosmosLinqSerializer : CosmosSerializer + { + protected CosmosLinqSerializer(); + public abstract string SerializeMemberName(MemberInfo memberInfo); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException, ICloneable + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public object Clone(); + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public class CosmosThresholdOptions + { + public CosmosThresholdOptions(); + public TimeSpan NonPointOperationLatencyThreshold { get; set; } + public Nullable PayloadSizeThresholdInBytes { get; set; } + public TimeSpan PointOperationLatencyThreshold { get; set; } + public Nullable RequestChargeThreshold { get; set; } + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable BypassIntegratedCache { get; set; } + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public enum DistanceFunction + { + Cosine = 1, + DotProduct = 2, + Euclidean = 0, + } + public class Embedding : IEquatable + { + public Embedding(); + public VectorDataType DataType { get; set; } + public int Dimensions { get; set; } + public DistanceFunction DistanceFunction { get; set; } + public string Path { get; set; } + public bool Equals(Embedding that); + public void ValidateEmbeddingPath(); + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class FullTextIndexPath + { + public FullTextIndexPath(); + public string Path { get; set; } + } + public sealed class FullTextPath : IEquatable + { + public FullTextPath(); + public string Language { get; set; } + public string Path { get; set; } + public bool Equals(FullTextPath that); + public void ValidateFullTextPath(); + } + public sealed class FullTextPolicy + { + public FullTextPolicy(); + public string DefaultLanguage { get; set; } + public Collection FullTextPaths { get; set; } + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection FullTextIndexes { get; set; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + public Collection VectorIndexes { get; set; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public class NetworkMetricsOptions + { + public NetworkMetricsOptions(); + public IDictionary CustomDimensions { get; set; } + public Nullable IncludeRoutingId { get; set; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public class OperationMetricsOptions + { + public OperationMetricsOptions(); + public IDictionary CustomDimensions { get; set; } + public Nullable IncludeRegion { get; set; } + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public virtual string From { get; set; } + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Move(string from, string path); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Move = 5, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public enum PriorityLevel + { + High = 1, + Low = 2, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public bool EnableOptimisticDirectExecution { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public QueryTextMode QueryTextMode { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public enum QueryTextMode + { + All = 2, + None = 0, + ParameterizedOnly = 1, + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string AustriaEast = "Austria East"; + public const string BelgiumCentral = "Belgium Central"; + public const string BleuFranceCentral = "Bleu France Central"; + public const string BleuFranceSouth = "Bleu France South"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChileCentral = "Chile Central"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string DelosCloudGermanyCentral = "Delos Cloud Germany Central"; + public const string DelosCloudGermanyNorth = "Delos Cloud Germany North"; + public const string DenmarkEast = "Denmark East"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyNorth = "Germany North"; + public const string GermanyWestCentral = "Germany West Central"; + public const string IndonesiaCentral = "Indonesia Central"; + public const string IsraelCentral = "Israel Central"; + public const string IsraelNorthwest = "Israel Northwest"; + public const string ItalyNorth = "Italy North"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string MalaysiaSouth = "Malaysia South"; + public const string MalaysiaWest = "Malaysia West"; + public const string MexicoCentral = "Mexico Central"; + public const string NewZealandNorth = "New Zealand North"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SouthCentralUS2 = "South Central US 2"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SoutheastUS = "Southeast US"; + public const string SoutheastUS3 = "Southeast US 3"; + public const string SoutheastUS5 = "Southeast US 5"; + public const string SouthIndia = "South India"; + public const string SouthwestUS = "Southwest US"; + public const string SpainCentral = "Spain Central"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string TaiwanNorth = "Taiwan North"; + public const string TaiwanNorthwest = "Taiwan Northwest"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string USSecWestCentral = "USSec West Central"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public List ExcludeRegions { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public NetworkMetricsOptions NetworkMetricsOptions { get; set; } + public OperationMetricsOptions OperationMetricsOptions { get; set; } + public Nullable PriorityLevel { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public Nullable ThroughputBucket { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public abstract class ServerSideCumulativeMetrics + { + protected ServerSideCumulativeMetrics(); + public abstract ServerSideMetrics CumulativeMetrics { get; } + public abstract IReadOnlyList PartitionedMetrics { get; } + public abstract double TotalRequestCharge { get; } + } + public abstract class ServerSideMetrics + { + protected ServerSideMetrics(); + public abstract TimeSpan DocumentLoadTime { get; } + public abstract TimeSpan DocumentWriteTime { get; } + public abstract double IndexHitRatio { get; } + public abstract TimeSpan IndexLookupTime { get; } + public abstract long OutputDocumentCount { get; } + public abstract long OutputDocumentSize { get; } + public abstract TimeSpan QueryPreparationTime { get; } + public abstract long RetrievedDocumentCount { get; } + public abstract long RetrievedDocumentSize { get; } + public abstract TimeSpan RuntimeExecutionTime { get; } + public abstract TimeSpan TotalTime { get; } + public abstract TimeSpan VMExecutionTime { get; } + } + public abstract class ServerSidePartitionedMetrics + { + protected ServerSidePartitionedMetrics(); + public abstract string FeedRange { get; } + public abstract Nullable PartitionKeyRangeId { get; } + public abstract double RequestCharge { get; } + public abstract ServerSideMetrics ServerSideMetrics { get; } + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } + public enum VectorDataType + { + Float32 = 0, + Int8 = 2, + Uint8 = 1, + } + public sealed class VectorEmbeddingPolicy + { + public readonly Collection Embeddings; + public VectorEmbeddingPolicy(Collection embeddings); + } + public sealed class VectorIndexPath + { + public VectorIndexPath(); + public int IndexingSearchListSize { get; set; } + public string Path { get; set; } + public int QuantizationByteSize { get; set; } + public VectorIndexType Type { get; set; } + public string[] VectorIndexShardKey { get; set; } + } + public enum VectorIndexType + { + DiskANN = 1, + Flat = 0, + QuantizedFlat = 2, + } +} +namespace Microsoft.Azure.Cosmos.FaultInjection +{ + public interface IFaultInjector + { + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public class ChangeFeedPolicyDefinition + { + public ContainerBuilder Attach(); + } + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ComputedPropertiesDefinition + { + public T Attach(); + public ComputedPropertiesDefinition WithComputedProperty(string name, string query); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ChangeFeedPolicyDefinition WithChangeFeedPolicy(TimeSpan retention); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public FullTextPolicyDefinition WithFullTextPolicy(string defaultLanguage, Collection fullTextPaths); + public UniqueKeyDefinition WithUniqueKey(); + public VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(Collection embeddings); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public ComputedPropertiesDefinition WithComputedProperties(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithAvailabilityStrategy(AvailabilityStrategy strategy); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptions options); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomAccountEndpoints(IEnumerable customAccountEndpoints); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithEnableRemoteRegionPreferredForSessionRetry(bool enableRemoteRegionPreferredForSessionRetry); + public CosmosClientBuilder WithFaultInjection(IFaultInjector faultInjector); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithPriorityLevel(PriorityLevel priorityLevel); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithSystemTextJsonSerializerOptions(JsonSerializerOptions serializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + public CosmosClientBuilder WithThroughputBucket(int throughputBucket); + } + public class FullTextIndexDefinition + { + public FullTextIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public FullTextIndexDefinition Path(string path); + } + public class FullTextPolicyDefinition + { + public FullTextPolicyDefinition(ContainerBuilder parent, string defaultLanguage, Collection fullTextPaths, Action attachCallback); + public ContainerBuilder Attach(); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public FullTextIndexDefinition> WithFullTextIndex(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + public VectorIndexDefinition> WithVectorIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } + public class VectorEmbeddingPolicyDefinition + { + public VectorEmbeddingPolicyDefinition(ContainerBuilder parent, Collection embeddings, Action attachCallback); + public ContainerBuilder Attach(); + } + public class VectorIndexDefinition + { + public VectorIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public VectorIndexDefinition Path(string path, VectorIndexType indexType); + public VectorIndexDefinition WithIndexingSearchListSize(int indexingSearchListSize); + public VectorIndexDefinition WithQuantizationByteSize(int quantizationByteSize); + public VectorIndexDefinition WithVectorIndexShardKey(string[] vectorIndexShardKey); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static int DocumentId(this object obj); + public static bool FullTextContains(this object obj, string search); + public static bool FullTextContainsAll(this object obj, params string[] searches); + public static bool FullTextContainsAny(this object obj, params string[] searches); + public static bool IsArray(this object obj); + public static bool IsBool(this object obj); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsNumber(this object obj); + public static bool IsObject(this object obj); + public static bool IsPrimitive(this object obj); + public static bool IsString(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static bool RegexMatch(this object obj, string regularExpression); + public static bool RegexMatch(this object obj, string regularExpression, string searchModifier); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query, IDictionary namedParameters); + public static FeedIterator ToStreamIterator(this IQueryable query); + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + Upsert = (short)5, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.50.0-preview.1.txt b/Microsoft.Azure.Cosmos/contracts/API_3.50.0-preview.1.txt new file mode 100644 index 0000000000..9587956e75 --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.50.0-preview.1.txt @@ -0,0 +1,1874 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public abstract class AvailabilityStrategy + { + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep); + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep, bool enableMultiWriteRegionHedge=false); + public static AvailabilityStrategy DisabledStrategy(); + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public class ChangeFeedItem + { + public ChangeFeedItem(); + public T Current { get; set; } + public ChangeFeedMetadata Metadata { get; set; } + public T Previous { get; set; } + } + public class ChangeFeedMetadata + { + public ChangeFeedMetadata(); + public DateTime ConflictResolutionTimestamp { get; } + public bool IsTimeToLiveExpired { get; } + public long Lsn { get; } + public ChangeFeedOperationType OperationType { get; } + public long PreviousLsn { get; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode AllVersionsAndDeletes { get; } + public static ChangeFeedMode Incremental { get; } + public static ChangeFeedMode LatestVersion { get; } + } + public enum ChangeFeedOperationType + { + Create = 0, + Delete = 2, + Replace = 1, + } + public sealed class ChangeFeedPolicy + { + public ChangeFeedPolicy(); + public static TimeSpan FullFidelityNoRetention { get; } + public TimeSpan FullFidelityRetention { get; set; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract FeedRange FeedRange { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public sealed class ComputedProperty + { + public ComputedProperty(); + public string Name { get; set; } + public string Query { get; set; } + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public virtual Task DeleteAllItemsByPartitionKeyStreamAsync(PartitionKey partitionKey, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes(string processorName, Container.ChangeFeedHandler> onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> GetPartitionKeyRangesAsync(FeedRange feedRange, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task IsFeedRangePartOfAsync(FeedRange x, FeedRange y, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ChangeFeedPolicy ChangeFeedPolicy { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public Collection ComputedProperties { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public FullTextPolicy FullTextPolicy { get; set; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + public VectorEmbeddingPolicy VectorEmbeddingPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public IEnumerable AccountInitializationCustomEndpoints { get; set; } + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public CosmosClientTelemetryOptions CosmosClientTelemetryOptions { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableRemoteRegionPreferredForSessionRetry { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public IFaultInjector FaultInjector { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public Nullable PriorityLevel { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable ThroughputBucket { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public JsonSerializerOptions UseSystemTextJsonSerializerWithOptions { get; set; } + public IWebProxy WebProxy { get; set; } + } + public class CosmosClientTelemetryOptions + { + public CosmosClientTelemetryOptions(); + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public bool DisableDistributedTracing { get; set; } + public bool DisableSendingMetricsToService { get; set; } + public bool IsClientMetricsEnabled { get; set; } + public NetworkMetricsOptions NetworkMetricsOptions { get; set; } + public OperationMetricsOptions OperationMetricsOptions { get; set; } + public QueryTextMode QueryTextMode { get; set; } + } + public sealed class CosmosDbClientMetrics + { + public CosmosDbClientMetrics(); + public static class HistogramBuckets + { + public static readonly double[] RequestLatencyBuckets; + public static readonly double[] RequestUnitBuckets; + public static readonly double[] RowCountBuckets; + } + public static class NetworkMetrics + { + public const string MeterName = "Azure.Cosmos.Client.Request"; + public const string Version = "1.0.0"; + public static class Description + { + public const string BackendLatency = "Backend Latency (for direct mode)."; + public const string ChannelAquisitionLatency = "The duration of the successfully established outbound TCP connections. i.e. Channel Aquisition Time (for direct mode)."; + public const string Latency = "Duration of client requests."; + public const string ReceivedTimeLatency = "Time spent on 'Received' stage (for direct mode)."; + public const string RequestBodySize = "Size of client request body."; + public const string ResponseBodySize = "Size of client response body."; + public const string TransitTimeLatency = "Time spent on the wire (for direct mode)."; + } + public static class Name + { + public const string BackendLatency = "azure.cosmosdb.client.request.service_duration"; + public const string ChannelAquisitionLatency = "azure.cosmosdb.client.request.channel_aquisition.duration"; + public const string Latency = "azure.cosmosdb.client.request.duration"; + public const string ReceivedTimeLatency = "azure.cosmosdb.client.request.received.duration"; + public const string RequestBodySize = "azure.cosmosdb.client.request.body.size"; + public const string ResponseBodySize = "azure.cosmosdb.client.response.body.size"; + public const string TransitTimeLatency = "azure.cosmosdb.client.request.transit.duration"; + } + public static class Unit + { + public const string Bytes = "bytes"; + public const string Sec = "s"; + } + } + public static class OperationMetrics + { + public const string MeterName = "Azure.Cosmos.Client.Operation"; + public const string Version = "1.0.0"; + public static class Description + { + public const string ActiveInstances = "Number of active SDK client instances."; + public const string Latency = "Total end-to-end duration of the operation"; + public const string RequestCharge = "Total request units per operation (sum of RUs for all requested needed when processing an operation)"; + public const string RowCount = "For feed operations (query, readAll, readMany, change feed) batch operations this meter capture the actual item count in responses from the service"; + } + public static class Name + { + public const string ActiveInstances = "azure.cosmosdb.client.active_instance.count"; + public const string Latency = "db.client.operation.duration"; + public const string RequestCharge = "azure.cosmosdb.client.operation.request_charge"; + public const string RowCount = "db.client.response.returned_rows"; + } + public static class Unit + { + public const string Instance = "{instance}"; + public const string Item = "{item}"; + public const string RequestUnit = "{request_unit}"; + public const string Sec = "s"; + } + } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual ServerSideCumulativeMetrics GetQueryMetrics(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception, ICloneable + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public object Clone(); + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public abstract class CosmosLinqSerializer : CosmosSerializer + { + protected CosmosLinqSerializer(); + public abstract string SerializeMemberName(MemberInfo memberInfo); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException, ICloneable + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public object Clone(); + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public class CosmosThresholdOptions + { + public CosmosThresholdOptions(); + public TimeSpan NonPointOperationLatencyThreshold { get; set; } + public Nullable PayloadSizeThresholdInBytes { get; set; } + public TimeSpan PointOperationLatencyThreshold { get; set; } + public Nullable RequestChargeThreshold { get; set; } + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable BypassIntegratedCache { get; set; } + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public enum DistanceFunction + { + Cosine = 1, + DotProduct = 2, + Euclidean = 0, + } + public class Embedding : IEquatable + { + public Embedding(); + public VectorDataType DataType { get; set; } + public int Dimensions { get; set; } + public DistanceFunction DistanceFunction { get; set; } + public string Path { get; set; } + public bool Equals(Embedding that); + public void ValidateEmbeddingPath(); + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class FullTextIndexPath + { + public FullTextIndexPath(); + public string Path { get; set; } + } + public sealed class FullTextPath : IEquatable + { + public FullTextPath(); + public string Language { get; set; } + public string Path { get; set; } + public bool Equals(FullTextPath that); + public void ValidateFullTextPath(); + } + public sealed class FullTextPolicy + { + public FullTextPolicy(); + public string DefaultLanguage { get; set; } + public Collection FullTextPaths { get; set; } + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection FullTextIndexes { get; set; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + public Collection VectorIndexes { get; set; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public class NetworkMetricsOptions + { + public NetworkMetricsOptions(); + public IDictionary CustomDimensions { get; set; } + public Nullable IncludeRoutingId { get; set; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public class OperationMetricsOptions + { + public OperationMetricsOptions(); + public IDictionary CustomDimensions { get; set; } + public Nullable IncludeRegion { get; set; } + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public virtual string From { get; set; } + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Move(string from, string path); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Move = 5, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public enum PriorityLevel + { + High = 1, + Low = 2, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public bool EnableOptimisticDirectExecution { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public QueryTextMode QueryTextMode { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public enum QueryTextMode + { + All = 2, + None = 0, + ParameterizedOnly = 1, + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string AustriaEast = "Austria East"; + public const string BelgiumCentral = "Belgium Central"; + public const string BleuFranceCentral = "Bleu France Central"; + public const string BleuFranceSouth = "Bleu France South"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChileCentral = "Chile Central"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string DelosCloudGermanyCentral = "Delos Cloud Germany Central"; + public const string DelosCloudGermanyNorth = "Delos Cloud Germany North"; + public const string DenmarkEast = "Denmark East"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyNorth = "Germany North"; + public const string GermanyWestCentral = "Germany West Central"; + public const string IndonesiaCentral = "Indonesia Central"; + public const string IsraelCentral = "Israel Central"; + public const string IsraelNorthwest = "Israel Northwest"; + public const string ItalyNorth = "Italy North"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string MalaysiaSouth = "Malaysia South"; + public const string MalaysiaWest = "Malaysia West"; + public const string MexicoCentral = "Mexico Central"; + public const string NewZealandNorth = "New Zealand North"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SouthCentralUS2 = "South Central US 2"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SoutheastUS = "Southeast US"; + public const string SoutheastUS3 = "Southeast US 3"; + public const string SoutheastUS5 = "Southeast US 5"; + public const string SouthIndia = "South India"; + public const string SouthwestUS = "Southwest US"; + public const string SpainCentral = "Spain Central"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string TaiwanNorth = "Taiwan North"; + public const string TaiwanNorthwest = "Taiwan Northwest"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string USSecWestCentral = "USSec West Central"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public List ExcludeRegions { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public NetworkMetricsOptions NetworkMetricsOptions { get; set; } + public OperationMetricsOptions OperationMetricsOptions { get; set; } + public Nullable PriorityLevel { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public Nullable ThroughputBucket { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public abstract class ServerSideCumulativeMetrics + { + protected ServerSideCumulativeMetrics(); + public abstract ServerSideMetrics CumulativeMetrics { get; } + public abstract IReadOnlyList PartitionedMetrics { get; } + public abstract double TotalRequestCharge { get; } + } + public abstract class ServerSideMetrics + { + protected ServerSideMetrics(); + public abstract TimeSpan DocumentLoadTime { get; } + public abstract TimeSpan DocumentWriteTime { get; } + public abstract double IndexHitRatio { get; } + public abstract TimeSpan IndexLookupTime { get; } + public abstract long OutputDocumentCount { get; } + public abstract long OutputDocumentSize { get; } + public abstract TimeSpan QueryPreparationTime { get; } + public abstract long RetrievedDocumentCount { get; } + public abstract long RetrievedDocumentSize { get; } + public abstract TimeSpan RuntimeExecutionTime { get; } + public abstract TimeSpan TotalTime { get; } + public abstract TimeSpan VMExecutionTime { get; } + } + public abstract class ServerSidePartitionedMetrics + { + protected ServerSidePartitionedMetrics(); + public abstract string FeedRange { get; } + public abstract Nullable PartitionKeyRangeId { get; } + public abstract double RequestCharge { get; } + public abstract ServerSideMetrics ServerSideMetrics { get; } + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } + public enum VectorDataType + { + Float32 = 0, + Int8 = 2, + Uint8 = 1, + } + public sealed class VectorEmbeddingPolicy + { + public readonly Collection Embeddings; + public VectorEmbeddingPolicy(Collection embeddings); + } + public sealed class VectorIndexPath + { + public VectorIndexPath(); + public int IndexingSearchListSize { get; set; } + public string Path { get; set; } + public int QuantizationByteSize { get; set; } + public VectorIndexType Type { get; set; } + public string[] VectorIndexShardKey { get; set; } + } + public enum VectorIndexType + { + DiskANN = 1, + Flat = 0, + QuantizedFlat = 2, + } +} +namespace Microsoft.Azure.Cosmos.FaultInjection +{ + public interface IFaultInjector + { + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public class ChangeFeedPolicyDefinition + { + public ContainerBuilder Attach(); + } + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ComputedPropertiesDefinition + { + public T Attach(); + public ComputedPropertiesDefinition WithComputedProperty(string name, string query); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ChangeFeedPolicyDefinition WithChangeFeedPolicy(TimeSpan retention); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public FullTextPolicyDefinition WithFullTextPolicy(string defaultLanguage, Collection fullTextPaths); + public UniqueKeyDefinition WithUniqueKey(); + public VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(Collection embeddings); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public ComputedPropertiesDefinition WithComputedProperties(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithAvailabilityStrategy(AvailabilityStrategy strategy); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptions options); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomAccountEndpoints(IEnumerable customAccountEndpoints); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithEnableRemoteRegionPreferredForSessionRetry(bool enableRemoteRegionPreferredForSessionRetry); + public CosmosClientBuilder WithFaultInjection(IFaultInjector faultInjector); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithPriorityLevel(PriorityLevel priorityLevel); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithSystemTextJsonSerializerOptions(JsonSerializerOptions serializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + public CosmosClientBuilder WithThroughputBucket(int throughputBucket); + } + public class FullTextIndexDefinition + { + public FullTextIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public FullTextIndexDefinition Path(string path); + } + public class FullTextPolicyDefinition + { + public FullTextPolicyDefinition(ContainerBuilder parent, string defaultLanguage, Collection fullTextPaths, Action attachCallback); + public ContainerBuilder Attach(); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public FullTextIndexDefinition> WithFullTextIndex(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + public VectorIndexDefinition> WithVectorIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } + public class VectorEmbeddingPolicyDefinition + { + public VectorEmbeddingPolicyDefinition(ContainerBuilder parent, Collection embeddings, Action attachCallback); + public ContainerBuilder Attach(); + } + public class VectorIndexDefinition + { + public VectorIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public VectorIndexDefinition Path(string path, VectorIndexType indexType); + public VectorIndexDefinition WithIndexingSearchListSize(int indexingSearchListSize); + public VectorIndexDefinition WithQuantizationByteSize(int quantizationByteSize); + public VectorIndexDefinition WithVectorIndexShardKey(string[] vectorIndexShardKey); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static int DocumentId(this object obj); + public static bool FullTextContains(this object obj, string search); + public static bool FullTextContainsAll(this object obj, params string[] searches); + public static bool FullTextContainsAny(this object obj, params string[] searches); + public static bool IsArray(this object obj); + public static bool IsBool(this object obj); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsNumber(this object obj); + public static bool IsObject(this object obj); + public static bool IsPrimitive(this object obj); + public static bool IsString(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static bool RegexMatch(this object obj, string regularExpression); + public static bool RegexMatch(this object obj, string regularExpression, string searchModifier); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query, IDictionary namedParameters); + public static FeedIterator ToStreamIterator(this IQueryable query); + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + Upsert = (short)5, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.50.0.txt b/Microsoft.Azure.Cosmos/contracts/API_3.50.0.txt new file mode 100644 index 0000000000..25d5040bb5 --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.50.0.txt @@ -0,0 +1,1742 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public abstract class AvailabilityStrategy + { + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep, bool enableMultiWriteRegionHedge=false); + public static AvailabilityStrategy DisabledStrategy(); + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode Incremental { get; } + public static ChangeFeedMode LatestVersion { get; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract FeedRange FeedRange { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public sealed class ComputedProperty + { + public ComputedProperty(); + public string Name { get; set; } + public string Query { get; set; } + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public virtual Task DeleteAllItemsByPartitionKeyStreamAsync(PartitionKey partitionKey, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public Collection ComputedProperties { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public FullTextPolicy FullTextPolicy { get; set; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + public VectorEmbeddingPolicy VectorEmbeddingPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public IEnumerable AccountInitializationCustomEndpoints { get; set; } + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public CosmosClientTelemetryOptions CosmosClientTelemetryOptions { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public IFaultInjector FaultInjector { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public Nullable PriorityLevel { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public JsonSerializerOptions UseSystemTextJsonSerializerWithOptions { get; set; } + public IWebProxy WebProxy { get; set; } + } + public class CosmosClientTelemetryOptions + { + public CosmosClientTelemetryOptions(); + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public bool DisableDistributedTracing { get; set; } + public bool DisableSendingMetricsToService { get; set; } + public QueryTextMode QueryTextMode { get; set; } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual ServerSideCumulativeMetrics GetQueryMetrics(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception, ICloneable + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public object Clone(); + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public abstract class CosmosLinqSerializer : CosmosSerializer + { + protected CosmosLinqSerializer(); + public abstract string SerializeMemberName(MemberInfo memberInfo); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException, ICloneable + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public object Clone(); + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public class CosmosThresholdOptions + { + public CosmosThresholdOptions(); + public TimeSpan NonPointOperationLatencyThreshold { get; set; } + public Nullable PayloadSizeThresholdInBytes { get; set; } + public TimeSpan PointOperationLatencyThreshold { get; set; } + public Nullable RequestChargeThreshold { get; set; } + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable BypassIntegratedCache { get; set; } + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public enum DistanceFunction + { + Cosine = 1, + DotProduct = 2, + Euclidean = 0, + } + public class Embedding : IEquatable + { + public Embedding(); + public VectorDataType DataType { get; set; } + public int Dimensions { get; set; } + public DistanceFunction DistanceFunction { get; set; } + public string Path { get; set; } + public bool Equals(Embedding that); + public void ValidateEmbeddingPath(); + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class FullTextIndexPath + { + public FullTextIndexPath(); + public string Path { get; set; } + } + public class FullTextPath : IEquatable + { + public FullTextPath(); + public string Language { get; set; } + public string Path { get; set; } + public bool Equals(FullTextPath that); + public void ValidateFullTextPath(); + } + public sealed class FullTextPolicy + { + public FullTextPolicy(); + public string DefaultLanguage { get; set; } + public Collection FullTextPaths { get; set; } + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection FullTextIndexes { get; set; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + public Collection VectorIndexes { get; set; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public virtual string From { get; set; } + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Move(string from, string path); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Move = 5, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public enum PriorityLevel + { + High = 1, + Low = 2, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public bool EnableOptimisticDirectExecution { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public QueryTextMode QueryTextMode { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public enum QueryTextMode + { + All = 2, + None = 0, + ParameterizedOnly = 1, + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string AustriaEast = "Austria East"; + public const string BelgiumCentral = "Belgium Central"; + public const string BleuFranceCentral = "Bleu France Central"; + public const string BleuFranceSouth = "Bleu France South"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChileCentral = "Chile Central"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string DelosCloudGermanyCentral = "Delos Cloud Germany Central"; + public const string DelosCloudGermanyNorth = "Delos Cloud Germany North"; + public const string DenmarkEast = "Denmark East"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyNorth = "Germany North"; + public const string GermanyWestCentral = "Germany West Central"; + public const string IndonesiaCentral = "Indonesia Central"; + public const string IsraelCentral = "Israel Central"; + public const string IsraelNorthwest = "Israel Northwest"; + public const string ItalyNorth = "Italy North"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string MalaysiaSouth = "Malaysia South"; + public const string MalaysiaWest = "Malaysia West"; + public const string MexicoCentral = "Mexico Central"; + public const string NewZealandNorth = "New Zealand North"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SouthCentralUS2 = "South Central US 2"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SoutheastUS = "Southeast US"; + public const string SoutheastUS3 = "Southeast US 3"; + public const string SoutheastUS5 = "Southeast US 5"; + public const string SouthIndia = "South India"; + public const string SouthwestUS = "Southwest US"; + public const string SpainCentral = "Spain Central"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string TaiwanNorth = "Taiwan North"; + public const string TaiwanNorthwest = "Taiwan Northwest"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string USSecWestCentral = "USSec West Central"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public List ExcludeRegions { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public Nullable PriorityLevel { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public abstract class ServerSideCumulativeMetrics + { + protected ServerSideCumulativeMetrics(); + public abstract ServerSideMetrics CumulativeMetrics { get; } + public abstract IReadOnlyList PartitionedMetrics { get; } + public abstract double TotalRequestCharge { get; } + } + public abstract class ServerSideMetrics + { + protected ServerSideMetrics(); + public abstract TimeSpan DocumentLoadTime { get; } + public abstract TimeSpan DocumentWriteTime { get; } + public abstract double IndexHitRatio { get; } + public abstract TimeSpan IndexLookupTime { get; } + public abstract long OutputDocumentCount { get; } + public abstract long OutputDocumentSize { get; } + public abstract TimeSpan QueryPreparationTime { get; } + public abstract long RetrievedDocumentCount { get; } + public abstract long RetrievedDocumentSize { get; } + public abstract TimeSpan RuntimeExecutionTime { get; } + public abstract TimeSpan TotalTime { get; } + public abstract TimeSpan VMExecutionTime { get; } + } + public abstract class ServerSidePartitionedMetrics + { + protected ServerSidePartitionedMetrics(); + public abstract string FeedRange { get; } + public abstract Nullable PartitionKeyRangeId { get; } + public abstract double RequestCharge { get; } + public abstract ServerSideMetrics ServerSideMetrics { get; } + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } + public enum VectorDataType + { + Float32 = 0, + Int8 = 2, + Uint8 = 1, + } + public sealed class VectorEmbeddingPolicy + { + public readonly Collection Embeddings; + public VectorEmbeddingPolicy(Collection embeddings); + } + public sealed class VectorIndexPath + { + public VectorIndexPath(); + public string Path { get; set; } + public VectorIndexType Type { get; set; } + } + public enum VectorIndexType + { + DiskANN = 1, + Flat = 0, + QuantizedFlat = 2, + } +} +namespace Microsoft.Azure.Cosmos.FaultInjection +{ + public interface IFaultInjector + { + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ComputedPropertiesDefinition + { + public T Attach(); + public ComputedPropertiesDefinition WithComputedProperty(string name, string query); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public FullTextPolicyDefinition WithFullTextPolicy(string defaultLanguage, Collection fullTextPaths); + public UniqueKeyDefinition WithUniqueKey(); + public VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(Collection embeddings); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public ComputedPropertiesDefinition WithComputedProperties(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithAvailabilityStrategy(AvailabilityStrategy strategy); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptions options); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomAccountEndpoints(IEnumerable customAccountEndpoints); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithFaultInjection(IFaultInjector faultInjector); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithPriorityLevel(PriorityLevel priorityLevel); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithSystemTextJsonSerializerOptions(JsonSerializerOptions serializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + } + public class FullTextIndexDefinition + { + public FullTextIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public FullTextIndexDefinition Path(string path); + } + public class FullTextPolicyDefinition + { + public FullTextPolicyDefinition(ContainerBuilder parent, string defaultLanguage, Collection fullTextPaths, Action attachCallback); + public ContainerBuilder Attach(); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public FullTextIndexDefinition> WithFullTextIndex(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + public VectorIndexDefinition> WithVectorIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } + public class VectorEmbeddingPolicyDefinition + { + public VectorEmbeddingPolicyDefinition(ContainerBuilder parent, Collection embeddings, Action attachCallback); + public ContainerBuilder Attach(); + } + public class VectorIndexDefinition + { + public VectorIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public VectorIndexDefinition Path(string path, VectorIndexType indexType); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static int DocumentId(this object obj); + public static bool FullTextContains(this object obj, string search); + public static bool FullTextContainsAll(this object obj, params string[] searches); + public static bool FullTextContainsAny(this object obj, params string[] searches); + public static double FullTextScore(this TSource obj, params string[] terms); + public static bool IsArray(this object obj); + public static bool IsBool(this object obj); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsNumber(this object obj); + public static bool IsObject(this object obj); + public static bool IsPrimitive(this object obj); + public static bool IsString(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static IOrderedQueryable OrderByRank(this IQueryable source, Expression> scoreFunction); + public static bool RegexMatch(this object obj, string regularExpression); + public static bool RegexMatch(this object obj, string regularExpression, string searchModifier); + public static double RRF(params double[] scoringFunctions); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static FeedIterator ToStreamIterator(this IQueryable query); + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + Upsert = (short)5, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.51.0-preview.0.txt b/Microsoft.Azure.Cosmos/contracts/API_3.51.0-preview.0.txt new file mode 100644 index 0000000000..5f11d9a9c6 --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.51.0-preview.0.txt @@ -0,0 +1,1876 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public abstract class AvailabilityStrategy + { + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep, bool enableMultiWriteRegionHedge=false); + public static AvailabilityStrategy DisabledStrategy(); + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public class ChangeFeedItem + { + public ChangeFeedItem(); + public T Current { get; set; } + public ChangeFeedMetadata Metadata { get; set; } + public T Previous { get; set; } + } + public class ChangeFeedMetadata + { + public ChangeFeedMetadata(); + public DateTime ConflictResolutionTimestamp { get; } + public bool IsTimeToLiveExpired { get; } + public long Lsn { get; } + public ChangeFeedOperationType OperationType { get; } + public long PreviousLsn { get; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode AllVersionsAndDeletes { get; } + public static ChangeFeedMode Incremental { get; } + public static ChangeFeedMode LatestVersion { get; } + } + public enum ChangeFeedOperationType + { + Create = 0, + Delete = 2, + Replace = 1, + } + public sealed class ChangeFeedPolicy + { + public ChangeFeedPolicy(); + public static TimeSpan FullFidelityNoRetention { get; } + public TimeSpan FullFidelityRetention { get; set; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract FeedRange FeedRange { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public sealed class ComputedProperty + { + public ComputedProperty(); + public string Name { get; set; } + public string Query { get; set; } + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public virtual Task DeleteAllItemsByPartitionKeyStreamAsync(PartitionKey partitionKey, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes(string processorName, Container.ChangeFeedHandler> onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> GetPartitionKeyRangesAsync(FeedRange feedRange, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task IsFeedRangePartOfAsync(FeedRange x, FeedRange y, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ChangeFeedPolicy ChangeFeedPolicy { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public Collection ComputedProperties { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public FullTextPolicy FullTextPolicy { get; set; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + public VectorEmbeddingPolicy VectorEmbeddingPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public IEnumerable AccountInitializationCustomEndpoints { get; set; } + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public CosmosClientTelemetryOptions CosmosClientTelemetryOptions { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableRemoteRegionPreferredForSessionRetry { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public IFaultInjector FaultInjector { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public Nullable PriorityLevel { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable ThroughputBucket { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public JsonSerializerOptions UseSystemTextJsonSerializerWithOptions { get; set; } + public IWebProxy WebProxy { get; set; } + } + public class CosmosClientTelemetryOptions + { + public CosmosClientTelemetryOptions(); + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public bool DisableDistributedTracing { get; set; } + public bool DisableSendingMetricsToService { get; set; } + public bool IsClientMetricsEnabled { get; set; } + public NetworkMetricsOptions NetworkMetricsOptions { get; set; } + public OperationMetricsOptions OperationMetricsOptions { get; set; } + public QueryTextMode QueryTextMode { get; set; } + } + public sealed class CosmosDbClientMetrics + { + public CosmosDbClientMetrics(); + public static class HistogramBuckets + { + public static readonly double[] RequestLatencyBuckets; + public static readonly double[] RequestUnitBuckets; + public static readonly double[] RowCountBuckets; + } + public static class NetworkMetrics + { + public const string MeterName = "Azure.Cosmos.Client.Request"; + public const string Version = "1.0.0"; + public static class Description + { + public const string BackendLatency = "Backend Latency (for direct mode)."; + public const string ChannelAquisitionLatency = "The duration of the successfully established outbound TCP connections. i.e. Channel Aquisition Time (for direct mode)."; + public const string Latency = "Duration of client requests."; + public const string ReceivedTimeLatency = "Time spent on 'Received' stage (for direct mode)."; + public const string RequestBodySize = "Size of client request body."; + public const string ResponseBodySize = "Size of client response body."; + public const string TransitTimeLatency = "Time spent on the wire (for direct mode)."; + } + public static class Name + { + public const string BackendLatency = "azure.cosmosdb.client.request.service_duration"; + public const string ChannelAquisitionLatency = "azure.cosmosdb.client.request.channel_aquisition.duration"; + public const string Latency = "azure.cosmosdb.client.request.duration"; + public const string ReceivedTimeLatency = "azure.cosmosdb.client.request.received.duration"; + public const string RequestBodySize = "azure.cosmosdb.client.request.body.size"; + public const string ResponseBodySize = "azure.cosmosdb.client.response.body.size"; + public const string TransitTimeLatency = "azure.cosmosdb.client.request.transit.duration"; + } + public static class Unit + { + public const string Bytes = "bytes"; + public const string Sec = "s"; + } + } + public static class OperationMetrics + { + public const string MeterName = "Azure.Cosmos.Client.Operation"; + public const string Version = "1.0.0"; + public static class Description + { + public const string ActiveInstances = "Number of active SDK client instances."; + public const string Latency = "Total end-to-end duration of the operation"; + public const string RequestCharge = "Total request units per operation (sum of RUs for all requested needed when processing an operation)"; + public const string RowCount = "For feed operations (query, readAll, readMany, change feed) batch operations this meter capture the actual item count in responses from the service"; + } + public static class Name + { + public const string ActiveInstances = "azure.cosmosdb.client.active_instance.count"; + public const string Latency = "db.client.operation.duration"; + public const string RequestCharge = "azure.cosmosdb.client.operation.request_charge"; + public const string RowCount = "db.client.response.returned_rows"; + } + public static class Unit + { + public const string Instance = "{instance}"; + public const string Item = "{item}"; + public const string RequestUnit = "{request_unit}"; + public const string Sec = "s"; + } + } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual ServerSideCumulativeMetrics GetQueryMetrics(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception, ICloneable + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public object Clone(); + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public abstract class CosmosLinqSerializer : CosmosSerializer + { + protected CosmosLinqSerializer(); + public abstract string SerializeMemberName(MemberInfo memberInfo); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException, ICloneable + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public object Clone(); + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public class CosmosThresholdOptions + { + public CosmosThresholdOptions(); + public TimeSpan NonPointOperationLatencyThreshold { get; set; } + public Nullable PayloadSizeThresholdInBytes { get; set; } + public TimeSpan PointOperationLatencyThreshold { get; set; } + public Nullable RequestChargeThreshold { get; set; } + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable BypassIntegratedCache { get; set; } + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public enum DistanceFunction + { + Cosine = 1, + DotProduct = 2, + Euclidean = 0, + } + public class Embedding : IEquatable + { + public Embedding(); + public VectorDataType DataType { get; set; } + public int Dimensions { get; set; } + public DistanceFunction DistanceFunction { get; set; } + public string Path { get; set; } + public bool Equals(Embedding that); + public void ValidateEmbeddingPath(); + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class FullTextIndexPath + { + public FullTextIndexPath(); + public string Path { get; set; } + } + public class FullTextPath : IEquatable + { + public FullTextPath(); + public string Language { get; set; } + public string Path { get; set; } + public bool Equals(FullTextPath that); + public void ValidateFullTextPath(); + } + public sealed class FullTextPolicy + { + public FullTextPolicy(); + public string DefaultLanguage { get; set; } + public Collection FullTextPaths { get; set; } + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection FullTextIndexes { get; set; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + public Collection VectorIndexes { get; set; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public class NetworkMetricsOptions + { + public NetworkMetricsOptions(); + public IDictionary CustomDimensions { get; set; } + public Nullable IncludeRoutingId { get; set; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public class OperationMetricsOptions + { + public OperationMetricsOptions(); + public IDictionary CustomDimensions { get; set; } + public Nullable IncludeRegion { get; set; } + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public virtual string From { get; set; } + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Move(string from, string path); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Move = 5, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public enum PriorityLevel + { + High = 1, + Low = 2, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public bool EnableOptimisticDirectExecution { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public QueryTextMode QueryTextMode { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public enum QueryTextMode + { + All = 2, + None = 0, + ParameterizedOnly = 1, + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string AustriaEast = "Austria East"; + public const string BelgiumCentral = "Belgium Central"; + public const string BleuFranceCentral = "Bleu France Central"; + public const string BleuFranceSouth = "Bleu France South"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChileCentral = "Chile Central"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string DelosCloudGermanyCentral = "Delos Cloud Germany Central"; + public const string DelosCloudGermanyNorth = "Delos Cloud Germany North"; + public const string DenmarkEast = "Denmark East"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyNorth = "Germany North"; + public const string GermanyWestCentral = "Germany West Central"; + public const string IndonesiaCentral = "Indonesia Central"; + public const string IsraelCentral = "Israel Central"; + public const string IsraelNorthwest = "Israel Northwest"; + public const string ItalyNorth = "Italy North"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string MalaysiaSouth = "Malaysia South"; + public const string MalaysiaWest = "Malaysia West"; + public const string MexicoCentral = "Mexico Central"; + public const string NewZealandNorth = "New Zealand North"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SouthCentralUS2 = "South Central US 2"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SoutheastUS = "Southeast US"; + public const string SoutheastUS3 = "Southeast US 3"; + public const string SoutheastUS5 = "Southeast US 5"; + public const string SouthIndia = "South India"; + public const string SouthwestUS = "Southwest US"; + public const string SpainCentral = "Spain Central"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string TaiwanNorth = "Taiwan North"; + public const string TaiwanNorthwest = "Taiwan Northwest"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string USSecWestCentral = "USSec West Central"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public List ExcludeRegions { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public NetworkMetricsOptions NetworkMetricsOptions { get; set; } + public OperationMetricsOptions OperationMetricsOptions { get; set; } + public Nullable PriorityLevel { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public Nullable ThroughputBucket { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public abstract class ServerSideCumulativeMetrics + { + protected ServerSideCumulativeMetrics(); + public abstract ServerSideMetrics CumulativeMetrics { get; } + public abstract IReadOnlyList PartitionedMetrics { get; } + public abstract double TotalRequestCharge { get; } + } + public abstract class ServerSideMetrics + { + protected ServerSideMetrics(); + public abstract TimeSpan DocumentLoadTime { get; } + public abstract TimeSpan DocumentWriteTime { get; } + public abstract double IndexHitRatio { get; } + public abstract TimeSpan IndexLookupTime { get; } + public abstract long OutputDocumentCount { get; } + public abstract long OutputDocumentSize { get; } + public abstract TimeSpan QueryPreparationTime { get; } + public abstract long RetrievedDocumentCount { get; } + public abstract long RetrievedDocumentSize { get; } + public abstract TimeSpan RuntimeExecutionTime { get; } + public abstract TimeSpan TotalTime { get; } + public abstract TimeSpan VMExecutionTime { get; } + } + public abstract class ServerSidePartitionedMetrics + { + protected ServerSidePartitionedMetrics(); + public abstract string FeedRange { get; } + public abstract Nullable PartitionKeyRangeId { get; } + public abstract double RequestCharge { get; } + public abstract ServerSideMetrics ServerSideMetrics { get; } + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } + public enum VectorDataType + { + Float32 = 0, + Int8 = 2, + Uint8 = 1, + } + public sealed class VectorEmbeddingPolicy + { + public readonly Collection Embeddings; + public VectorEmbeddingPolicy(Collection embeddings); + } + public sealed class VectorIndexPath + { + public VectorIndexPath(); + public int IndexingSearchListSize { get; set; } + public string Path { get; set; } + public int QuantizationByteSize { get; set; } + public VectorIndexType Type { get; set; } + public string[] VectorIndexShardKey { get; set; } + } + public enum VectorIndexType + { + DiskANN = 1, + Flat = 0, + QuantizedFlat = 2, + } +} +namespace Microsoft.Azure.Cosmos.FaultInjection +{ + public interface IFaultInjector + { + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public class ChangeFeedPolicyDefinition + { + public ContainerBuilder Attach(); + } + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ComputedPropertiesDefinition + { + public T Attach(); + public ComputedPropertiesDefinition WithComputedProperty(string name, string query); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ChangeFeedPolicyDefinition WithChangeFeedPolicy(TimeSpan retention); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public FullTextPolicyDefinition WithFullTextPolicy(string defaultLanguage, Collection fullTextPaths); + public UniqueKeyDefinition WithUniqueKey(); + public VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(Collection embeddings); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public ComputedPropertiesDefinition WithComputedProperties(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithAvailabilityStrategy(AvailabilityStrategy strategy); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptions options); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomAccountEndpoints(IEnumerable customAccountEndpoints); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithEnableRemoteRegionPreferredForSessionRetry(bool enableRemoteRegionPreferredForSessionRetry); + public CosmosClientBuilder WithFaultInjection(IFaultInjector faultInjector); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithPriorityLevel(PriorityLevel priorityLevel); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithSystemTextJsonSerializerOptions(JsonSerializerOptions serializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + public CosmosClientBuilder WithThroughputBucket(int throughputBucket); + } + public class FullTextIndexDefinition + { + public FullTextIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public FullTextIndexDefinition Path(string path); + } + public class FullTextPolicyDefinition + { + public FullTextPolicyDefinition(ContainerBuilder parent, string defaultLanguage, Collection fullTextPaths, Action attachCallback); + public ContainerBuilder Attach(); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public FullTextIndexDefinition> WithFullTextIndex(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + public VectorIndexDefinition> WithVectorIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } + public class VectorEmbeddingPolicyDefinition + { + public VectorEmbeddingPolicyDefinition(ContainerBuilder parent, Collection embeddings, Action attachCallback); + public ContainerBuilder Attach(); + } + public class VectorIndexDefinition + { + public VectorIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public VectorIndexDefinition Path(string path, VectorIndexType indexType); + public VectorIndexDefinition WithIndexingSearchListSize(int indexingSearchListSize); + public VectorIndexDefinition WithQuantizationByteSize(int quantizationByteSize); + public VectorIndexDefinition WithVectorIndexShardKey(string[] vectorIndexShardKey); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static int DocumentId(this object obj); + public static bool FullTextContains(this object obj, string search); + public static bool FullTextContainsAll(this object obj, params string[] searches); + public static bool FullTextContainsAny(this object obj, params string[] searches); + public static double FullTextScore(this TSource obj, params string[] terms); + public static bool IsArray(this object obj); + public static bool IsBool(this object obj); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsNumber(this object obj); + public static bool IsObject(this object obj); + public static bool IsPrimitive(this object obj); + public static bool IsString(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static IOrderedQueryable OrderByRank(this IQueryable source, Expression> scoreFunction); + public static bool RegexMatch(this object obj, string regularExpression); + public static bool RegexMatch(this object obj, string regularExpression, string searchModifier); + public static double RRF(params double[] scoringFunctions); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query, IDictionary namedParameters); + public static FeedIterator ToStreamIterator(this IQueryable query); + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + Upsert = (short)5, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.51.0.txt b/Microsoft.Azure.Cosmos/contracts/API_3.51.0.txt new file mode 100644 index 0000000000..2d20879087 --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.51.0.txt @@ -0,0 +1,1743 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public abstract class AvailabilityStrategy + { + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep, bool enableMultiWriteRegionHedge=false); + public static AvailabilityStrategy DisabledStrategy(); + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode Incremental { get; } + public static ChangeFeedMode LatestVersion { get; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public virtual ChangeFeedProcessorBuilder WithInMemoryLeaseContainer(); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract FeedRange FeedRange { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public sealed class ComputedProperty + { + public ComputedProperty(); + public string Name { get; set; } + public string Query { get; set; } + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public virtual Task DeleteAllItemsByPartitionKeyStreamAsync(PartitionKey partitionKey, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public Collection ComputedProperties { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public FullTextPolicy FullTextPolicy { get; set; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + public VectorEmbeddingPolicy VectorEmbeddingPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public IEnumerable AccountInitializationCustomEndpoints { get; set; } + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public CosmosClientTelemetryOptions CosmosClientTelemetryOptions { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public IFaultInjector FaultInjector { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public Nullable PriorityLevel { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public JsonSerializerOptions UseSystemTextJsonSerializerWithOptions { get; set; } + public IWebProxy WebProxy { get; set; } + } + public class CosmosClientTelemetryOptions + { + public CosmosClientTelemetryOptions(); + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public bool DisableDistributedTracing { get; set; } + public bool DisableSendingMetricsToService { get; set; } + public QueryTextMode QueryTextMode { get; set; } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual ServerSideCumulativeMetrics GetQueryMetrics(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception, ICloneable + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public object Clone(); + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public abstract class CosmosLinqSerializer : CosmosSerializer + { + protected CosmosLinqSerializer(); + public abstract string SerializeMemberName(MemberInfo memberInfo); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException, ICloneable + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public object Clone(); + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public class CosmosThresholdOptions + { + public CosmosThresholdOptions(); + public TimeSpan NonPointOperationLatencyThreshold { get; set; } + public Nullable PayloadSizeThresholdInBytes { get; set; } + public TimeSpan PointOperationLatencyThreshold { get; set; } + public Nullable RequestChargeThreshold { get; set; } + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable BypassIntegratedCache { get; set; } + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public enum DistanceFunction + { + Cosine = 1, + DotProduct = 2, + Euclidean = 0, + } + public class Embedding : IEquatable + { + public Embedding(); + public VectorDataType DataType { get; set; } + public int Dimensions { get; set; } + public DistanceFunction DistanceFunction { get; set; } + public string Path { get; set; } + public bool Equals(Embedding that); + public void ValidateEmbeddingPath(); + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class FullTextIndexPath + { + public FullTextIndexPath(); + public string Path { get; set; } + } + public class FullTextPath : IEquatable + { + public FullTextPath(); + public string Language { get; set; } + public string Path { get; set; } + public bool Equals(FullTextPath that); + public void ValidateFullTextPath(); + } + public sealed class FullTextPolicy + { + public FullTextPolicy(); + public string DefaultLanguage { get; set; } + public Collection FullTextPaths { get; set; } + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection FullTextIndexes { get; set; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + public Collection VectorIndexes { get; set; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public virtual string From { get; set; } + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Move(string from, string path); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Move = 5, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public enum PriorityLevel + { + High = 1, + Low = 2, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public bool EnableOptimisticDirectExecution { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public QueryTextMode QueryTextMode { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public enum QueryTextMode + { + All = 2, + None = 0, + ParameterizedOnly = 1, + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string AustriaEast = "Austria East"; + public const string BelgiumCentral = "Belgium Central"; + public const string BleuFranceCentral = "Bleu France Central"; + public const string BleuFranceSouth = "Bleu France South"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChileCentral = "Chile Central"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string DelosCloudGermanyCentral = "Delos Cloud Germany Central"; + public const string DelosCloudGermanyNorth = "Delos Cloud Germany North"; + public const string DenmarkEast = "Denmark East"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyNorth = "Germany North"; + public const string GermanyWestCentral = "Germany West Central"; + public const string IndonesiaCentral = "Indonesia Central"; + public const string IsraelCentral = "Israel Central"; + public const string IsraelNorthwest = "Israel Northwest"; + public const string ItalyNorth = "Italy North"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string MalaysiaSouth = "Malaysia South"; + public const string MalaysiaWest = "Malaysia West"; + public const string MexicoCentral = "Mexico Central"; + public const string NewZealandNorth = "New Zealand North"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SouthCentralUS2 = "South Central US 2"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SoutheastUS = "Southeast US"; + public const string SoutheastUS3 = "Southeast US 3"; + public const string SoutheastUS5 = "Southeast US 5"; + public const string SouthIndia = "South India"; + public const string SouthwestUS = "Southwest US"; + public const string SpainCentral = "Spain Central"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string TaiwanNorth = "Taiwan North"; + public const string TaiwanNorthwest = "Taiwan Northwest"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string USSecWestCentral = "USSec West Central"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public List ExcludeRegions { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public Nullable PriorityLevel { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public abstract class ServerSideCumulativeMetrics + { + protected ServerSideCumulativeMetrics(); + public abstract ServerSideMetrics CumulativeMetrics { get; } + public abstract IReadOnlyList PartitionedMetrics { get; } + public abstract double TotalRequestCharge { get; } + } + public abstract class ServerSideMetrics + { + protected ServerSideMetrics(); + public abstract TimeSpan DocumentLoadTime { get; } + public abstract TimeSpan DocumentWriteTime { get; } + public abstract double IndexHitRatio { get; } + public abstract TimeSpan IndexLookupTime { get; } + public abstract long OutputDocumentCount { get; } + public abstract long OutputDocumentSize { get; } + public abstract TimeSpan QueryPreparationTime { get; } + public abstract long RetrievedDocumentCount { get; } + public abstract long RetrievedDocumentSize { get; } + public abstract TimeSpan RuntimeExecutionTime { get; } + public abstract TimeSpan TotalTime { get; } + public abstract TimeSpan VMExecutionTime { get; } + } + public abstract class ServerSidePartitionedMetrics + { + protected ServerSidePartitionedMetrics(); + public abstract string FeedRange { get; } + public abstract Nullable PartitionKeyRangeId { get; } + public abstract double RequestCharge { get; } + public abstract ServerSideMetrics ServerSideMetrics { get; } + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } + public enum VectorDataType + { + Float32 = 0, + Int8 = 2, + Uint8 = 1, + } + public sealed class VectorEmbeddingPolicy + { + public readonly Collection Embeddings; + public VectorEmbeddingPolicy(Collection embeddings); + } + public sealed class VectorIndexPath + { + public VectorIndexPath(); + public string Path { get; set; } + public VectorIndexType Type { get; set; } + } + public enum VectorIndexType + { + DiskANN = 1, + Flat = 0, + QuantizedFlat = 2, + } +} +namespace Microsoft.Azure.Cosmos.FaultInjection +{ + public interface IFaultInjector + { + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ComputedPropertiesDefinition + { + public T Attach(); + public ComputedPropertiesDefinition WithComputedProperty(string name, string query); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public FullTextPolicyDefinition WithFullTextPolicy(string defaultLanguage, Collection fullTextPaths); + public UniqueKeyDefinition WithUniqueKey(); + public VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(Collection embeddings); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public ComputedPropertiesDefinition WithComputedProperties(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithAvailabilityStrategy(AvailabilityStrategy strategy); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptions options); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomAccountEndpoints(IEnumerable customAccountEndpoints); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithFaultInjection(IFaultInjector faultInjector); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithPriorityLevel(PriorityLevel priorityLevel); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithSystemTextJsonSerializerOptions(JsonSerializerOptions serializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + } + public class FullTextIndexDefinition + { + public FullTextIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public FullTextIndexDefinition Path(string path); + } + public class FullTextPolicyDefinition + { + public FullTextPolicyDefinition(ContainerBuilder parent, string defaultLanguage, Collection fullTextPaths, Action attachCallback); + public ContainerBuilder Attach(); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public FullTextIndexDefinition> WithFullTextIndex(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + public VectorIndexDefinition> WithVectorIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } + public class VectorEmbeddingPolicyDefinition + { + public VectorEmbeddingPolicyDefinition(ContainerBuilder parent, Collection embeddings, Action attachCallback); + public ContainerBuilder Attach(); + } + public class VectorIndexDefinition + { + public VectorIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public VectorIndexDefinition Path(string path, VectorIndexType indexType); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static int DocumentId(this object obj); + public static bool FullTextContains(this object obj, string search); + public static bool FullTextContainsAll(this object obj, params string[] searches); + public static bool FullTextContainsAny(this object obj, params string[] searches); + public static double FullTextScore(this TSource obj, params string[] terms); + public static bool IsArray(this object obj); + public static bool IsBool(this object obj); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsNumber(this object obj); + public static bool IsObject(this object obj); + public static bool IsPrimitive(this object obj); + public static bool IsString(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static IOrderedQueryable OrderByRank(this IQueryable source, Expression> scoreFunction); + public static bool RegexMatch(this object obj, string regularExpression); + public static bool RegexMatch(this object obj, string regularExpression, string searchModifier); + public static double RRF(params double[] scoringFunctions); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static FeedIterator ToStreamIterator(this IQueryable query); + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + Upsert = (short)5, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.52.0-preview.0.txt b/Microsoft.Azure.Cosmos/contracts/API_3.52.0-preview.0.txt new file mode 100644 index 0000000000..2be43aec62 --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.52.0-preview.0.txt @@ -0,0 +1,1877 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public abstract class AvailabilityStrategy + { + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep, bool enableMultiWriteRegionHedge=false); + public static AvailabilityStrategy DisabledStrategy(); + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public class ChangeFeedItem + { + public ChangeFeedItem(); + public T Current { get; set; } + public ChangeFeedMetadata Metadata { get; set; } + public T Previous { get; set; } + } + public class ChangeFeedMetadata + { + public ChangeFeedMetadata(); + public DateTime ConflictResolutionTimestamp { get; } + public bool IsTimeToLiveExpired { get; } + public long Lsn { get; } + public ChangeFeedOperationType OperationType { get; } + public long PreviousLsn { get; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode AllVersionsAndDeletes { get; } + public static ChangeFeedMode Incremental { get; } + public static ChangeFeedMode LatestVersion { get; } + } + public enum ChangeFeedOperationType + { + Create = 0, + Delete = 2, + Replace = 1, + } + public sealed class ChangeFeedPolicy + { + public ChangeFeedPolicy(); + public static TimeSpan FullFidelityNoRetention { get; } + public TimeSpan FullFidelityRetention { get; set; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public virtual ChangeFeedProcessorBuilder WithInMemoryLeaseContainer(); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract FeedRange FeedRange { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public sealed class ComputedProperty + { + public ComputedProperty(); + public string Name { get; set; } + public string Query { get; set; } + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public virtual Task DeleteAllItemsByPartitionKeyStreamAsync(PartitionKey partitionKey, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes(string processorName, Container.ChangeFeedHandler> onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> GetPartitionKeyRangesAsync(FeedRange feedRange, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task IsFeedRangePartOfAsync(FeedRange x, FeedRange y, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ChangeFeedPolicy ChangeFeedPolicy { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public Collection ComputedProperties { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public FullTextPolicy FullTextPolicy { get; set; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + public VectorEmbeddingPolicy VectorEmbeddingPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public IEnumerable AccountInitializationCustomEndpoints { get; set; } + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public CosmosClientTelemetryOptions CosmosClientTelemetryOptions { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableRemoteRegionPreferredForSessionRetry { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public IFaultInjector FaultInjector { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public Nullable PriorityLevel { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable ThroughputBucket { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public JsonSerializerOptions UseSystemTextJsonSerializerWithOptions { get; set; } + public IWebProxy WebProxy { get; set; } + } + public class CosmosClientTelemetryOptions + { + public CosmosClientTelemetryOptions(); + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public bool DisableDistributedTracing { get; set; } + public bool DisableSendingMetricsToService { get; set; } + public bool IsClientMetricsEnabled { get; set; } + public NetworkMetricsOptions NetworkMetricsOptions { get; set; } + public OperationMetricsOptions OperationMetricsOptions { get; set; } + public QueryTextMode QueryTextMode { get; set; } + } + public sealed class CosmosDbClientMetrics + { + public CosmosDbClientMetrics(); + public static class HistogramBuckets + { + public static readonly double[] RequestLatencyBuckets; + public static readonly double[] RequestUnitBuckets; + public static readonly double[] RowCountBuckets; + } + public static class NetworkMetrics + { + public const string MeterName = "Azure.Cosmos.Client.Request"; + public const string Version = "1.0.0"; + public static class Description + { + public const string BackendLatency = "Backend Latency (for direct mode)."; + public const string ChannelAquisitionLatency = "The duration of the successfully established outbound TCP connections. i.e. Channel Aquisition Time (for direct mode)."; + public const string Latency = "Duration of client requests."; + public const string ReceivedTimeLatency = "Time spent on 'Received' stage (for direct mode)."; + public const string RequestBodySize = "Size of client request body."; + public const string ResponseBodySize = "Size of client response body."; + public const string TransitTimeLatency = "Time spent on the wire (for direct mode)."; + } + public static class Name + { + public const string BackendLatency = "azure.cosmosdb.client.request.service_duration"; + public const string ChannelAquisitionLatency = "azure.cosmosdb.client.request.channel_aquisition.duration"; + public const string Latency = "azure.cosmosdb.client.request.duration"; + public const string ReceivedTimeLatency = "azure.cosmosdb.client.request.received.duration"; + public const string RequestBodySize = "azure.cosmosdb.client.request.body.size"; + public const string ResponseBodySize = "azure.cosmosdb.client.response.body.size"; + public const string TransitTimeLatency = "azure.cosmosdb.client.request.transit.duration"; + } + public static class Unit + { + public const string Bytes = "bytes"; + public const string Sec = "s"; + } + } + public static class OperationMetrics + { + public const string MeterName = "Azure.Cosmos.Client.Operation"; + public const string Version = "1.0.0"; + public static class Description + { + public const string ActiveInstances = "Number of active SDK client instances."; + public const string Latency = "Total end-to-end duration of the operation"; + public const string RequestCharge = "Total request units per operation (sum of RUs for all requested needed when processing an operation)"; + public const string RowCount = "For feed operations (query, readAll, readMany, change feed) batch operations this meter capture the actual item count in responses from the service"; + } + public static class Name + { + public const string ActiveInstances = "azure.cosmosdb.client.active_instance.count"; + public const string Latency = "db.client.operation.duration"; + public const string RequestCharge = "azure.cosmosdb.client.operation.request_charge"; + public const string RowCount = "db.client.response.returned_rows"; + } + public static class Unit + { + public const string Instance = "{instance}"; + public const string Item = "{item}"; + public const string RequestUnit = "{request_unit}"; + public const string Sec = "s"; + } + } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual ServerSideCumulativeMetrics GetQueryMetrics(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception, ICloneable + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public object Clone(); + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public abstract class CosmosLinqSerializer : CosmosSerializer + { + protected CosmosLinqSerializer(); + public abstract string SerializeMemberName(MemberInfo memberInfo); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException, ICloneable + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public object Clone(); + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public class CosmosThresholdOptions + { + public CosmosThresholdOptions(); + public TimeSpan NonPointOperationLatencyThreshold { get; set; } + public Nullable PayloadSizeThresholdInBytes { get; set; } + public TimeSpan PointOperationLatencyThreshold { get; set; } + public Nullable RequestChargeThreshold { get; set; } + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable BypassIntegratedCache { get; set; } + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public enum DistanceFunction + { + Cosine = 1, + DotProduct = 2, + Euclidean = 0, + } + public class Embedding : IEquatable + { + public Embedding(); + public VectorDataType DataType { get; set; } + public int Dimensions { get; set; } + public DistanceFunction DistanceFunction { get; set; } + public string Path { get; set; } + public bool Equals(Embedding that); + public void ValidateEmbeddingPath(); + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class FullTextIndexPath + { + public FullTextIndexPath(); + public string Path { get; set; } + } + public class FullTextPath : IEquatable + { + public FullTextPath(); + public string Language { get; set; } + public string Path { get; set; } + public bool Equals(FullTextPath that); + public void ValidateFullTextPath(); + } + public sealed class FullTextPolicy + { + public FullTextPolicy(); + public string DefaultLanguage { get; set; } + public Collection FullTextPaths { get; set; } + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection FullTextIndexes { get; set; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + public Collection VectorIndexes { get; set; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public class NetworkMetricsOptions + { + public NetworkMetricsOptions(); + public IDictionary CustomDimensions { get; set; } + public Nullable IncludeRoutingId { get; set; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public class OperationMetricsOptions + { + public OperationMetricsOptions(); + public IDictionary CustomDimensions { get; set; } + public Nullable IncludeRegion { get; set; } + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public virtual string From { get; set; } + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Move(string from, string path); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Move = 5, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public enum PriorityLevel + { + High = 1, + Low = 2, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public bool EnableOptimisticDirectExecution { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public QueryTextMode QueryTextMode { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public enum QueryTextMode + { + All = 2, + None = 0, + ParameterizedOnly = 1, + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string AustriaEast = "Austria East"; + public const string BelgiumCentral = "Belgium Central"; + public const string BleuFranceCentral = "Bleu France Central"; + public const string BleuFranceSouth = "Bleu France South"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChileCentral = "Chile Central"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string DelosCloudGermanyCentral = "Delos Cloud Germany Central"; + public const string DelosCloudGermanyNorth = "Delos Cloud Germany North"; + public const string DenmarkEast = "Denmark East"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyNorth = "Germany North"; + public const string GermanyWestCentral = "Germany West Central"; + public const string IndonesiaCentral = "Indonesia Central"; + public const string IsraelCentral = "Israel Central"; + public const string IsraelNorthwest = "Israel Northwest"; + public const string ItalyNorth = "Italy North"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string MalaysiaSouth = "Malaysia South"; + public const string MalaysiaWest = "Malaysia West"; + public const string MexicoCentral = "Mexico Central"; + public const string NewZealandNorth = "New Zealand North"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SouthCentralUS2 = "South Central US 2"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SoutheastUS = "Southeast US"; + public const string SoutheastUS3 = "Southeast US 3"; + public const string SoutheastUS5 = "Southeast US 5"; + public const string SouthIndia = "South India"; + public const string SouthwestUS = "Southwest US"; + public const string SpainCentral = "Spain Central"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string TaiwanNorth = "Taiwan North"; + public const string TaiwanNorthwest = "Taiwan Northwest"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string USSecWestCentral = "USSec West Central"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public List ExcludeRegions { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public NetworkMetricsOptions NetworkMetricsOptions { get; set; } + public OperationMetricsOptions OperationMetricsOptions { get; set; } + public Nullable PriorityLevel { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public Nullable ThroughputBucket { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public abstract class ServerSideCumulativeMetrics + { + protected ServerSideCumulativeMetrics(); + public abstract ServerSideMetrics CumulativeMetrics { get; } + public abstract IReadOnlyList PartitionedMetrics { get; } + public abstract double TotalRequestCharge { get; } + } + public abstract class ServerSideMetrics + { + protected ServerSideMetrics(); + public abstract TimeSpan DocumentLoadTime { get; } + public abstract TimeSpan DocumentWriteTime { get; } + public abstract double IndexHitRatio { get; } + public abstract TimeSpan IndexLookupTime { get; } + public abstract long OutputDocumentCount { get; } + public abstract long OutputDocumentSize { get; } + public abstract TimeSpan QueryPreparationTime { get; } + public abstract long RetrievedDocumentCount { get; } + public abstract long RetrievedDocumentSize { get; } + public abstract TimeSpan RuntimeExecutionTime { get; } + public abstract TimeSpan TotalTime { get; } + public abstract TimeSpan VMExecutionTime { get; } + } + public abstract class ServerSidePartitionedMetrics + { + protected ServerSidePartitionedMetrics(); + public abstract string FeedRange { get; } + public abstract Nullable PartitionKeyRangeId { get; } + public abstract double RequestCharge { get; } + public abstract ServerSideMetrics ServerSideMetrics { get; } + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } + public enum VectorDataType + { + Float32 = 0, + Int8 = 2, + Uint8 = 1, + } + public sealed class VectorEmbeddingPolicy + { + public readonly Collection Embeddings; + public VectorEmbeddingPolicy(Collection embeddings); + } + public sealed class VectorIndexPath + { + public VectorIndexPath(); + public int IndexingSearchListSize { get; set; } + public string Path { get; set; } + public int QuantizationByteSize { get; set; } + public VectorIndexType Type { get; set; } + public string[] VectorIndexShardKey { get; set; } + } + public enum VectorIndexType + { + DiskANN = 1, + Flat = 0, + QuantizedFlat = 2, + } +} +namespace Microsoft.Azure.Cosmos.FaultInjection +{ + public interface IFaultInjector + { + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public class ChangeFeedPolicyDefinition + { + public ContainerBuilder Attach(); + } + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ComputedPropertiesDefinition + { + public T Attach(); + public ComputedPropertiesDefinition WithComputedProperty(string name, string query); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ChangeFeedPolicyDefinition WithChangeFeedPolicy(TimeSpan retention); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public FullTextPolicyDefinition WithFullTextPolicy(string defaultLanguage, Collection fullTextPaths); + public UniqueKeyDefinition WithUniqueKey(); + public VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(Collection embeddings); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public ComputedPropertiesDefinition WithComputedProperties(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithAvailabilityStrategy(AvailabilityStrategy strategy); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptions options); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomAccountEndpoints(IEnumerable customAccountEndpoints); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithEnableRemoteRegionPreferredForSessionRetry(bool enableRemoteRegionPreferredForSessionRetry); + public CosmosClientBuilder WithFaultInjection(IFaultInjector faultInjector); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithPriorityLevel(PriorityLevel priorityLevel); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithSystemTextJsonSerializerOptions(JsonSerializerOptions serializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + public CosmosClientBuilder WithThroughputBucket(int throughputBucket); + } + public class FullTextIndexDefinition + { + public FullTextIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public FullTextIndexDefinition Path(string path); + } + public class FullTextPolicyDefinition + { + public FullTextPolicyDefinition(ContainerBuilder parent, string defaultLanguage, Collection fullTextPaths, Action attachCallback); + public ContainerBuilder Attach(); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public FullTextIndexDefinition> WithFullTextIndex(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + public VectorIndexDefinition> WithVectorIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } + public class VectorEmbeddingPolicyDefinition + { + public VectorEmbeddingPolicyDefinition(ContainerBuilder parent, Collection embeddings, Action attachCallback); + public ContainerBuilder Attach(); + } + public class VectorIndexDefinition + { + public VectorIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public VectorIndexDefinition Path(string path, VectorIndexType indexType); + public VectorIndexDefinition WithIndexingSearchListSize(int indexingSearchListSize); + public VectorIndexDefinition WithQuantizationByteSize(int quantizationByteSize); + public VectorIndexDefinition WithVectorIndexShardKey(string[] vectorIndexShardKey); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static int DocumentId(this object obj); + public static bool FullTextContains(this object obj, string search); + public static bool FullTextContainsAll(this object obj, params string[] searches); + public static bool FullTextContainsAny(this object obj, params string[] searches); + public static double FullTextScore(this TSource obj, params string[] terms); + public static bool IsArray(this object obj); + public static bool IsBool(this object obj); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsNumber(this object obj); + public static bool IsObject(this object obj); + public static bool IsPrimitive(this object obj); + public static bool IsString(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static IOrderedQueryable OrderByRank(this IQueryable source, Expression> scoreFunction); + public static bool RegexMatch(this object obj, string regularExpression); + public static bool RegexMatch(this object obj, string regularExpression, string searchModifier); + public static double RRF(params double[] scoringFunctions); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query, IDictionary namedParameters); + public static FeedIterator ToStreamIterator(this IQueryable query); + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + Upsert = (short)5, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.52.0.txt b/Microsoft.Azure.Cosmos/contracts/API_3.52.0.txt new file mode 100644 index 0000000000..ccd2d98ebe --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.52.0.txt @@ -0,0 +1,1756 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public abstract class AvailabilityStrategy + { + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep, bool enableMultiWriteRegionHedge=false); + public static AvailabilityStrategy DisabledStrategy(); + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode Incremental { get; } + public static ChangeFeedMode LatestVersion { get; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public virtual ChangeFeedProcessorBuilder WithInMemoryLeaseContainer(); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract FeedRange FeedRange { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public sealed class ComputedProperty + { + public ComputedProperty(); + public string Name { get; set; } + public string Query { get; set; } + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public virtual Task DeleteAllItemsByPartitionKeyStreamAsync(PartitionKey partitionKey, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public Collection ComputedProperties { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public FullTextPolicy FullTextPolicy { get; set; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + public VectorEmbeddingPolicy VectorEmbeddingPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public IEnumerable AccountInitializationCustomEndpoints { get; set; } + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public CosmosClientTelemetryOptions CosmosClientTelemetryOptions { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public IFaultInjector FaultInjector { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public Nullable PriorityLevel { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public JsonSerializerOptions UseSystemTextJsonSerializerWithOptions { get; set; } + public IWebProxy WebProxy { get; set; } + } + public class CosmosClientTelemetryOptions + { + public CosmosClientTelemetryOptions(); + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public bool DisableDistributedTracing { get; set; } + public bool DisableSendingMetricsToService { get; set; } + public QueryTextMode QueryTextMode { get; set; } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual ServerSideCumulativeMetrics GetQueryMetrics(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception, ICloneable + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public object Clone(); + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public abstract class CosmosLinqSerializer : CosmosSerializer + { + protected CosmosLinqSerializer(); + public abstract string SerializeMemberName(MemberInfo memberInfo); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException, ICloneable + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public object Clone(); + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public class CosmosThresholdOptions + { + public CosmosThresholdOptions(); + public TimeSpan NonPointOperationLatencyThreshold { get; set; } + public Nullable PayloadSizeThresholdInBytes { get; set; } + public TimeSpan PointOperationLatencyThreshold { get; set; } + public Nullable RequestChargeThreshold { get; set; } + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable BypassIntegratedCache { get; set; } + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public enum DistanceFunction + { + Cosine = 1, + DotProduct = 2, + Euclidean = 0, + } + public class Embedding : IEquatable + { + public Embedding(); + public VectorDataType DataType { get; set; } + public int Dimensions { get; set; } + public DistanceFunction DistanceFunction { get; set; } + public string Path { get; set; } + public bool Equals(Embedding that); + public void ValidateEmbeddingPath(); + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public virtual string QueryAdvice { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class FullTextIndexPath + { + public FullTextIndexPath(); + public string Path { get; set; } + } + public class FullTextPath : IEquatable + { + public FullTextPath(); + public string Language { get; set; } + public string Path { get; set; } + public bool Equals(FullTextPath that); + public void ValidateFullTextPath(); + } + public sealed class FullTextPolicy + { + public FullTextPolicy(); + public string DefaultLanguage { get; set; } + public Collection FullTextPaths { get; set; } + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection FullTextIndexes { get; set; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + public Collection VectorIndexes { get; set; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public virtual string From { get; set; } + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Move(string from, string path); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Move = 5, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public enum PriorityLevel + { + High = 1, + Low = 2, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public bool EnableOptimisticDirectExecution { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public Nullable PopulateQueryAdvice { get; set; } + public QueryTextMode QueryTextMode { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public enum QueryTextMode + { + All = 2, + None = 0, + ParameterizedOnly = 1, + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string AustriaEast = "Austria East"; + public const string BelgiumCentral = "Belgium Central"; + public const string BleuFranceCentral = "Bleu France Central"; + public const string BleuFranceSouth = "Bleu France South"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChileCentral = "Chile Central"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string DelosCloudGermanyCentral = "Delos Cloud Germany Central"; + public const string DelosCloudGermanyNorth = "Delos Cloud Germany North"; + public const string DenmarkEast = "Denmark East"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUS3 = "East US 3"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyNorth = "Germany North"; + public const string GermanyWestCentral = "Germany West Central"; + public const string IndonesiaCentral = "Indonesia Central"; + public const string IsraelCentral = "Israel Central"; + public const string IsraelNorthwest = "Israel Northwest"; + public const string ItalyNorth = "Italy North"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string MalaysiaSouth = "Malaysia South"; + public const string MalaysiaWest = "Malaysia West"; + public const string MexicoCentral = "Mexico Central"; + public const string NewZealandNorth = "New Zealand North"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SouthCentralUS2 = "South Central US 2"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SoutheastUS = "Southeast US"; + public const string SoutheastUS3 = "Southeast US 3"; + public const string SoutheastUS5 = "Southeast US 5"; + public const string SouthIndia = "South India"; + public const string SouthwestUS = "Southwest US"; + public const string SpainCentral = "Spain Central"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string TaiwanNorth = "Taiwan North"; + public const string TaiwanNorthwest = "Taiwan Northwest"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string USSecWestCentral = "USSec West Central"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public List ExcludeRegions { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public Nullable PriorityLevel { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public abstract class ServerSideCumulativeMetrics + { + protected ServerSideCumulativeMetrics(); + public abstract ServerSideMetrics CumulativeMetrics { get; } + public abstract IReadOnlyList PartitionedMetrics { get; } + public abstract double TotalRequestCharge { get; } + } + public abstract class ServerSideMetrics + { + protected ServerSideMetrics(); + public abstract TimeSpan DocumentLoadTime { get; } + public abstract TimeSpan DocumentWriteTime { get; } + public abstract double IndexHitRatio { get; } + public abstract TimeSpan IndexLookupTime { get; } + public abstract long OutputDocumentCount { get; } + public abstract long OutputDocumentSize { get; } + public abstract TimeSpan QueryPreparationTime { get; } + public abstract long RetrievedDocumentCount { get; } + public abstract long RetrievedDocumentSize { get; } + public abstract TimeSpan RuntimeExecutionTime { get; } + public abstract TimeSpan TotalTime { get; } + public abstract TimeSpan VMExecutionTime { get; } + } + public abstract class ServerSidePartitionedMetrics + { + protected ServerSidePartitionedMetrics(); + public abstract string FeedRange { get; } + public abstract Nullable PartitionKeyRangeId { get; } + public abstract double RequestCharge { get; } + public abstract ServerSideMetrics ServerSideMetrics { get; } + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } + public enum VectorDataType + { + Float32 = 0, + Int8 = 2, + Uint8 = 1, + } + public sealed class VectorEmbeddingPolicy + { + public readonly Collection Embeddings; + public VectorEmbeddingPolicy(Collection embeddings); + } + public sealed class VectorIndexPath + { + public VectorIndexPath(); + public string Path { get; set; } + public VectorIndexType Type { get; set; } + } + public enum VectorIndexType + { + DiskANN = 1, + Flat = 0, + QuantizedFlat = 2, + } +} +namespace Microsoft.Azure.Cosmos.FaultInjection +{ + public interface IFaultInjector + { + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ComputedPropertiesDefinition + { + public T Attach(); + public ComputedPropertiesDefinition WithComputedProperty(string name, string query); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public FullTextPolicyDefinition WithFullTextPolicy(string defaultLanguage, Collection fullTextPaths); + public UniqueKeyDefinition WithUniqueKey(); + public VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(Collection embeddings); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public ComputedPropertiesDefinition WithComputedProperties(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithAvailabilityStrategy(AvailabilityStrategy strategy); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptions options); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomAccountEndpoints(IEnumerable customAccountEndpoints); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithFaultInjection(IFaultInjector faultInjector); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithPriorityLevel(PriorityLevel priorityLevel); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithSystemTextJsonSerializerOptions(JsonSerializerOptions serializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + } + public class FullTextIndexDefinition + { + public FullTextIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public FullTextIndexDefinition Path(string path); + } + public class FullTextPolicyDefinition + { + public FullTextPolicyDefinition(ContainerBuilder parent, string defaultLanguage, Collection fullTextPaths, Action attachCallback); + public ContainerBuilder Attach(); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public FullTextIndexDefinition> WithFullTextIndex(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + public VectorIndexDefinition> WithVectorIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } + public class VectorEmbeddingPolicyDefinition + { + public VectorEmbeddingPolicyDefinition(ContainerBuilder parent, Collection embeddings, Action attachCallback); + public ContainerBuilder Attach(); + } + public class VectorIndexDefinition + { + public VectorIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public VectorIndexDefinition Path(string path, VectorIndexType indexType); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static int DocumentId(this object obj); + public static bool FullTextContains(this object obj, string search); + public static bool FullTextContainsAll(this object obj, params string[] searches); + public static bool FullTextContainsAny(this object obj, params string[] searches); + public static double FullTextScore(this TSource obj, params string[] terms); + public static bool IsArray(this object obj); + public static bool IsBool(this object obj); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsNumber(this object obj); + public static bool IsObject(this object obj); + public static bool IsPrimitive(this object obj); + public static bool IsString(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static IOrderedQueryable OrderByRank(this IQueryable source, Expression> scoreFunction); + public static bool RegexMatch(this object obj, string regularExpression); + public static bool RegexMatch(this object obj, string regularExpression, string searchModifier); + public static double RRF(params double[] scoringFunctions); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static FeedIterator ToStreamIterator(this IQueryable query); + public static double VectorDistance(this byte[] vector1, byte[] vector2, bool isBruteForce, CosmosLinqExtensions.VectorDistanceOptions options); + public static double VectorDistance(this sbyte[] vector1, sbyte[] vector2, bool isBruteForce, CosmosLinqExtensions.VectorDistanceOptions options); + public static double VectorDistance(this float[] vector1, float[] vector2, bool isBruteForce, CosmosLinqExtensions.VectorDistanceOptions options); + public sealed class VectorDistanceOptions + { + public VectorDistanceOptions(); + public Nullable DataType { get; set; } + public Nullable DistanceFunction { get; set; } + public Nullable SearchListSizeMultiplier { get; set; } + } + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + Upsert = (short)5, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.52.1.txt b/Microsoft.Azure.Cosmos/contracts/API_3.52.1.txt new file mode 100644 index 0000000000..ccd2d98ebe --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.52.1.txt @@ -0,0 +1,1756 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public abstract class AvailabilityStrategy + { + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep, bool enableMultiWriteRegionHedge=false); + public static AvailabilityStrategy DisabledStrategy(); + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode Incremental { get; } + public static ChangeFeedMode LatestVersion { get; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public virtual ChangeFeedProcessorBuilder WithInMemoryLeaseContainer(); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract FeedRange FeedRange { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public sealed class ComputedProperty + { + public ComputedProperty(); + public string Name { get; set; } + public string Query { get; set; } + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public virtual Task DeleteAllItemsByPartitionKeyStreamAsync(PartitionKey partitionKey, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public Collection ComputedProperties { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public FullTextPolicy FullTextPolicy { get; set; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + public VectorEmbeddingPolicy VectorEmbeddingPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public IEnumerable AccountInitializationCustomEndpoints { get; set; } + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public CosmosClientTelemetryOptions CosmosClientTelemetryOptions { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public IFaultInjector FaultInjector { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public Nullable PriorityLevel { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public JsonSerializerOptions UseSystemTextJsonSerializerWithOptions { get; set; } + public IWebProxy WebProxy { get; set; } + } + public class CosmosClientTelemetryOptions + { + public CosmosClientTelemetryOptions(); + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public bool DisableDistributedTracing { get; set; } + public bool DisableSendingMetricsToService { get; set; } + public QueryTextMode QueryTextMode { get; set; } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual ServerSideCumulativeMetrics GetQueryMetrics(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception, ICloneable + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public object Clone(); + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public abstract class CosmosLinqSerializer : CosmosSerializer + { + protected CosmosLinqSerializer(); + public abstract string SerializeMemberName(MemberInfo memberInfo); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException, ICloneable + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public object Clone(); + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public class CosmosThresholdOptions + { + public CosmosThresholdOptions(); + public TimeSpan NonPointOperationLatencyThreshold { get; set; } + public Nullable PayloadSizeThresholdInBytes { get; set; } + public TimeSpan PointOperationLatencyThreshold { get; set; } + public Nullable RequestChargeThreshold { get; set; } + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable BypassIntegratedCache { get; set; } + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public enum DistanceFunction + { + Cosine = 1, + DotProduct = 2, + Euclidean = 0, + } + public class Embedding : IEquatable + { + public Embedding(); + public VectorDataType DataType { get; set; } + public int Dimensions { get; set; } + public DistanceFunction DistanceFunction { get; set; } + public string Path { get; set; } + public bool Equals(Embedding that); + public void ValidateEmbeddingPath(); + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public virtual string QueryAdvice { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class FullTextIndexPath + { + public FullTextIndexPath(); + public string Path { get; set; } + } + public class FullTextPath : IEquatable + { + public FullTextPath(); + public string Language { get; set; } + public string Path { get; set; } + public bool Equals(FullTextPath that); + public void ValidateFullTextPath(); + } + public sealed class FullTextPolicy + { + public FullTextPolicy(); + public string DefaultLanguage { get; set; } + public Collection FullTextPaths { get; set; } + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection FullTextIndexes { get; set; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + public Collection VectorIndexes { get; set; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public virtual string From { get; set; } + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Move(string from, string path); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Move = 5, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public enum PriorityLevel + { + High = 1, + Low = 2, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public bool EnableOptimisticDirectExecution { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public Nullable PopulateQueryAdvice { get; set; } + public QueryTextMode QueryTextMode { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public enum QueryTextMode + { + All = 2, + None = 0, + ParameterizedOnly = 1, + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string AustriaEast = "Austria East"; + public const string BelgiumCentral = "Belgium Central"; + public const string BleuFranceCentral = "Bleu France Central"; + public const string BleuFranceSouth = "Bleu France South"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChileCentral = "Chile Central"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string DelosCloudGermanyCentral = "Delos Cloud Germany Central"; + public const string DelosCloudGermanyNorth = "Delos Cloud Germany North"; + public const string DenmarkEast = "Denmark East"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUS3 = "East US 3"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyNorth = "Germany North"; + public const string GermanyWestCentral = "Germany West Central"; + public const string IndonesiaCentral = "Indonesia Central"; + public const string IsraelCentral = "Israel Central"; + public const string IsraelNorthwest = "Israel Northwest"; + public const string ItalyNorth = "Italy North"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string MalaysiaSouth = "Malaysia South"; + public const string MalaysiaWest = "Malaysia West"; + public const string MexicoCentral = "Mexico Central"; + public const string NewZealandNorth = "New Zealand North"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SouthCentralUS2 = "South Central US 2"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SoutheastUS = "Southeast US"; + public const string SoutheastUS3 = "Southeast US 3"; + public const string SoutheastUS5 = "Southeast US 5"; + public const string SouthIndia = "South India"; + public const string SouthwestUS = "Southwest US"; + public const string SpainCentral = "Spain Central"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string TaiwanNorth = "Taiwan North"; + public const string TaiwanNorthwest = "Taiwan Northwest"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string USSecWestCentral = "USSec West Central"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public List ExcludeRegions { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public Nullable PriorityLevel { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public abstract class ServerSideCumulativeMetrics + { + protected ServerSideCumulativeMetrics(); + public abstract ServerSideMetrics CumulativeMetrics { get; } + public abstract IReadOnlyList PartitionedMetrics { get; } + public abstract double TotalRequestCharge { get; } + } + public abstract class ServerSideMetrics + { + protected ServerSideMetrics(); + public abstract TimeSpan DocumentLoadTime { get; } + public abstract TimeSpan DocumentWriteTime { get; } + public abstract double IndexHitRatio { get; } + public abstract TimeSpan IndexLookupTime { get; } + public abstract long OutputDocumentCount { get; } + public abstract long OutputDocumentSize { get; } + public abstract TimeSpan QueryPreparationTime { get; } + public abstract long RetrievedDocumentCount { get; } + public abstract long RetrievedDocumentSize { get; } + public abstract TimeSpan RuntimeExecutionTime { get; } + public abstract TimeSpan TotalTime { get; } + public abstract TimeSpan VMExecutionTime { get; } + } + public abstract class ServerSidePartitionedMetrics + { + protected ServerSidePartitionedMetrics(); + public abstract string FeedRange { get; } + public abstract Nullable PartitionKeyRangeId { get; } + public abstract double RequestCharge { get; } + public abstract ServerSideMetrics ServerSideMetrics { get; } + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } + public enum VectorDataType + { + Float32 = 0, + Int8 = 2, + Uint8 = 1, + } + public sealed class VectorEmbeddingPolicy + { + public readonly Collection Embeddings; + public VectorEmbeddingPolicy(Collection embeddings); + } + public sealed class VectorIndexPath + { + public VectorIndexPath(); + public string Path { get; set; } + public VectorIndexType Type { get; set; } + } + public enum VectorIndexType + { + DiskANN = 1, + Flat = 0, + QuantizedFlat = 2, + } +} +namespace Microsoft.Azure.Cosmos.FaultInjection +{ + public interface IFaultInjector + { + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ComputedPropertiesDefinition + { + public T Attach(); + public ComputedPropertiesDefinition WithComputedProperty(string name, string query); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public FullTextPolicyDefinition WithFullTextPolicy(string defaultLanguage, Collection fullTextPaths); + public UniqueKeyDefinition WithUniqueKey(); + public VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(Collection embeddings); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public ComputedPropertiesDefinition WithComputedProperties(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithAvailabilityStrategy(AvailabilityStrategy strategy); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptions options); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomAccountEndpoints(IEnumerable customAccountEndpoints); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithFaultInjection(IFaultInjector faultInjector); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithPriorityLevel(PriorityLevel priorityLevel); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithSystemTextJsonSerializerOptions(JsonSerializerOptions serializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + } + public class FullTextIndexDefinition + { + public FullTextIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public FullTextIndexDefinition Path(string path); + } + public class FullTextPolicyDefinition + { + public FullTextPolicyDefinition(ContainerBuilder parent, string defaultLanguage, Collection fullTextPaths, Action attachCallback); + public ContainerBuilder Attach(); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public FullTextIndexDefinition> WithFullTextIndex(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + public VectorIndexDefinition> WithVectorIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } + public class VectorEmbeddingPolicyDefinition + { + public VectorEmbeddingPolicyDefinition(ContainerBuilder parent, Collection embeddings, Action attachCallback); + public ContainerBuilder Attach(); + } + public class VectorIndexDefinition + { + public VectorIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public VectorIndexDefinition Path(string path, VectorIndexType indexType); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static int DocumentId(this object obj); + public static bool FullTextContains(this object obj, string search); + public static bool FullTextContainsAll(this object obj, params string[] searches); + public static bool FullTextContainsAny(this object obj, params string[] searches); + public static double FullTextScore(this TSource obj, params string[] terms); + public static bool IsArray(this object obj); + public static bool IsBool(this object obj); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsNumber(this object obj); + public static bool IsObject(this object obj); + public static bool IsPrimitive(this object obj); + public static bool IsString(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static IOrderedQueryable OrderByRank(this IQueryable source, Expression> scoreFunction); + public static bool RegexMatch(this object obj, string regularExpression); + public static bool RegexMatch(this object obj, string regularExpression, string searchModifier); + public static double RRF(params double[] scoringFunctions); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static FeedIterator ToStreamIterator(this IQueryable query); + public static double VectorDistance(this byte[] vector1, byte[] vector2, bool isBruteForce, CosmosLinqExtensions.VectorDistanceOptions options); + public static double VectorDistance(this sbyte[] vector1, sbyte[] vector2, bool isBruteForce, CosmosLinqExtensions.VectorDistanceOptions options); + public static double VectorDistance(this float[] vector1, float[] vector2, bool isBruteForce, CosmosLinqExtensions.VectorDistanceOptions options); + public sealed class VectorDistanceOptions + { + public VectorDistanceOptions(); + public Nullable DataType { get; set; } + public Nullable DistanceFunction { get; set; } + public Nullable SearchListSizeMultiplier { get; set; } + } + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + Upsert = (short)5, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.53.0-preview.0.txt b/Microsoft.Azure.Cosmos/contracts/API_3.53.0-preview.0.txt new file mode 100644 index 0000000000..208d2599cf --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.53.0-preview.0.txt @@ -0,0 +1,1890 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public abstract class AvailabilityStrategy + { + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep, bool enableMultiWriteRegionHedge=false); + public static AvailabilityStrategy DisabledStrategy(); + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public class ChangeFeedItem + { + public ChangeFeedItem(); + public T Current { get; set; } + public ChangeFeedMetadata Metadata { get; set; } + public T Previous { get; set; } + } + public class ChangeFeedMetadata + { + public ChangeFeedMetadata(); + public DateTime ConflictResolutionTimestamp { get; } + public bool IsTimeToLiveExpired { get; } + public long Lsn { get; } + public ChangeFeedOperationType OperationType { get; } + public long PreviousLsn { get; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode AllVersionsAndDeletes { get; } + public static ChangeFeedMode Incremental { get; } + public static ChangeFeedMode LatestVersion { get; } + } + public enum ChangeFeedOperationType + { + Create = 0, + Delete = 2, + Replace = 1, + } + public sealed class ChangeFeedPolicy + { + public ChangeFeedPolicy(); + public static TimeSpan FullFidelityNoRetention { get; } + public TimeSpan FullFidelityRetention { get; set; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public virtual ChangeFeedProcessorBuilder WithInMemoryLeaseContainer(); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract FeedRange FeedRange { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public sealed class ComputedProperty + { + public ComputedProperty(); + public string Name { get; set; } + public string Query { get; set; } + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public virtual Task DeleteAllItemsByPartitionKeyStreamAsync(PartitionKey partitionKey, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes(string processorName, Container.ChangeFeedHandler> onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> GetPartitionKeyRangesAsync(FeedRange feedRange, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task IsFeedRangePartOfAsync(FeedRange x, FeedRange y, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ChangeFeedPolicy ChangeFeedPolicy { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public Collection ComputedProperties { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public FullTextPolicy FullTextPolicy { get; set; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + public VectorEmbeddingPolicy VectorEmbeddingPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public IEnumerable AccountInitializationCustomEndpoints { get; set; } + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public CosmosClientTelemetryOptions CosmosClientTelemetryOptions { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableRemoteRegionPreferredForSessionRetry { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public IFaultInjector FaultInjector { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public Nullable PriorityLevel { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable ThroughputBucket { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public JsonSerializerOptions UseSystemTextJsonSerializerWithOptions { get; set; } + public IWebProxy WebProxy { get; set; } + } + public class CosmosClientTelemetryOptions + { + public CosmosClientTelemetryOptions(); + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public bool DisableDistributedTracing { get; set; } + public bool DisableSendingMetricsToService { get; set; } + public bool IsClientMetricsEnabled { get; set; } + public NetworkMetricsOptions NetworkMetricsOptions { get; set; } + public OperationMetricsOptions OperationMetricsOptions { get; set; } + public QueryTextMode QueryTextMode { get; set; } + } + public sealed class CosmosDbClientMetrics + { + public CosmosDbClientMetrics(); + public static class HistogramBuckets + { + public static readonly double[] RequestLatencyBuckets; + public static readonly double[] RequestUnitBuckets; + public static readonly double[] RowCountBuckets; + } + public static class NetworkMetrics + { + public const string MeterName = "Azure.Cosmos.Client.Request"; + public const string Version = "1.0.0"; + public static class Description + { + public const string BackendLatency = "Backend Latency (for direct mode)."; + public const string ChannelAquisitionLatency = "The duration of the successfully established outbound TCP connections. i.e. Channel Aquisition Time (for direct mode)."; + public const string Latency = "Duration of client requests."; + public const string ReceivedTimeLatency = "Time spent on 'Received' stage (for direct mode)."; + public const string RequestBodySize = "Size of client request body."; + public const string ResponseBodySize = "Size of client response body."; + public const string TransitTimeLatency = "Time spent on the wire (for direct mode)."; + } + public static class Name + { + public const string BackendLatency = "azure.cosmosdb.client.request.service_duration"; + public const string ChannelAquisitionLatency = "azure.cosmosdb.client.request.channel_aquisition.duration"; + public const string Latency = "azure.cosmosdb.client.request.duration"; + public const string ReceivedTimeLatency = "azure.cosmosdb.client.request.received.duration"; + public const string RequestBodySize = "azure.cosmosdb.client.request.body.size"; + public const string ResponseBodySize = "azure.cosmosdb.client.response.body.size"; + public const string TransitTimeLatency = "azure.cosmosdb.client.request.transit.duration"; + } + public static class Unit + { + public const string Bytes = "bytes"; + public const string Sec = "s"; + } + } + public static class OperationMetrics + { + public const string MeterName = "Azure.Cosmos.Client.Operation"; + public const string Version = "1.0.0"; + public static class Description + { + public const string ActiveInstances = "Number of active SDK client instances."; + public const string Latency = "Total end-to-end duration of the operation"; + public const string RequestCharge = "Total request units per operation (sum of RUs for all requested needed when processing an operation)"; + public const string RowCount = "For feed operations (query, readAll, readMany, change feed) batch operations this meter capture the actual item count in responses from the service"; + } + public static class Name + { + public const string ActiveInstances = "azure.cosmosdb.client.active_instance.count"; + public const string Latency = "db.client.operation.duration"; + public const string RequestCharge = "azure.cosmosdb.client.operation.request_charge"; + public const string RowCount = "db.client.response.returned_rows"; + } + public static class Unit + { + public const string Instance = "{instance}"; + public const string Item = "{item}"; + public const string RequestUnit = "{request_unit}"; + public const string Sec = "s"; + } + } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual ServerSideCumulativeMetrics GetQueryMetrics(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception, ICloneable + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public object Clone(); + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public abstract class CosmosLinqSerializer : CosmosSerializer + { + protected CosmosLinqSerializer(); + public abstract string SerializeMemberName(MemberInfo memberInfo); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException, ICloneable + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public object Clone(); + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public class CosmosThresholdOptions + { + public CosmosThresholdOptions(); + public TimeSpan NonPointOperationLatencyThreshold { get; set; } + public Nullable PayloadSizeThresholdInBytes { get; set; } + public TimeSpan PointOperationLatencyThreshold { get; set; } + public Nullable RequestChargeThreshold { get; set; } + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable BypassIntegratedCache { get; set; } + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public enum DistanceFunction + { + Cosine = 1, + DotProduct = 2, + Euclidean = 0, + } + public class Embedding : IEquatable + { + public Embedding(); + public VectorDataType DataType { get; set; } + public int Dimensions { get; set; } + public DistanceFunction DistanceFunction { get; set; } + public string Path { get; set; } + public bool Equals(Embedding that); + public void ValidateEmbeddingPath(); + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public virtual string QueryAdvice { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class FullTextIndexPath + { + public FullTextIndexPath(); + public string Path { get; set; } + } + public class FullTextPath : IEquatable + { + public FullTextPath(); + public string Language { get; set; } + public string Path { get; set; } + public bool Equals(FullTextPath that); + public void ValidateFullTextPath(); + } + public sealed class FullTextPolicy + { + public FullTextPolicy(); + public string DefaultLanguage { get; set; } + public Collection FullTextPaths { get; set; } + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection FullTextIndexes { get; set; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + public Collection VectorIndexes { get; set; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public class NetworkMetricsOptions + { + public NetworkMetricsOptions(); + public IDictionary CustomDimensions { get; set; } + public Nullable IncludeRoutingId { get; set; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public class OperationMetricsOptions + { + public OperationMetricsOptions(); + public IDictionary CustomDimensions { get; set; } + public Nullable IncludeRegion { get; set; } + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public virtual string From { get; set; } + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Move(string from, string path); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Move = 5, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public enum PriorityLevel + { + High = 1, + Low = 2, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public bool EnableOptimisticDirectExecution { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public Nullable PopulateQueryAdvice { get; set; } + public QueryTextMode QueryTextMode { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public enum QueryTextMode + { + All = 2, + None = 0, + ParameterizedOnly = 1, + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string AustriaEast = "Austria East"; + public const string BelgiumCentral = "Belgium Central"; + public const string BleuFranceCentral = "Bleu France Central"; + public const string BleuFranceSouth = "Bleu France South"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChileCentral = "Chile Central"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string DelosCloudGermanyCentral = "Delos Cloud Germany Central"; + public const string DelosCloudGermanyNorth = "Delos Cloud Germany North"; + public const string DenmarkEast = "Denmark East"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUS3 = "East US 3"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyNorth = "Germany North"; + public const string GermanyWestCentral = "Germany West Central"; + public const string IndonesiaCentral = "Indonesia Central"; + public const string IsraelCentral = "Israel Central"; + public const string IsraelNorthwest = "Israel Northwest"; + public const string ItalyNorth = "Italy North"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string MalaysiaSouth = "Malaysia South"; + public const string MalaysiaWest = "Malaysia West"; + public const string MexicoCentral = "Mexico Central"; + public const string NewZealandNorth = "New Zealand North"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SouthCentralUS2 = "South Central US 2"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SoutheastUS = "Southeast US"; + public const string SoutheastUS3 = "Southeast US 3"; + public const string SoutheastUS5 = "Southeast US 5"; + public const string SouthIndia = "South India"; + public const string SouthwestUS = "Southwest US"; + public const string SpainCentral = "Spain Central"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string TaiwanNorth = "Taiwan North"; + public const string TaiwanNorthwest = "Taiwan Northwest"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string USSecWestCentral = "USSec West Central"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public List ExcludeRegions { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public NetworkMetricsOptions NetworkMetricsOptions { get; set; } + public OperationMetricsOptions OperationMetricsOptions { get; set; } + public Nullable PriorityLevel { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public Nullable ThroughputBucket { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public abstract class ServerSideCumulativeMetrics + { + protected ServerSideCumulativeMetrics(); + public abstract ServerSideMetrics CumulativeMetrics { get; } + public abstract IReadOnlyList PartitionedMetrics { get; } + public abstract double TotalRequestCharge { get; } + } + public abstract class ServerSideMetrics + { + protected ServerSideMetrics(); + public abstract TimeSpan DocumentLoadTime { get; } + public abstract TimeSpan DocumentWriteTime { get; } + public abstract double IndexHitRatio { get; } + public abstract TimeSpan IndexLookupTime { get; } + public abstract long OutputDocumentCount { get; } + public abstract long OutputDocumentSize { get; } + public abstract TimeSpan QueryPreparationTime { get; } + public abstract long RetrievedDocumentCount { get; } + public abstract long RetrievedDocumentSize { get; } + public abstract TimeSpan RuntimeExecutionTime { get; } + public abstract TimeSpan TotalTime { get; } + public abstract TimeSpan VMExecutionTime { get; } + } + public abstract class ServerSidePartitionedMetrics + { + protected ServerSidePartitionedMetrics(); + public abstract string FeedRange { get; } + public abstract Nullable PartitionKeyRangeId { get; } + public abstract double RequestCharge { get; } + public abstract ServerSideMetrics ServerSideMetrics { get; } + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } + public enum VectorDataType + { + Float32 = 0, + Int8 = 2, + Uint8 = 1, + } + public sealed class VectorEmbeddingPolicy + { + public readonly Collection Embeddings; + public VectorEmbeddingPolicy(Collection embeddings); + } + public sealed class VectorIndexPath + { + public VectorIndexPath(); + public int IndexingSearchListSize { get; set; } + public string Path { get; set; } + public int QuantizationByteSize { get; set; } + public VectorIndexType Type { get; set; } + public string[] VectorIndexShardKey { get; set; } + } + public enum VectorIndexType + { + DiskANN = 1, + Flat = 0, + QuantizedFlat = 2, + } +} +namespace Microsoft.Azure.Cosmos.FaultInjection +{ + public interface IFaultInjector + { + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public class ChangeFeedPolicyDefinition + { + public ContainerBuilder Attach(); + } + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ComputedPropertiesDefinition + { + public T Attach(); + public ComputedPropertiesDefinition WithComputedProperty(string name, string query); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ChangeFeedPolicyDefinition WithChangeFeedPolicy(TimeSpan retention); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public FullTextPolicyDefinition WithFullTextPolicy(string defaultLanguage, Collection fullTextPaths); + public UniqueKeyDefinition WithUniqueKey(); + public VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(Collection embeddings); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public ComputedPropertiesDefinition WithComputedProperties(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithAvailabilityStrategy(AvailabilityStrategy strategy); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptions options); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomAccountEndpoints(IEnumerable customAccountEndpoints); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithEnableRemoteRegionPreferredForSessionRetry(bool enableRemoteRegionPreferredForSessionRetry); + public CosmosClientBuilder WithFaultInjection(IFaultInjector faultInjector); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithPriorityLevel(PriorityLevel priorityLevel); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithSystemTextJsonSerializerOptions(JsonSerializerOptions serializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + public CosmosClientBuilder WithThroughputBucket(int throughputBucket); + } + public class FullTextIndexDefinition + { + public FullTextIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public FullTextIndexDefinition Path(string path); + } + public class FullTextPolicyDefinition + { + public FullTextPolicyDefinition(ContainerBuilder parent, string defaultLanguage, Collection fullTextPaths, Action attachCallback); + public ContainerBuilder Attach(); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public FullTextIndexDefinition> WithFullTextIndex(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + public VectorIndexDefinition> WithVectorIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } + public class VectorEmbeddingPolicyDefinition + { + public VectorEmbeddingPolicyDefinition(ContainerBuilder parent, Collection embeddings, Action attachCallback); + public ContainerBuilder Attach(); + } + public class VectorIndexDefinition + { + public VectorIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public VectorIndexDefinition Path(string path, VectorIndexType indexType); + public VectorIndexDefinition WithIndexingSearchListSize(int indexingSearchListSize); + public VectorIndexDefinition WithQuantizationByteSize(int quantizationByteSize); + public VectorIndexDefinition WithVectorIndexShardKey(string[] vectorIndexShardKey); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static int DocumentId(this object obj); + public static bool FullTextContains(this object obj, string search); + public static bool FullTextContainsAll(this object obj, params string[] searches); + public static bool FullTextContainsAny(this object obj, params string[] searches); + public static double FullTextScore(this TSource obj, params string[] terms); + public static bool IsArray(this object obj); + public static bool IsBool(this object obj); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsNumber(this object obj); + public static bool IsObject(this object obj); + public static bool IsPrimitive(this object obj); + public static bool IsString(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static IOrderedQueryable OrderByRank(this IQueryable source, Expression> scoreFunction); + public static bool RegexMatch(this object obj, string regularExpression); + public static bool RegexMatch(this object obj, string regularExpression, string searchModifier); + public static double RRF(params double[] scoringFunctions); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query, IDictionary namedParameters); + public static FeedIterator ToStreamIterator(this IQueryable query); + public static double VectorDistance(this byte[] vector1, byte[] vector2, bool isBruteForce, CosmosLinqExtensions.VectorDistanceOptions options); + public static double VectorDistance(this sbyte[] vector1, sbyte[] vector2, bool isBruteForce, CosmosLinqExtensions.VectorDistanceOptions options); + public static double VectorDistance(this float[] vector1, float[] vector2, bool isBruteForce, CosmosLinqExtensions.VectorDistanceOptions options); + public sealed class VectorDistanceOptions + { + public VectorDistanceOptions(); + public Nullable DataType { get; set; } + public Nullable DistanceFunction { get; set; } + public Nullable SearchListSizeMultiplier { get; set; } + } + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + Upsert = (short)5, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.53.0-preview.1.txt b/Microsoft.Azure.Cosmos/contracts/API_3.53.0-preview.1.txt new file mode 100644 index 0000000000..208d2599cf --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.53.0-preview.1.txt @@ -0,0 +1,1890 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public abstract class AvailabilityStrategy + { + public static AvailabilityStrategy CrossRegionHedgingStrategy(TimeSpan threshold, Nullable thresholdStep, bool enableMultiWriteRegionHedge=false); + public static AvailabilityStrategy DisabledStrategy(); + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public class ChangeFeedItem + { + public ChangeFeedItem(); + public T Current { get; set; } + public ChangeFeedMetadata Metadata { get; set; } + public T Previous { get; set; } + } + public class ChangeFeedMetadata + { + public ChangeFeedMetadata(); + public DateTime ConflictResolutionTimestamp { get; } + public bool IsTimeToLiveExpired { get; } + public long Lsn { get; } + public ChangeFeedOperationType OperationType { get; } + public long PreviousLsn { get; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode AllVersionsAndDeletes { get; } + public static ChangeFeedMode Incremental { get; } + public static ChangeFeedMode LatestVersion { get; } + } + public enum ChangeFeedOperationType + { + Create = 0, + Delete = 2, + Replace = 1, + } + public sealed class ChangeFeedPolicy + { + public ChangeFeedPolicy(); + public static TimeSpan FullFidelityNoRetention { get; } + public TimeSpan FullFidelityRetention { get; set; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public virtual ChangeFeedProcessorBuilder WithInMemoryLeaseContainer(); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract FeedRange FeedRange { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public sealed class ComputedProperty + { + public ComputedProperty(); + public string Name { get; set; } + public string Query { get; set; } + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public virtual Task DeleteAllItemsByPartitionKeyStreamAsync(PartitionKey partitionKey, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes(string processorName, Container.ChangeFeedHandler> onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> GetPartitionKeyRangesAsync(FeedRange feedRange, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task IsFeedRangePartOfAsync(FeedRange x, FeedRange y, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ChangeFeedPolicy ChangeFeedPolicy { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public Collection ComputedProperties { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public FullTextPolicy FullTextPolicy { get; set; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + public VectorEmbeddingPolicy VectorEmbeddingPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public IEnumerable AccountInitializationCustomEndpoints { get; set; } + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public CosmosClientTelemetryOptions CosmosClientTelemetryOptions { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableRemoteRegionPreferredForSessionRetry { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public IFaultInjector FaultInjector { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public Nullable PriorityLevel { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable ThroughputBucket { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public JsonSerializerOptions UseSystemTextJsonSerializerWithOptions { get; set; } + public IWebProxy WebProxy { get; set; } + } + public class CosmosClientTelemetryOptions + { + public CosmosClientTelemetryOptions(); + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public bool DisableDistributedTracing { get; set; } + public bool DisableSendingMetricsToService { get; set; } + public bool IsClientMetricsEnabled { get; set; } + public NetworkMetricsOptions NetworkMetricsOptions { get; set; } + public OperationMetricsOptions OperationMetricsOptions { get; set; } + public QueryTextMode QueryTextMode { get; set; } + } + public sealed class CosmosDbClientMetrics + { + public CosmosDbClientMetrics(); + public static class HistogramBuckets + { + public static readonly double[] RequestLatencyBuckets; + public static readonly double[] RequestUnitBuckets; + public static readonly double[] RowCountBuckets; + } + public static class NetworkMetrics + { + public const string MeterName = "Azure.Cosmos.Client.Request"; + public const string Version = "1.0.0"; + public static class Description + { + public const string BackendLatency = "Backend Latency (for direct mode)."; + public const string ChannelAquisitionLatency = "The duration of the successfully established outbound TCP connections. i.e. Channel Aquisition Time (for direct mode)."; + public const string Latency = "Duration of client requests."; + public const string ReceivedTimeLatency = "Time spent on 'Received' stage (for direct mode)."; + public const string RequestBodySize = "Size of client request body."; + public const string ResponseBodySize = "Size of client response body."; + public const string TransitTimeLatency = "Time spent on the wire (for direct mode)."; + } + public static class Name + { + public const string BackendLatency = "azure.cosmosdb.client.request.service_duration"; + public const string ChannelAquisitionLatency = "azure.cosmosdb.client.request.channel_aquisition.duration"; + public const string Latency = "azure.cosmosdb.client.request.duration"; + public const string ReceivedTimeLatency = "azure.cosmosdb.client.request.received.duration"; + public const string RequestBodySize = "azure.cosmosdb.client.request.body.size"; + public const string ResponseBodySize = "azure.cosmosdb.client.response.body.size"; + public const string TransitTimeLatency = "azure.cosmosdb.client.request.transit.duration"; + } + public static class Unit + { + public const string Bytes = "bytes"; + public const string Sec = "s"; + } + } + public static class OperationMetrics + { + public const string MeterName = "Azure.Cosmos.Client.Operation"; + public const string Version = "1.0.0"; + public static class Description + { + public const string ActiveInstances = "Number of active SDK client instances."; + public const string Latency = "Total end-to-end duration of the operation"; + public const string RequestCharge = "Total request units per operation (sum of RUs for all requested needed when processing an operation)"; + public const string RowCount = "For feed operations (query, readAll, readMany, change feed) batch operations this meter capture the actual item count in responses from the service"; + } + public static class Name + { + public const string ActiveInstances = "azure.cosmosdb.client.active_instance.count"; + public const string Latency = "db.client.operation.duration"; + public const string RequestCharge = "azure.cosmosdb.client.operation.request_charge"; + public const string RowCount = "db.client.response.returned_rows"; + } + public static class Unit + { + public const string Instance = "{instance}"; + public const string Item = "{item}"; + public const string RequestUnit = "{request_unit}"; + public const string Sec = "s"; + } + } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual ServerSideCumulativeMetrics GetQueryMetrics(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception, ICloneable + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public object Clone(); + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public abstract class CosmosLinqSerializer : CosmosSerializer + { + protected CosmosLinqSerializer(); + public abstract string SerializeMemberName(MemberInfo memberInfo); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException, ICloneable + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public object Clone(); + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public class CosmosThresholdOptions + { + public CosmosThresholdOptions(); + public TimeSpan NonPointOperationLatencyThreshold { get; set; } + public Nullable PayloadSizeThresholdInBytes { get; set; } + public TimeSpan PointOperationLatencyThreshold { get; set; } + public Nullable RequestChargeThreshold { get; set; } + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable BypassIntegratedCache { get; set; } + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public enum DistanceFunction + { + Cosine = 1, + DotProduct = 2, + Euclidean = 0, + } + public class Embedding : IEquatable + { + public Embedding(); + public VectorDataType DataType { get; set; } + public int Dimensions { get; set; } + public DistanceFunction DistanceFunction { get; set; } + public string Path { get; set; } + public bool Equals(Embedding that); + public void ValidateEmbeddingPath(); + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public virtual string QueryAdvice { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class FullTextIndexPath + { + public FullTextIndexPath(); + public string Path { get; set; } + } + public class FullTextPath : IEquatable + { + public FullTextPath(); + public string Language { get; set; } + public string Path { get; set; } + public bool Equals(FullTextPath that); + public void ValidateFullTextPath(); + } + public sealed class FullTextPolicy + { + public FullTextPolicy(); + public string DefaultLanguage { get; set; } + public Collection FullTextPaths { get; set; } + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection FullTextIndexes { get; set; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + public Collection VectorIndexes { get; set; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public class NetworkMetricsOptions + { + public NetworkMetricsOptions(); + public IDictionary CustomDimensions { get; set; } + public Nullable IncludeRoutingId { get; set; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public class OperationMetricsOptions + { + public OperationMetricsOptions(); + public IDictionary CustomDimensions { get; set; } + public Nullable IncludeRegion { get; set; } + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public virtual string From { get; set; } + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Move(string from, string path); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Move = 5, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public enum PriorityLevel + { + High = 1, + Low = 2, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public bool EnableOptimisticDirectExecution { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public Nullable PopulateQueryAdvice { get; set; } + public QueryTextMode QueryTextMode { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public enum QueryTextMode + { + All = 2, + None = 0, + ParameterizedOnly = 1, + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string AustriaEast = "Austria East"; + public const string BelgiumCentral = "Belgium Central"; + public const string BleuFranceCentral = "Bleu France Central"; + public const string BleuFranceSouth = "Bleu France South"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChileCentral = "Chile Central"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string DelosCloudGermanyCentral = "Delos Cloud Germany Central"; + public const string DelosCloudGermanyNorth = "Delos Cloud Germany North"; + public const string DenmarkEast = "Denmark East"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUS3 = "East US 3"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyNorth = "Germany North"; + public const string GermanyWestCentral = "Germany West Central"; + public const string IndonesiaCentral = "Indonesia Central"; + public const string IsraelCentral = "Israel Central"; + public const string IsraelNorthwest = "Israel Northwest"; + public const string ItalyNorth = "Italy North"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string MalaysiaSouth = "Malaysia South"; + public const string MalaysiaWest = "Malaysia West"; + public const string MexicoCentral = "Mexico Central"; + public const string NewZealandNorth = "New Zealand North"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SouthCentralUS2 = "South Central US 2"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SoutheastUS = "Southeast US"; + public const string SoutheastUS3 = "Southeast US 3"; + public const string SoutheastUS5 = "Southeast US 5"; + public const string SouthIndia = "South India"; + public const string SouthwestUS = "Southwest US"; + public const string SpainCentral = "Spain Central"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string TaiwanNorth = "Taiwan North"; + public const string TaiwanNorthwest = "Taiwan Northwest"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string USSecWestCentral = "USSec West Central"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public AvailabilityStrategy AvailabilityStrategy { get; set; } + public CosmosThresholdOptions CosmosThresholdOptions { get; set; } + public List ExcludeRegions { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public NetworkMetricsOptions NetworkMetricsOptions { get; set; } + public OperationMetricsOptions OperationMetricsOptions { get; set; } + public Nullable PriorityLevel { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public Nullable ThroughputBucket { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public abstract class ServerSideCumulativeMetrics + { + protected ServerSideCumulativeMetrics(); + public abstract ServerSideMetrics CumulativeMetrics { get; } + public abstract IReadOnlyList PartitionedMetrics { get; } + public abstract double TotalRequestCharge { get; } + } + public abstract class ServerSideMetrics + { + protected ServerSideMetrics(); + public abstract TimeSpan DocumentLoadTime { get; } + public abstract TimeSpan DocumentWriteTime { get; } + public abstract double IndexHitRatio { get; } + public abstract TimeSpan IndexLookupTime { get; } + public abstract long OutputDocumentCount { get; } + public abstract long OutputDocumentSize { get; } + public abstract TimeSpan QueryPreparationTime { get; } + public abstract long RetrievedDocumentCount { get; } + public abstract long RetrievedDocumentSize { get; } + public abstract TimeSpan RuntimeExecutionTime { get; } + public abstract TimeSpan TotalTime { get; } + public abstract TimeSpan VMExecutionTime { get; } + } + public abstract class ServerSidePartitionedMetrics + { + protected ServerSidePartitionedMetrics(); + public abstract string FeedRange { get; } + public abstract Nullable PartitionKeyRangeId { get; } + public abstract double RequestCharge { get; } + public abstract ServerSideMetrics ServerSideMetrics { get; } + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } + public enum VectorDataType + { + Float32 = 0, + Int8 = 2, + Uint8 = 1, + } + public sealed class VectorEmbeddingPolicy + { + public readonly Collection Embeddings; + public VectorEmbeddingPolicy(Collection embeddings); + } + public sealed class VectorIndexPath + { + public VectorIndexPath(); + public int IndexingSearchListSize { get; set; } + public string Path { get; set; } + public int QuantizationByteSize { get; set; } + public VectorIndexType Type { get; set; } + public string[] VectorIndexShardKey { get; set; } + } + public enum VectorIndexType + { + DiskANN = 1, + Flat = 0, + QuantizedFlat = 2, + } +} +namespace Microsoft.Azure.Cosmos.FaultInjection +{ + public interface IFaultInjector + { + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public class ChangeFeedPolicyDefinition + { + public ContainerBuilder Attach(); + } + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ComputedPropertiesDefinition + { + public T Attach(); + public ComputedPropertiesDefinition WithComputedProperty(string name, string query); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ChangeFeedPolicyDefinition WithChangeFeedPolicy(TimeSpan retention); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public FullTextPolicyDefinition WithFullTextPolicy(string defaultLanguage, Collection fullTextPaths); + public UniqueKeyDefinition WithUniqueKey(); + public VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(Collection embeddings); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public ComputedPropertiesDefinition WithComputedProperties(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithAvailabilityStrategy(AvailabilityStrategy strategy); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptions options); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomAccountEndpoints(IEnumerable customAccountEndpoints); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithEnableRemoteRegionPreferredForSessionRetry(bool enableRemoteRegionPreferredForSessionRetry); + public CosmosClientBuilder WithFaultInjection(IFaultInjector faultInjector); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithPriorityLevel(PriorityLevel priorityLevel); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithSystemTextJsonSerializerOptions(JsonSerializerOptions serializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + public CosmosClientBuilder WithThroughputBucket(int throughputBucket); + } + public class FullTextIndexDefinition + { + public FullTextIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public FullTextIndexDefinition Path(string path); + } + public class FullTextPolicyDefinition + { + public FullTextPolicyDefinition(ContainerBuilder parent, string defaultLanguage, Collection fullTextPaths, Action attachCallback); + public ContainerBuilder Attach(); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public FullTextIndexDefinition> WithFullTextIndex(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + public VectorIndexDefinition> WithVectorIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } + public class VectorEmbeddingPolicyDefinition + { + public VectorEmbeddingPolicyDefinition(ContainerBuilder parent, Collection embeddings, Action attachCallback); + public ContainerBuilder Attach(); + } + public class VectorIndexDefinition + { + public VectorIndexDefinition(T parent, Action attachCallback); + public T Attach(); + public VectorIndexDefinition Path(string path, VectorIndexType indexType); + public VectorIndexDefinition WithIndexingSearchListSize(int indexingSearchListSize); + public VectorIndexDefinition WithQuantizationByteSize(int quantizationByteSize); + public VectorIndexDefinition WithVectorIndexShardKey(string[] vectorIndexShardKey); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static int DocumentId(this object obj); + public static bool FullTextContains(this object obj, string search); + public static bool FullTextContainsAll(this object obj, params string[] searches); + public static bool FullTextContainsAny(this object obj, params string[] searches); + public static double FullTextScore(this TSource obj, params string[] terms); + public static bool IsArray(this object obj); + public static bool IsBool(this object obj); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsNumber(this object obj); + public static bool IsObject(this object obj); + public static bool IsPrimitive(this object obj); + public static bool IsString(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static IOrderedQueryable OrderByRank(this IQueryable source, Expression> scoreFunction); + public static bool RegexMatch(this object obj, string regularExpression); + public static bool RegexMatch(this object obj, string regularExpression, string searchModifier); + public static double RRF(params double[] scoringFunctions); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query, IDictionary namedParameters); + public static FeedIterator ToStreamIterator(this IQueryable query); + public static double VectorDistance(this byte[] vector1, byte[] vector2, bool isBruteForce, CosmosLinqExtensions.VectorDistanceOptions options); + public static double VectorDistance(this sbyte[] vector1, sbyte[] vector2, bool isBruteForce, CosmosLinqExtensions.VectorDistanceOptions options); + public static double VectorDistance(this float[] vector1, float[] vector2, bool isBruteForce, CosmosLinqExtensions.VectorDistanceOptions options); + public sealed class VectorDistanceOptions + { + public VectorDistanceOptions(); + public Nullable DataType { get; set; } + public Nullable DistanceFunction { get; set; } + public Nullable SearchListSizeMultiplier { get; set; } + } + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStoredProcedureStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionStreamAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureStreamAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerStreamAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionStreamAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + Upsert = (short)5, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/src/AssemblyInfo.cs b/Microsoft.Azure.Cosmos/src/AssemblyInfo.cs index b46a574ec0..6222a74645 100644 --- a/Microsoft.Azure.Cosmos/src/AssemblyInfo.cs +++ b/Microsoft.Azure.Cosmos/src/AssemblyInfo.cs @@ -3,6 +3,7 @@ //------------------------------------------------------------ using System.Runtime.CompilerServices; +using Microsoft.Azure.Cosmos.Direct; [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2" + AssemblyKeys.MoqPublicKey)] [assembly: InternalsVisibleTo("Microsoft.Azure.Cosmos.FaultInjection" + AssemblyKeys.ProductPublicKey)] @@ -33,15 +34,13 @@ [assembly: InternalsVisibleTo("Microsoft.Azure.Cosmos.NetFramework.Tests" + AssemblyKeys.TestPublicKey)] [assembly: InternalsVisibleTo("Microsoft.Azure.Cosmos.Analytics.Core" + AssemblyKeys.ProductPublicKey)] [assembly: InternalsVisibleTo("Microsoft.Azure.Cosmos.Analytics.Core" + AssemblyKeys.TestPublicKey)] - -internal static class AssemblyKeys -{ - /// ProductPublicKey is an official MS supported public key for external releases. TestPublicKey is an unsupported strong key for testing and internal use only - internal const string ProductPublicKey = ", PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9"; - internal const string TestPublicKey = ", PublicKey=0024000004800000940000000602000000240000525341310004000001000100197c25d0a04f73cb271e8181dba1c0c713df8deebb25864541a66670500f34896d280484b45fe1ff6c29f2ee7aa175d8bcbd0c83cc23901a894a86996030f6292ce6eda6e6f3e6c74b3c5a3ded4903c951e6747e6102969503360f7781bf8bf015058eb89b7621798ccc85aaca036ff1bc1556bb7f62de15908484886aa8bbae"; - - // check https://github.com/Moq/moq4/wiki/Quickstart - internal const string MoqPublicKey = ", PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7"; - // check https://msdn.microsoft.com/en-us/library/hh708916.aspx - internal const string FakesPublicKey = ", PublicKey=0024000004800000940000000602000000240000525341310004000001000100e92decb949446f688ab9f6973436c535bf50acd1fd580495aae3f875aa4e4f663ca77908c63b7f0996977cb98fcfdb35e05aa2c842002703cad835473caac5ef14107e3a7fae01120a96558785f48319f66daabc862872b2c53f5ac11fa335c0165e202b4c011334c7bc8f4c4e570cf255190f4e3e2cbc9137ca57cb687947bc"; -} \ No newline at end of file +[assembly: InternalsVisibleTo("Microsoft.Azure.Cosmos.QueryOracle" + AssemblyKeys.ProductPublicKey)] +[assembly: InternalsVisibleTo("Microsoft.Azure.Cosmos.QueryOracle" + AssemblyKeys.TestPublicKey)] +[assembly: InternalsVisibleTo("Microsoft.Azure.Cosmos.QueryOracle.JobProcessor" + AssemblyKeys.ProductPublicKey)] +[assembly: InternalsVisibleTo("Microsoft.Azure.Cosmos.QueryOracle.JobProcessor" + AssemblyKeys.TestPublicKey)] +[assembly: InternalsVisibleTo("Microsoft.Azure.Cosmos.QueryOracle.UnitTests" + AssemblyKeys.ProductPublicKey)] +[assembly: InternalsVisibleTo("Microsoft.Azure.Cosmos.QueryOracle.UnitTests" + AssemblyKeys.TestPublicKey)] +[assembly: InternalsVisibleTo("CosmosCTL" + AssemblyKeys.ProductPublicKey)] +[assembly: InternalsVisibleTo("CosmosCTL" + AssemblyKeys.TestPublicKey)] +[assembly: InternalsVisibleTo("CosmosBenchmark" + AssemblyKeys.ProductPublicKey)] +[assembly: InternalsVisibleTo("CosmosBenchmark" + AssemblyKeys.TestPublicKey)] \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Authorization/StringHMACSHA256Hash.cs b/Microsoft.Azure.Cosmos/src/Authorization/StringHMACSHA256Hash.cs index baba6db57a..1da795296f 100644 --- a/Microsoft.Azure.Cosmos/src/Authorization/StringHMACSHA256Hash.cs +++ b/Microsoft.Azure.Cosmos/src/Authorization/StringHMACSHA256Hash.cs @@ -15,7 +15,9 @@ internal sealed class StringHMACSHA256Hash : IComputeHash private readonly String base64EncodedKey; private readonly byte[] keyBytes; private SecureString secureString; +#pragma warning disable IDE0044 // Add readonly modifier private ConcurrentQueue hmacPool; +#pragma warning restore IDE0044 // Add readonly modifier public StringHMACSHA256Hash(String base64EncodedKey) { diff --git a/Microsoft.Azure.Cosmos/src/Authorization/TokenCredentialCache.cs b/Microsoft.Azure.Cosmos/src/Authorization/TokenCredentialCache.cs index ca4eeeb5ed..e844dbdec8 100644 --- a/Microsoft.Azure.Cosmos/src/Authorization/TokenCredentialCache.cs +++ b/Microsoft.Azure.Cosmos/src/Authorization/TokenCredentialCache.cs @@ -35,8 +35,9 @@ internal sealed class TokenCredentialCache : IDisposable // The token refresh retries half the time. Given default of 1hr it will retry at 30m, 15, 7.5, 3.75, 1.875 // If the background refresh fails with less than a minute then just allow the request to hit the exception. public static readonly TimeSpan MinimumTimeBetweenBackgroundRefreshInterval = TimeSpan.FromMinutes(1); - + private const string ScopeFormat = "https://{0}/.default"; + private readonly TokenRequestContext tokenRequestContext; private readonly TokenCredential tokenCredential; private readonly CancellationTokenSource cancellationTokenSource; @@ -62,13 +63,17 @@ internal TokenCredentialCache( if (accountEndpoint == null) { throw new ArgumentNullException(nameof(accountEndpoint)); - } - - this.tokenRequestContext = new TokenRequestContext(new string[] - { - string.Format(TokenCredentialCache.ScopeFormat, accountEndpoint.Host) - }); - + } + + string? scopeOverride = ConfigurationManager.AADScopeOverrideValue(defaultValue: null); + + this.tokenRequestContext = new TokenRequestContext(new string[] + { + !string.IsNullOrEmpty(scopeOverride) + ? scopeOverride + : string.Format(TokenCredentialCache.ScopeFormat, accountEndpoint.Host) + }); + if (backgroundTokenCredentialRefreshInterval.HasValue) { if (backgroundTokenCredentialRefreshInterval.Value <= TimeSpan.Zero) @@ -219,9 +224,9 @@ private async ValueTask RefreshCachedTokenWithRetryHelperAsync( lastException = requestFailedException; getTokenTrace.AddDatum( $"RequestFailedException at {DateTime.UtcNow.ToString(CultureInfo.InvariantCulture)}", - requestFailedException); + requestFailedException.Message); - DefaultTrace.TraceError($"TokenCredential.GetToken() failed with RequestFailedException. scope = {string.Join(";", this.tokenRequestContext.Scopes)}, retry = {retry}, Exception = {lastException}"); + DefaultTrace.TraceError($"TokenCredential.GetToken() failed with RequestFailedException. scope = {string.Join(";", this.tokenRequestContext.Scopes)}, retry = {retry}, Exception = {lastException.Message}"); // Don't retry on auth failures if (requestFailedException.Status == (int)HttpStatusCode.Unauthorized || @@ -236,10 +241,10 @@ private async ValueTask RefreshCachedTokenWithRetryHelperAsync( lastException = operationCancelled; getTokenTrace.AddDatum( $"OperationCanceledException at {DateTime.UtcNow.ToString(CultureInfo.InvariantCulture)}", - operationCancelled); + operationCancelled.Message); DefaultTrace.TraceError( - $"TokenCredential.GetTokenAsync() failed. scope = {string.Join(";", this.tokenRequestContext.Scopes)}, retry = {retry}, Exception = {lastException}"); + $"TokenCredential.GetTokenAsync() failed. scope = {string.Join(";", this.tokenRequestContext.Scopes)}, retry = {retry}, Exception = {lastException.Message}"); throw CosmosExceptionFactory.CreateRequestTimeoutException( message: ClientResources.FailedToGetAadToken, @@ -255,10 +260,10 @@ private async ValueTask RefreshCachedTokenWithRetryHelperAsync( lastException = exception; getTokenTrace.AddDatum( $"Exception at {DateTime.UtcNow.ToString(CultureInfo.InvariantCulture)}", - exception); + exception.Message); DefaultTrace.TraceError( - $"TokenCredential.GetTokenAsync() failed. scope = {string.Join(";", this.tokenRequestContext.Scopes)}, retry = {retry}, Exception = {lastException}"); + $"TokenCredential.GetTokenAsync() failed. scope = {string.Join(";", this.tokenRequestContext.Scopes)}, retry = {retry}, Exception = {lastException.Message}"); } } } @@ -339,7 +344,7 @@ private async void StartBackgroundTokenRefreshLoop() DefaultTrace.TraceWarning( "BackgroundTokenRefreshLoop() - Unable to refresh token credential cache. Exception: {0}", - ex.ToString()); + ex.Message); // Since it failed retry again in with half the token life span again. if (!this.userDefinedBackgroundTokenCredentialRefreshInterval.HasValue && this.cachedAccessToken.HasValue) diff --git a/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncBatcher.cs b/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncBatcher.cs index ebfb7d87ff..90b38a6d99 100644 --- a/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncBatcher.cs +++ b/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncBatcher.cs @@ -208,7 +208,7 @@ private async Task DispatchHelperAsync( } catch (Exception ex) { - DefaultTrace.TraceError("Exception during BatchAsyncBatcher: {0}", ex); + DefaultTrace.TraceError("Exception during BatchAsyncBatcher: {0}", ex.Message); } finally { diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeed/StandByFeedIteratorCore.cs b/Microsoft.Azure.Cosmos/src/ChangeFeed/StandByFeedIteratorCore.cs index dc41d17d2b..b8899ddb54 100644 --- a/Microsoft.Azure.Cosmos/src/ChangeFeed/StandByFeedIteratorCore.cs +++ b/Microsoft.Azure.Cosmos/src/ChangeFeed/StandByFeedIteratorCore.cs @@ -30,7 +30,9 @@ internal class StandByFeedIteratorCore : FeedIteratorInternal private string containerRid; private string continuationToken; +#pragma warning disable IDE0044 // Add readonly modifier private int? maxItemCount; +#pragma warning restore IDE0044 // Add readonly modifier internal StandByFeedIteratorCore( CosmosClientContext clientContext, diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedEstimatorIterator.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedEstimatorIterator.cs index 61441a1a4c..969a921a5e 100644 --- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedEstimatorIterator.cs +++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedEstimatorIterator.cs @@ -398,7 +398,7 @@ public ChangeFeedEstimatorFeedResponse( public override string IndexMetrics => null; - internal override string QueryAdvice => null; + public override string QueryAdvice => null; internal override RequestMessage RequestMessage => null; @@ -435,7 +435,7 @@ public ChangeFeedEstimatorEmptyFeedResponse(ITrace trace) public override string IndexMetrics => null; - internal override string QueryAdvice => null; + public override string QueryAdvice => null; internal override RequestMessage RequestMessage => null; diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedProcessorBuilder.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedProcessorBuilder.cs index 3287f1b857..53ac46b969 100644 --- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedProcessorBuilder.cs +++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedProcessorBuilder.cs @@ -213,12 +213,11 @@ public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer) /// /// Uses an in-memory container to maintain state of the leases - /// - /// + /// /// Using an in-memory container restricts the scaling capability to just the instance running the current processor. - /// + /// /// The instance of to use. - internal virtual ChangeFeedProcessorBuilder WithInMemoryLeaseContainer() + public virtual ChangeFeedProcessorBuilder WithInMemoryLeaseContainer() { if (this.leaseContainer != null) { diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/PartitionControllerCore.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/PartitionControllerCore.cs index 37ef33cff5..fc6281c96d 100644 --- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/PartitionControllerCore.cs +++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/PartitionControllerCore.cs @@ -203,7 +203,7 @@ private async Task HandlePartitionGoneAsync(DocumentServiceLease lease, string l catch (Exception ex) { await this.monitor.NotifyErrorAsync(lease.CurrentLeaseToken, ex); - DefaultTrace.TraceWarning("Lease with token {0}: failed to handle gone", ex, lease.CurrentLeaseToken); + DefaultTrace.TraceWarning("Lease with token {0}: failed to handle gone", ex.Message, lease.CurrentLeaseToken); } } } diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedProcessing/FeedProcessorCore.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedProcessing/FeedProcessorCore.cs index e961787339..29306e1c32 100644 --- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedProcessing/FeedProcessorCore.cs +++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedProcessing/FeedProcessorCore.cs @@ -54,7 +54,7 @@ public override async Task RunAsync(CancellationToken cancellationToken) if (!ReferenceEquals(await Task.WhenAny(task, Task.Delay(this.options.RequestTimeout, cts.Token)), task)) { Task catchExceptionFromTask = task.ContinueWith(task => DefaultTrace.TraceInformation( - "Timed out Change Feed request failed with exception: {2}", task.Exception.InnerException), + "Timed out Change Feed request failed with exception: {2}", task.Exception.Message), TaskContinuationOptions.OnlyOnFaulted); throw CosmosExceptionFactory.CreateRequestTimeoutException("Change Feed request timed out", new Headers()); } diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Observers/ChangeFeedObserverContextCore.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Observers/ChangeFeedObserverContextCore.cs index d07127fa9b..196d0faf58 100644 --- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Observers/ChangeFeedObserverContextCore.cs +++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Observers/ChangeFeedObserverContextCore.cs @@ -49,6 +49,7 @@ public async Task CheckpointAsync() catch (LeaseLostException leaseLostException) { // LeaseLost means another instance stole the lease due to load balancing, so the right status is 412 +#pragma warning disable CDX1002 // DontUseExceptionStackTrace CosmosException cosmosException = CosmosExceptionFactory.Create( statusCode: HttpStatusCode.PreconditionFailed, message: "Lease was lost due to load balancing and will be processed by another instance", @@ -57,6 +58,7 @@ public async Task CheckpointAsync() trace: NoOpTrace.Singleton, error: null, innerException: leaseLostException); +#pragma warning restore CDX1002 // DontUseExceptionStackTrace throw cosmosException; } } diff --git a/Microsoft.Azure.Cosmos/src/ClientRetryPolicy.cs b/Microsoft.Azure.Cosmos/src/ClientRetryPolicy.cs index 11391ddcbd..7e53f4b3de 100644 --- a/Microsoft.Azure.Cosmos/src/ClientRetryPolicy.cs +++ b/Microsoft.Azure.Cosmos/src/ClientRetryPolicy.cs @@ -28,7 +28,7 @@ internal sealed class ClientRetryPolicy : IDocumentClientRetryPolicy private readonly GlobalEndpointManager globalEndpointManager; private readonly GlobalPartitionEndpointManager partitionKeyRangeLocationCache; private readonly bool enableEndpointDiscovery; - private readonly bool isPertitionLevelFailoverEnabled; + private readonly bool isPartitionLevelFailoverEnabled; private int failoverRetryCount; private int sessionTokenRetryCount; @@ -45,7 +45,7 @@ public ClientRetryPolicy( GlobalPartitionEndpointManager partitionKeyRangeLocationCache, RetryOptions retryOptions, bool enableEndpointDiscovery, - bool isPertitionLevelFailoverEnabled) + bool isPartitionLevelFailoverEnabled) { this.throttlingRetry = new ResourceThrottleRetryPolicy( retryOptions.MaxRetryAttemptsOnThrottledRequests, @@ -59,7 +59,7 @@ public ClientRetryPolicy( this.serviceUnavailableRetryCount = 0; this.canUseMultipleWriteLocations = false; this.isMultiMasterWriteRequest = false; - this.isPertitionLevelFailoverEnabled = isPertitionLevelFailoverEnabled; + this.isPartitionLevelFailoverEnabled = isPartitionLevelFailoverEnabled; } /// @@ -80,13 +80,9 @@ public async Task ShouldRetryAsync( this.documentServiceRequest?.RequestContext?.LocationEndpointToRoute?.ToString() ?? string.Empty, this.documentServiceRequest?.ResourceAddress ?? string.Empty); - if (this.isPertitionLevelFailoverEnabled) - { - // In the event of the routing gateway having outage on region A, mark the partition as unavailable assuming that the - // partition has been failed over to region B, when per partition automatic failover is enabled. - this.partitionKeyRangeLocationCache.TryMarkEndpointUnavailableForPartitionKeyRange( - this.documentServiceRequest); - } + // In the event of the routing gateway having outage on region A, mark the partition as unavailable assuming that the + // partition has been failed over to region B, when per partition automatic failover is enabled. + this.TryMarkEndpointUnavailableForPkRange(isSystemResourceUnavailableForWrite: false); // Mark both read and write requests because it gateway exception. // This means all requests going to the region will fail. @@ -113,7 +109,7 @@ public async Task ShouldRetryAsync( StatusCodes.TooManyRequests, SubStatusCodes.SystemResourceUnavailable); return this.TryMarkEndpointUnavailableForPkRangeAndRetryOnServiceUnavailable( - shouldMarkEndpointUnavailableForPkRange: true); + isSystemResourceUnavailableForWrite: true); } ShouldRetryResult shouldRetryResult = await this.ShouldRetryInternalAsync( @@ -139,6 +135,23 @@ public async Task ShouldRetryAsync( } } + if (exception is OperationCanceledException) + { + DefaultTrace.TraceInformation("ClientRetryPolicy: The operation was cancelled. Not retrying. Retry count = {0}, Endpoint = {1}", + this.failoverRetryCount, + this.locationEndpoint?.ToString() ?? string.Empty); + + if (this.partitionKeyRangeLocationCache.IncrementRequestFailureCounterAndCheckIfPartitionCanFailover( + this.documentServiceRequest)) + { + // In the event of a (ppaf + write operation) or (ppcb + read or multi-master write operation) getting timed + // out due to cancellation token expiration on region A, mark the partition as unavailable assuming that + // the partition has been failed over to region B, when per partition automatic failover is enabled. + this.partitionKeyRangeLocationCache.TryMarkEndpointUnavailableForPartitionKeyRange( + this.documentServiceRequest); + } + } + return await this.throttlingRetry.ShouldRetryAsync(exception, cancellationToken); } @@ -176,7 +189,7 @@ public async Task ShouldRetryAsync( StatusCodes.TooManyRequests, SubStatusCodes.SystemResourceUnavailable); return this.TryMarkEndpointUnavailableForPkRangeAndRetryOnServiceUnavailable( - shouldMarkEndpointUnavailableForPkRange: true); + isSystemResourceUnavailableForWrite: true); } return await this.throttlingRetry.ShouldRetryAsync(cosmosResponseMessage, cancellationToken); @@ -213,7 +226,11 @@ public void OnBeforeSendRequest(DocumentServiceRequest request) // Resolve the endpoint for the request and pin the resolution to the resolved endpoint // This enables marking the endpoint unavailability on endpoint failover/unreachability - this.locationEndpoint = this.globalEndpointManager.ResolveServiceEndpoint(request); + this.locationEndpoint = ConfigurationManager.IsThinClientEnabled(defaultValue: false) + && ThinClientStoreModel.IsOperationSupportedByThinClient(request) + ? this.globalEndpointManager.ResolveThinClientEndpoint(request) + : this.globalEndpointManager.ResolveServiceEndpoint(request); + request.RequestContext.RouteToLocation(this.locationEndpoint); } @@ -236,8 +253,7 @@ private async Task ShouldRetryInternalAsync( this.documentServiceRequest?.ResourceAddress ?? string.Empty); // Mark the partition key range as unavailable to retry future request on a new region. - this.partitionKeyRangeLocationCache.TryMarkEndpointUnavailableForPartitionKeyRange( - this.documentServiceRequest); + this.TryMarkEndpointUnavailableForPkRange(isSystemResourceUnavailableForWrite: false); } // Received 403.3 on write region, initiate the endpoint rediscovery @@ -296,11 +312,12 @@ private async Task ShouldRetryInternalAsync( this.documentServiceRequest?.RequestContext?.LocationEndpointToRoute?.ToString() ?? string.Empty, this.documentServiceRequest?.ResourceAddress ?? string.Empty); + //Retry policy will retry on the next preffered region as the original requert region is not accepting requests return await this.ShouldRetryOnEndpointFailureAsync( isReadRequest: this.isReadRequest, markBothReadAndWriteAsUnavailable: false, forceRefresh: false, - retryOnPreferredLocations: false); + retryOnPreferredLocations: true); } if (statusCode == HttpStatusCode.NotFound @@ -313,7 +330,14 @@ private async Task ShouldRetryInternalAsync( if (statusCode == HttpStatusCode.ServiceUnavailable) { return this.TryMarkEndpointUnavailableForPkRangeAndRetryOnServiceUnavailable( - shouldMarkEndpointUnavailableForPkRange: true); + isSystemResourceUnavailableForWrite: false); + } + + // Recieved 500 status code or lease not found + if ((statusCode == HttpStatusCode.InternalServerError && this.isReadRequest) + || (statusCode == HttpStatusCode.Gone && subStatusCode == SubStatusCodes.LeaseNotFound)) + { + return this.ShouldRetryOnUnavailableEndpointStatusCodes(); } return null; @@ -442,32 +466,28 @@ private ShouldRetryResult ShouldRetryOnSessionNotAvailable(DocumentServiceReques /// Service Unavailable response is received, indicating that the service might be temporarily unavailable. /// It optionally marks the partition key range as unavailable, which will influence future routing decisions. /// - /// A boolean flag indicating whether the endpoint for the - /// current partition key range should be marked as unavailable. + /// A boolean flag indicating whether the endpoint for the + /// current partition key range should be marked as unavailable, if the failure happened due to system + /// resource unavailability. /// An instance of indicating whether the operation should be retried. private ShouldRetryResult TryMarkEndpointUnavailableForPkRangeAndRetryOnServiceUnavailable( - bool shouldMarkEndpointUnavailableForPkRange) + bool isSystemResourceUnavailableForWrite) { DefaultTrace.TraceWarning("ClientRetryPolicy: ServiceUnavailable. Refresh cache and retry. Failed Location: {0}; ResourceAddress: {1}", this.documentServiceRequest?.RequestContext?.LocationEndpointToRoute?.ToString() ?? string.Empty, this.documentServiceRequest?.ResourceAddress ?? string.Empty); - if (shouldMarkEndpointUnavailableForPkRange) - { - // Mark the partition as unavailable. - // Let the ClientRetry logic decide if the request should be retried - this.partitionKeyRangeLocationCache.TryMarkEndpointUnavailableForPartitionKeyRange( - this.documentServiceRequest); - } + this.TryMarkEndpointUnavailableForPkRange(isSystemResourceUnavailableForWrite); - return this.ShouldRetryOnServiceUnavailable(); + return this.ShouldRetryOnUnavailableEndpointStatusCodes(); } /// /// For a ServiceUnavailable (503.0) we could be having a timeout from Direct/TCP locally or a request to Gateway request with a similar response due to an endpoint not yet available. /// We try and retry the request only if there are other regions available. The retry logic is applicable for single master write accounts as well. + /// Other status codes include InternalServerError (500.0) and LeaseNotFound (410.1022). /// - private ShouldRetryResult ShouldRetryOnServiceUnavailable() + private ShouldRetryResult ShouldRetryOnUnavailableEndpointStatusCodes() { if (this.serviceUnavailableRetryCount++ >= ClientRetryPolicy.MaxServiceUnavailableRetryCount) { @@ -477,7 +497,7 @@ private ShouldRetryResult ShouldRetryOnServiceUnavailable() if (!this.canUseMultipleWriteLocations && !this.isReadRequest - && !this.isPertitionLevelFailoverEnabled) + && !this.isPartitionLevelFailoverEnabled) { // Write requests on single master cannot be retried if partition level failover is disabled. // This means there are no other regions available to serve the writes. @@ -506,6 +526,30 @@ private ShouldRetryResult ShouldRetryOnServiceUnavailable() return ShouldRetryResult.RetryAfter(TimeSpan.Zero); } + /// + /// Attempts to mark the endpoint associated with the current partition key range as unavailable + /// which will influence future routing decisions. + /// + /// A boolean flag indicating if the system resource was unavailable. If true, + /// the endpoint will be marked unavailable for the pk-range of a multi master write request, bypassing the circuit breaker check. + /// A boolean flag indicating whether the endpoint was marked as unavailable. + private bool TryMarkEndpointUnavailableForPkRange( + bool isSystemResourceUnavailableForWrite) + { + if (this.documentServiceRequest != null + && (isSystemResourceUnavailableForWrite + || this.IsRequestEligibleForPerPartitionAutomaticFailover() + || this.IsRequestEligibleForPartitionLevelCircuitBreaker())) + { + // Mark the partition as unavailable. + // Let the ClientRetry logic decide if the request should be retried + return this.partitionKeyRangeLocationCache.TryMarkEndpointUnavailableForPartitionKeyRange( + request: this.documentServiceRequest); + } + + return false; + } + /// /// Returns a boolean flag indicating if the endpoint should be marked as unavailable /// due to a 429 response with a sub status code of 3092 (system resource unavailable). @@ -524,6 +568,32 @@ private bool ShouldMarkEndpointUnavailableOnSystemResourceUnavailableForWrite( && subStatusCode == SubStatusCodes.SystemResourceUnavailable; } + /// + /// Determines if a request is eligible for per-partition automatic failover. + /// A request is eligible if it is a write request, partition level failover is enabled, + /// and the global endpoint manager cannot use multiple write locations for the request. + /// + /// True if the request is eligible for per-partition automatic failover, otherwise false. + private bool IsRequestEligibleForPerPartitionAutomaticFailover() + { + return this.partitionKeyRangeLocationCache.IsRequestEligibleForPerPartitionAutomaticFailover( + this.documentServiceRequest); + } + + /// + /// Determines if a request is eligible for partition-level circuit breaker. + /// This method checks if the request is a read-only request or a multi master write request, if partition-level circuit breaker is enabled, + /// and if the partition key range location cache indicates that the partition can fail over based on the number of request failures. + /// + /// + /// True if the read request is eligible for partition-level circuit breaker, otherwise false. + /// + private bool IsRequestEligibleForPartitionLevelCircuitBreaker() + { + return this.partitionKeyRangeLocationCache.IsRequestEligibleForPartitionLevelCircuitBreaker(this.documentServiceRequest) + && this.partitionKeyRangeLocationCache.IncrementRequestFailureCounterAndCheckIfPartitionCanFailover(this.documentServiceRequest); + } + private sealed class RetryContext { public int RetryLocationIndex { get; set; } diff --git a/Microsoft.Azure.Cosmos/src/ConnectionPolicy.cs b/Microsoft.Azure.Cosmos/src/ConnectionPolicy.cs index b54c4837c4..8b871de13d 100644 --- a/Microsoft.Azure.Cosmos/src/ConnectionPolicy.cs +++ b/Microsoft.Azure.Cosmos/src/ConnectionPolicy.cs @@ -28,8 +28,12 @@ internal sealed class ConnectionPolicy private static ConnectionPolicy defaultPolicy; private Protocol connectionProtocol; +#pragma warning disable IDE0044 // Add readonly modifier private ObservableCollection preferredLocations; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private ObservableCollection accountInitializationCustomEndpoints; +#pragma warning restore IDE0044 // Add readonly modifier /// /// Initializes a new instance of the class to connect to the Azure Cosmos DB service. @@ -50,7 +54,7 @@ public ConnectionPolicy() this.RetryOptions = new RetryOptions(); this.EnableReadRequestsFallback = null; this.ServerCertificateCustomValidationCallback = null; - + this.AvailabilityStrategy = null; this.CosmosClientTelemetryOptions = new CosmosClientTelemetryOptions(); } @@ -332,6 +336,12 @@ public bool EnablePartitionLevelFailover set; } + public bool EnablePartitionLevelCircuitBreaker + { + get; + set; + } + /// /// Gets or sets the certificate validation callback. /// @@ -506,6 +516,34 @@ public bool? EnableAdvancedReplicaSelectionForTcp set; } + /// + /// Availability Strategy to be used for periods of high latency + /// + /// /// + /// An example on how to set an availability strategy custom serializer. + /// + /// { "East US", "Central US", "West US" } ) + /// .WithAvailabilityStrategy( + /// AvailabilityStrategy.CrossRegionHedgingStrategy( + /// threshold: TimeSpan.FromMilliseconds(500), + /// thresholdStep: TimeSpan.FromMilliseconds(100) + /// )) + /// .Build(); + /// ]]> + /// + /// + /// + /// The availability strategy in the example is a Cross Region Hedging Strategy. + /// These strategies take two values, a threshold and a threshold step.When a request that is sent + /// out takes longer than the threshold time, the SDK will hedge to the second region in the application preferred regions list. + /// If a response from either the primary request or the first hedged request is not received + /// after the threshold step time, the SDK will hedge to the third region and so on. + /// + public AvailabilityStrategy AvailabilityStrategy { get; set; } + /// /// (Direct/TCP) This is an advanced setting that controls the number of TCP connections that will be opened eagerly to each Cosmos DB back-end. /// @@ -530,6 +568,24 @@ internal CosmosClientTelemetryOptions CosmosClientTelemetryOptions set; } + /// + /// provides SessionTokenMismatchRetryPolicy optimization through customer supplied region switch hints + /// + internal SessionRetryOptions SessionRetryOptions + { + get; + set; + } + + /// + /// A string containing the application name. + /// + internal string ApplicationName + { + get; + set; + } + /// /// GlobalEndpointManager will subscribe to this event if user updates the preferredLocations list in the Azure Cosmos DB service. /// diff --git a/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs b/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs index 3f4cc279e4..3f60995b4a 100644 --- a/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs +++ b/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs @@ -54,7 +54,7 @@ public class CosmosClientOptions private const string ConnectionStringAccountKey = "AccountKey"; private const string ConnectionStringDisableServerCertificateValidation = "DisableServerCertificateValidation"; - private const ApiType DefaultApiType = ApiType.None; + private const ApiType DefaultApiType = ApiType.None; /// /// Default request timeout @@ -74,7 +74,8 @@ public class CosmosClientOptions private IWebProxy webProxy; private Func httpClientFactory; private string applicationName; - private IFaultInjector faultInjector; + private IFaultInjector faultInjector; + private bool isCustomSerializerProvided; /// /// Creates a new CosmosClientOptions @@ -88,7 +89,8 @@ public CosmosClientOptions() this.ConnectionProtocol = CosmosClientOptions.DefaultProtocol; this.ApiType = CosmosClientOptions.DefaultApiType; this.CustomHandlers = new Collection(); - this.CosmosClientTelemetryOptions = new CosmosClientTelemetryOptions(); + this.CosmosClientTelemetryOptions = new CosmosClientTelemetryOptions(); + this.SessionRetryOptions = new SessionRetryOptions(); } /// @@ -119,7 +121,12 @@ public string ApplicationName /// /// Get or set session container for the client /// - internal ISessionContainer SessionContainer { get; set; } + internal ISessionContainer SessionContainer { get; set; } + + /// + /// hint which guide SDK-internal retry policies on how early to switch retries to a different region. + /// + internal SessionRetryOptions SessionRetryOptions { get; private set; } /// /// Gets or sets the location where the application is running. This will influence the SDK's choice for the Azure Cosmos DB service interaction. @@ -443,7 +450,22 @@ public System.Text.Json.JsonSerializerOptions UseSystemTextJsonSerializerWithOpt /// /// This is optimal for latency-sensitive workloads. Does not apply if is used. /// - internal bool? EnableAdvancedReplicaSelectionForTcp { get; set; } + internal bool? EnableAdvancedReplicaSelectionForTcp { get; set; } + + /// + /// Gets or sets stack trace optimization to reduce stack trace proliferation in high-concurrency scenarios where exceptions are frequently thrown. + /// When enabled, critical SDK components optimize exception handling to minimize performance overhead. + /// The default value is 'true'. + /// + internal bool EnableAsyncCacheExceptionNoSharing { get; set; } = true; + + /// + /// Gets or sets the boolean flag to skip converting a text stream to binary and vice versa. When enabled, the request and response stream + /// would not be converted to the desired target serialization type and will act just like a pass through. This client option will + /// remain internal only since the consumer of this flag will be the internal components of the cosmos db ecosystem. + /// The default value for this parameter is 'false'. + /// + internal bool EnableStreamPassThrough { get; set; } = false; /// /// (Direct/TCP) Controls the amount of idle time after which unused connections are closed. @@ -624,7 +646,8 @@ public CosmosSerializer Serializer throw new ArgumentException( $"{nameof(this.Serializer)} is not compatible with {nameof(this.SerializerOptions)} or {nameof(this.UseSystemTextJsonSerializerWithOptions)}. Only one can be set. "); } - + + this.isCustomSerializerProvided = true; this.serializerInternal = value; } } @@ -723,11 +746,31 @@ public Func HttpClientFactory /// after the threshold step time, the SDK will hedge to the third region and so on. /// public AvailabilityStrategy AvailabilityStrategy { get; set; } - + + /// + /// Provides SessionTokenMismatchRetryPolicy optimization through customer supplied region switch hints, + /// which guide SDK-internal retry policies on how early to fallback to the next applicable region. + /// With a single-write-region account the next applicable region is the write-region, with a + /// multi-write-region account the next applicable region is the next region in the order of effective + /// preferred regions (same order also used for read/query operations). + /// +#if PREVIEW + public +#else + internal +#endif + bool EnableRemoteRegionPreferredForSessionRetry + { + get => this.SessionRetryOptions.RemoteRegionPreferred; + set => this.SessionRetryOptions.RemoteRegionPreferred = value; + } + /// - /// Enable partition key level failover + /// Enable partition level circuit breaker (aka PPCB). For compute gateway use case, by default per partition automatic failover will be disabled, so does the PPCB. + /// If compute gateway chooses to enable PPAF, then the .NET SDK will enable PPCB by default, which will improve the read availability and latency. This would mean + /// when PPAF is enabled, the SDK will automatically enable PPCB as well. /// - internal bool EnablePartitionLevelFailover { get; set; } = ConfigurationManager.IsPartitionLevelFailoverEnabled(defaultValue: false); + internal bool EnablePartitionLevelCircuitBreaker { get; set; } = ConfigurationManager.IsPartitionLevelCircuitBreakerEnabled(defaultValue: false); /// /// Quorum Read allowed with eventual consistency account or consistent prefix account. @@ -943,7 +986,12 @@ public IFaultInjector FaultInjector /// If is set to true in CosmosClientOptions, throughput bucket can only be set at client level. /// /// - internal int? ThroughputBucket { get; set; } +#if PREVIEW + public +#else + internal +#endif + int? ThroughputBucket { get; set; } internal IChaosInterceptorFactory ChaosInterceptorFactory { get; set; } @@ -964,29 +1012,31 @@ internal CosmosClientOptions Clone() internal virtual ConnectionPolicy GetConnectionPolicy(int clientId) { this.ValidateDirectTCPSettings(); - this.ValidateLimitToEndpointSettings(); - this.ValidatePartitionLevelFailoverSettings(); + this.ValidateLimitToEndpointSettings(); ConnectionPolicy connectionPolicy = new ConnectionPolicy() - { + { + ApplicationName = this.ApplicationName, MaxConnectionLimit = this.GatewayModeMaxConnectionLimit, RequestTimeout = this.RequestTimeout, ConnectionMode = this.ConnectionMode, ConnectionProtocol = this.ConnectionProtocol, UserAgentContainer = this.CreateUserAgentContainerWithFeatures(clientId), UseMultipleWriteLocations = true, - IdleTcpConnectionTimeout = this.IdleTcpConnectionTimeout, + IdleTcpConnectionTimeout = this.IdleTcpConnectionTimeout, + SessionRetryOptions = this.SessionRetryOptions, OpenTcpConnectionTimeout = this.OpenTcpConnectionTimeout, MaxRequestsPerTcpConnection = this.MaxRequestsPerTcpConnection, MaxTcpConnectionsPerEndpoint = this.MaxTcpConnectionsPerEndpoint, EnableEndpointDiscovery = !this.LimitToEndpoint, - EnablePartitionLevelFailover = this.EnablePartitionLevelFailover, + EnablePartitionLevelCircuitBreaker = this.EnablePartitionLevelCircuitBreaker, PortReuseMode = this.portReuseMode, EnableTcpConnectionEndpointRediscovery = this.EnableTcpConnectionEndpointRediscovery, EnableAdvancedReplicaSelectionForTcp = this.EnableAdvancedReplicaSelectionForTcp, HttpClientFactory = this.httpClientFactory, ServerCertificateCustomValidationCallback = this.ServerCertificateCustomValidationCallback, - CosmosClientTelemetryOptions = new CosmosClientTelemetryOptions() + CosmosClientTelemetryOptions = new CosmosClientTelemetryOptions(), + AvailabilityStrategy = this.AvailabilityStrategy, }; if (this.CosmosClientTelemetryOptions != null) @@ -1084,6 +1134,11 @@ internal static CosmosClientOptions GetCosmosClientOptionsWithCertificateFlag(st return clientOptions; } + + internal bool IsCustomSerializerProvided() + { + return this.isCustomSerializerProvided; + } private static T GetValueFromConnectionString(string connectionString, string keyName, T defaultValue) { @@ -1135,16 +1190,6 @@ private void ValidateLimitToEndpointSettings() } } - private void ValidatePartitionLevelFailoverSettings() - { - if (this.EnablePartitionLevelFailover - && string.IsNullOrEmpty(this.ApplicationRegion) - && (this.ApplicationPreferredRegions is null || this.ApplicationPreferredRegions.Count == 0)) - { - throw new ArgumentException($"{nameof(this.ApplicationPreferredRegions)} or {nameof(this.ApplicationRegion)} is required when {nameof(this.EnablePartitionLevelFailover)} is enabled."); - } - } - private void ValidateDirectTCPSettings() { string settingName = string.Empty; @@ -1197,14 +1242,14 @@ internal UserAgentContainer CreateUserAgentContainerWithFeatures(int clientId) featureString = Convert.ToString((int)features, 2).PadLeft(8, '0'); } - string regionConfiguration = this.GetRegionConfiguration(); + string regionConfiguration = this.GetRegionConfiguration(); return new UserAgentContainer( clientId: clientId, features: featureString, - regionConfiguration: regionConfiguration, + regionConfiguration: regionConfiguration, suffix: this.ApplicationName); - } + } /// /// This generates a key that added to the user agent to make it diff --git a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosObject.cs b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosObject.cs index 2fb8f6a1f4..5c65de7e76 100644 --- a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosObject.cs +++ b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosObject.cs @@ -224,7 +224,9 @@ public void Reset() public struct KeyCollection : IEnumerable { +#pragma warning disable IDE0044 // Add readonly modifier private Dictionary.KeyCollection innerCollection; +#pragma warning restore IDE0044 // Add readonly modifier internal KeyCollection(Dictionary.KeyCollection innerCollection) { @@ -266,7 +268,9 @@ public void Reset() public struct ValueCollection : IEnumerable { +#pragma warning disable IDE0044 // Add readonly modifier private Dictionary.ValueCollection innerCollection; +#pragma warning restore IDE0044 // Add readonly modifier internal ValueCollection(Dictionary.ValueCollection innerCollection) { diff --git a/Microsoft.Azure.Cosmos/src/Diagnostics/UserAgentFeatureFlags.cs b/Microsoft.Azure.Cosmos/src/Diagnostics/UserAgentFeatureFlags.cs new file mode 100644 index 0000000000..39c22d88bc --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Diagnostics/UserAgentFeatureFlags.cs @@ -0,0 +1,28 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos +{ + /// + /// User agent feature flags. + /// Each new feature flag will represent a bit in a number to encode what features are enabled. + /// Therefore, the first feature flag will be 1, the second 2, the third 4, etc. + /// When constructing the user agent suffix, the feature flags will be used to encode a unique number representing the features enabled. + /// This number will be converted into a hex string following the prefix "F" to save space in the user agent as it is limited and appended to the user agent suffix. + /// This number will then be used to determine what features are enabled by decoding the hex string back to a number and checking what bits are set. + /// For example if the user agent suffix has F7, this means that the feature flags 1, 2 and 4 are enabled (the first three feature flags). + /// + internal enum UserAgentFeatureFlags + { + PerPartitionAutomaticFailover = 1, + + PerPartitionCircuitBreaker = 2, + + ThinClient = 4, + + BinaryEncoding = 8, + + Http2 = 16, + } +} diff --git a/Microsoft.Azure.Cosmos/src/DocumentClient.cs b/Microsoft.Azure.Cosmos/src/DocumentClient.cs index 00353501fd..4a2d2da54c 100644 --- a/Microsoft.Azure.Cosmos/src/DocumentClient.cs +++ b/Microsoft.Azure.Cosmos/src/DocumentClient.cs @@ -113,11 +113,20 @@ internal partial class DocumentClient : IDisposable, IAuthorizationTokenProvider private const bool DefaultEnableCpuMonitor = true; private const string DefaultInitTaskKey = "InitTaskKey"; + /// + /// Default thresholds for PPAF request hedging. + /// + private const int DefaultHedgingThresholdInMilliseconds = 1000; + private const int DefaultHedgingThresholdStepInMilliseconds = 500; + private static readonly char[] resourceIdOrFullNameSeparators = new char[] { '/' }; private static readonly char[] resourceIdSeparators = new char[] { '/', '\\', '?', '#' }; private readonly bool IsLocalQuorumConsistency = false; private readonly bool isReplicaAddressValidationEnabled; + private readonly bool enableAsyncCacheExceptionNoSharing; + + private readonly bool isThinClientEnabled; //Fault Injection private readonly IChaosInterceptorFactory chaosInterceptorFactory; @@ -194,10 +203,14 @@ internal partial class DocumentClient : IDisposable, IAuthorizationTokenProvider private Func> initializeTaskFactory; internal AsyncCacheNonBlocking initTaskCache; +#pragma warning disable IDE0044 // Add readonly modifier private JsonSerializerSettings serializerSettings; +#pragma warning restore IDE0044 // Add readonly modifier private event EventHandler sendingRequest; private event EventHandler receivedResponse; +#pragma warning disable IDE0044 // Add readonly modifier private Func transportClientHandlerFactory; +#pragma warning restore IDE0044 // Add readonly modifier /// /// Initializes a new instance of the class using the @@ -243,8 +256,11 @@ public DocumentClient(Uri serviceEndpoint, } this.Initialize(serviceEndpoint, connectionPolicy, desiredConsistencyLevel); - this.initTaskCache = new AsyncCacheNonBlocking(cancellationToken: this.cancellationTokenSource.Token); + this.initTaskCache = new AsyncCacheNonBlocking( + cancellationToken: this.cancellationTokenSource.Token, + enableAsyncCacheExceptionNoSharing: this.enableAsyncCacheExceptionNoSharing); this.isReplicaAddressValidationEnabled = ConfigurationManager.IsReplicaAddressValidationEnabled(connectionPolicy); + this.isThinClientEnabled = ConfigurationManager.IsThinClientEnabled(defaultValue: false); } /// @@ -444,6 +460,7 @@ internal DocumentClient(Uri serviceEndpoint, /// This delegate responsible for validating the third party certificate. /// This is distributed tracing flag /// This is the chaos interceptor used for fault injection + /// A boolean flag indicating if stack trace optimization is enabled. /// /// The service endpoint can be obtained from the Azure Management Portal. /// If you are connecting using one of the Master Keys, these can be obtained along with the endpoint from the Azure Management Portal @@ -472,7 +489,8 @@ internal DocumentClient(Uri serviceEndpoint, string cosmosClientId = null, RemoteCertificateValidationCallback remoteCertificateValidationCallback = null, CosmosClientTelemetryOptions cosmosClientTelemetryOptions = null, - IChaosInterceptorFactory chaosInterceptorFactory = null) + IChaosInterceptorFactory chaosInterceptorFactory = null, + bool enableAsyncCacheExceptionNoSharing = true) { if (sendingRequestEventArgs != null) { @@ -491,12 +509,16 @@ internal DocumentClient(Uri serviceEndpoint, this.receivedResponse += receivedResponseEventArgs; } + this.enableAsyncCacheExceptionNoSharing = enableAsyncCacheExceptionNoSharing; this.cosmosAuthorization = cosmosAuthorization ?? throw new ArgumentNullException(nameof(cosmosAuthorization)); this.transportClientHandlerFactory = transportClientHandlerFactory; this.IsLocalQuorumConsistency = isLocalQuorumConsistency; - this.initTaskCache = new AsyncCacheNonBlocking(cancellationToken: this.cancellationTokenSource.Token); + this.initTaskCache = new AsyncCacheNonBlocking( + cancellationToken: this.cancellationTokenSource.Token, + enableAsyncCacheExceptionNoSharing: this.enableAsyncCacheExceptionNoSharing); this.chaosInterceptorFactory = chaosInterceptorFactory; this.chaosInterceptor = chaosInterceptorFactory?.CreateInterceptor(this); + this.isThinClientEnabled = ConfigurationManager.IsThinClientEnabled(defaultValue: false); this.Initialize( serviceEndpoint: serviceEndpoint, @@ -508,7 +530,8 @@ internal DocumentClient(Uri serviceEndpoint, storeClientFactory: storeClientFactory, cosmosClientId: cosmosClientId, remoteCertificateValidationCallback: remoteCertificateValidationCallback, - cosmosClientTelemetryOptions: cosmosClientTelemetryOptions); + cosmosClientTelemetryOptions: cosmosClientTelemetryOptions, + enableThinClientMode: this.isThinClientEnabled); } /// @@ -675,10 +698,11 @@ private async Task OpenPrivateAsync(CancellationToken cancellationToken) storeModel: this.GatewayStoreModel, tokenProvider: this, retryPolicy: this.retryPolicy, - telemetryToServiceHelper: this.telemetryToServiceHelper); - this.partitionKeyRangeCache = new PartitionKeyRangeCache(this, this.GatewayStoreModel, this.collectionCache, this.GlobalEndpointManager); + telemetryToServiceHelper: this.telemetryToServiceHelper, + enableAsyncCacheExceptionNoSharing: this.enableAsyncCacheExceptionNoSharing); + this.partitionKeyRangeCache = new PartitionKeyRangeCache(this, this.GatewayStoreModel, this.collectionCache, this.GlobalEndpointManager, this.enableAsyncCacheExceptionNoSharing); - DefaultTrace.TraceWarning("{0} occurred while OpenAsync. Exception Message: {1}", ex.ToString(), ex.Message); + DefaultTrace.TraceWarning("Exception occurred while OpenAsync. Exception Message: {0}", ex.Message); } } @@ -692,7 +716,8 @@ internal virtual void Initialize(Uri serviceEndpoint, TokenCredential tokenCredential = null, string cosmosClientId = null, RemoteCertificateValidationCallback remoteCertificateValidationCallback = null, - CosmosClientTelemetryOptions cosmosClientTelemetryOptions = null) + CosmosClientTelemetryOptions cosmosClientTelemetryOptions = null, + bool enableThinClientMode = false) { if (serviceEndpoint == null) { @@ -934,14 +959,13 @@ internal virtual void Initialize(Uri serviceEndpoint, this.ConnectionPolicy = connectionPolicy ?? ConnectionPolicy.Default; #if !NETSTANDARD16 - ServicePointAccessor servicePoint = ServicePointAccessor.FindServicePoint(this.ServiceEndpoint); - servicePoint.ConnectionLimit = this.ConnectionPolicy.MaxConnectionLimit; + if (ServicePointAccessor.IsSupported) + { + ServicePointAccessor servicePoint = ServicePointAccessor.FindServicePoint(this.ServiceEndpoint); + servicePoint.ConnectionLimit = this.ConnectionPolicy.MaxConnectionLimit; + } #endif - - this.GlobalEndpointManager = new GlobalEndpointManager(this, this.ConnectionPolicy); - this.PartitionKeyRangeLocation = this.ConnectionPolicy.EnablePartitionLevelFailover - ? new GlobalPartitionEndpointManagerCore(this.GlobalEndpointManager) - : GlobalPartitionEndpointManagerNoOp.Instance; + this.GlobalEndpointManager = new GlobalEndpointManager(this, this.ConnectionPolicy, this.enableAsyncCacheExceptionNoSharing); this.httpClient = CosmosHttpClientCore.CreateWithConnectionPolicy( this.ApiType, @@ -982,13 +1006,6 @@ internal virtual void Initialize(Uri serviceEndpoint, this.sessionContainer = new SessionContainer(this.ServiceEndpoint.Host); } - this.retryPolicy = new RetryPolicy( - globalEndpointManager: this.GlobalEndpointManager, - connectionPolicy: this.ConnectionPolicy, - partitionKeyRangeLocationCache: this.PartitionKeyRangeLocation); - - this.ResetSessionTokenRetryPolicy = this.retryPolicy; - this.desiredConsistencyLevel = desiredConsistencyLevel; // Setup the proxy to be used based on connection mode. // For gateway: GatewayProxy. @@ -1015,7 +1032,9 @@ internal virtual void Initialize(Uri serviceEndpoint, // UnobservedTaskException by using ContinueWith method w/ TaskContinuationOptions.OnlyOnFaulted // and accessing the Exception property on the target task. #pragma warning disable VSTHRD110 // Observe result of async calls +#pragma warning disable CDX1000 // DontConvertExceptionToObject initTask.ContinueWith(t => DefaultTrace.TraceWarning("initializeTask failed {0}", t.Exception), TaskContinuationOptions.OnlyOnFaulted); +#pragma warning restore CDX1000 // DontConvertExceptionToObject #pragma warning restore VSTHRD110 // Observe result of async calls this.traceId = Interlocked.Increment(ref DocumentClient.idCounter); @@ -1041,13 +1060,42 @@ private async Task GetInitializationTaskAsync(IStoreClientFactory storeCli this.EnsureValidOverwrite(this.desiredConsistencyLevel.Value); } + bool isPPafEnabled = ConfigurationManager.IsPartitionLevelFailoverEnabled(defaultValue: false); + if (this.accountServiceConfiguration != null && this.accountServiceConfiguration.AccountProperties.EnablePartitionLevelFailover.HasValue) + { + isPPafEnabled = this.accountServiceConfiguration.AccountProperties.EnablePartitionLevelFailover.Value; + } + + this.ConnectionPolicy.EnablePartitionLevelFailover = isPPafEnabled; + this.ConnectionPolicy.EnablePartitionLevelCircuitBreaker |= this.ConnectionPolicy.EnablePartitionLevelFailover; + this.ConnectionPolicy.UserAgentContainer.AppendFeatures(this.GetUserAgentFeatures()); + this.InitializePartitionLevelFailoverWithDefaultHedging(); + + this.PartitionKeyRangeLocation = + this.ConnectionPolicy.EnablePartitionLevelFailover + || this.ConnectionPolicy.EnablePartitionLevelCircuitBreaker + ? new GlobalPartitionEndpointManagerCore( + this.GlobalEndpointManager, + this.ConnectionPolicy.EnablePartitionLevelFailover, + this.ConnectionPolicy.EnablePartitionLevelCircuitBreaker) + : GlobalPartitionEndpointManagerNoOp.Instance; + + this.retryPolicy = new RetryPolicy( + globalEndpointManager: this.GlobalEndpointManager, + connectionPolicy: this.ConnectionPolicy, + partitionKeyRangeLocationCache: this.PartitionKeyRangeLocation); + + this.ResetSessionTokenRetryPolicy = this.retryPolicy; + GatewayStoreModel gatewayStoreModel = new GatewayStoreModel( this.GlobalEndpointManager, this.sessionContainer, (Cosmos.ConsistencyLevel)this.accountServiceConfiguration.DefaultConsistencyLevel, this.eventSource, this.serializerSettings, - this.httpClient); + this.httpClient, + this.PartitionKeyRangeLocation, + isPartitionLevelFailoverEnabled: this.ConnectionPolicy.EnablePartitionLevelFailover || this.ConnectionPolicy.EnablePartitionLevelCircuitBreaker); this.GatewayStoreModel = gatewayStoreModel; @@ -1056,13 +1104,29 @@ private async Task GetInitializationTaskAsync(IStoreClientFactory storeCli storeModel: this.GatewayStoreModel, tokenProvider: this, retryPolicy: this.retryPolicy, - telemetryToServiceHelper: this.telemetryToServiceHelper); - this.partitionKeyRangeCache = new PartitionKeyRangeCache(this, this.GatewayStoreModel, this.collectionCache, this.GlobalEndpointManager); + telemetryToServiceHelper: this.telemetryToServiceHelper, + enableAsyncCacheExceptionNoSharing: this.enableAsyncCacheExceptionNoSharing); + this.partitionKeyRangeCache = new PartitionKeyRangeCache(this, this.GatewayStoreModel, this.collectionCache, this.GlobalEndpointManager, this.enableAsyncCacheExceptionNoSharing); this.ResetSessionTokenRetryPolicy = new ResetSessionTokenRetryPolicyFactory(this.sessionContainer, this.collectionCache, this.retryPolicy); gatewayStoreModel.SetCaches(this.partitionKeyRangeCache, this.collectionCache); - if (this.ConnectionPolicy.ConnectionMode == ConnectionMode.Gateway) + if (this.ConnectionPolicy.ConnectionMode == ConnectionMode.Gateway && this.isThinClientEnabled) + { + ThinClientStoreModel thinClientStoreModel = new ( + endpointManager: this.GlobalEndpointManager, + this.PartitionKeyRangeLocation, + this.sessionContainer, + (Cosmos.ConsistencyLevel)this.accountServiceConfiguration.DefaultConsistencyLevel, + this.eventSource, + this.serializerSettings, + this.httpClient); + + thinClientStoreModel.SetCaches(this.partitionKeyRangeCache, this.collectionCache); + + this.StoreModel = thinClientStoreModel; + } + else if (this.ConnectionPolicy.ConnectionMode == ConnectionMode.Gateway) { this.StoreModel = this.GatewayStoreModel; } @@ -1339,7 +1403,7 @@ public void Dispose() catch (Exception exception) { DefaultTrace.TraceWarning("Exception {0} thrown during dispose of HttpClient, this could happen if there are inflight request during the dispose of client", - exception); + exception.Message); } this.httpClient = null; @@ -1607,8 +1671,8 @@ internal virtual async Task EnsureValidClientAsync(ITrace trace) } catch (Exception e) { - DefaultTrace.TraceWarning("EnsureValidClientAsync initializeTask failed {0}", e); - childTrace.AddDatum("initializeTask failed", e); + DefaultTrace.TraceWarning("EnsureValidClientAsync initializeTask failed {0}", e.Message); + childTrace.AddDatum("initializeTask failed", e.Message); throw; } @@ -6547,6 +6611,13 @@ internal IStoreModel GetStoreProxy(DocumentServiceRequest request) return this.GatewayStoreModel; } + if (this.isThinClientEnabled + && operationType == OperationType.Read + && resourceType == ResourceType.Database) + { + return this.GatewayStoreModel; + } + if (operationType == OperationType.Create || operationType == OperationType.Upsert) { @@ -6697,6 +6768,7 @@ private void InitializeDirectConnectivity(IStoreClientFactory storeClientFactory rntbdMaxConcurrentOpeningConnectionCount: this.rntbdMaxConcurrentOpeningConnectionCount, remoteCertificateValidationCallback: this.remoteCertificateValidationCallback, distributedTracingOptions: distributedTracingOptions, + enableChannelMultiplexing: ConfigurationManager.IsTcpChannelMultiplexingEnabled(), chaosInterceptor: this.chaosInterceptor); if (this.transportClientHandlerFactory != null) @@ -6718,7 +6790,8 @@ private void InitializeDirectConnectivity(IStoreClientFactory storeClientFactory this.accountServiceConfiguration, this.ConnectionPolicy, this.httpClient, - this.storeClientFactory.GetConnectionStateListener()); + this.storeClientFactory.GetConnectionStateListener(), + this.enableAsyncCacheExceptionNoSharing); this.CreateStoreModel(subscribeRntbdStatus: true); } @@ -6738,7 +6811,8 @@ private void CreateStoreModel(bool subscribeRntbdStatus) !this.enableRntbdChannel, this.UseMultipleWriteLocations && (this.accountServiceConfiguration.DefaultConsistencyLevel != Documents.ConsistencyLevel.Strong), true, - enableReplicaValidation: this.isReplicaAddressValidationEnabled); + enableReplicaValidation: this.isReplicaAddressValidationEnabled, + sessionRetryOptions: this.ConnectionPolicy.SessionRetryOptions); if (subscribeRntbdStatus) { @@ -6764,17 +6838,60 @@ private async Task InitializeGatewayConfigurationReaderAsync() cosmosAuthorization: this.cosmosAuthorization, connectionPolicy: this.ConnectionPolicy, httpClient: this.httpClient, - cancellationToken: this.cancellationTokenSource.Token); + cancellationToken: this.cancellationTokenSource.Token, + isThinClientEnabled: this.isThinClientEnabled); this.accountServiceConfiguration = new CosmosAccountServiceConfiguration(accountReader.InitializeReaderAsync); await this.accountServiceConfiguration.InitializeAsync(); AccountProperties accountProperties = this.accountServiceConfiguration.AccountProperties; this.UseMultipleWriteLocations = this.ConnectionPolicy.UseMultipleWriteLocations && accountProperties.EnableMultipleWriteLocations; - this.GlobalEndpointManager.InitializeAccountPropertiesAndStartBackgroundRefresh(accountProperties); } + internal string GetUserAgentFeatures() + { + int featureFlag = 0; + if (this.ConnectionPolicy.EnablePartitionLevelFailover) + { + featureFlag += (int)UserAgentFeatureFlags.PerPartitionAutomaticFailover; + } + + if (this.ConnectionPolicy.EnablePartitionLevelFailover || this.ConnectionPolicy.EnablePartitionLevelCircuitBreaker) + { + featureFlag += (int)UserAgentFeatureFlags.PerPartitionCircuitBreaker; + } + + if (this.isThinClientEnabled) + { + featureFlag += (int)UserAgentFeatureFlags.ThinClient; + } + + if (ConfigurationManager.IsBinaryEncodingEnabled()) + { + featureFlag += (int)UserAgentFeatureFlags.BinaryEncoding; + } + + return featureFlag == 0 ? string.Empty : $"F{featureFlag:X}"; + } + + internal void InitializePartitionLevelFailoverWithDefaultHedging() + { + if (this.ConnectionPolicy.EnablePartitionLevelFailover + && this.ConnectionPolicy.AvailabilityStrategy == null) + { + // The default threshold is the minimum value of 1 second and a fraction (currently it's half) of + // the request timeout value provided by the end customer. + double defaultThresholdInMillis = Math.Min( + DocumentClient.DefaultHedgingThresholdInMilliseconds, + this.ConnectionPolicy.RequestTimeout.TotalMilliseconds / 2); + + this.ConnectionPolicy.AvailabilityStrategy = AvailabilityStrategy.CrossRegionHedgingStrategy( + threshold: TimeSpan.FromMilliseconds(defaultThresholdInMillis), + thresholdStep: TimeSpan.FromMilliseconds(DocumentClient.DefaultHedgingThresholdStepInMilliseconds)); + } + } + internal void CaptureSessionToken(DocumentServiceRequest request, DocumentServiceResponse response) { this.sessionContainer.SetSessionToken(request, response.Headers); diff --git a/Microsoft.Azure.Cosmos/src/DocumentClientEventSource.cs b/Microsoft.Azure.Cosmos/src/DocumentClientEventSource.cs index 1daa128077..fca6c61844 100644 --- a/Microsoft.Azure.Cosmos/src/DocumentClientEventSource.cs +++ b/Microsoft.Azure.Cosmos/src/DocumentClientEventSource.cs @@ -13,7 +13,9 @@ namespace Microsoft.Azure.Cosmos // Marking it as non-sealed in order to unit test it using Moq framework internal class DocumentClientEventSource : EventSource, ICommunicationEventSource { +#pragma warning disable IDE0044 // Add readonly modifier private static Lazy documentClientEventSourceInstance +#pragma warning restore IDE0044 // Add readonly modifier = new Lazy(() => new DocumentClientEventSource()); public static DocumentClientEventSource Instance diff --git a/Microsoft.Azure.Cosmos/src/ExceptionHandlingUtility.cs b/Microsoft.Azure.Cosmos/src/ExceptionHandlingUtility.cs new file mode 100644 index 0000000000..5258a81963 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/ExceptionHandlingUtility.cs @@ -0,0 +1,47 @@ +// ------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// ------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos +{ + using System; + using System.Collections.Generic; + using System.Text; + using System.Threading.Tasks; + using Microsoft.Azure.Documents; + + /// + /// Utility for post-processing of exceptions. + /// + internal static class ExceptionHandlingUtility + { + /// + /// Tries to create a shallow copy of specific exception types (e.g., TaskCanceledException, TimeoutException, OperationCanceledException) + /// to prevent excessive stack trace growth. Returns true if the exception was cloned, otherwise false. + /// + public static bool TryCloneException(Exception e, out Exception clonedException) + { +#pragma warning disable CDX1000 // DontConvertExceptionToObject + clonedException = e switch + { + ICloneable cloneableEx => (Exception)cloneableEx.Clone(), + OperationCanceledException operationCanceledException => AddMessageData((Exception)Activator.CreateInstance(operationCanceledException.GetType(), operationCanceledException.Message, operationCanceledException), e), //Handles all OperationCanceledException types + TimeoutException timeoutEx => AddMessageData(new TimeoutException(timeoutEx.Message, timeoutEx), e), + _ => null + }; +#pragma warning restore CDX1000 // DontConvertExceptionToObject + + return clonedException is not null; + } + + private static Exception AddMessageData(Exception target, Exception source) + { + if (source.Data.Contains("Message")) + { + target.Data["Message"] = source.Data["Message"]; + } + + return target; + } + } +} diff --git a/Microsoft.Azure.Cosmos/src/Fluent/CosmosClientBuilder.cs b/Microsoft.Azure.Cosmos/src/Fluent/CosmosClientBuilder.cs index 0f3e5821fe..5e7ce3d116 100644 --- a/Microsoft.Azure.Cosmos/src/Fluent/CosmosClientBuilder.cs +++ b/Microsoft.Azure.Cosmos/src/Fluent/CosmosClientBuilder.cs @@ -581,8 +581,28 @@ public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosm { this.clientOptions.SerializerOptions = cosmosSerializerOptions; return this; - } - + } + + /// + /// Provides SessionTokenMismatchRetryPolicy optimization through customer supplied region switch hints, + /// which guide SDK-internal retry policies on how early to fallback to the next applicable region. + /// With a single-write-region account the next applicable region is the write-region, with a + /// multi-write-region account the next applicable region is the next region in the order of effective + /// preferred regions (same order also used for read/query operations). + /// + /// + /// The object +#if PREVIEW + public +#else + internal +#endif + CosmosClientBuilder WithEnableRemoteRegionPreferredForSessionRetry(bool enableRemoteRegionPreferredForSessionRetry) + { + this.clientOptions.EnableRemoteRegionPreferredForSessionRetry = enableRemoteRegionPreferredForSessionRetry; + return this; + } + /// /// Set a custom JSON serializer. /// @@ -706,12 +726,7 @@ internal CosmosClientBuilder WithApiType(ApiType apiType) /// /// /// The CosmosClientBuilder -#if PREVIEW - public -#else - internal -#endif - CosmosClientBuilder WithAvailabilityStrategy(AvailabilityStrategy strategy) + public CosmosClientBuilder WithAvailabilityStrategy(AvailabilityStrategy strategy) { this.clientOptions.AvailabilityStrategy = strategy; return this; @@ -739,15 +754,6 @@ internal CosmosClientBuilder WithCpuMonitorDisabled() return this; } - /// - /// Enabled partition level failover in the SDK - /// - internal CosmosClientBuilder WithPartitionLevelFailoverEnabled() - { - this.clientOptions.EnablePartitionLevelFailover = true; - return this; - } - /// /// Enables SDK to inject fault. Used for testing applications. /// @@ -813,7 +819,12 @@ public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptio /// The desired throughput bucket for the client. /// The current . /// - internal CosmosClientBuilder WithThroughputBucket(int throughputBucket) +#if PREVIEW + public +#else + internal +#endif + CosmosClientBuilder WithThroughputBucket(int throughputBucket) { this.clientOptions.ThroughputBucket = throughputBucket; return this; diff --git a/Microsoft.Azure.Cosmos/src/Fluent/Settings/ContainerBuilder.cs b/Microsoft.Azure.Cosmos/src/Fluent/Settings/ContainerBuilder.cs index 10362faca8..c1cc2e8b71 100644 --- a/Microsoft.Azure.Cosmos/src/Fluent/Settings/ContainerBuilder.cs +++ b/Microsoft.Azure.Cosmos/src/Fluent/Settings/ContainerBuilder.cs @@ -138,12 +138,7 @@ public VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy( /// A string indicating the default language. /// List of full text paths to include in the policy definition. /// An instance of . -#if PREVIEW - public -#else - internal -#endif - FullTextPolicyDefinition WithFullTextPolicy( + public FullTextPolicyDefinition WithFullTextPolicy( string defaultLanguage, Collection fullTextPaths) { diff --git a/Microsoft.Azure.Cosmos/src/Fluent/Settings/FullTextIndexDefinition.cs b/Microsoft.Azure.Cosmos/src/Fluent/Settings/FullTextIndexDefinition.cs index 241bbb3cc3..c70feeef58 100644 --- a/Microsoft.Azure.Cosmos/src/Fluent/Settings/FullTextIndexDefinition.cs +++ b/Microsoft.Azure.Cosmos/src/Fluent/Settings/FullTextIndexDefinition.cs @@ -10,12 +10,7 @@ namespace Microsoft.Azure.Cosmos.Fluent /// Full text index fluent definition. /// /// -#if PREVIEW - public -#else - internal -#endif - class FullTextIndexDefinition + public class FullTextIndexDefinition { private readonly FullTextIndexPath fullTextIndexPath = new (); private readonly T parent; diff --git a/Microsoft.Azure.Cosmos/src/Fluent/Settings/FullTextPolicyDefinition.cs b/Microsoft.Azure.Cosmos/src/Fluent/Settings/FullTextPolicyDefinition.cs index 1c8d69ecc7..d3f539eabf 100644 --- a/Microsoft.Azure.Cosmos/src/Fluent/Settings/FullTextPolicyDefinition.cs +++ b/Microsoft.Azure.Cosmos/src/Fluent/Settings/FullTextPolicyDefinition.cs @@ -10,12 +10,7 @@ namespace Microsoft.Azure.Cosmos.Fluent /// /// fluent definition. /// -#if PREVIEW - public -#else - internal -#endif - class FullTextPolicyDefinition + public class FullTextPolicyDefinition { private readonly ContainerBuilder parent; private readonly Action attachCallback; diff --git a/Microsoft.Azure.Cosmos/src/Fluent/Settings/IndexingPolicyDefinition.cs b/Microsoft.Azure.Cosmos/src/Fluent/Settings/IndexingPolicyDefinition.cs index ac38f5cd4b..960d890342 100644 --- a/Microsoft.Azure.Cosmos/src/Fluent/Settings/IndexingPolicyDefinition.cs +++ b/Microsoft.Azure.Cosmos/src/Fluent/Settings/IndexingPolicyDefinition.cs @@ -128,12 +128,7 @@ public VectorIndexDefinition> WithVectorIndex() /// Defines a in the current 's definition. /// /// An instance of . -#if PREVIEW - public -#else - internal -#endif - FullTextIndexDefinition> WithFullTextIndex() + public FullTextIndexDefinition> WithFullTextIndex() { return new FullTextIndexDefinition>( this, diff --git a/Microsoft.Azure.Cosmos/src/Fluent/Settings/VectorIndexDefinition.cs b/Microsoft.Azure.Cosmos/src/Fluent/Settings/VectorIndexDefinition.cs index 460fbbc116..8bf1310187 100644 --- a/Microsoft.Azure.Cosmos/src/Fluent/Settings/VectorIndexDefinition.cs +++ b/Microsoft.Azure.Cosmos/src/Fluent/Settings/VectorIndexDefinition.cs @@ -98,7 +98,12 @@ VectorIndexDefinition WithIndexingSearchListSize( /// applies to index types DiskANN and quantizedFlat. /// /// An instance of the current . - internal VectorIndexDefinition WithVectorIndexShardKey( +#if PREVIEW + public +#else + internal +#endif + VectorIndexDefinition WithVectorIndexShardKey( string[] vectorIndexShardKey) { this.vectorIndexPath.VectorIndexShardKey = vectorIndexShardKey ?? throw new ArgumentNullException(nameof(vectorIndexShardKey)); diff --git a/Microsoft.Azure.Cosmos/src/GatewayAccountReader.cs b/Microsoft.Azure.Cosmos/src/GatewayAccountReader.cs index f332d873fd..459ac9c5f5 100644 --- a/Microsoft.Azure.Cosmos/src/GatewayAccountReader.cs +++ b/Microsoft.Azure.Cosmos/src/GatewayAccountReader.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.Cosmos internal sealed class GatewayAccountReader { + private readonly bool isThinClientEnabled; private readonly ConnectionPolicy connectionPolicy; private readonly AuthorizationTokenProvider cosmosAuthorization; private readonly CosmosHttpClient httpClient; @@ -28,13 +29,15 @@ public GatewayAccountReader(Uri serviceEndpoint, AuthorizationTokenProvider cosmosAuthorization, ConnectionPolicy connectionPolicy, CosmosHttpClient httpClient, - CancellationToken cancellationToken = default) + CancellationToken cancellationToken = default, + bool isThinClientEnabled = false) { this.httpClient = httpClient; this.serviceEndpoint = serviceEndpoint; this.cosmosAuthorization = cosmosAuthorization ?? throw new ArgumentNullException(nameof(AuthorizationTokenProvider)); this.connectionPolicy = connectionPolicy; this.cancellationToken = cancellationToken; + this.isThinClientEnabled = isThinClientEnabled; } private async Task GetDatabaseAccountAsync(Uri serviceEndpoint) @@ -57,6 +60,13 @@ await this.cosmosAuthorization.AddAuthorizationHeaderAsync( resourceType: ResourceType.DatabaseAccount, authorizationTokenType: AuthorizationTokenType.PrimaryMasterKey)) { + if (this.isThinClientEnabled) + { + headers.Add( + ThinClientConstants.EnableThinClientEndpointDiscoveryHeaderName, + this.isThinClientEnabled.ToString()); + } + using (HttpResponseMessage responseMessage = await this.httpClient.GetAsync( uri: serviceEndpoint, additionalHeaders: headers, diff --git a/Microsoft.Azure.Cosmos/src/GatewayStoreClient.cs b/Microsoft.Azure.Cosmos/src/GatewayStoreClient.cs index d6c24c7ee2..5701316ac6 100644 --- a/Microsoft.Azure.Cosmos/src/GatewayStoreClient.cs +++ b/Microsoft.Azure.Cosmos/src/GatewayStoreClient.cs @@ -14,6 +14,7 @@ namespace Microsoft.Azure.Cosmos using System.Text; using System.Threading; using System.Threading.Tasks; + using Microsoft.Azure.Cosmos.Routing; using Microsoft.Azure.Cosmos.Tracing.TraceData; using Microsoft.Azure.Documents; using Microsoft.Azure.Documents.Collections; @@ -21,19 +22,23 @@ namespace Microsoft.Azure.Cosmos internal class GatewayStoreClient : TransportClient { + private readonly bool isPartitionLevelFailoverEnabled; private readonly ICommunicationEventSource eventSource; - private readonly CosmosHttpClient httpClient; - private readonly JsonSerializerSettings SerializerSettings; + protected readonly CosmosHttpClient httpClient; + protected readonly JsonSerializerSettings SerializerSettings; + private static readonly HttpMethod httpPatchMethod = new HttpMethod(HttpConstants.HttpMethods.Patch); public GatewayStoreClient( CosmosHttpClient httpClient, ICommunicationEventSource eventSource, - JsonSerializerSettings serializerSettings = null) + JsonSerializerSettings serializerSettings = null, + bool isPartitionLevelFailoverEnabled = false) { this.httpClient = httpClient; this.SerializerSettings = serializerSettings; this.eventSource = eventSource; + this.isPartitionLevelFailoverEnabled = isPartitionLevelFailoverEnabled; } public async Task InvokeAsync( @@ -48,6 +53,18 @@ public async Task InvokeAsync( } } + public virtual Task InvokeAsync( + DocumentServiceRequest request, + ResourceType resourceType, + Uri physicalAddress, + Uri endpoint, + string globalDatabaseAccountName, + ClientCollectionCache clientCollectionCache, + CancellationToken cancellationToken) + { + return this.InvokeAsync(request, resourceType, physicalAddress, cancellationToken); + } + public static bool IsFeedRequest(OperationType requestOperationType) { return requestOperationType == OperationType.Create || @@ -151,23 +168,28 @@ internal static async Task CreateDocumentClientExceptio } // If service rejects the initial payload like header is to large it will return an HTML error instead of JSON. + string contentString = null; if (string.Equals(responseMessage.Content?.Headers?.ContentType?.MediaType, "application/json", StringComparison.OrdinalIgnoreCase) && responseMessage.Content?.Headers.ContentLength > 0) { try { - Stream contentAsStream = await responseMessage.Content.ReadAsStreamAsync(); - Error error = JsonSerializable.LoadFrom(stream: contentAsStream); - - return new DocumentClientException( - errorResource: error, - responseHeaders: responseMessage.Headers, - statusCode: responseMessage.StatusCode) + // Buffer the content once to avoid "stream already consumed" issue + contentString = await responseMessage.Content.ReadAsStringAsync(); + using (MemoryStream contentStream = new MemoryStream(Encoding.UTF8.GetBytes(contentString))) { - StatusDescription = responseMessage.ReasonPhrase, - ResourceAddress = resourceIdOrFullName, - RequestStatistics = requestStatistics - }; + Error error = JsonSerializable.LoadFrom(stream: contentStream); + + return new DocumentClientException( + errorResource: error, + responseHeaders: responseMessage.Headers, + statusCode: responseMessage.StatusCode) + { + StatusDescription = responseMessage.ReasonPhrase, + ResourceAddress = resourceIdOrFullName, + RequestStatistics = requestStatistics + }; + } } catch { @@ -175,7 +197,8 @@ internal static async Task CreateDocumentClientExceptio } StringBuilder contextBuilder = new StringBuilder(); - contextBuilder.AppendLine(await responseMessage.Content.ReadAsStringAsync()); + // Reuse the already buffered content if available, otherwise read it now + contextBuilder.AppendLine(contentString ?? await responseMessage.Content.ReadAsStringAsync()); HttpRequestMessage requestMessage = responseMessage.RequestMessage; @@ -249,7 +272,7 @@ private static async Task BufferContentIfAvailableAsync(HttpResponseMess } [SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope", Justification = "Disposable object returned by method")] - private async ValueTask PrepareRequestMessageAsync( + internal async ValueTask PrepareRequestMessageAsync( DocumentServiceRequest request, Uri physicalAddress) { @@ -347,7 +370,7 @@ private async ValueTask PrepareRequestMessageAsync( { requestMessage.Properties.Add(ClientSideRequestStatisticsTraceDatum.HttpRequestRegionNameProperty, regionName); } - + return requestMessage; } @@ -361,10 +384,12 @@ private Task InvokeClientAsync( return this.httpClient.SendHttpAsync( () => this.PrepareRequestMessageAsync(request, physicalAddress), resourceType, - HttpTimeoutPolicy.GetTimeoutPolicy(request), + HttpTimeoutPolicy.GetTimeoutPolicy( + request, + this.isPartitionLevelFailoverEnabled), request.RequestContext.ClientRequestStatistics, cancellationToken, request); } } -} +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/GatewayStoreModel.cs b/Microsoft.Azure.Cosmos/src/GatewayStoreModel.cs index e91f07dd3c..6a0f33131f 100644 --- a/Microsoft.Azure.Cosmos/src/GatewayStoreModel.cs +++ b/Microsoft.Azure.Cosmos/src/GatewayStoreModel.cs @@ -24,18 +24,20 @@ namespace Microsoft.Azure.Cosmos // Marking it as non-sealed in order to unit test it using Moq framework internal class GatewayStoreModel : IStoreModelExtension, IDisposable { + private readonly bool isPartitionLevelFailoverEnabled; private static readonly string sessionConsistencyAsString = ConsistencyLevel.Session.ToString(); + private readonly GlobalPartitionEndpointManager globalPartitionEndpointManager; - private readonly GlobalEndpointManager endpointManager; + internal readonly GlobalEndpointManager endpointManager; private readonly DocumentClientEventSource eventSource; - private readonly ISessionContainer sessionContainer; - private readonly ConsistencyLevel defaultConsistencyLevel; + internal readonly ConsistencyLevel defaultConsistencyLevel; private GatewayStoreClient gatewayStoreClient; // Caches to resolve the PartitionKeyRange from request. For Session Token Optimization. - private ClientCollectionCache clientCollectionCache; - private PartitionKeyRangeCache partitionKeyRangeCache; + protected PartitionKeyRangeCache partitionKeyRangeCache; + protected ClientCollectionCache clientCollectionCache; + protected ISessionContainer sessionContainer; public GatewayStoreModel( GlobalEndpointManager endpointManager, @@ -43,17 +45,24 @@ public GatewayStoreModel( ConsistencyLevel defaultConsistencyLevel, DocumentClientEventSource eventSource, JsonSerializerSettings serializerSettings, - CosmosHttpClient httpClient) + CosmosHttpClient httpClient, + GlobalPartitionEndpointManager globalPartitionEndpointManager, + bool isPartitionLevelFailoverEnabled = false) { + this.isPartitionLevelFailoverEnabled = isPartitionLevelFailoverEnabled; this.endpointManager = endpointManager; this.sessionContainer = sessionContainer; this.defaultConsistencyLevel = defaultConsistencyLevel; this.eventSource = eventSource; - + this.globalPartitionEndpointManager = globalPartitionEndpointManager; this.gatewayStoreClient = new GatewayStoreClient( httpClient, this.eventSource, - serializerSettings); + serializerSettings, + isPartitionLevelFailoverEnabled); + + this.globalPartitionEndpointManager.SetBackgroundConnectionPeriodicRefreshTask( + this.MarkEndpointsToHealthyAsync); } public virtual async Task ProcessMessageAsync(DocumentServiceRequest request, CancellationToken cancellationToken = default) @@ -69,12 +78,29 @@ await GatewayStoreModel.ApplySessionTokenAsync( DocumentServiceResponse response; try { - Uri physicalAddress = GatewayStoreClient.IsFeedRequest(request.OperationType) ? this.GetFeedUri(request) : this.GetEntityUri(request); // Collect region name only for document resources if (request.ResourceType.Equals(ResourceType.Document) && this.endpointManager.TryGetLocationForGatewayDiagnostics(request.RequestContext.LocationEndpointToRoute, out string regionName)) { request.RequestContext.RegionName = regionName; } + + // This is applicable for both per partition automatic failover and per partition circuit breaker. + if (this.isPartitionLevelFailoverEnabled + && !ReplicatedResourceClient.IsMasterResource(request.ResourceType) + && request.ResourceType.IsPartitioned()) + { + (bool isSuccess, PartitionKeyRange partitionKeyRange) = await TryResolvePartitionKeyRangeAsync( + request: request, + sessionContainer: this.sessionContainer, + partitionKeyRangeCache: this.partitionKeyRangeCache, + clientCollectionCache: this.clientCollectionCache, + refreshCache: false); + + request.RequestContext.ResolvedPartitionKeyRange = partitionKeyRange; + this.globalPartitionEndpointManager.TryAddPartitionLevelLocationOverride(request); + } + + Uri physicalAddress = GatewayStoreClient.IsFeedRequest(request.OperationType) ? this.GetFeedUri(request) : this.GetEntityUri(request); response = await this.gatewayStoreClient.InvokeAsync(request, request.ResourceType, physicalAddress, cancellationToken); } catch (DocumentClientException exception) @@ -113,8 +139,7 @@ public virtual async Task GetDatabaseAccountAsync(Func headerValues; - if (responseMessage.Headers.TryGetValues(HttpConstants.HttpHeaders.MaxMediaStorageUsageInMB, out headerValues) && + if (responseMessage.Headers.TryGetValues(HttpConstants.HttpHeaders.MaxMediaStorageUsageInMB, out IEnumerable headerValues) && (headerValues.Count() != 0)) { if (long.TryParse(headerValues.First(), out longValue)) @@ -163,8 +188,8 @@ public virtual async Task GetDatabaseAccountAsync(Func> TryResolvePartitionKey return new Tuple(true, partitonKeyRange); } + /// + /// Attempts to mark the unhealthy endpoints for a faulty partition to healthy state, un-deterministically. This is done + /// specifically for the gateway mode to get the faulty partition failed back to the original location. + /// + /// A dictionary mapping partition key ranges to their corresponding collection resource ID, original failed location, and health status. + public Task MarkEndpointsToHealthyAsync( + Dictionary> pkRangeUriMappings) + { + foreach (PartitionKeyRange pkRange in pkRangeUriMappings?.Keys) + { + string collectionRid = pkRangeUriMappings[pkRange].Item1; + Uri originalFailedLocation = pkRangeUriMappings[pkRange].Item2; + + DefaultTrace.TraceVerbose("Un-deterministically marking the original failed endpoint: {0}, for the PkRange: {1}, collectionRid: {2} back to healthy.", + originalFailedLocation, + pkRange.Id, + collectionRid); + + pkRangeUriMappings[pkRange] = new Tuple(collectionRid, originalFailedLocation, TransportAddressHealthState.HealthStatus.Connected); + } + + return Task.CompletedTask; + } + // DEVNOTE: This can be replace with ReplicatedResourceClient.IsMasterOperation on next Direct sync internal static bool IsMasterOperation( ResourceType resourceType, @@ -445,7 +494,7 @@ internal static bool IsStoredProcedureCrudOperation( operationType != Documents.OperationType.ExecuteJavaScript; } - private void Dispose(bool disposing) + protected virtual void Dispose(bool disposing) { if (disposing) { @@ -458,7 +507,7 @@ private void Dispose(bool disposing) catch (Exception exception) { DefaultTrace.TraceWarning("Exception {0} thrown during dispose of HttpClient, this could happen if there are inflight request during the dispose of client", - exception); + exception.Message); } this.gatewayStoreClient = null; @@ -466,7 +515,7 @@ private void Dispose(bool disposing) } } - private Uri GetEntityUri(DocumentServiceRequest entity) + internal Uri GetEntityUri(DocumentServiceRequest entity) { string contentLocation = entity.Headers[HttpConstants.HttpHeaders.ContentLocation]; @@ -478,7 +527,7 @@ private Uri GetEntityUri(DocumentServiceRequest entity) return new Uri(this.endpointManager.ResolveServiceEndpoint(entity), PathsHelper.GeneratePath(entity.ResourceType, entity, false)); } - private Uri GetFeedUri(DocumentServiceRequest request) + internal Uri GetFeedUri(DocumentServiceRequest request) { return new Uri(this.endpointManager.ResolveServiceEndpoint(request), PathsHelper.GeneratePath(request.ResourceType, request, true)); } diff --git a/Microsoft.Azure.Cosmos/src/GlobalSuppressions.cs b/Microsoft.Azure.Cosmos/src/GlobalSuppressions.cs index 7497795a8e..c384a03d0f 100644 --- a/Microsoft.Azure.Cosmos/src/GlobalSuppressions.cs +++ b/Microsoft.Azure.Cosmos/src/GlobalSuppressions.cs @@ -968,3 +968,2485 @@ [assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1507:Code should not contain multiple blank lines in a row", Justification = "Belongs to Cosmos.Direct Project", Scope = "type", Target = "~T:Microsoft.Azure.Documents.ConsistencyLevel")] [assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1505:Opening braces should not be followed by blank line", Justification = "Belongs to Cosmos.Direct Project", Scope = "namespace", Target = "~N:Microsoft.Azure.Documents.Client")] [assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1114:Parameter list should follow declaration", Justification = "Belongs to Cosmos.Direct Project", Scope = "member", Target = "~M:Microsoft.Azure.Documents.AddressEnumerator.GetEffectiveStatus(Microsoft.Azure.Documents.TransportAddressUri,System.Collections.Generic.HashSet{Microsoft.Azure.Documents.TransportAddressUri})~Microsoft.Azure.Documents.TransportAddressHealthState.HealthStatus")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Cosmos.AccountProperties.id")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Cosmos.ContainerProperties.clientEncryptionPolicyInternal")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Cosmos.ContainerProperties.fullTextPolicyInternal")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Cosmos.ContainerProperties.vectorEmbeddingPolicyInternal")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Cosmos.DocumentFeedResponse`1.queryMetrics")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Cosmos.DocumentFeedResponse`1.responseHeaders")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Cosmos.DocumentFeedResponse`1.useETagAsContinuation")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Cosmos.MediaResponse.responseHeaders")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Cosmos.Rntbd.RntbdStreamReader.length")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Cosmos.Routing.GatewayAddressCache.serviceEndpoint")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Cosmos.SecureStringHMACSHA256Helper.key")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Cosmos.StoredProcedureResponse`1.responseBody")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.BarrierRequestHelper.isOldBarrierRequestHandlingEnabled")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.DocumentServiceRequest.serviceIdentity")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.DocumentServiceRequestContext.quorumSelectedStoreResponse")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.PerformanceActivity.operationName")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.PerformanceActivity.stopWatch")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.QueryResult.jObject")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.QueryResult.jsonSerializer")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.QueryResult.ownerFullName")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.Rntbd.ChannelCallArguments.commonArguments")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.Rntbd.ChannelCallArguments.locationEndpointToRouteTo")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.Rntbd.ChannelCallArguments.operationType")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.Rntbd.ChannelCallArguments.requestHeaders")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.Rntbd.ChannelCallArguments.resolvedCollectionRid")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.Rntbd.ChannelCallArguments.resourceType")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments.callerId")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments.commonArguments")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments.openTimeline")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments.openTimeout")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments.portReuseMode")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments.userPortPool")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.Rntbd.Connection.connectionCorrelationId")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.Rntbd.Connection.disposed")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.Rntbd.Connection.idleConnectionClosureTimeout")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.Rntbd.Connection.serverUri")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.Rntbd.LbChannelState.channel")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.Rntbd.SystemUsageMonitor.pollDelayInMilliSeconds")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.Routing.NumberPartitionKeyComponent.value")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.components")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.SimpleSessionToken.globalLsn")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.TimerPool.minSupportedTimeout")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.TimerPool.pooledTimersByTimeout")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.UserAgentContainer.userAgent")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.UserAgentContainer.userAgentUTF8")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.AccountProperties.Id")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ContainerProperties.ClientEncryptionPolicy")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ContainerProperties.FullTextPolicy")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ContainerProperties.VectorEmbeddingPolicy")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.DocumentFeedResponse`1.Headers")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.DocumentFeedResponse`1.QueryMetrics")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.DocumentFeedResponse`1.UseETagAsContinuation")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.MediaResponse.Headers")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Rntbd.RntbdStreamReader.AvailableByteCount")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Routing.GatewayAddressCache.ServiceEndpoint")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.SecureStringHMACSHA256Helper.Key")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.StoredProcedureResponse`1.Response")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.BarrierRequestHelper.IsOldBarrierRequestHandlingEnabled")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentServiceRequest.ServiceIdentity")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentServiceRequestContext.QuorumSelectedStoreResponse")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.PerformanceActivity.OperationName")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.PerformanceActivity.StopWatch")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.QueryResult.JsonSerializer")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.QueryResult.OwnerFullName")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.QueryResult.Payload")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelCallArguments.CommonArguments")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelCallArguments.LocationEndpointToRouteTo")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelCallArguments.OperationType")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelCallArguments.RequestHeaders")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelCallArguments.ResolvedCollectionRid")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelCallArguments.ResourceType")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments.CallerId")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments.CommonArguments")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments.OpenTimeline")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments.OpenTimeout")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments.PortPool")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments.PortReuseMode")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.Connection.ConnectionCorrelationId")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.Connection.Disposed")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.Connection.ServerUri")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.Connection.TestIdleConnectionClosureTimeout")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.LbChannelState.Channel")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.SystemUsageMonitor.PollDelayInMs")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Routing.NumberPartitionKeyComponent.Value")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.Components")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.SimpleSessionToken.LSN")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.TimerPool.MinSupportedTimeout")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.TimerPool.PooledTimersByTimeout")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.UserAgentContainer.UserAgent")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.UserAgentContainer.UserAgentUTF8")] +[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.VectorSessionToken.LSN")] +[assembly: SuppressMessage("Style", "IDE0059:Unnecessary assignment of a value", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.BarrierRequestHelper.CreateAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.IAuthorizationTokenProvider,System.Nullable{System.Int64},System.Nullable{System.Int64},System.Boolean)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.DocumentServiceRequest}")] +[assembly: SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "", Scope = "member", Target = "~F:Microsoft.Azure.Documents.PerformanceActivity.stopWatch")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~E:Microsoft.Azure.Cosmos.ConnectionPolicy.PreferenceChanged")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~E:Microsoft.Azure.Documents.Rntbd.Channel.TestOnConnectionClosed")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.AccountProperties.Id")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ConnectionPolicy.ConnectionProtocol")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ConnectionPolicy.UserAgentSuffix")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Core.Trace.DefaultTrace.TraceSource")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.DocumentClient.Session")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.MediaResponse.Headers")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.MediaStream.Position")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.MediaStream.ReadTimeout")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.MediaStream.WriteTimeout")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Query.Core.SqlParameterCollection.Item(System.Int32)")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Query.DocumentQueryClient.Microsoft#Azure#Cosmos#Query#IDocumentQueryClient#QueryCompatibilityMode")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.RetryOptions.InitialRetryForRetryWithMilliseconds")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.RetryOptions.MaximumRetryForRetryWithMilliseconds")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.RetryOptions.MaxRetryAttemptsOnThrottledRequests")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.RetryOptions.MaxRetryWaitTimeInSeconds")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.RetryOptions.RandomSaltForRetryWithMilliseconds")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.RetryOptions.TotalWaitTimeForRetryWithMilliseconds")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Address.IsAuxiliary")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Address.IsPrimary")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Address.LogicalUri")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Address.PartitionIndex")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Address.PartitionKeyRangeId")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Address.PhysicalUri")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Address.Protocol")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Attachment.ContentType")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Attachment.MediaLink")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.BoundingBoxSpec.Xmax")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.BoundingBoxSpec.Xmin")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.BoundingBoxSpec.Ymax")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.BoundingBoxSpec.Ymin")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ByokConfig.ByokStatus")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ClientEncryptionIncludedPath.ClientEncryptionKeyId")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ClientEncryptionIncludedPath.EncryptionAlgorithm")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ClientEncryptionIncludedPath.EncryptionType")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ClientEncryptionIncludedPath.Path")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ClientEncryptionKey.EncryptionAlgorithm")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ClientEncryptionKey.WrappedDataEncryptionKey")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.CloneableStream.Position")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.CloneableStream.ReadTimeout")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.CloneableStream.WriteTimeout")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.CMKMetadataInfo.DefaultIdentity")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.CMKMetadataInfo.KeyVaultKeyUri")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.CMKMetadataInfo.MsiClientId")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.CMKMetadataInfo.MsiClientSecretEncrypted")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.CMKMetadataInfo.WrappedDek")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.CollectionBackupPolicy.CollectionBackupType")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Collections.DictionaryNameValueCollection.Item(System.String)")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Collections.NameValueCollectionWrapper.Item(System.String)")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.CollectionTieringPolicy.CollectionTieringThreshold")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.CollectionTieringPolicy.CollectionTieringType")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.CompositePath.Order")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.CompositePath.Path")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ComputedProperty.Name")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ComputedProperty.Query")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Conflict.ConflictLSN")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Conflict.SourceResourceId")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ConflictResolutionPolicy.ConflictResolutionPath")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ConflictResolutionPolicy.ConflictResolutionProcedure")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ConflictResolutionPolicy.Mode")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ConsistencyReader.LastReadAddress")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Database.CreateMode")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DataMaskingIncludedPath.Path")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Document.TimeToLive")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentClientException.Error")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.AllowMaterializedViews")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.AnalyticalStorageTimeToLive")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.CreateMode")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.DefaultTimeToLive")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.EncryptionScopeId")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.InternalSchemaProperties")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.PartitionKeyDeleteThroughputFraction")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.SchemaPolicy")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.StatisticsJRaw")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.TimeToLivePropertyPath")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.UniqueIndexNameEncodingMode")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentServiceRequest.Continuation")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentServiceRequest.PartitionKeyRangeIdentity")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentServiceRequest.ServiceIdentity")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Embedding.DataType")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Embedding.Dimensions")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Embedding.DistanceFunction")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Embedding.Path")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.EncryptionScopeMetadata.CMKMetadataList")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.EncryptionScopeMetadata.DataEncryptionKeyStatus")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.EncryptionScopeMetadata.Id")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.EncryptionScopeMetadata.Name")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Error.AdditionalErrorInfo")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Error.Code")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Error.ErrorDetails")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Error.Message")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ExcludedPath.Path")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.FeedResource`1.InnerCollection")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.FullTextIndexPath.Path")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.FullTextPath.Language")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.FullTextPath.Path")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.FullTextPolicy.DefaultLanguage")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.GeospatialConfig.GeospatialType")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.HashIndex.DataType")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.HashIndex.Precision")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.InAccountRestoreParameters.InstanceId")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.InAccountRestoreParameters.RestoreSource")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.InAccountRestoreParameters.RestoreTimestampInUtc")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.InAccountRestoreParameters.RestoreWithTtlDisabled")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.InAccountRestoreParameters.SourceBackupLocation")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.IncludedPath.Path")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Index.Kind")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.IndexingPolicy.Automatic")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.IndexingPolicy.IndexingMode")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.InternalSchemaProperties.UseSchemaForAnalyticsOnly")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.KeyWrapMetadata.Algorithm")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.KeyWrapMetadata.Name")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.KeyWrapMetadata.Type")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.KeyWrapMetadata.Value")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.MaterializedViewDefinition.ApiSpecificDefinition")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.MaterializedViewDefinition.ContainerType")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.MaterializedViewDefinition.Definition")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.MaterializedViewDefinition.SourceCollectionId")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.MaterializedViewDefinition.SourceCollectionRid")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.MaterializedViews.Id")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.MaterializedViews.Rid")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Offer.OfferResourceId")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Offer.OfferType")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Offer.OfferVersion")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Offer.ResourceLink")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.OfferContentV2.BackgroundTaskMaxAllowedThroughputPercent")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.OfferContentV2.OfferIsRUPerMinuteThroughputEnabled")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.OfferContentV2.OfferThroughput")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.OfferV2.Content")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.PartitionKeyDefinition.IsSystemKey")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.PartitionKeyDefinition.Version")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.PartitionKeyRange.LSN")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.PartitionKeyRange.MaxExclusive")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.PartitionKeyRange.MinInclusive")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.PartitionKeyRange.OwnedArchivalPKRangeIds")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.PartitionKeyRange.Parents")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.PartitionKeyRange.RidPrefix")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.PartitionKeyRange.Status")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.PartitionKeyRange.ThroughputFraction")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.PerformanceActivity.OperationName")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Permission.PermissionMode")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Permission.ResourceLink")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Permission.Token")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.PooledTimer.Timeout")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.RangeIndex.DataType")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.RangeIndex.Precision")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ReadPolicy.PrimaryReadCoefficient")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ReadPolicy.SecondaryReadCoefficient")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ReplicatedResourceClient.LastReadAddress")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ReplicationPolicy.AsyncReplication")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ReplicationPolicy.MaxReplicaSetSize")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ReplicationPolicy.MinReplicaSetSize")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Resource.ETag")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Resource.Id")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Resource.ResourceId")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Resource.SelfLink")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Resource.Timestamp")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.TransportClient.Options.LocalRegionOpenTimeout")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.TransportClient.Options.OpenTimeout")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.TransportClient.Options.TimerPoolResolution")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.TransportClient.Options.UserAgent")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.TransportExceptions.AddSourceIpAddressInNetworkExceptionMessage")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.SchemaDiscoveryPolicy.SchemaBuilderMode")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ServerStoreModel.ForceAddressRefresh")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ServerStoreModel.LastReadAddress")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Snapshot.CompressedSizeInKB")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Snapshot.Kind")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Snapshot.LSN")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Snapshot.OwnerResourceId")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Snapshot.ParentResourceId")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Snapshot.ResourceLink")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Snapshot.SizeInKB")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Snapshot.SnapshotTimestamp")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Snapshot.State")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.SnapshotContent.IsMasterResourcesDeletionPending")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.SnapshotContent.MetadataDirectory")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.SnapshotContent.OperationType")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.SnapshotContent.SerializedCollection")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.SnapshotContent.SerializedDatabase")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.SnapshotContent.SerializedOffer")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.SoftDeletionMetadata.IsSoftDeleted")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.SoftDeletionMetadata.SoftDeletionResourceExpirationTimestamp")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.SoftDeletionMetadata.SoftDeletionStartTimestamp")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.SpatialIndex.DataType")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.SpatialSpec.BoundingBox")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.SpatialSpec.Path")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.StoreClient.ForceAddressRefresh")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.StoreClient.LastReadAddress")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.StoredProcedure.Body")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Trigger.Body")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Trigger.TriggerOperation")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Trigger.TriggerType")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.UniqueIndexReIndexContext.LastDocumentGLSN")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.UserAgentContainer.Suffix")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.UserDefinedFunction.Body")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.VectorIndexPath.IndexingSearchListSize")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.VectorIndexPath.Path")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.VectorIndexPath.QuantizationByteSize")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.VectorIndexPath.Type")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.VectorIndexPath.VectorIndexShardKey")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Common.AsyncCache`2.Keys")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ConnectionPolicy.AccountInitializationCustomEndpoints")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ConnectionPolicy.PreferredLocations")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.DocumentClient.ReadEndpoint")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.DocumentClient.WriteEndpoint")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.DocumentClientEventSource.Instance")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Linq.DocumentQuery`1.ElementType")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Linq.DocumentQuery`1.HasMoreResults")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Linq.DocumentQuery`1.Provider")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Linq.QueryUnderConstruction.Alias")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.MediaResponse.ResponseHeaders")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.MediaStream.CanRead")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.MediaStream.CanSeek")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.MediaStream.CanTimeout")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.MediaStream.CanWrite")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.MediaStream.Length")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Metrics.AverageElapsedMilliseconds")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Metrics.ElapsedMilliseconds")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Number64.IsDouble")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Number64.IsInfinity")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Number64.IsInteger")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Number64.IsNaN")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Query.Core.Metrics.SchedulingStopwatch.Elapsed")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Query.Core.Monads.Either`2.IsRight")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Query.Core.SqlParameterCollection.Count")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Query.Core.SqlParameterCollection.IsReadOnly")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Query.DocumentQueryClient.Microsoft#Azure#Cosmos#Query#IDocumentQueryClient#ConnectionMode")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Query.DocumentQueryClient.Microsoft#Azure#Cosmos#Query#IDocumentQueryClient#OnExecuteScalarQueryCallback")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Query.DocumentQueryClient.Microsoft#Azure#Cosmos#Query#IDocumentQueryClient#ResetSessionTokenRetryPolicy")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Query.DocumentQueryClient.Microsoft#Azure#Cosmos#Query#IDocumentQueryClient#ServiceEndpoint")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Query.ProxyDocumentQueryExecutionContext.IsDone")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Routing.CollectionRoutingMap.OrderedPartitionKeyRanges")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.SecureStringHMACSHA256Helper.Key")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.SerializableNameValueCollection.Collection")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.StoredProcedureResponse`1.ActivityId")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.StoredProcedureResponse`1.CurrentResourceQuotaUsage")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.StoredProcedureResponse`1.Headers")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.StoredProcedureResponse`1.MaxResourceQuota")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.StoredProcedureResponse`1.RequestCharge")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.StoredProcedureResponse`1.RequestStatistics")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.StoredProcedureResponse`1.Response")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.StoredProcedureResponse`1.ResponseHeaders")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.StoredProcedureResponse`1.ScriptLog")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.StoredProcedureResponse`1.SessionToken")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.StoredProcedureResponse`1.StatusCode")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.BarrierRequestHelper.IsOldBarrierRequestHandlingEnabled")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.ActivityId")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.CollectionQuota")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.CollectionSizeQuota")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.CollectionSizeUsage")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.CollectionUsage")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.ContentLocation")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.CurrentResourceQuotaUsage")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.DatabaseQuota")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.DatabaseUsage")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.DocumentCount")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.DocumentQuota")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.DocumentUsage")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.Headers")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.IndexTransformationProgress")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.LazyIndexingProgress")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.MaxResourceQuota")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.PermissionQuota")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.PermissionUsage")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.RequestCharge")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.RequestStatistics")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.ResponseHeaders")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.ResponseStream")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.SessionToken")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.StatusCode")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.StoredProceduresQuota")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.StoredProceduresUsage")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.TriggersQuota")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.TriggersUsage")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.UserDefinedFunctionsQuota")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.UserDefinedFunctionsUsage")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.UserQuota")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Client.ResourceResponseBase.UserUsage")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ClientSideRequestStatistics.IsCpuHigh")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ClientSideRequestStatistics.IsCpuThreadStarvation")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.CloneableStream.CanRead")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.CloneableStream.CanSeek")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.CloneableStream.CanTimeout")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.CloneableStream.CanWrite")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.CloneableStream.Length")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Collections.DictionaryNameValueCollection.CompositeValue.Value")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Collections.DictionaryNameValueCollection.CompositeValue.Values")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Database.CollectionsLink")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Database.UserDefinedTypesLink")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Database.UsersLink")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Document.AttachmentsLink")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentClientException.Headers")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentClientException.RawErrorMessage")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentClientException.ResponseHeaders")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentClientException.ScriptLog")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentClientException.SkippingStackTraceCapture")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.ConflictsLink")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.DocumentsLink")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.StoredProceduresLink")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.TriggersLink")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.UserDefinedFunctionsLink")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentServiceRequest.ApiVersion")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentServiceRequest.IsBodySeekableClonableAndCountable")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentServiceRequest.IsReadOnlyRequest")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentServiceResponse.ResponseHeaders")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.FeedResource`1.Count")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.GoneAndRetryWithRetryPolicy.Microsoft#Azure#Documents#IRetryPolicy#InitialArgumentValue")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.GoneAndRetryWithRetryPolicy.Microsoft#Azure#Documents#IRetryPolicy>#InitialArgumentValue")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.GoneAndRetryWithRetryPolicy.Microsoft#Azure#Documents#IRetryPolicy>#InitialArgumentValue")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.IndexJsonConverter.CanWrite")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.PartitionKeyStatistics.PartitionKey")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.PerformanceActivity.ElapsedMilliseconds")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.PerformanceActivity.ElapsedTicks")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.PerformanceActivity.StopWatch")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.PooledTimer.MinSupportedTimeout")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.PooledTimer.TimeoutTicks")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.QueryResult.JsonSerializer")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.QueryResult.OwnerFullName")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.QueryResult.Payload")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ReplicatedResourceClient.LastWriteAddress")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.RequestChargeTracker.TotalRequestCharge")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ResourceId.IsAuthPolicyElementId")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ResourceId.IsClientEncryptionKeyId")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ResourceId.IsDatabaseId")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ResourceId.IsDocumentCollectionId")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ResourceId.IsEncryptionScopeId")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ResourceId.IsInteropUserId")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ResourceId.IsPartitionKeyRangeId")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ResourceId.IsRoleAssignmentId")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ResourceId.IsRoleDefinitionId")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ResourceId.IsSnapshotId")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ResourceId.UniqueDocumentCollectionId")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.Channel.ConnectionCorrelationId")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.Channel.TestIsIdle")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelCallArguments.CommonArguments")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelCallArguments.LocationEndpointToRouteTo")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelCallArguments.OperationType")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelCallArguments.RequestHeaders")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelCallArguments.ResolvedCollectionRid")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelCallArguments.ResourceType")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments.CallerId")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments.CommonArguments")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments.OpenTimeline")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments.OpenTimeout")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments.PortPool")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments.PortReuseMode")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.Connection.ConnectionCorrelationId")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.Connection.Disposed")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.Connection.NumberOfOpenTcpConnections")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.Connection.ServerUri")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.CpuLoadHistory.IsCpuOverloaded")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.CpuLoadHistory.LastTimestamp")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.Dispatcher.ConnectionCorrelationId")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.LbChannelState.Channel")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.LinuxSystemUtilizationReader.StringParser.HasNext")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.SystemUsageHistory.IsCpuHigh")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.SystemUsageHistory.IsCpuThreadStarvation")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Rntbd.TransportClient.IsDisableRntbdChannelActionRegistered")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Routing.NumberPartitionKeyComponent.Value")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.Components")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.Empty")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.ExclusiveMaximum")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.InclusiveMinimum")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.None")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.Undefined")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Routing.Range`1.IsEmpty")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Routing.Range`1.IsSingleValue")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Schema.ResourceLink")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.SerializableNameValueCollection.Collection")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.SimpleSessionToken.LSN")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.StoreClient.LastWriteAddress")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.TimerPool.MinSupportedTimeout")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.TimerPool.PooledTimersByTimeout")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.User.PermissionsLink")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.UserAgentContainer.BaseUserAgent")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.UserAgentContainer.UserAgent")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.UserAgentContainer.UserAgentUTF8")] +[assembly: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1404:Code analysis suppression should have justification", Justification = "")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Azure.Core.DiagnosticScope.ActivityAdapter.SetTraceContext(System.String,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AddressResolver.EnsureRoutingMapPresent(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Cosmos.Routing.CollectionRoutingMap,Microsoft.Azure.Cosmos.ContainerProperties)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AddressResolver.HandleRangeAddressResolutionFailure(Microsoft.Azure.Documents.DocumentServiceRequest,System.Boolean,System.Boolean,Microsoft.Azure.Cosmos.Routing.CollectionRoutingMap)~Microsoft.Azure.Cosmos.AddressResolver.ResolutionResult")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AddressResolver.IsSameCollection(Microsoft.Azure.Documents.PartitionKeyRange,Microsoft.Azure.Documents.PartitionKeyRange)~System.Boolean")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AddressResolver.ResolutionResult.#ctor(Microsoft.Azure.Documents.PartitionAddressInformation,Microsoft.Azure.Documents.ServiceIdentity)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AddressResolver.ResolutionResult.#ctor(Microsoft.Azure.Documents.PartitionAddressInformation,Microsoft.Azure.Documents.ServiceIdentity)")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AddressResolver.ResolutionResult.#ctor(Microsoft.Azure.Documents.PartitionKeyRange,Microsoft.Azure.Documents.PartitionAddressInformation,Microsoft.Azure.Documents.ServiceIdentity)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AddressResolver.ResolutionResult.#ctor(Microsoft.Azure.Documents.PartitionKeyRange,Microsoft.Azure.Documents.PartitionAddressInformation,Microsoft.Azure.Documents.ServiceIdentity)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AddressResolver.ResolveAddressesAndIdentityAsync(Microsoft.Azure.Documents.DocumentServiceRequest,System.Boolean,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.AddressResolver.ResolutionResult}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AddressResolver.ThrowIfTargetChanged(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.PartitionKeyRange)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AddressResolver.TryResolveServerPartitionAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Cosmos.ContainerProperties,Microsoft.Azure.Cosmos.Routing.CollectionRoutingMap,System.Boolean,System.Boolean,System.Boolean,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.AddressResolver.ResolutionResult}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AddressResolver.TryResolveServerPartitionByPartitionKey(Microsoft.Azure.Documents.DocumentServiceRequest,System.String,System.Boolean,Microsoft.Azure.Cosmos.ContainerProperties,Microsoft.Azure.Cosmos.Routing.CollectionRoutingMap)~Microsoft.Azure.Documents.PartitionKeyRange")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AddressResolver.TryResolveSinglePartitionCollection(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Cosmos.ContainerProperties,Microsoft.Azure.Cosmos.Routing.CollectionRoutingMap,System.Boolean)~Microsoft.Azure.Documents.PartitionKeyRange")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AddressResolver.UpdateAsync(Microsoft.Azure.Documents.Rntbd.ServerKey,System.Threading.CancellationToken)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AddressResolver.UpdateAsync(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Documents.AddressCacheToken},System.Threading.CancellationToken)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AsyncCacheNonBlocking`2.GetAsync(`0,System.Func{`1,System.Threading.Tasks.Task{`1}},System.Func{`1,System.Boolean})~System.Threading.Tasks.Task{`1}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AsyncCacheNonBlocking`2.UpdateCacheAndGetValueFromBackgroundTaskAsync(`0,Microsoft.Azure.Cosmos.AsyncCacheNonBlocking`2.AsyncLazyWithRefreshTask{`1},System.Func{`1,System.Threading.Tasks.Task{`1}},System.String)~System.Threading.Tasks.Task{`1}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Authorization.AzureKeyCredentialAuthorizationTokenProvider.#ctor(Azure.AzureKeyCredential)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AuthorizationHelper.CheckTimeRangeIsCurrent(System.Int32,System.DateTime,System.DateTime)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AuthorizationHelper.GenerateAuthorizationTokenWithHashCore(System.String,System.String,System.String,Microsoft.Azure.Documents.Collections.INameValueCollection,Microsoft.Azure.Cosmos.IComputeHash,System.Boolean,Microsoft.Azure.Cosmos.AuthorizationHelper.ArrayOwner@)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AuthorizationHelper.GenerateGatewayAuthSignatureWithAddressResolution(System.String,System.Uri,Microsoft.Azure.Documents.Collections.INameValueCollection,Microsoft.Azure.Cosmos.IComputeHash,System.String)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AuthorizationHelper.GenerateKeyAuthorizationCore(System.String,System.String,System.String,Microsoft.Azure.Documents.Collections.INameValueCollection,System.String)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AuthorizationHelper.GenerateKeyAuthorizationSignature(System.String,System.String,System.String,Microsoft.Azure.Documents.Collections.INameValueCollection,Microsoft.Azure.Cosmos.IComputeHash,Microsoft.Azure.Cosmos.AuthorizationHelper.ArrayOwner@)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AuthorizationHelper.GenerateKeyAuthorizationSignature(System.String,System.Uri,Microsoft.Azure.Documents.Collections.INameValueCollection,Microsoft.Azure.Cosmos.IComputeHash,System.String)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AuthorizationHelper.GenerateUriFromAddressRequestUri(System.Uri)~System.Uri")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AuthorizationHelper.GetResourceTypeAndIdOrFullName(System.Uri,System.Boolean@,System.String@,System.String@,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AuthorizationHelper.OptimizedConvertToBase64string(System.Byte[],System.Boolean)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AuthorizationHelper.ParseAuthorizationToken(System.String,System.ReadOnlyMemory{System.Char}@,System.ReadOnlyMemory{System.Char}@,System.ReadOnlyMemory{System.Char}@)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AuthorizationHelper.SerializeMessagePayload(System.Span{System.Byte},System.String,System.String,System.String,Microsoft.Azure.Documents.Collections.INameValueCollection,System.Boolean)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AuthorizationHelper.UrlEncodeBase64SpanInPlace(System.Span{System.Byte},System.Int32)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AuthorizationHelper.ValidateInputRequestTime(System.String,System.Int32,System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AuthorizationHelper.ValidateInputRequestTime``1(``0,System.Func{``0,System.String,System.String},System.Int32,System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AuthorizationTokenProvider.CreateWithResourceTokenOrAuthKey(System.String)~Microsoft.Azure.Cosmos.AuthorizationTokenProvider")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.AuthorizationTokenProviderMasterKey.#ctor(Microsoft.Azure.Cosmos.IComputeHash)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Base64Helper.ParseStringToIntPtr(System.Security.SecureString,System.IntPtr,System.Int32,System.UInt32@)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Base64Helper.SecureStringToNativeBytes(System.Security.SecureString,System.Int32,System.IntPtr@,System.UInt32@)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchAsyncBatcher.#ctor(System.Int32,System.Int32,Microsoft.Azure.Cosmos.CosmosSerializerCore,Microsoft.Azure.Cosmos.BatchAsyncBatcherExecuteDelegate,Microsoft.Azure.Cosmos.BatchAsyncBatcherRetryDelegate,Microsoft.Azure.Cosmos.CosmosClientContext)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchAsyncBatcher.DispatchHelperAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,Microsoft.Azure.Cosmos.BatchPartitionMetric,System.Threading.CancellationToken)~System.Threading.Tasks.Task{System.Object}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchAsyncBatcher.TryAdd(Microsoft.Azure.Cosmos.ItemBatchOperation)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchAsyncContainerExecutor.#ctor(Microsoft.Azure.Cosmos.ContainerInternal,Microsoft.Azure.Cosmos.CosmosClientContext,System.Int32,System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchAsyncContainerExecutor.AddAsync(Microsoft.Azure.Cosmos.ItemBatchOperation,Microsoft.Azure.Cosmos.Tracing.ITrace,Microsoft.Azure.Cosmos.ItemRequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.TransactionalBatchOperationResult}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchAsyncContainerExecutor.ValidateOperationAsync(Microsoft.Azure.Cosmos.ItemBatchOperation,Microsoft.Azure.Cosmos.ItemRequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchAsyncContainerExecutor.ValidateOperationEPK(Microsoft.Azure.Cosmos.ItemBatchOperation,Microsoft.Azure.Cosmos.ItemRequestOptions)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchAsyncContainerExecutorCache.GetExecutorForContainer(Microsoft.Azure.Cosmos.ContainerInternal,Microsoft.Azure.Cosmos.CosmosClientContext)~Microsoft.Azure.Cosmos.BatchAsyncContainerExecutor")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchAsyncStreamer.#ctor(System.Int32,System.Int32,Microsoft.Azure.Cosmos.TimerWheel,System.Threading.SemaphoreSlim,System.Int32,Microsoft.Azure.Cosmos.CosmosSerializerCore,Microsoft.Azure.Cosmos.BatchAsyncBatcherExecuteDelegate,Microsoft.Azure.Cosmos.BatchAsyncBatcherRetryDelegate,Microsoft.Azure.Cosmos.CosmosClientContext)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchAsyncStreamer.#ctor(System.Int32,System.Int32,Microsoft.Azure.Cosmos.TimerWheel,System.Threading.SemaphoreSlim,System.Int32,Microsoft.Azure.Cosmos.CosmosSerializerCore,Microsoft.Azure.Cosmos.BatchAsyncBatcherExecuteDelegate,Microsoft.Azure.Cosmos.BatchAsyncBatcherRetryDelegate,Microsoft.Azure.Cosmos.CosmosClientContext)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchCore.CreateItem``1(``0,Microsoft.Azure.Cosmos.TransactionalBatchItemRequestOptions)~Microsoft.Azure.Cosmos.TransactionalBatch")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchCore.CreateItemStream(System.IO.Stream,Microsoft.Azure.Cosmos.TransactionalBatchItemRequestOptions)~Microsoft.Azure.Cosmos.TransactionalBatch")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchCore.DeleteItem(System.String,Microsoft.Azure.Cosmos.TransactionalBatchItemRequestOptions)~Microsoft.Azure.Cosmos.TransactionalBatch")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchCore.PatchItem(System.String,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.PatchOperation},Microsoft.Azure.Cosmos.TransactionalBatchPatchItemRequestOptions)~Microsoft.Azure.Cosmos.TransactionalBatch")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchCore.ReadItem(System.String,Microsoft.Azure.Cosmos.TransactionalBatchItemRequestOptions)~Microsoft.Azure.Cosmos.TransactionalBatch")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchCore.ReplaceItem``1(System.String,``0,Microsoft.Azure.Cosmos.TransactionalBatchItemRequestOptions)~Microsoft.Azure.Cosmos.TransactionalBatch")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchCore.ReplaceItemStream(System.String,System.IO.Stream,Microsoft.Azure.Cosmos.TransactionalBatchItemRequestOptions)~Microsoft.Azure.Cosmos.TransactionalBatch")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchCore.UpsertItem``1(``0,Microsoft.Azure.Cosmos.TransactionalBatchItemRequestOptions)~Microsoft.Azure.Cosmos.TransactionalBatch")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchCore.UpsertItemStream(System.IO.Stream,Microsoft.Azure.Cosmos.TransactionalBatchItemRequestOptions)~Microsoft.Azure.Cosmos.TransactionalBatch")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchExecUtils.EnsureValid(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.ItemBatchOperation},Microsoft.Azure.Cosmos.RequestOptions)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchPartitionMetric.#ctor(System.Int64,System.Int64,System.Int64)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BatchPartitionMetric.Add(System.Int64,System.Int64,System.Int64)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.BulkExecutionRetryPolicy.#ctor(Microsoft.Azure.Cosmos.ContainerInternal,Microsoft.Azure.Documents.OperationType,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.AutoCheckpointer.#ctor(Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedObserver)")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.Bootstrapping.BootstrapperCore.#ctor(Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement.PartitionSynchronizer,Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStore,System.TimeSpan,System.TimeSpan)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.Bootstrapping.BootstrapperCore.#ctor(Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement.PartitionSynchronizer,Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStore,System.TimeSpan,System.TimeSpan)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.Bootstrapping.PartitionSynchronizerCore.HandlePartitionGoneAsync(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease)~System.Threading.Tasks.Task{System.ValueTuple{System.Collections.Generic.IEnumerable{Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease},System.Boolean}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeAsyncEnumerable.#ctor(Microsoft.Azure.Cosmos.Pagination.IDocumentContainer,Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeState,Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedExecutionOptions,Microsoft.Azure.Cosmos.Serializer.JsonSerializationFormatOptions)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeAsyncEnumerator.#ctor(Microsoft.Azure.Cosmos.ChangeFeed.Pagination.CrossPartitionChangeFeedAsyncEnumerator,Microsoft.Azure.Cosmos.Serializer.JsonSerializationFormatOptions)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeAsyncEnumerator.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeState.#ctor(System.ReadOnlyMemory{Microsoft.Azure.Cosmos.Pagination.FeedRangeState{Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedState}})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeState.CreateFromBeginning(Microsoft.Azure.Cosmos.FeedRange)~Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeState")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeState.CreateFromContinuation(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement,Microsoft.Azure.Cosmos.FeedRange)~Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeState")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeState.CreateFromNow(Microsoft.Azure.Cosmos.FeedRange)~Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeState")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeState.CreateFromTime(System.DateTime,Microsoft.Azure.Cosmos.FeedRange)~Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeState")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeState.Monadic.CreateFromCosmosElement(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeState}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeState.Monadic.Parse(System.String)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeState}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeState.Parse(System.String)~Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeState")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeState.TryParse(System.String,Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeState@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedEstimatorIterator.#ctor(System.String,Microsoft.Azure.Cosmos.ContainerInternal,Microsoft.Azure.Cosmos.ContainerInternal,Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseContainer,Microsoft.Azure.Cosmos.ChangeFeedEstimatorRequestOptions,System.Func{Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease,System.String,System.Boolean,Microsoft.Azure.Cosmos.FeedIteratorInternal})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedEstimatorIterator.ChangeFeedEstimatorEmptyFeedResponse.#ctor(Microsoft.Azure.Cosmos.Tracing.ITrace)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedEstimatorIterator.ChangeFeedEstimatorFeedResponse.#ctor(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Collections.ObjectModel.ReadOnlyCollection{Microsoft.Azure.Cosmos.ChangeFeedProcessorState},System.Double)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedEstimatorIterator.GetRemainingWorkAsync(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{System.ValueTuple{Microsoft.Azure.Cosmos.ChangeFeedProcessorState,Microsoft.Azure.Cosmos.ResponseMessage}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedEstimatorIterator.ReadNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.FeedResponse{Microsoft.Azure.Cosmos.ChangeFeedProcessorState}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedEstimatorRunner.#ctor(Microsoft.Azure.Cosmos.Container.ChangesEstimationHandler,System.Nullable{System.TimeSpan})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedEstimatorRunner.#ctor(System.Nullable{System.TimeSpan})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedEstimatorRunner.ApplyBuildConfiguration(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManager,Microsoft.Azure.Cosmos.ContainerInternal,System.String,Microsoft.Azure.Cosmos.ChangeFeed.Configuration.ChangeFeedLeaseOptions,Microsoft.Azure.Cosmos.ChangeFeed.Configuration.ChangeFeedProcessorOptions,Microsoft.Azure.Cosmos.ContainerInternal)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedEstimatorRunner.StartAsync~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedIteratorCore.#ctor(Microsoft.Azure.Cosmos.Pagination.IDocumentContainer,Microsoft.Azure.Cosmos.ChangeFeedMode,Microsoft.Azure.Cosmos.ChangeFeedRequestOptions,Microsoft.Azure.Cosmos.ChangeFeedStartFrom,Microsoft.Azure.Cosmos.CosmosClientContext,Microsoft.Azure.Cosmos.ContainerInternal,Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedQuerySpec)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedIteratorCore.ChangeFeedStateFromToChangeFeedCrossFeedRangeState.Visit(Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedStartFromContinuationAndFeedRange)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeState}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedIteratorCore.ReadNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedIteratorCore.ReadNextInternalAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedObserverContextCore.CheckpointAsync~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedObserverFactoryCore.#ctor(Microsoft.Azure.Cosmos.Container.ChangeFeedStreamHandler)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedObserverFactoryCore.#ctor(Microsoft.Azure.Cosmos.Container.ChangeFeedStreamHandlerWithManualCheckpoint)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedObserverFactoryCore`1.#ctor(Microsoft.Azure.Cosmos.Container.ChangeFeedHandler{`0},Microsoft.Azure.Cosmos.CosmosSerializerCore)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedObserverFactoryCore`1.#ctor(Microsoft.Azure.Cosmos.Container.ChangeFeedHandler{Microsoft.Azure.Cosmos.ChangeFeedItem{`0}},Microsoft.Azure.Cosmos.CosmosSerializerCore)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedObserverFactoryCore`1.#ctor(Microsoft.Azure.Cosmos.Container.ChangeFeedHandlerWithManualCheckpoint{`0},Microsoft.Azure.Cosmos.CosmosSerializerCore)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedObserverFactoryCore`1.#ctor(Microsoft.Azure.Cosmos.Container.ChangesHandler{`0},Microsoft.Azure.Cosmos.CosmosSerializerCore)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedObserverFactoryCore`1.#ctor(Microsoft.Azure.Cosmos.CosmosSerializerCore)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedObserverFactoryCore`1.AllVersionsAsIReadOnlyCollection(System.IO.Stream,Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedObserverContextCore)~System.Collections.Generic.IReadOnlyCollection{Microsoft.Azure.Cosmos.ChangeFeedItem{`0}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedObserverFactoryCore`1.AsIReadOnlyCollection(System.IO.Stream,Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedObserverContextCore)~System.Collections.Generic.IReadOnlyCollection{`0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedPage.#ctor(Microsoft.Azure.Cosmos.CosmosElements.CosmosArray,System.Boolean,System.Double,System.String,Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedCrossFeedRangeState,System.Collections.Generic.IReadOnlyDictionary{System.String,System.String})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedPartitionKeyResultSetIteratorCore.#ctor(Microsoft.Azure.Cosmos.ContainerInternal,Microsoft.Azure.Cosmos.ChangeFeedMode,Microsoft.Azure.Cosmos.ChangeFeedStartFrom,Microsoft.Azure.Cosmos.ChangeFeedRequestOptions)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedProcessorCore.#ctor(Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedObserverFactory)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedProcessorCore.ApplyBuildConfiguration(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManager,Microsoft.Azure.Cosmos.ContainerInternal,System.String,Microsoft.Azure.Cosmos.ChangeFeed.Configuration.ChangeFeedLeaseOptions,Microsoft.Azure.Cosmos.ChangeFeed.Configuration.ChangeFeedProcessorOptions,Microsoft.Azure.Cosmos.ContainerInternal)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedQuerySpec.#ctor(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedStartFromContinuation.#ctor(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedStartFromRequestOptionPopulator.#ctor(Microsoft.Azure.Cosmos.RequestMessage)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedStartFromTime.#ctor(System.DateTime,Microsoft.Azure.Cosmos.FeedRangeInternal)")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement.EqualPartitionsBalancingStrategy.#ctor(System.String,System.Int32,System.Int32,System.TimeSpan)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement.EqualPartitionsBalancingStrategy.#ctor(System.String,System.Int32,System.Int32,System.TimeSpan)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement.LeaseRenewerCore.RenewAsync~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement.LeaseRenewerCore.RunAsync(System.Threading.CancellationToken)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement.PartitionControllerCore.AddOrUpdateLeaseAsync(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement.PartitionLoadBalancerCore.#ctor(Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement.PartitionController,Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseContainer,Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement.LoadBalancingStrategy,System.TimeSpan)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement.PartitionLoadBalancerCore.#ctor(Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement.PartitionController,Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseContainer,Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement.LoadBalancingStrategy,System.TimeSpan)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement.PartitionLoadBalancerCore.Start")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement.PartitionLoadBalancerCore.StopAsync~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement.PartitionSupervisorCore.RunAsync(System.Threading.CancellationToken)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement.PartitionSupervisorFactoryCore.#ctor(Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedObserverFactory,Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseManager,Microsoft.Azure.Cosmos.ChangeFeed.FeedProcessing.FeedProcessorFactory,Microsoft.Azure.Cosmos.ChangeFeed.Configuration.ChangeFeedLeaseOptions)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement.PartitionSupervisorFactoryCore.Create(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease)~Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement.PartitionSupervisor")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.FeedProcessing.CheckpointerObserverFactory.#ctor(Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedObserverFactory,System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.FeedProcessing.FeedEstimatorRunner.RunAsync(System.Threading.CancellationToken)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.FeedProcessing.FeedProcessorCore.#ctor(Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedObserver,Microsoft.Azure.Cosmos.FeedIterator,Microsoft.Azure.Cosmos.ChangeFeed.FeedProcessing.ProcessorOptions,Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement.PartitionCheckpointer)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.FeedProcessing.FeedProcessorCore.HandleFailedRequest(Microsoft.Azure.Cosmos.ResponseMessage,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.FeedProcessing.FeedProcessorCore.RunAsync(System.Threading.CancellationToken)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.FeedProcessing.FeedProcessorFactoryCore.#ctor(Microsoft.Azure.Cosmos.ContainerInternal,Microsoft.Azure.Cosmos.ChangeFeed.Configuration.ChangeFeedProcessorOptions,Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseCheckpointer)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.FeedProcessing.FeedProcessorFactoryCore.Create(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease,Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedObserver)~Microsoft.Azure.Cosmos.ChangeFeed.FeedProcessing.FeedProcessor")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseCheckpointerCore.CheckpointAsync(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease,System.String)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseContainerCosmos.ListDocumentsAsync(System.String)~System.Threading.Tasks.Task{System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseConverter.ReadJson(Newtonsoft.Json.JsonReader,System.Type,System.Object,Newtonsoft.Json.JsonSerializer)~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseManager.VerifyChangeFeedProcessorMode(Microsoft.Azure.Cosmos.ChangeFeedMode,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseManagerCosmos.AcquireAsync(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseManagerCosmos.CreateLeaseIfNotExistAsync(Microsoft.Azure.Cosmos.FeedRangeEpk,System.String)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseManagerCosmos.CreateLeaseIfNotExistAsync(Microsoft.Azure.Documents.PartitionKeyRange,System.String)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseManagerCosmos.DeleteAsync(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseManagerCosmos.ReleaseAsync(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseManagerCosmos.RenewAsync(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseManagerCosmos.UpdatePropertiesAsync(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseManagerInMemory.AcquireAsync(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseManagerInMemory.CreateLeaseIfNotExistAsync(Microsoft.Azure.Cosmos.FeedRangeEpk,System.String)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseManagerInMemory.CreateLeaseIfNotExistAsync(Microsoft.Azure.Documents.PartitionKeyRange,System.String)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseManagerInMemory.DeleteAsync(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseManagerInMemory.ReleaseAsync(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseManagerInMemory.RenewAsync(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseManagerInMemory.UpdatePropertiesAsync(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManagerBuilder.Build~Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManager")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManagerBuilder.InitializeAsync(Microsoft.Azure.Cosmos.ContainerInternal,Microsoft.Azure.Cosmos.ContainerInternal,System.String,System.String,Microsoft.Azure.Cosmos.ChangeFeedMode)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManager}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManagerBuilder.WithChangeFeedMode(Microsoft.Azure.Cosmos.ChangeFeedMode)~Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManagerBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManagerBuilder.WithHostName(System.String)~Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManagerBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManagerBuilder.WithLeaseContainer(Microsoft.Azure.Cosmos.ContainerInternal)~Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManagerBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManagerBuilder.WithLeasePrefix(System.String)~Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManagerBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManagerBuilder.WithMonitoredContainer(Microsoft.Azure.Cosmos.ContainerInternal)~Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManagerBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManagerBuilder.WithRequestOptionsFactory(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.RequestOptionsFactory)~Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManagerBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManagerCosmos.#ctor(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManagerOptions,Microsoft.Azure.Cosmos.ContainerInternal,Microsoft.Azure.Cosmos.ContainerInternal,Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.RequestOptionsFactory,Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseUpdater)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseStoreManagerInMemory.#ctor(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseUpdater,System.Collections.Concurrent.ConcurrentDictionary{System.String,Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseUpdaterCosmos.#ctor(Microsoft.Azure.Cosmos.Container)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseUpdaterCosmos.TryReplaceLeaseAsync(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease,Microsoft.Azure.Cosmos.PartitionKey,System.String)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseUpdaterCosmos.UpdateLeaseAsync(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease,System.String,Microsoft.Azure.Cosmos.PartitionKey,System.Func{Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease,Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease})~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseUpdaterInMemory.UpdateLeaseAsync(Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease,System.String,Microsoft.Azure.Cosmos.PartitionKey,System.Func{Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease,Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease})~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLease}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ObserverExceptionWrappingChangeFeedObserverDecorator.#ctor(Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedObserver)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.ObserverExceptionWrappingChangeFeedObserverDecorator.ProcessChangesAsync(Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedObserverContextCore,System.IO.Stream,System.Threading.CancellationToken)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedExecutionOptions.#ctor(Microsoft.Azure.Cosmos.ChangeFeedMode,System.Nullable{System.Int32},System.Nullable{Microsoft.Azure.Cosmos.Json.JsonSerializationFormat},System.Collections.Generic.Dictionary{System.String,System.String},Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedQuerySpec)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedFeedRangeStateSerializer.Monadic.CreateFromCosmosElement(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Pagination.FeedRangeState{Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedState}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedPartitionRangePageAsyncEnumerator.#ctor(Microsoft.Azure.Cosmos.ChangeFeed.Pagination.IChangeFeedDataSource,Microsoft.Azure.Cosmos.Pagination.FeedRangeState{Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedState},Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedExecutionOptions)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedStateContinuation.#ctor(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedStateCosmosElementSerializer.MonadicFromCosmosElement(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedState}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedStateCosmosElementSerializer.ToCosmosElement(Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedState)~Microsoft.Azure.Cosmos.CosmosElements.CosmosElement")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedStateTime.#ctor(System.DateTime)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedSuccessPage.#ctor(System.IO.Stream,System.Double,System.Int32,System.String,System.Collections.Generic.IReadOnlyDictionary{System.String,System.String},Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedState)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.Pagination.CrossPartitionChangeFeedAsyncEnumerator.#ctor(Microsoft.Azure.Cosmos.Pagination.CrossPartitionRangePageAsyncEnumerator{Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedPage,Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedState})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.Pagination.CrossPartitionChangeFeedAsyncEnumerator.Create(Microsoft.Azure.Cosmos.Pagination.IDocumentContainer,Microsoft.Azure.Cosmos.Pagination.CrossFeedRangeState{Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedState},Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedExecutionOptions)~Microsoft.Azure.Cosmos.ChangeFeed.Pagination.CrossPartitionChangeFeedAsyncEnumerator")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.Pagination.CrossPartitionChangeFeedAsyncEnumerator.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.StandByFeedContinuationToken.#ctor(System.String,System.String,Microsoft.Azure.Cosmos.ChangeFeed.StandByFeedContinuationToken.PartitionKeyRangeCacheDelegate)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.StandByFeedContinuationToken.#ctor(System.String,System.String,Microsoft.Azure.Cosmos.ChangeFeed.StandByFeedContinuationToken.PartitionKeyRangeCacheDelegate)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.StandByFeedContinuationToken.BuildCompositeTokensAsync(System.String)~System.Threading.Tasks.Task{System.Collections.Generic.IEnumerable{Microsoft.Azure.Cosmos.Routing.CompositeContinuationToken}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.StandByFeedContinuationToken.CreateForRange(System.String,System.String,System.String)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.StandByFeedContinuationToken.HandleSplit(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Documents.PartitionKeyRange})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.StandByFeedContinuationToken.TryGetOverlappingRangesAsync(Microsoft.Azure.Documents.Routing.Range{System.String},System.Boolean)~System.Threading.Tasks.Task{System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Documents.PartitionKeyRange}}")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.StandByFeedIteratorCore.#ctor(Microsoft.Azure.Cosmos.CosmosClientContext,Microsoft.Azure.Cosmos.ContainerInternal,System.String,System.Nullable{System.Int32},Microsoft.Azure.Cosmos.StandByFeedIteratorRequestOptions)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.StandByFeedIteratorCore.#ctor(Microsoft.Azure.Cosmos.CosmosClientContext,Microsoft.Azure.Cosmos.ContainerInternal,System.String,System.Nullable{System.Int32},Microsoft.Azure.Cosmos.StandByFeedIteratorRequestOptions)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.StandByFeedIteratorCore.ReadNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeed.StandByFeedIteratorCore.ReadNextInternalAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{System.Tuple{System.String,Microsoft.Azure.Cosmos.ResponseMessage}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeedEstimatorCore.#ctor(System.String,Microsoft.Azure.Cosmos.ContainerInternal,Microsoft.Azure.Cosmos.ContainerInternal,Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement.DocumentServiceLeaseContainer)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder.Build~Microsoft.Azure.Cosmos.ChangeFeedProcessor")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder.WithErrorNotification(Microsoft.Azure.Cosmos.Container.ChangeFeedMonitorErrorDelegate)~Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder.WithInMemoryLeaseContainer~Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder.WithLeaseAcquireNotification(Microsoft.Azure.Cosmos.Container.ChangeFeedMonitorLeaseAcquireDelegate)~Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder.WithLeaseContainer(Microsoft.Azure.Cosmos.Container)~Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder.WithLeaseReleaseNotification(Microsoft.Azure.Cosmos.Container.ChangeFeedMonitorLeaseReleaseDelegate)~Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder.WithMaxItems(System.Int32)~Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder.WithPollInterval(System.TimeSpan)~Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder.WithStartFromBeginning~Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder.WithStartTime(System.DateTime)~Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeedProcessorState.#ctor(System.String,System.Int64,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeedStartFrom.Beginning(Microsoft.Azure.Cosmos.FeedRange)~Microsoft.Azure.Cosmos.ChangeFeedStartFrom")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeedStartFrom.Now(Microsoft.Azure.Cosmos.FeedRange)~Microsoft.Azure.Cosmos.ChangeFeedStartFrom")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ChangeFeedStartFrom.Time(System.DateTime,Microsoft.Azure.Cosmos.FeedRange)~Microsoft.Azure.Cosmos.ChangeFeedStartFrom")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ClearingSessionContainerClientRetryPolicy.ShouldRetryAsync(Microsoft.Azure.Cosmos.ResponseMessage,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.ShouldRetryResult}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ClientContextCore.Create(Microsoft.Azure.Cosmos.CosmosClient,Microsoft.Azure.Cosmos.CosmosClientOptions)~Microsoft.Azure.Cosmos.CosmosClientContext")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ClientContextCore.Create(Microsoft.Azure.Cosmos.CosmosClient,Microsoft.Azure.Cosmos.DocumentClient,Microsoft.Azure.Cosmos.CosmosClientOptions,Microsoft.Azure.Cosmos.Handlers.RequestInvokerHandler)~Microsoft.Azure.Cosmos.CosmosClientContext")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ClientContextCore.GetCachedContainerPropertiesAsync(System.String,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ContainerProperties}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ClientContextCore.ProcessResourceOperationStreamAsync(System.String,Microsoft.Azure.Documents.ResourceType,Microsoft.Azure.Documents.OperationType,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.ContainerInternal,System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},System.String,System.IO.Stream,System.Action{Microsoft.Azure.Cosmos.RequestMessage},Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ClientContextCore.RunWithDiagnosticsHelperAsync``1(System.String,System.String,Microsoft.Azure.Documents.OperationType,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Func{Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.Tasks.Task{``0}},System.Nullable{System.ValueTuple{System.String,System.Func{``0,Microsoft.Azure.Cosmos.Telemetry.OpenTelemetryAttributes}}},Microsoft.Azure.Cosmos.RequestOptions,System.Nullable{Microsoft.Azure.Documents.ResourceType})~System.Threading.Tasks.Task{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ClientContextCore.ThrowIfDisposed")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ClientEncryptionKeyProperties.#ctor(System.String,System.String,System.Byte[],Microsoft.Azure.Cosmos.EncryptionKeyWrapMetadata)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ClientEncryptionPolicy.#ctor(System.Collections.Generic.IEnumerable{Microsoft.Azure.Cosmos.ClientEncryptionIncludedPath},System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ClientEncryptionPolicy.ValidateClientEncryptionIncludedPath(Microsoft.Azure.Cosmos.ClientEncryptionIncludedPath,System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ClientEncryptionPolicy.ValidateIncludedPaths(System.Collections.Generic.IEnumerable{Microsoft.Azure.Cosmos.ClientEncryptionIncludedPath},System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ClientEncryptionPolicy.ValidatePartitionKeyPathsIfEncrypted(System.Collections.Generic.IReadOnlyList{System.Collections.Generic.IReadOnlyList{System.String}})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ClientExtensions.GetAsync(System.Net.Http.HttpClient,System.Uri,Microsoft.Azure.Documents.Collections.INameValueCollection,System.Threading.CancellationToken)~System.Threading.Tasks.Task{System.Net.Http.HttpResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ClientExtensions.ParseMediaResponseAsync(System.Net.Http.HttpResponseMessage,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.DocumentServiceResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ClientPipelineBuilder.#ctor(Microsoft.Azure.Cosmos.CosmosClient,System.Nullable{Microsoft.Azure.Cosmos.ConsistencyLevel},System.Nullable{Microsoft.Azure.Cosmos.PriorityLevel},System.Collections.Generic.IReadOnlyCollection{Microsoft.Azure.Cosmos.RequestHandler},Microsoft.Azure.Cosmos.Telemetry.TelemetryToServiceHelper,System.Nullable{System.Int32})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ClientPipelineBuilder.CreatePipeline(Microsoft.Azure.Cosmos.RequestHandler[])~Microsoft.Azure.Cosmos.RequestHandler")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Common.AsyncCache`2.GetAsync(`0,`1,System.Func{System.Threading.Tasks.Task{`1}},System.Threading.CancellationToken,System.Boolean)~System.Threading.Tasks.Task{`1}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Common.CollectionCache.ResolveByPartitionKeyRangeIdentityAsync(System.String,Microsoft.Azure.Documents.PartitionKeyRangeIdentity,Microsoft.Azure.Cosmos.Tracing.ITrace,Microsoft.Azure.Documents.IClientSideRequestStatistics,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ContainerProperties}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Common.SessionContainer.AddSessionToken(Microsoft.Azure.Cosmos.Common.SessionContainer.SessionContainerState,System.UInt64,System.String,Microsoft.Azure.Documents.ISessionToken)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ConflictResourceTypeJsonConverter.WriteJson(Newtonsoft.Json.JsonWriter,System.Object,Newtonsoft.Json.JsonSerializer)")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ConflictsCore.#ctor(Microsoft.Azure.Cosmos.CosmosClientContext,Microsoft.Azure.Cosmos.ContainerInternal)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ConflictsCore.#ctor(Microsoft.Azure.Cosmos.CosmosClientContext,Microsoft.Azure.Cosmos.ContainerInternal)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ConflictsCore.DeleteAsync(Microsoft.Azure.Cosmos.ConflictProperties,Microsoft.Azure.Cosmos.PartitionKey,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ConflictsCore.GetConflictQueryIterator``1(Microsoft.Azure.Cosmos.QueryDefinition,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)~Microsoft.Azure.Cosmos.FeedIterator{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ConflictsCore.ReadConflictContent``1(Microsoft.Azure.Cosmos.ConflictProperties)~``0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ConflictsCore.ReadCurrentAsync``1(Microsoft.Azure.Cosmos.ConflictProperties,Microsoft.Azure.Cosmos.PartitionKey,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ItemResponse{``0}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ConnectionPolicy.SetAccountInitializationCustomEndpoints(System.Collections.Generic.IEnumerable{System.Uri})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ConnectionPolicy.SetCurrentLocation(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ConnectionPolicy.SetPreferredLocations(System.Collections.Generic.IReadOnlyList{System.String})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Container.DeleteAllItemsByPartitionKeyStreamAsync(Microsoft.Azure.Cosmos.PartitionKey,Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.ConvertToFeedRangeInternal(Microsoft.Azure.Cosmos.FeedRange,System.String)~Microsoft.Azure.Cosmos.FeedRangeInternal")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.CosmosElementToPartitionKeyObject(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.CosmosElements.CosmosElement})~Microsoft.Azure.Cosmos.PartitionKey")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.CreateItemAsync``1(``0,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},Microsoft.Azure.Cosmos.ItemRequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ItemResponse{``0}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.EnsureConsistentInclusivity(System.Collections.Generic.List{Microsoft.Azure.Documents.Routing.Range{System.String}})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.ExtractPartitionKeyAndProcessItemStreamAsync``1(System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},System.String,``0,Microsoft.Azure.Documents.OperationType,Microsoft.Azure.Cosmos.ItemRequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.GetCachedContainerPropertiesAsync(System.Boolean,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ContainerProperties}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.GetChangeFeedEstimator(System.String,Microsoft.Azure.Cosmos.Container)~Microsoft.Azure.Cosmos.ChangeFeedEstimator")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.GetChangeFeedEstimatorBuilder(System.String,Microsoft.Azure.Cosmos.Container.ChangesEstimationHandler,System.Nullable{System.TimeSpan})~Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.GetChangeFeedIterator``1(Microsoft.Azure.Cosmos.ChangeFeedStartFrom,Microsoft.Azure.Cosmos.ChangeFeedMode,Microsoft.Azure.Cosmos.ChangeFeedRequestOptions)~Microsoft.Azure.Cosmos.FeedIterator{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.GetChangeFeedIteratorWithQuery``1(Microsoft.Azure.Cosmos.ChangeFeedStartFrom,Microsoft.Azure.Cosmos.ChangeFeedMode,Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedQuerySpec,Microsoft.Azure.Cosmos.ChangeFeedRequestOptions)~Microsoft.Azure.Cosmos.FeedIterator{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.GetChangeFeedProcessorBuilder(System.String,Microsoft.Azure.Cosmos.Container.ChangeFeedStreamHandler)~Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.GetChangeFeedProcessorBuilder``1(System.String,Microsoft.Azure.Cosmos.Container.ChangeFeedHandler{``0})~Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.GetChangeFeedProcessorBuilder``1(System.String,Microsoft.Azure.Cosmos.Container.ChangesHandler{``0})~Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes``1(System.String,Microsoft.Azure.Cosmos.Container.ChangeFeedHandler{Microsoft.Azure.Cosmos.ChangeFeedItem{``0}})~Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.GetChangeFeedProcessorBuilderWithManualCheckpoint(System.String,Microsoft.Azure.Cosmos.Container.ChangeFeedStreamHandlerWithManualCheckpoint)~Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.GetChangeFeedProcessorBuilderWithManualCheckpoint``1(System.String,Microsoft.Azure.Cosmos.Container.ChangeFeedHandlerWithManualCheckpoint{``0})~Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.GetChangeFeedStreamIterator(Microsoft.Azure.Cosmos.ChangeFeedStartFrom,Microsoft.Azure.Cosmos.ChangeFeedMode,Microsoft.Azure.Cosmos.ChangeFeedRequestOptions)~Microsoft.Azure.Cosmos.FeedIterator")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.GetChangeFeedStreamIteratorWithQuery(Microsoft.Azure.Cosmos.ChangeFeedStartFrom,Microsoft.Azure.Cosmos.ChangeFeedMode,Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedQuerySpec,Microsoft.Azure.Cosmos.ChangeFeedRequestOptions)~Microsoft.Azure.Cosmos.FeedIterator")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.GetFeedRangesAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.FeedRange}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.GetItemQueryIterator``1(Microsoft.Azure.Cosmos.FeedRange,Microsoft.Azure.Cosmos.QueryDefinition,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)~Microsoft.Azure.Cosmos.FeedIterator{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.GetItemQueryIterator``1(Microsoft.Azure.Cosmos.QueryDefinition,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)~Microsoft.Azure.Cosmos.FeedIterator{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.GetItemQueryStreamIteratorInternal(Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,System.Boolean,System.String,Microsoft.Azure.Cosmos.FeedRangeInternal,Microsoft.Azure.Cosmos.QueryRequestOptions)~Microsoft.Azure.Cosmos.FeedIteratorInternal")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.GetPartitionKeyPathTokensAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{System.Collections.Generic.IReadOnlyList{System.Collections.Generic.IReadOnlyList{System.String}}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.GetPartitionKeyRangesAsync(Microsoft.Azure.Cosmos.FeedRange,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{System.Collections.Generic.IEnumerable{System.String}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.GetPartitionKeyValueFromStreamAsync(System.IO.Stream,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.PartitionKey}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.IsFeedRangePartOfAsync(Microsoft.Azure.Cosmos.FeedRange,Microsoft.Azure.Cosmos.FeedRange,System.Threading.CancellationToken)~System.Threading.Tasks.Task{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.IsSubset(Microsoft.Azure.Documents.Routing.Range{System.String},Microsoft.Azure.Documents.Routing.Range{System.String})~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.PatchItemStreamAsync(System.String,Microsoft.Azure.Cosmos.PartitionKey,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.PatchOperation},Microsoft.Azure.Cosmos.Tracing.ITrace,Microsoft.Azure.Cosmos.PatchItemRequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.PatchItemStreamAsync(System.String,Microsoft.Azure.Cosmos.PartitionKey,System.IO.Stream,Microsoft.Azure.Cosmos.Tracing.ITrace,Microsoft.Azure.Cosmos.ItemRequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.ProcessItemStreamAsync(System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},System.String,System.IO.Stream,Microsoft.Azure.Documents.OperationType,Microsoft.Azure.Cosmos.ItemRequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Nullable{Microsoft.Azure.Cosmos.Json.JsonSerializationFormat},System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.ReadManyItemsAsync``1(System.Collections.Generic.IReadOnlyList{System.ValueTuple{System.String,Microsoft.Azure.Cosmos.PartitionKey}},Microsoft.Azure.Cosmos.Tracing.ITrace,Microsoft.Azure.Cosmos.ReadManyRequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.FeedResponse{``0}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.ReadManyItemsStreamAsync(System.Collections.Generic.IReadOnlyList{System.ValueTuple{System.String,Microsoft.Azure.Cosmos.PartitionKey}},Microsoft.Azure.Cosmos.Tracing.ITrace,Microsoft.Azure.Cosmos.ReadManyRequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.ReadThroughputAsync(Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ThroughputResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.ReplaceContainerAsync(Microsoft.Azure.Cosmos.ContainerProperties,Microsoft.Azure.Cosmos.Tracing.ITrace,Microsoft.Azure.Cosmos.ContainerRequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ContainerResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.ReplaceContainerStreamAsync(Microsoft.Azure.Cosmos.ContainerProperties,Microsoft.Azure.Cosmos.Tracing.ITrace,Microsoft.Azure.Cosmos.ContainerRequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.ReplaceItemAsync``1(``0,System.String,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},Microsoft.Azure.Cosmos.ItemRequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ItemResponse{``0}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.ReplaceThroughputAsync(Microsoft.Azure.Cosmos.ThroughputProperties,Microsoft.Azure.Cosmos.Tracing.ITrace,Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ThroughputResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerCore.UpsertItemAsync``1(``0,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},Microsoft.Azure.Cosmos.ItemRequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ItemResponse{``0}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerInternal.FailedToGetQueryPlanResult.#ctor(System.Exception)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerInternal.QueryPlanIsSupportedResult.#ctor(Microsoft.Azure.Cosmos.Query.QueryIterator)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerInternal.QueryPlanNotSupportedResult.#ctor(Microsoft.Azure.Cosmos.Query.Core.QueryPlan.PartitionedQueryExecutionInfo)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerInternal.ValidatePartitionKey(System.Object,Microsoft.Azure.Cosmos.RequestOptions)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerProperties.CreateWithResourceId(System.String)~Microsoft.Azure.Cosmos.ContainerProperties")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerProperties.GetNoneValue~Microsoft.Azure.Documents.Routing.PartitionKeyInternal")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ContainerProperties.ValidateRequiredProperties")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Core.Trace.EtwTraceListener.#ctor(System.Guid,System.String)")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosAccountServiceConfiguration.#ctor(System.Func{System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.AccountProperties}})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosAccountServiceConfiguration.#ctor(System.Func{System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.AccountProperties}})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosClient.#ctor(System.String,Microsoft.Azure.Cosmos.AuthorizationTokenProvider,Microsoft.Azure.Cosmos.CosmosClientOptions)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosClient.#ctor(System.String,System.String,Microsoft.Azure.Cosmos.CosmosClientOptions,Microsoft.Azure.Cosmos.DocumentClient)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosClient.CreateAndInitializeAsync(System.String,Azure.AzureKeyCredential,System.Collections.Generic.IReadOnlyList{System.ValueTuple{System.String,System.String}},Microsoft.Azure.Cosmos.CosmosClientOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.CosmosClient}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosClient.CreateAndInitializeAsync(System.String,Azure.Core.TokenCredential,System.Collections.Generic.IReadOnlyList{System.ValueTuple{System.String,System.String}},Microsoft.Azure.Cosmos.CosmosClientOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.CosmosClient}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosClient.CreateAndInitializeAsync(System.String,System.Collections.Generic.IReadOnlyList{System.ValueTuple{System.String,System.String}},Microsoft.Azure.Cosmos.CosmosClientOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.CosmosClient}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosClient.CreateAndInitializeAsync(System.String,System.String,System.Collections.Generic.IReadOnlyList{System.ValueTuple{System.String,System.String}},Microsoft.Azure.Cosmos.CosmosClientOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.CosmosClient}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosClient.CreateDatabaseAsync(System.String,Microsoft.Azure.Cosmos.ThroughputProperties,Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DatabaseResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosClient.CreateDatabaseAsync(System.String,System.Nullable{System.Int32},Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DatabaseResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosClient.CreateDatabaseIfNotExistsAsync(System.String,Microsoft.Azure.Cosmos.ThroughputProperties,Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DatabaseResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosClient.CreateDatabaseStreamAsync(Microsoft.Azure.Cosmos.DatabaseProperties,Microsoft.Azure.Cosmos.ThroughputProperties,Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosClient.CreateDatabaseStreamAsync(Microsoft.Azure.Cosmos.DatabaseProperties,System.Nullable{System.Int32},Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosClient.GetContainer(System.String,System.String)~Microsoft.Azure.Cosmos.Container")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosClient.GetDatabaseQueryIteratorHelper``1(Microsoft.Azure.Cosmos.QueryDefinition,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)~Microsoft.Azure.Cosmos.FeedIteratorInternal{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosClient.InitializeContainersAsync(System.Collections.Generic.IReadOnlyList{System.ValueTuple{System.String,System.String}},System.Threading.CancellationToken)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosClient.PrepareDatabaseProperties(System.String)~Microsoft.Azure.Cosmos.DatabaseProperties")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosClientOptions.ClientOptionJsonConverter.ReadJson(Newtonsoft.Json.JsonReader,System.Type,System.Object,Newtonsoft.Json.JsonSerializer)~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosClientOptions.GetValueFromConnectionString``1(System.String,System.String,``0)~``0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosClientOptions.SetSerializerIfNotConfigured(Microsoft.Azure.Cosmos.CosmosSerializer)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosClientOptions.ValidateDirectTCPSettings")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosClientOptions.ValidateLimitToEndpointSettings")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosDiagnostics.GetClientElapsedTime~System.TimeSpan")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosDiagnostics.GetFailedRequestCount~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosDiagnostics.GetQueryMetrics~Microsoft.Azure.Cosmos.ServerSideCumulativeMetrics")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosDiagnostics.GetStartTimeUtc~System.Nullable{System.DateTime}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.CosmosArray.Enumerator.Reset")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.CosmosArray.LazyCosmosArray.#ctor(Microsoft.Azure.Cosmos.Json.IJsonNavigator,Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.CosmosBinary.LazyCosmosBinary.#ctor(Microsoft.Azure.Cosmos.Json.IJsonNavigator,Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.CosmosElement.Dispatch(Microsoft.Azure.Cosmos.Json.IJsonNavigator,Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~Microsoft.Azure.Cosmos.CosmosElements.CosmosElement")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.CosmosElement.Monadic.Parse``1(System.String)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.CosmosElementJsonConverter.WriteJson(Newtonsoft.Json.JsonWriter,System.Object,Newtonsoft.Json.JsonSerializer)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.CosmosGuid.LazyCosmosGuid.#ctor(Microsoft.Azure.Cosmos.Json.IJsonNavigator,Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.CosmosObject.Enumerator.Reset")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.CosmosObject.KeyCollection.Enumerator.Reset")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.CosmosObject.LazyCosmosObject.#ctor(Microsoft.Azure.Cosmos.Json.IJsonNavigator,Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.CosmosObject.ValueCollection.Enumerator.Reset")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.CosmosString.Create(System.String)~Microsoft.Azure.Cosmos.CosmosElements.CosmosString")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.CosmosString.LazyCosmosString.#ctor(Microsoft.Azure.Cosmos.Json.IJsonNavigator,Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.Numbers.CosmosFloat32.LazyCosmosFloat32.#ctor(Microsoft.Azure.Cosmos.Json.IJsonNavigator,Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.Numbers.CosmosFloat64.LazyCosmosFloat64.#ctor(Microsoft.Azure.Cosmos.Json.IJsonNavigator,Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.Numbers.CosmosInt16.LazyCosmosInt16.#ctor(Microsoft.Azure.Cosmos.Json.IJsonNavigator,Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.Numbers.CosmosInt32.LazyCosmosInt32.#ctor(Microsoft.Azure.Cosmos.Json.IJsonNavigator,Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.Numbers.CosmosInt64.LazyCosmosInt64.#ctor(Microsoft.Azure.Cosmos.Json.IJsonNavigator,Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.Numbers.CosmosInt8.LazyCosmosInt8.#ctor(Microsoft.Azure.Cosmos.Json.IJsonNavigator,Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.Numbers.CosmosNumber64.LazyCosmosNumber64.#ctor(Microsoft.Azure.Cosmos.Json.IJsonNavigator,Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosElements.Numbers.CosmosUInt32.LazyCosmosUInt32.#ctor(Microsoft.Azure.Cosmos.Json.IJsonNavigator,Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosException.ToStringHelper(System.Text.StringBuilder)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosFeedResponseSerializer.GetArrayEndPosition(System.ReadOnlyMemory{System.Byte})~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosFeedResponseSerializer.GetArrayStartPosition(System.ReadOnlyMemory{System.Byte})~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosHttpClientCore.#ctor(System.Net.Http.HttpClient,System.Net.Http.HttpMessageHandler,Microsoft.Azure.Documents.ICommunicationEventSource,Microsoft.Azure.Documents.FaultInjection.IChaosInterceptor)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosHttpClientCore.CreateHelper(System.Net.Http.HttpClient,System.Net.Http.HttpMessageHandler,System.TimeSpan,Microsoft.Azure.Cosmos.UserAgentContainer,Microsoft.Azure.Documents.ApiType,Microsoft.Azure.Documents.ICommunicationEventSource,Microsoft.Azure.Documents.FaultInjection.IChaosInterceptor)~Microsoft.Azure.Cosmos.CosmosHttpClient")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosHttpClientCore.CreateWithConnectionPolicy(Microsoft.Azure.Documents.ApiType,Microsoft.Azure.Documents.ICommunicationEventSource,Microsoft.Azure.Cosmos.ConnectionPolicy,System.Net.Http.HttpMessageHandler,System.EventHandler{Microsoft.Azure.Documents.SendingRequestEventArgs},System.EventHandler{Microsoft.Azure.Documents.ReceivedResponseEventArgs},Microsoft.Azure.Documents.FaultInjection.IChaosInterceptor)~Microsoft.Azure.Cosmos.CosmosHttpClient")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosHttpClientCore.GetAsync(System.Uri,Microsoft.Azure.Documents.Collections.INameValueCollection,Microsoft.Azure.Documents.ResourceType,Microsoft.Azure.Cosmos.HttpTimeoutPolicy,Microsoft.Azure.Documents.IClientSideRequestStatistics,System.Threading.CancellationToken,Microsoft.Azure.Documents.DocumentServiceRequest)~System.Threading.Tasks.Task{System.Net.Http.HttpResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosHttpClientCore.HttpRequestMessageHandler.#ctor(System.EventHandler{Microsoft.Azure.Documents.SendingRequestEventArgs},System.EventHandler{Microsoft.Azure.Documents.ReceivedResponseEventArgs},System.Net.Http.HttpMessageHandler)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosHttpClientCore.SendHttpAsync(System.Func{System.Threading.Tasks.ValueTask{System.Net.Http.HttpRequestMessage}},Microsoft.Azure.Documents.ResourceType,Microsoft.Azure.Cosmos.HttpTimeoutPolicy,Microsoft.Azure.Documents.IClientSideRequestStatistics,System.Threading.CancellationToken,Microsoft.Azure.Documents.DocumentServiceRequest)~System.Threading.Tasks.Task{System.Net.Http.HttpResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosHttpClientCore.SendHttpHelperAsync(System.Func{System.Threading.Tasks.ValueTask{System.Net.Http.HttpRequestMessage}},Microsoft.Azure.Documents.ResourceType,Microsoft.Azure.Cosmos.HttpTimeoutPolicy,Microsoft.Azure.Documents.IClientSideRequestStatistics,System.Threading.CancellationToken,Microsoft.Azure.Documents.DocumentServiceRequest)~System.Threading.Tasks.Task{System.Net.Http.HttpResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosIndexJsonConverter.ReadJson(Newtonsoft.Json.JsonReader,System.Type,System.Object,Newtonsoft.Json.JsonSerializer)~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosIndexJsonConverter.WriteJson(Newtonsoft.Json.JsonWriter,System.Object,Newtonsoft.Json.JsonSerializer)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosJsonDotNetSerializer.#ctor(Newtonsoft.Json.JsonSerializerSettings,System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosJsonSerializerWrapper.#ctor(Microsoft.Azure.Cosmos.CosmosSerializer)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosJsonSerializerWrapper.FromStream``1(System.IO.Stream)~``0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosJsonSerializerWrapper.ToStream``1(``0)~System.IO.Stream")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosMessageHeadersInternal.Add(System.String,System.Collections.Generic.IEnumerable{System.String})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosNullReferenceException.#ctor(System.NullReferenceException,Microsoft.Azure.Cosmos.Tracing.ITrace)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosObjectDisposedException.#ctor(System.ObjectDisposedException,Microsoft.Azure.Cosmos.CosmosClient,Microsoft.Azure.Cosmos.Tracing.ITrace)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosOffers.GetOfferQueryIterator``1(Microsoft.Azure.Cosmos.QueryDefinition,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions,System.Threading.CancellationToken)~Microsoft.Azure.Cosmos.FeedIterator{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosOffers.GetOfferV2Async``1(System.String,System.Boolean,System.Threading.CancellationToken)~System.Threading.Tasks.Task{System.ValueTuple{``0,System.Double}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosOperationCanceledException.#ctor(System.OperationCanceledException,Microsoft.Azure.Cosmos.CosmosDiagnostics)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosOperationCanceledException.#ctor(System.OperationCanceledException,Microsoft.Azure.Cosmos.Tracing.ITrace)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosQueryClientCore.#ctor(Microsoft.Azure.Cosmos.CosmosClientContext,Microsoft.Azure.Cosmos.ContainerInternal)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosQueryClientCore.GetTargetPartitionKeyRangesAsync(System.String,System.String,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Documents.Routing.Range{System.String}},System.Boolean,Microsoft.Azure.Cosmos.Tracing.ITrace)~System.Threading.Tasks.Task{System.Collections.Generic.List{Microsoft.Azure.Documents.PartitionKeyRange}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosQueryClientCore.ParseRestStream(System.IO.Stream,Microsoft.Azure.Documents.ResourceType,Microsoft.Azure.Cosmos.CosmosElements.CosmosArray@,Microsoft.Azure.Cosmos.CosmosElements.CosmosObject@,System.Nullable{System.Boolean}@)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosQueryClientCore.PopulatePartitionKeyRangeInfo(Microsoft.Azure.Cosmos.RequestMessage,Microsoft.Azure.Documents.PartitionKeyRangeIdentity)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosResource.FromStream``1(Microsoft.Azure.Documents.DocumentServiceResponse)~``0")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosSerializationFormatOptions.#ctor(System.String,Microsoft.Azure.Cosmos.CosmosSerializationFormatOptions.CreateCustomNavigator,Microsoft.Azure.Cosmos.CosmosSerializationFormatOptions.CreateCustomWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosSerializationFormatOptions.#ctor(System.String,Microsoft.Azure.Cosmos.CosmosSerializationFormatOptions.CreateCustomNavigator,Microsoft.Azure.Cosmos.CosmosSerializationFormatOptions.CreateCustomWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosSerializationUtil.GetStringWithPropertyNamingPolicy(Microsoft.Azure.Cosmos.CosmosPropertyNamingPolicy,System.String)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosSerializerCore.Create(Microsoft.Azure.Cosmos.CosmosSerializer,Microsoft.Azure.Cosmos.CosmosSerializationOptions)~Microsoft.Azure.Cosmos.CosmosSerializerCore")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosSerializerCore.GetSerializer``1(System.Boolean)~Microsoft.Azure.Cosmos.CosmosSerializer")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosSqlQuerySpecJsonConverter.#ctor(Microsoft.Azure.Cosmos.CosmosSerializer)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosSqlQuerySpecJsonConverter.ReadJson(Newtonsoft.Json.JsonReader,System.Type,System.Object,Newtonsoft.Json.JsonSerializer)~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CosmosSystemTextJsonSerializer.FromStream``1(System.IO.Stream)~``0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CrossRegionHedgingAvailabilityStrategy.#ctor(System.TimeSpan,System.Nullable{System.TimeSpan},System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CrossRegionHedgingAvailabilityStrategy.ExecuteAvailabilityStrategyAsync(System.Func{Microsoft.Azure.Cosmos.RequestMessage,System.Threading.CancellationToken,System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}},Microsoft.Azure.Cosmos.CosmosClient,Microsoft.Azure.Cosmos.RequestMessage,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.CrossRegionHedgingAvailabilityStrategy.RequestSenderAndResultCheckAsync(System.Func{Microsoft.Azure.Cosmos.RequestMessage,System.Threading.CancellationToken,System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}},Microsoft.Azure.Cosmos.RequestMessage,System.Threading.CancellationToken,System.Threading.CancellationTokenSource,Microsoft.Azure.Cosmos.Tracing.ITrace)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.CrossRegionHedgingAvailabilityStrategy.HedgingResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DatabaseCore.CreateClientEncryptionKeyStreamAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.IO.Stream,Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DatabaseCore.CreateContainerAsync(Microsoft.Azure.Cosmos.ContainerProperties,Microsoft.Azure.Cosmos.ThroughputProperties,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ContainerResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DatabaseCore.CreateContainerAsync(Microsoft.Azure.Cosmos.ContainerProperties,System.Nullable{System.Int32},Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ContainerResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DatabaseCore.CreateContainerAsync(System.String,System.String,System.Nullable{System.Int32},Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ContainerResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DatabaseCore.CreateContainerIfNotExistsAsync(Microsoft.Azure.Cosmos.ContainerProperties,Microsoft.Azure.Cosmos.ThroughputProperties,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ContainerResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DatabaseCore.CreateContainerIfNotExistsAsync(Microsoft.Azure.Cosmos.ContainerProperties,System.Nullable{System.Int32},Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ContainerResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DatabaseCore.CreateContainerIfNotExistsAsync(System.String,System.String,System.Nullable{System.Int32},Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ContainerResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DatabaseCore.CreateContainerStreamAsync(Microsoft.Azure.Cosmos.ContainerProperties,Microsoft.Azure.Cosmos.ThroughputProperties,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DatabaseCore.CreateContainerStreamAsync(Microsoft.Azure.Cosmos.ContainerProperties,System.Nullable{System.Int32},Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DatabaseCore.CreateUserAsync(System.String,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.UserResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DatabaseCore.CreateUserStreamAsync(Microsoft.Azure.Cosmos.UserProperties,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DatabaseCore.GetClientEncryptionKey(System.String)~Microsoft.Azure.Cosmos.ClientEncryptionKey")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DatabaseCore.GetClientEncryptionKeyQueryIterator(Microsoft.Azure.Cosmos.QueryDefinition,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)~Microsoft.Azure.Cosmos.FeedIterator{Microsoft.Azure.Cosmos.ClientEncryptionKeyProperties}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DatabaseCore.GetContainer(System.String)~Microsoft.Azure.Cosmos.Container")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DatabaseCore.GetContainerQueryIterator``1(Microsoft.Azure.Cosmos.QueryDefinition,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)~Microsoft.Azure.Cosmos.FeedIterator{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DatabaseCore.GetUser(System.String)~Microsoft.Azure.Cosmos.User")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DatabaseCore.GetUserQueryIterator``1(Microsoft.Azure.Cosmos.QueryDefinition,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)~Microsoft.Azure.Cosmos.FeedIterator{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DatabaseCore.UpsertUserAsync(System.String,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.UserResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DedicatedGatewayRequestOptions.PopulateMaxIntegratedCacheStalenessOption(Microsoft.Azure.Cosmos.DedicatedGatewayRequestOptions,Microsoft.Azure.Cosmos.RequestMessage)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Diagnostics.BoundedList`1.#ctor(System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Diagnostics.CircularQueue`1.#ctor(System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Diagnostics.CosmosTraceDiagnostics.#ctor(Microsoft.Azure.Cosmos.Tracing.ITrace)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DisabledAvailabilityStrategy.ExecuteAvailabilityStrategyAsync(System.Func{Microsoft.Azure.Cosmos.RequestMessage,System.Threading.CancellationToken,System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}},Microsoft.Azure.Cosmos.CosmosClient,Microsoft.Azure.Cosmos.RequestMessage,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.#ctor(System.Uri,Microsoft.Azure.Cosmos.AuthorizationTokenProvider,System.EventHandler{Microsoft.Azure.Documents.SendingRequestEventArgs},Microsoft.Azure.Cosmos.ConnectionPolicy,System.Nullable{Microsoft.Azure.Documents.ConsistencyLevel},Newtonsoft.Json.JsonSerializerSettings,Microsoft.Azure.Documents.ApiType,System.EventHandler{Microsoft.Azure.Documents.ReceivedResponseEventArgs},System.Net.Http.HttpMessageHandler,Microsoft.Azure.Documents.ISessionContainer,System.Nullable{System.Boolean},System.Func{Microsoft.Azure.Documents.TransportClient,Microsoft.Azure.Documents.TransportClient},Microsoft.Azure.Documents.IStoreClientFactory,System.Boolean,System.String,System.Net.Security.RemoteCertificateValidationCallback,Microsoft.Azure.Cosmos.CosmosClientTelemetryOptions,Microsoft.Azure.Cosmos.IChaosInterceptorFactory,System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.#ctor(System.Uri,System.Security.SecureString,Microsoft.Azure.Cosmos.ConnectionPolicy,System.Nullable{Microsoft.Azure.Documents.ConsistencyLevel})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.AddPartitionKeyInformationAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.DocumentServiceResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateConflictQuery(System.Uri,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IOrderedQueryable{Microsoft.Azure.Documents.Conflict}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateConflictQuery(System.Uri,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IQueryable{System.Object}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateConflictQuery(System.Uri,System.String,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IQueryable{System.Object}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDatabaseIfNotExistsPrivateAsync(Microsoft.Azure.Documents.Database,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Database}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDatabasePrivateAsync(Microsoft.Azure.Documents.Database,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Database}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentAsync(System.Uri,System.Object,Microsoft.Azure.Documents.Client.RequestOptions,System.Boolean,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Document}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentChangeFeedQuery(System.String,Microsoft.Azure.Cosmos.ChangeFeedOptions)~Microsoft.Azure.Cosmos.Linq.IDocumentQuery{Microsoft.Azure.Documents.Document}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentChangeFeedQuery(System.Uri,Microsoft.Azure.Cosmos.ChangeFeedOptions)~Microsoft.Azure.Cosmos.Linq.IDocumentQuery{Microsoft.Azure.Documents.Document}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentCollectionAsync(System.Uri,Microsoft.Azure.Documents.DocumentCollection,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.DocumentCollection}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentCollectionChangeFeedQuery(System.String,Microsoft.Azure.Cosmos.ChangeFeedOptions)~Microsoft.Azure.Cosmos.Linq.IDocumentQuery{Microsoft.Azure.Documents.DocumentCollection}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentCollectionChangeFeedQuery(System.Uri,Microsoft.Azure.Cosmos.ChangeFeedOptions)~Microsoft.Azure.Cosmos.Linq.IDocumentQuery{Microsoft.Azure.Documents.DocumentCollection}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentCollectionIfNotExistsPrivateAsync(System.String,Microsoft.Azure.Documents.DocumentCollection,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.DocumentCollection}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentCollectionIfNotExistsPrivateAsync(System.Uri,Microsoft.Azure.Documents.DocumentCollection,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.DocumentCollection}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentCollectionPrivateAsync(System.String,Microsoft.Azure.Documents.DocumentCollection,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.DocumentCollection}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentCollectionQuery(System.Uri,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IOrderedQueryable{Microsoft.Azure.Documents.DocumentCollection}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentCollectionQuery(System.Uri,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IQueryable{System.Object}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentCollectionQuery(System.Uri,System.String,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IQueryable{System.Object}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentPrivateAsync(System.String,System.Object,Microsoft.Azure.Documents.Client.RequestOptions,System.Boolean,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Document}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentQuery(System.Uri,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IOrderedQueryable{Microsoft.Azure.Documents.Document}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentQuery(System.Uri,Microsoft.Azure.Cosmos.FeedOptions,System.Object)~System.Linq.IOrderedQueryable{Microsoft.Azure.Documents.Document}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentQuery(System.Uri,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IQueryable{System.Object}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentQuery(System.Uri,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,Microsoft.Azure.Cosmos.FeedOptions,System.Object)~System.Linq.IQueryable{System.Object}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentQuery(System.Uri,System.String,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IQueryable{System.Object}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentQuery(System.Uri,System.String,Microsoft.Azure.Cosmos.FeedOptions,System.Object)~System.Linq.IQueryable{System.Object}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentQuery``1(System.Uri,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IOrderedQueryable{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentQuery``1(System.Uri,Microsoft.Azure.Cosmos.FeedOptions,System.Object)~System.Linq.IOrderedQueryable{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentQuery``1(System.Uri,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IQueryable{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentQuery``1(System.Uri,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,Microsoft.Azure.Cosmos.FeedOptions,System.Object)~System.Linq.IQueryable{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentQuery``1(System.Uri,System.String,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IQueryable{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateDocumentQuery``1(System.Uri,System.String,Microsoft.Azure.Cosmos.FeedOptions,System.Object)~System.Linq.IQueryable{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateSnapshotPrivateAsync(Microsoft.Azure.Documents.Snapshot,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Snapshot}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateStoredProcedureAsync(System.Uri,Microsoft.Azure.Documents.StoredProcedure,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.StoredProcedure}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateStoredProcedurePrivateAsync(System.String,Microsoft.Azure.Documents.StoredProcedure,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.StoredProcedure}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateStoredProcedureQuery(System.Uri,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IOrderedQueryable{Microsoft.Azure.Documents.StoredProcedure}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateStoredProcedureQuery(System.Uri,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IQueryable{System.Object}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateStoredProcedureQuery(System.Uri,System.String,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IQueryable{System.Object}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateTriggerAsync(System.Uri,Microsoft.Azure.Documents.Trigger,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Trigger}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateTriggerPrivateAsync(System.String,Microsoft.Azure.Documents.Trigger,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Trigger}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateTriggerQuery(System.Uri,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IOrderedQueryable{Microsoft.Azure.Documents.Trigger}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateTriggerQuery(System.Uri,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IQueryable{System.Object}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateTriggerQuery(System.Uri,System.String,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IQueryable{System.Object}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateUserDefinedFunctionAsync(System.Uri,Microsoft.Azure.Documents.UserDefinedFunction,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.UserDefinedFunction}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateUserDefinedFunctionPrivateAsync(System.String,Microsoft.Azure.Documents.UserDefinedFunction,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.UserDefinedFunction}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateUserDefinedFunctionQuery(System.Uri,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IOrderedQueryable{Microsoft.Azure.Documents.UserDefinedFunction}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateUserDefinedFunctionQuery(System.Uri,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IQueryable{System.Object}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateUserDefinedFunctionQuery(System.Uri,System.String,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IQueryable{System.Object}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateUserDefinedTypeAsync(System.Uri,Microsoft.Azure.Documents.UserDefinedType,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.UserDefinedType}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateUserDefinedTypeChangeFeedQuery(System.String,Microsoft.Azure.Cosmos.ChangeFeedOptions)~Microsoft.Azure.Cosmos.Linq.IDocumentQuery{Microsoft.Azure.Documents.UserDefinedType}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateUserDefinedTypeChangeFeedQuery(System.Uri,Microsoft.Azure.Cosmos.ChangeFeedOptions)~Microsoft.Azure.Cosmos.Linq.IDocumentQuery{Microsoft.Azure.Documents.UserDefinedType}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateUserDefinedTypePrivateAsync(System.String,Microsoft.Azure.Documents.UserDefinedType,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.UserDefinedType}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateUserDefinedTypeQuery(System.Uri,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IOrderedQueryable{Microsoft.Azure.Documents.UserDefinedType}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateUserDefinedTypeQuery(System.Uri,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IQueryable{System.Object}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.CreateUserDefinedTypeQuery(System.Uri,System.String,Microsoft.Azure.Cosmos.FeedOptions)~System.Linq.IQueryable{System.Object}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.DeleteAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.DocumentServiceResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.DeleteConflictAsync(System.Uri,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Conflict}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.DeleteConflictPrivateAsync(System.String,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Conflict}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.DeleteDatabaseAsync(System.Uri,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Database}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.DeleteDatabasePrivateAsync(System.String,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Database}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.DeleteDocumentAsync(System.Uri,Microsoft.Azure.Documents.Client.RequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Document}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.DeleteDocumentCollectionAsync(System.Uri,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.DocumentCollection}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.DeleteDocumentCollectionPrivateAsync(System.String,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.DocumentCollection}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.DeleteDocumentPrivateAsync(System.String,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Document}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.DeleteSnapshotPrivateAsync(System.String,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Snapshot}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.DeleteStoredProcedureAsync(System.Uri,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.StoredProcedure}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.DeleteStoredProcedurePrivateAsync(System.String,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.StoredProcedure}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.DeleteTriggerAsync(System.Uri,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Trigger}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.DeleteTriggerPrivateAsync(System.String,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Trigger}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.DeleteUserDefinedFunctionAsync(System.Uri,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.UserDefinedFunction}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.DeleteUserDefinedFunctionPrivateAsync(System.String,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.UserDefinedFunction}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.EnsureValidClientAsync(Microsoft.Azure.Cosmos.Tracing.ITrace)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.EnsureValidOverwrite(Microsoft.Azure.Documents.ConsistencyLevel,System.Nullable{Microsoft.Azure.Documents.OperationType},System.Nullable{Microsoft.Azure.Documents.ResourceType})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ExecuteProcedureAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.DocumentServiceResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ExecuteQueryAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.DocumentServiceResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ExecuteStoredProcedureAsync``1(System.Uri,Microsoft.Azure.Documents.Client.RequestOptions,System.Object[])~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.StoredProcedureResponse{``0}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ExecuteStoredProcedureAsync``1(System.Uri,Microsoft.Azure.Documents.Client.RequestOptions,System.Threading.CancellationToken,System.Object[])~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.StoredProcedureResponse{``0}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ExecuteStoredProcedureAsync``1(System.Uri,System.Object[])~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.StoredProcedureResponse{``0}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ExecuteStoredProcedurePrivateAsync``1(System.String,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.Threading.CancellationToken,System.Object[])~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.StoredProcedureResponse{``0}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.GetDocumentCollectionRestoreStatusPrivateAsync(System.String,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentCollectionRestoreStatus}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.GetRequestHeaders(Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Documents.OperationType,Microsoft.Azure.Documents.ResourceType)~Microsoft.Azure.Documents.Collections.INameValueCollection")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.GetSessionToken(System.String)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.Initialize(System.Uri,Microsoft.Azure.Cosmos.ConnectionPolicy,System.Nullable{Microsoft.Azure.Documents.ConsistencyLevel},System.Net.Http.HttpMessageHandler,Microsoft.Azure.Documents.ISessionContainer,System.Nullable{System.Boolean},Microsoft.Azure.Documents.IStoreClientFactory,Azure.Core.TokenCredential,System.String,System.Net.Security.RemoteCertificateValidationCallback,Microsoft.Azure.Cosmos.CosmosClientTelemetryOptions,System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.InitializeCachesAsync(System.String,Microsoft.Azure.Documents.DocumentCollection,System.Threading.CancellationToken)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.OpenConnectionsToAllReplicasAsync(System.String,System.String,System.Threading.CancellationToken)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ProcessRequestAsync(System.String,Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.Threading.CancellationToken,System.String)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.DocumentServiceResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.DocumentServiceResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadConflictAsync(System.Uri,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Conflict}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadConflictFeedAsync(System.Uri,Microsoft.Azure.Cosmos.FeedOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{Microsoft.Azure.Documents.Conflict}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadConflictFeedInlineAsync(System.String,Microsoft.Azure.Cosmos.FeedOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{Microsoft.Azure.Documents.Conflict}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadConflictPrivateAsync(System.String,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Conflict}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadDatabaseAsync(System.Uri,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Database}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadDatabasePrivateAsync(System.String,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Database}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadDocumentAsync(System.Uri,Microsoft.Azure.Documents.Client.RequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Document}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadDocumentAsync``1(System.Uri,Microsoft.Azure.Documents.Client.RequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.DocumentResponse{``0}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadDocumentCollectionAsync(System.Uri,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.DocumentCollection}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadDocumentCollectionFeedAsync(System.Uri,Microsoft.Azure.Cosmos.FeedOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{Microsoft.Azure.Documents.DocumentCollection}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadDocumentCollectionFeedPrivateAsync(System.String,Microsoft.Azure.Cosmos.FeedOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{Microsoft.Azure.Documents.DocumentCollection}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadDocumentCollectionPrivateAsync(System.String,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.DocumentCollection}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadDocumentFeedAsync(System.Uri,Microsoft.Azure.Cosmos.FeedOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{System.Object}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadDocumentFeedInlineAsync(System.String,Microsoft.Azure.Cosmos.FeedOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{System.Object}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadDocumentPrivateAsync(System.String,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Document}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadDocumentPrivateAsync``1(System.String,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.DocumentResponse{``0}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadFeedAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.DocumentServiceResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadOfferPrivateAsync(System.String,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Offer}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadPartitionKeyRangeFeedAsync(System.Uri,Microsoft.Azure.Cosmos.FeedOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{Microsoft.Azure.Documents.PartitionKeyRange}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadPartitionKeyRangeFeedPrivateAsync(System.String,Microsoft.Azure.Cosmos.FeedOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{Microsoft.Azure.Documents.PartitionKeyRange}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadSchemaAsync(System.Uri,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Schema}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadSchemaFeedAsync(System.Uri,Microsoft.Azure.Cosmos.FeedOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{Microsoft.Azure.Documents.Schema}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadSchemaFeedPrivateAsync(System.String,Microsoft.Azure.Cosmos.FeedOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{Microsoft.Azure.Documents.Schema}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadSchemaPrivateAsync(System.String,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Schema}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadSnapshotAsync(System.Uri,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Snapshot}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadSnapshotPrivateAsync(System.String,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Snapshot}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadStoredProcedureAsync(System.String,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.StoredProcedure}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadStoredProcedureAsync(System.Uri,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.StoredProcedure}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadStoredProcedureFeedAsync(System.Uri,Microsoft.Azure.Cosmos.FeedOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{Microsoft.Azure.Documents.StoredProcedure}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadStoredProcedureFeedPrivateAsync(System.String,Microsoft.Azure.Cosmos.FeedOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{Microsoft.Azure.Documents.StoredProcedure}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadTriggerAsync(System.Uri,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Trigger}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadTriggerFeedAsync(System.Uri,Microsoft.Azure.Cosmos.FeedOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{Microsoft.Azure.Documents.Trigger}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadTriggerFeedPrivateAsync(System.String,Microsoft.Azure.Cosmos.FeedOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{Microsoft.Azure.Documents.Trigger}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadTriggerPrivateAsync(System.String,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Trigger}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadUserDefinedFunctionAsync(System.Uri,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.UserDefinedFunction}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadUserDefinedFunctionFeedAsync(System.Uri,Microsoft.Azure.Cosmos.FeedOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{Microsoft.Azure.Documents.UserDefinedFunction}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadUserDefinedFunctionFeedPrivateAsync(System.String,Microsoft.Azure.Cosmos.FeedOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{Microsoft.Azure.Documents.UserDefinedFunction}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadUserDefinedFunctionPrivateAsync(System.String,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.UserDefinedFunction}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadUserDefinedTypeAsync(System.Uri,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.UserDefinedType}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadUserDefinedTypeFeedAsync(System.Uri,Microsoft.Azure.Cosmos.FeedOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{Microsoft.Azure.Documents.UserDefinedType}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadUserDefinedTypeFeedPrivateAsync(System.String,Microsoft.Azure.Cosmos.FeedOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{Microsoft.Azure.Documents.UserDefinedType}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReadUserDefinedTypePrivateAsync(System.String,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.UserDefinedType}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReplaceDocumentAsync(System.Uri,System.Object,Microsoft.Azure.Documents.Client.RequestOptions,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Document}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReplaceDocumentCollectionAsync(System.Uri,Microsoft.Azure.Documents.DocumentCollection,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.DocumentCollection}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReplaceDocumentCollectionPrivateAsync(Microsoft.Azure.Documents.DocumentCollection,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.String)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.DocumentCollection}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReplaceDocumentPrivateAsync(System.String,Microsoft.Azure.Documents.Document,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Document}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReplaceDocumentPrivateAsync(System.String,System.Object,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Document}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReplaceOfferPrivateAsync(Microsoft.Azure.Documents.Offer,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Offer}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReplaceStoredProcedureAsync(System.Uri,Microsoft.Azure.Documents.StoredProcedure,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.StoredProcedure}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReplaceStoredProcedurePrivateAsync(Microsoft.Azure.Documents.StoredProcedure,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.String)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.StoredProcedure}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReplaceTriggerAsync(System.Uri,Microsoft.Azure.Documents.Trigger,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Trigger}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReplaceTriggerPrivateAsync(Microsoft.Azure.Documents.Trigger,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.String)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Trigger}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReplaceUserDefinedFunctionAsync(System.Uri,Microsoft.Azure.Documents.UserDefinedFunction,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.UserDefinedFunction}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReplaceUserDefinedFunctionPrivateAsync(Microsoft.Azure.Documents.UserDefinedFunction,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.String)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.UserDefinedFunction}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReplaceUserDefinedTypeAsync(System.Uri,Microsoft.Azure.Documents.UserDefinedType,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.UserDefinedType}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ReplaceUserDefinedTypePrivateAsync(Microsoft.Azure.Documents.UserDefinedType,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.String)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.UserDefinedType}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.RestoreDocumentCollectionPrivateAsync(System.String,Microsoft.Azure.Documents.DocumentCollection,System.Nullable{System.DateTimeOffset},Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.DocumentCollection}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.UpdateAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.DocumentServiceResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.UpsertAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.DocumentServiceResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.UpsertDatabasePrivateAsync(Microsoft.Azure.Documents.Database,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Database}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.UpsertDocumentAsync(System.Uri,System.Object,Microsoft.Azure.Documents.Client.RequestOptions,System.Boolean,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Document}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.UpsertDocumentCollectionAsync(System.String,Microsoft.Azure.Documents.DocumentCollection,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.DocumentCollection}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.UpsertDocumentPrivateAsync(System.String,System.Object,Microsoft.Azure.Documents.Client.RequestOptions,System.Boolean,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Document}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.UpsertStoredProcedureAsync(System.Uri,Microsoft.Azure.Documents.StoredProcedure,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.StoredProcedure}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.UpsertStoredProcedurePrivateAsync(System.String,Microsoft.Azure.Documents.StoredProcedure,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.StoredProcedure}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.UpsertTriggerAsync(System.Uri,Microsoft.Azure.Documents.Trigger,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Trigger}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.UpsertTriggerPrivateAsync(System.String,Microsoft.Azure.Documents.Trigger,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.Trigger}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.UpsertUserDefinedFunctionAsync(System.Uri,Microsoft.Azure.Documents.UserDefinedFunction,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.UserDefinedFunction}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.UpsertUserDefinedFunctionPrivateAsync(System.String,Microsoft.Azure.Documents.UserDefinedFunction,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.UserDefinedFunction}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.UpsertUserDefinedTypeAsync(System.Uri,Microsoft.Azure.Documents.UserDefinedType,Microsoft.Azure.Documents.Client.RequestOptions)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.UserDefinedType}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.UpsertUserDefinedTypePrivateAsync(System.String,Microsoft.Azure.Documents.UserDefinedType,Microsoft.Azure.Documents.Client.RequestOptions,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Client.ResourceResponse{Microsoft.Azure.Documents.UserDefinedType}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ValidateChangeFeedOptionsForNotPartitionedResource(Microsoft.Azure.Cosmos.ChangeFeedOptions)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClient.ValidateResource(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClientEventSource.Request(System.Guid,System.Guid,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.DocumentClientEventSource.Response(System.Guid,System.Guid,System.Int16,System.Double,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Embedding.ValidateEmbeddingPath")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.EncryptionKeyWrapMetadata.#ctor(System.String,System.String,System.String,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ExecUtils.ProcessResourceOperationAsync``1(Microsoft.Azure.Cosmos.CosmosClient,System.String,Microsoft.Azure.Documents.ResourceType,Microsoft.Azure.Documents.OperationType,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.ContainerInternal,Microsoft.Azure.Cosmos.FeedRange,System.IO.Stream,System.Action{Microsoft.Azure.Cosmos.RequestMessage},System.Func{Microsoft.Azure.Cosmos.ResponseMessage,``0},Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ExecUtils.ProcessResourceOperationAsync``1(Microsoft.Azure.Cosmos.Handlers.RequestInvokerHandler,System.String,Microsoft.Azure.Documents.ResourceType,Microsoft.Azure.Documents.OperationType,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.ContainerInternal,Microsoft.Azure.Cosmos.FeedRange,System.IO.Stream,System.Action{Microsoft.Azure.Cosmos.RequestMessage},System.Func{Microsoft.Azure.Cosmos.ResponseMessage,``0},Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Extensions.Add(Microsoft.Azure.Documents.Collections.INameValueCollection,System.String,System.Collections.Generic.IEnumerable{System.String})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Extensions.ToCosmosResponseMessage(Microsoft.Azure.Documents.DocumentClientException,Microsoft.Azure.Cosmos.RequestMessage)~Microsoft.Azure.Cosmos.ResponseMessage")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedIteratorCore.ReadNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedIteratorCore`1.ReadNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.FeedResponse{`0}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedIteratorInlineCore.#ctor(Microsoft.Azure.Cosmos.FeedIterator,Microsoft.Azure.Cosmos.CosmosClientContext)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedIteratorInlineCore.#ctor(Microsoft.Azure.Cosmos.FeedIteratorInternal,Microsoft.Azure.Cosmos.CosmosClientContext)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedIteratorInlineCore`1.#ctor(Microsoft.Azure.Cosmos.FeedIterator{`0},Microsoft.Azure.Cosmos.CosmosClientContext)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedIteratorInlineCore`1.#ctor(Microsoft.Azure.Cosmos.FeedIteratorInternal{`0},Microsoft.Azure.Cosmos.CosmosClientContext)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedOptions.#ctor(Microsoft.Azure.Cosmos.FeedOptions)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedRange.FromJsonString(System.String)~Microsoft.Azure.Cosmos.FeedRange")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedRangeCompositeContinuation.#ctor(System.String,Microsoft.Azure.Cosmos.FeedRangeInternal,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Routing.CompositeContinuationToken})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedRangeCompositeContinuation.#ctor(System.String,Microsoft.Azure.Cosmos.FeedRangeInternal,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Documents.Routing.Range{System.String}},System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedRangeCompositeContinuation.CreateChildRanges(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Documents.PartitionKeyRange})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedRangeCompositeContinuation.TryGetOverlappingRangesAsync(Microsoft.Azure.Cosmos.Routing.PartitionKeyRangeCache,System.String,System.String,System.Boolean)~System.Threading.Tasks.Task{System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Documents.PartitionKeyRange}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedRangeCompositeContinuationConverter.ReadJson(Newtonsoft.Json.JsonReader,System.Type,System.Object,Newtonsoft.Json.JsonSerializer)~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedRangeCompositeContinuationConverter.WriteJson(Newtonsoft.Json.JsonWriter,System.Object,Newtonsoft.Json.JsonSerializer)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedRangeContinuation.#ctor(System.String,Microsoft.Azure.Cosmos.FeedRangeInternal)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedRangeCosmosElementSerializer.MonadicCreateFromCosmosElement(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.FeedRangeInternal}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedRangeCosmosElementSerializer.ToCosmosElement(Microsoft.Azure.Cosmos.FeedRangeInternal)~Microsoft.Azure.Cosmos.CosmosElements.CosmosElement")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedRangeEpk.#ctor(Microsoft.Azure.Documents.Routing.Range{System.String})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedRangeInternalConverter.ReadJObject(Newtonsoft.Json.Linq.JObject,Newtonsoft.Json.JsonSerializer)~Microsoft.Azure.Cosmos.FeedRangeInternal")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedRangeInternalConverter.ReadJson(Newtonsoft.Json.JsonReader,System.Type,System.Object,Newtonsoft.Json.JsonSerializer)~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedRangeInternalConverter.WriteJObject(Newtonsoft.Json.JsonWriter,System.Object,Newtonsoft.Json.JsonSerializer)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedRangePartitionKeyRange.GetEffectiveRangesAsync(Microsoft.Azure.Cosmos.Routing.IRoutingMapProvider,System.String,Microsoft.Azure.Documents.PartitionKeyDefinition,Microsoft.Azure.Cosmos.Tracing.ITrace)~System.Threading.Tasks.Task{System.Collections.Generic.List{Microsoft.Azure.Documents.Routing.Range{System.String}}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedRangePartitionKeyRangeExtractor.#ctor(Microsoft.Azure.Cosmos.ContainerInternal)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedRangeResponse.CreateFailure(Microsoft.Azure.Cosmos.ResponseMessage)~Microsoft.Azure.Cosmos.ResponseMessage")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FeedRangeResponse.CreateSuccess(Microsoft.Azure.Cosmos.ResponseMessage,Microsoft.Azure.Cosmos.FeedRangeContinuation)~Microsoft.Azure.Cosmos.ResponseMessage")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.ChangeFeedPolicyDefinition.#ctor(Microsoft.Azure.Cosmos.Fluent.ContainerBuilder,System.TimeSpan,System.Action{Microsoft.Azure.Cosmos.ChangeFeedPolicy})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.ClientEncryptionPolicyDefinition.#ctor(Microsoft.Azure.Cosmos.Fluent.ContainerBuilder,System.Action{Microsoft.Azure.Cosmos.ClientEncryptionPolicy},System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.CompositeIndexDefinition`1.Path(System.String)~Microsoft.Azure.Cosmos.Fluent.CompositeIndexDefinition`1")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.CompositeIndexDefinition`1.Path(System.String,Microsoft.Azure.Cosmos.CompositePathSortOrder)~Microsoft.Azure.Cosmos.Fluent.CompositeIndexDefinition`1")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.ConflictResolutionDefinition.WithCustomStoredProcedureResolution(System.String)~Microsoft.Azure.Cosmos.Fluent.ConflictResolutionDefinition")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.ConflictResolutionDefinition.WithLastWriterWinsResolution(System.String)~Microsoft.Azure.Cosmos.Fluent.ConflictResolutionDefinition")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.ContainerBuilder.#ctor(Microsoft.Azure.Cosmos.Database,System.String,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.ContainerDefinition`1.WithComputedProperties~Microsoft.Azure.Cosmos.Fluent.ComputedPropertiesDefinition{`0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.ContainerDefinition`1.WithDefaultTimeToLive(System.Int32)~`0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.ContainerDefinition`1.WithDefaultTimeToLive(System.TimeSpan)~`0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.ContainerDefinition`1.WithIndexingPolicy~Microsoft.Azure.Cosmos.Fluent.IndexingPolicyDefinition{`0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.ContainerDefinition`1.WithTimeToLivePropertyPath(System.String)~`0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder.#ctor(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder.#ctor(System.String,Azure.AzureKeyCredential)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder.#ctor(System.String,Azure.Core.TokenCredential)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder.#ctor(System.String,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder.AddCustomHandlers(Microsoft.Azure.Cosmos.RequestHandler[])~Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder.WithHttpClientFactory(System.Func{System.Net.Http.HttpClient})~Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.FullTextIndexDefinition`1.Path(System.String)~Microsoft.Azure.Cosmos.Fluent.FullTextIndexDefinition`1")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.FullTextPolicyDefinition.#ctor(Microsoft.Azure.Cosmos.Fluent.ContainerBuilder,System.String,System.Collections.ObjectModel.Collection{Microsoft.Azure.Cosmos.FullTextPath},System.Action{Microsoft.Azure.Cosmos.FullTextPolicy})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.SpatialIndexDefinition`1.Path(System.String)~Microsoft.Azure.Cosmos.Fluent.SpatialIndexDefinition`1")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.SpatialIndexDefinition`1.Path(System.String,Microsoft.Azure.Cosmos.SpatialType[])~Microsoft.Azure.Cosmos.Fluent.SpatialIndexDefinition`1")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.UniqueKeyDefinition.Path(System.String)~Microsoft.Azure.Cosmos.Fluent.UniqueKeyDefinition")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.VectorEmbeddingPolicyDefinition.#ctor(Microsoft.Azure.Cosmos.Fluent.ContainerBuilder,System.Collections.ObjectModel.Collection{Microsoft.Azure.Cosmos.Embedding},System.Action{Microsoft.Azure.Cosmos.VectorEmbeddingPolicy})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.VectorIndexDefinition`1.Path(System.String,Microsoft.Azure.Cosmos.VectorIndexType)~Microsoft.Azure.Cosmos.Fluent.VectorIndexDefinition`1")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Fluent.VectorIndexDefinition`1.WithVectorIndexShardKey(System.String[])~Microsoft.Azure.Cosmos.Fluent.VectorIndexDefinition`1")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.FullTextPath.ValidateFullTextPath")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.GatewayAccountReader.#ctor(System.Uri,Microsoft.Azure.Cosmos.AuthorizationTokenProvider,Microsoft.Azure.Cosmos.ConnectionPolicy,Microsoft.Azure.Cosmos.CosmosHttpClient,System.Threading.CancellationToken,System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.GatewayAccountReader.GetDatabaseAccountAsync(System.Uri)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.AccountProperties}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.GatewayStoreClient.ParseResponseAsync(System.Net.Http.HttpResponseMessage,Newtonsoft.Json.JsonSerializerSettings,Microsoft.Azure.Documents.DocumentServiceRequest)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.DocumentServiceResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.GatewayStoreClient.PrepareRequestMessageAsync(Microsoft.Azure.Documents.DocumentServiceRequest,System.Uri)~System.Threading.Tasks.ValueTask{System.Net.Http.HttpRequestMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.GatewayStoreModel.ProcessMessageAsync(Microsoft.Azure.Documents.DocumentServiceRequest,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.DocumentServiceResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.GatewayStoreModel.TryResolveSessionTokenAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.ISessionContainer,Microsoft.Azure.Cosmos.Routing.PartitionKeyRangeCache,Microsoft.Azure.Cosmos.Common.CollectionCache)~System.Threading.Tasks.Task{System.Tuple{System.Boolean,System.String}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Handlers.AbstractRetryHandler.ExecuteHttpRequestAsync(System.Func{System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}},System.Func{Microsoft.Azure.Cosmos.ResponseMessage,System.Threading.CancellationToken,System.Threading.Tasks.Task{Microsoft.Azure.Documents.ShouldRetryResult}},System.Func{System.Exception,System.Threading.CancellationToken,System.Threading.Tasks.Task{Microsoft.Azure.Documents.ShouldRetryResult}},System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Handlers.AbstractRetryHandler.SendAsync(Microsoft.Azure.Cosmos.RequestMessage,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Handlers.PartitionKeyRangeHandler.#ctor(Microsoft.Azure.Cosmos.CosmosClient,Microsoft.Azure.Cosmos.Routing.PartitionRoutingHelper)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Handlers.PartitionKeyRangeHandler.SendAsync(Microsoft.Azure.Cosmos.RequestMessage,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Handlers.RequestInvokerHandler.GetHttpMethod(Microsoft.Azure.Documents.ResourceType,Microsoft.Azure.Documents.OperationType,System.Boolean)~System.Net.Http.HttpMethod")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Handlers.RequestInvokerHandler.SendAsync(Microsoft.Azure.Cosmos.RequestMessage,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Handlers.RequestInvokerHandler.SendAsync(System.String,Microsoft.Azure.Documents.ResourceType,Microsoft.Azure.Documents.OperationType,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.ContainerInternal,Microsoft.Azure.Cosmos.FeedRange,System.IO.Stream,System.Action{Microsoft.Azure.Cosmos.RequestMessage},Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Handlers.RequestInvokerHandler.SendAsync``1(System.String,Microsoft.Azure.Documents.ResourceType,Microsoft.Azure.Documents.OperationType,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.ContainerInternal,Microsoft.Azure.Cosmos.FeedRange,System.IO.Stream,System.Action{Microsoft.Azure.Cosmos.RequestMessage},System.Func{Microsoft.Azure.Cosmos.ResponseMessage,``0},Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Handlers.RequestInvokerHandler.ValidateAndSetConsistencyLevelAsync(Microsoft.Azure.Cosmos.RequestMessage)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Handlers.RequestInvokerHandler.ValidateAndSetThroughputBucket(Microsoft.Azure.Cosmos.RequestMessage)")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Handlers.RetryHandler.#ctor(Microsoft.Azure.Cosmos.CosmosClient)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Handlers.RetryHandler.#ctor(Microsoft.Azure.Cosmos.CosmosClient)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Handlers.RouterHandler.#ctor(Microsoft.Azure.Cosmos.RequestHandler,Microsoft.Azure.Cosmos.RequestHandler)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Handlers.TelemetryHandler.#ctor(Microsoft.Azure.Cosmos.Telemetry.TelemetryToServiceHelper)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Handlers.TransportHandler.#ctor(Microsoft.Azure.Cosmos.CosmosClient)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Handlers.TransportHandler.ProcessMessageAsync(Microsoft.Azure.Cosmos.RequestMessage,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Handlers.TransportHandler.SendAsync(Microsoft.Azure.Cosmos.RequestMessage,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Headers.GetValues(System.String)~System.String[]")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.IndexingDirectiveStrings.FromIndexingDirective(Microsoft.Azure.Cosmos.IndexingDirective)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.IndexingPolicy.IndexEqualityComparer.Equals(Microsoft.Azure.Cosmos.Index,Microsoft.Azure.Cosmos.Index)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.IndexingPolicy.IndexEqualityComparer.GetHashCode(Microsoft.Azure.Cosmos.Index)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.InterlockIncrementCheck.#ctor(System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.InterlockIncrementCheck.EnterLockCheck")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.IRoutingMapProviderExtensions.TryGetOverlappingRangesAsync(Microsoft.Azure.Cosmos.Routing.IRoutingMapProvider,System.String,System.Collections.Generic.IEnumerable{Microsoft.Azure.Documents.Routing.Range{System.String}},Microsoft.Azure.Cosmos.Tracing.ITrace,System.Boolean)~System.Threading.Tasks.Task{System.Collections.Generic.List{Microsoft.Azure.Documents.PartitionKeyRange}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ItemBatchOperation.AttachContext(Microsoft.Azure.Cosmos.ItemBatchOperationContext)")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ItemBatchOperationContext.#ctor(System.String,Microsoft.Azure.Cosmos.Tracing.ITrace,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ItemBatchOperationContext.#ctor(System.String,Microsoft.Azure.Cosmos.Tracing.ITrace,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.Interop.CosmosDBToNewtonsoftReader.#ctor(Microsoft.Azure.Cosmos.Json.IJsonReader)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.Interop.CosmosDBToNewtonsoftReader.Read~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.Interop.CosmosDBToNewtonsoftWriter.WriteComment(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.Interop.CosmosDBToNewtonsoftWriter.WriteEndConstructor")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.Interop.CosmosDBToNewtonsoftWriter.WriteStartConstructor(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.Interop.CosmosDBToNewtonsoftWriter.WriteUndefined")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.Interop.NewtonsoftToCosmosDBReader.#ctor(Newtonsoft.Json.JsonReader)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.Interop.NewtonsoftToCosmosDBReader.CreateFromReader(Newtonsoft.Json.JsonReader)~Microsoft.Azure.Cosmos.Json.Interop.NewtonsoftToCosmosDBReader")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.Interop.NewtonsoftToCosmosDBReader.CreateFromString(System.String)~Microsoft.Azure.Cosmos.Json.Interop.NewtonsoftToCosmosDBReader")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.Interop.NewtonsoftToCosmosDBReader.GetBinaryValue~System.ReadOnlyMemory{System.Byte}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.Interop.NewtonsoftToCosmosDBReader.Read~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.Interop.NewtonsoftToCosmosDBWriter.#ctor(Newtonsoft.Json.JsonWriter,System.Func{System.Byte[]})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.Interop.NewtonsoftToCosmosDBWriter.CreateFromWriter(Newtonsoft.Json.JsonWriter)~Microsoft.Azure.Cosmos.Json.Interop.NewtonsoftToCosmosDBWriter")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.Interop.NewtonsoftToCosmosDBWriter.WriteBinaryValue(System.ReadOnlySpan{System.Byte})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.Decode4BitCharacterStringValue(Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.StringCompressionLookupTables,System.ReadOnlySpan{System.Byte},System.Span{System.Byte})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.DecodeCompressedStringValue(System.Int32,System.ReadOnlySpan{System.Byte},System.Byte,System.Span{System.Byte})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.DecodeString(System.ReadOnlySpan{System.Byte},System.Span{System.Byte},System.Int32@)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.DecodeStringValue(System.Byte,System.ReadOnlySpan{System.Byte},System.Byte,System.Span{System.Byte})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.EncodedStringEqualsTo(System.Byte,System.ReadOnlySpan{System.Byte},System.ReadOnlySpan{System.Byte})~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.EncodeStringValue(System.Byte,System.ReadOnlySpan{System.Byte},System.Byte,System.Span{System.Byte})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.Enumerator.GetArrayItems(System.ReadOnlyMemory{System.Byte},System.Int32,Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.UniformArrayInfo)~System.Collections.Generic.IEnumerable{Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.Enumerator.ArrayItem}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.Enumerator.GetObjectProperties(System.ReadOnlyMemory{System.Byte},System.Int32)~System.Collections.Generic.IEnumerable{Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.Enumerator.ObjectProperty}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.GetBinaryValue(System.ReadOnlyMemory{System.Byte})~System.ReadOnlyMemory{System.Byte}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.GetEncodedStringBaseChar(System.ReadOnlySpan{System.Byte})~System.Byte")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.GetEncodedStringBufferLength(System.ReadOnlySpan{System.Byte})~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.GetEncodedStringValueLength(System.ReadOnlySpan{System.Byte})~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.GetFloat32Value(System.ReadOnlySpan{System.Byte})~System.Single")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.GetFloat64Value(System.ReadOnlySpan{System.Byte})~System.Double")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.GetGuidValue(System.ReadOnlySpan{System.Byte})~System.Guid")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.GetInt16Value(System.ReadOnlySpan{System.Byte})~System.Int16")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.GetInt32Value(System.ReadOnlySpan{System.Byte})~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.GetInt64Value(System.ReadOnlySpan{System.Byte})~System.Int64")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.GetInt8Value(System.ReadOnlySpan{System.Byte})~System.SByte")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.GetNumberValue(System.ReadOnlySpan{System.Byte},Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.UniformArrayInfo)~Microsoft.Azure.Cosmos.Number64")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.GetStringValue(System.ReadOnlyMemory{System.Byte},System.ReadOnlyMemory{System.Byte},Microsoft.Azure.Cosmos.Json.IJsonStringDictionary,System.Span{System.Byte},System.Int32@)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.GetUInt32Value(System.ReadOnlySpan{System.Byte})~System.UInt32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.GetUniformArrayInfo(System.ReadOnlySpan{System.Byte},System.Boolean)~Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.UniformArrayInfo")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.GetUniformArrayItemCount(System.ReadOnlySpan{System.Byte})~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.GetUniformArrayItemSize(System.ReadOnlySpan{System.Byte})~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.GetUtf8MemoryValue(System.ReadOnlyMemory{System.Byte},System.ReadOnlyMemory{System.Byte},Microsoft.Azure.Cosmos.Json.IJsonStringDictionary)~System.ReadOnlyMemory{System.Byte}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.GetValueLength(System.ReadOnlySpan{System.Byte})~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.StringCompressionLookupTables.#ctor(System.Collections.Immutable.ImmutableArray{System.Char},System.Collections.BitArray,System.Collections.Immutable.ImmutableArray{System.Byte},System.Collections.Immutable.ImmutableArray{System.UInt16})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.StringCompressionLookupTables.Create(System.Char[],System.Byte[],System.Byte[],System.UInt16[])~Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.StringCompressionLookupTables")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.TryEncodeString(System.Byte,System.ReadOnlySpan{System.Byte},System.Byte,System.Span{System.Byte},System.Int32@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.TryGetNumberValue(System.ReadOnlySpan{System.Byte},Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.UniformArrayInfo,Microsoft.Azure.Cosmos.Number64@,System.Int32@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.UInt24.op_Explicit(System.Int32)~Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.UInt24")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.ValueLengths.GetValueLength(System.ReadOnlySpan{System.Byte})~System.Int64")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonMemoryWriter.Resize(System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.Create(System.ReadOnlyMemory{System.Byte},Microsoft.Azure.Cosmos.Json.IJsonStringDictionary)~Microsoft.Azure.Cosmos.Json.IJsonNavigator")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonBinaryNavigator.#ctor(System.ReadOnlyMemory{System.Byte},Microsoft.Azure.Cosmos.Json.IJsonStringDictionary)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonBinaryNavigator.CreateReader(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~Microsoft.Azure.Cosmos.Json.IJsonReader")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonBinaryNavigator.GetArrayItemAt(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode,System.Int32)~Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonBinaryNavigator.GetArrayItemCount(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonBinaryNavigator.GetBinaryValue(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~System.ReadOnlyMemory{System.Byte}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonBinaryNavigator.GetNodeOfType(Microsoft.Azure.Cosmos.Json.JsonNodeType,Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonBinaryNavigator.BinaryNavigatorNode")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonBinaryNavigator.GetNodeType(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~Microsoft.Azure.Cosmos.Json.JsonNodeType")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonBinaryNavigator.GetNodeType(System.Int32,Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.UniformArrayInfo)~Microsoft.Azure.Cosmos.Json.JsonNodeType")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonBinaryNavigator.GetObjectPropertyCount(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonBinaryNavigator.WriteNode(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode,Microsoft.Azure.Cosmos.Json.IJsonWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonBinaryNavigator.WriteToInternal(Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonBinaryNavigator.BinaryNavigatorNode,Microsoft.Azure.Cosmos.Json.IJsonWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.#ctor(System.ReadOnlyMemory{System.Byte})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.CreateReader(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~Microsoft.Azure.Cosmos.Json.IJsonReader")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.GetArrayItemAt(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode,System.Int32)~Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.GetArrayItemCount(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.GetArrayItems(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~System.Collections.Generic.IEnumerable{Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.GetBinaryValue(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~System.ReadOnlyMemory{System.Byte}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.GetFloat32Value(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~System.Single")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.GetFloat64Value(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~System.Double")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.GetGuidValue(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~System.Guid")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.GetInt16Value(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~System.Int16")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.GetInt32Value(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.GetInt64Value(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~System.Int64")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.GetInt8Value(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~System.SByte")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.GetNodeBuffer(Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.JsonTextNavigatorNode)~System.ReadOnlyMemory{System.Byte}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.GetNodeType(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~Microsoft.Azure.Cosmos.Json.JsonNodeType")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.GetNumberValue(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~Microsoft.Azure.Cosmos.Number64")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.GetObjectProperties(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~System.Collections.Generic.IEnumerable{Microsoft.Azure.Cosmos.Json.ObjectProperty}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.GetObjectPropertyCount(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.GetStringValue(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~Microsoft.Azure.Cosmos.Core.Utf8.UtfAnyString")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.GetUInt32Value(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode)~System.UInt32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.Parser.Parse(Microsoft.Azure.Cosmos.Json.IJsonTextReaderPrivateImplementation)~Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.JsonTextNavigatorNode")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.Parser.ParseArrayNode(Microsoft.Azure.Cosmos.Json.IJsonTextReaderPrivateImplementation)~Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.ArrayNode")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.Parser.ParseFloatNode(Microsoft.Azure.Cosmos.Json.IJsonTextReaderPrivateImplementation,Microsoft.Azure.Cosmos.Json.JsonTokenType)~Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.FloatNode")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.Parser.ParseIntegerNode(Microsoft.Azure.Cosmos.Json.IJsonTextReaderPrivateImplementation,Microsoft.Azure.Cosmos.Json.JsonTokenType)~Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.IntegerNode")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.Parser.ParseNode(Microsoft.Azure.Cosmos.Json.IJsonTextReaderPrivateImplementation)~Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.JsonTextNavigatorNode")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.Parser.ParseObjectNode(Microsoft.Azure.Cosmos.Json.IJsonTextReaderPrivateImplementation)~Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.ObjectNode")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.TryGetBufferedStringValue(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode,Microsoft.Azure.Cosmos.Json.Utf8Memory@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.TryGetObjectProperty(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode,System.String,Microsoft.Azure.Cosmos.Json.ObjectProperty@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.TryGetUInt64Value(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode,System.UInt64@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.JsonTextNavigator.WriteNode(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode,Microsoft.Azure.Cosmos.Json.IJsonWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonNavigator.WriteNode(Microsoft.Azure.Cosmos.Json.IJsonNavigatorNode,Microsoft.Azure.Cosmos.Json.IJsonWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonObjectState.Push(System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonObjectState.RegisterEndArray")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonObjectState.RegisterEndObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonObjectState.RegisterFieldName")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonObjectState.RegisterToken(Microsoft.Azure.Cosmos.Json.JsonTokenType)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonObjectState.RegisterValue(Microsoft.Azure.Cosmos.Json.JsonTokenType)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.Create(Microsoft.Azure.Cosmos.Json.JsonSerializationFormat,System.ReadOnlyMemory{System.Byte},Microsoft.Azure.Cosmos.Json.IJsonStringDictionary)~Microsoft.Azure.Cosmos.Json.IJsonReader")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.Create(System.ReadOnlyMemory{System.Byte},Microsoft.Azure.Cosmos.Json.IJsonStringDictionary)~Microsoft.Azure.Cosmos.Json.IJsonReader")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonBinaryReader.#ctor(System.ReadOnlyMemory{System.Byte},System.Nullable{System.Int32},Microsoft.Azure.Cosmos.Json.IJsonStringDictionary)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonBinaryReader.ArrayAndObjectEndStack.Push(System.Int32,Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.UniformArrayInfo)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonBinaryReader.ArrayAndObjectEndStack.PushNestedArray(System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonBinaryReader.GetArrayOrObjectPrefixLength(System.Byte)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonBinaryReader.GetBinaryValue~System.ReadOnlyMemory{System.Byte}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonBinaryReader.GetFloat32Value~System.Single")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonBinaryReader.GetFloat64Value~System.Double")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonBinaryReader.GetGuidValue~System.Guid")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonBinaryReader.GetInt16Value~System.Int16")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonBinaryReader.GetInt32Value~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonBinaryReader.GetInt64Value~System.Int64")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonBinaryReader.GetInt8Value~System.SByte")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonBinaryReader.GetJsonTokenType(System.Byte,Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.UniformArrayInfo)~Microsoft.Azure.Cosmos.Json.JsonTokenType")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonBinaryReader.GetNumberValue~Microsoft.Azure.Cosmos.Number64")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonBinaryReader.GetStringValue~Microsoft.Azure.Cosmos.Core.Utf8.UtfAnyString")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonBinaryReader.GetUInt32Value~System.UInt32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonBinaryReader.GetUtf8SpanValue~Microsoft.Azure.Cosmos.Core.Utf8.Utf8Span")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonBinaryReader.Read~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonBinaryReader.TryGetBufferedStringValue(Microsoft.Azure.Cosmos.Json.Utf8Memory@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonBinaryReader.TryGetUInt64NumberValue(System.UInt64@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonTextReader.ProcessBinary")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonTextReader.ProcessFalse")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonTextReader.ProcessFloat32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonTextReader.ProcessFloat64")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonTextReader.ProcessGuid")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonTextReader.ProcessInt16")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonTextReader.ProcessInt32OrInt64")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonTextReader.ProcessInt8")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonTextReader.ProcessIntegerToken(Microsoft.Azure.Cosmos.Json.JsonReader.JsonTextReader.JsonTextTokenType)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonTextReader.ProcessNameSeparator")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonTextReader.ProcessNull")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonTextReader.ProcessNumberValueToken")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonTextReader.ProcessString")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonTextReader.ProcessTrue")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonTextReader.ProcessUInt32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonTextReader.ProcessValueSeparator")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonTextReader.Read~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.JsonTextReader.RegisterToken")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonReader.WriteCurrentToken(Microsoft.Azure.Cosmos.Json.IJsonWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonSerializationFormatExtensions.ToContentSerializationFormatString(Microsoft.Azure.Cosmos.Json.JsonSerializationFormat)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonSerializer.DeserializationVisitor.Visit(Microsoft.Azure.Cosmos.CosmosElements.CosmosArray,System.Type)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{System.Object}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonSerializer.DeserializationVisitor.Visit(Microsoft.Azure.Cosmos.CosmosElements.CosmosNumber,System.Type)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{System.Object}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonSerializer.Monadic.Deserialize``1(System.ReadOnlyMemory{System.Byte})~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonSerializer.ReadOnlyListWrapper`1.#ctor(System.Collections.Generic.IList{`0})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonSerializer.SerializeInternal(System.Object,Microsoft.Azure.Cosmos.Json.IJsonWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonStringDictionary.#ctor(System.Collections.Generic.IReadOnlyList{System.String})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonTextParser.GetDoubleValue(System.ReadOnlySpan{System.Byte})~System.Double")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonTextParser.GetFloat32Value(System.ReadOnlySpan{System.Byte})~System.Single")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonTextParser.GetFloat64Value(System.ReadOnlySpan{System.Byte})~System.Double")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonTextParser.GetFloatValue(System.ReadOnlySpan{System.Byte})~System.Single")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonTextParser.GetGuidValue(System.ReadOnlySpan{System.Byte})~System.Guid")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonTextParser.GetInt16Value(System.ReadOnlySpan{System.Byte})~System.Int16")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonTextParser.GetInt32Value(System.ReadOnlySpan{System.Byte})~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonTextParser.GetInt64Value(System.ReadOnlySpan{System.Byte})~System.Int64")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonTextParser.GetInt8Value(System.ReadOnlySpan{System.Byte})~System.SByte")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonTextParser.GetIntegerValue(System.ReadOnlySpan{System.Byte})~System.Int64")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonTextParser.GetNumberValue(System.ReadOnlySpan{System.Byte})~Microsoft.Azure.Cosmos.Number64")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonTextParser.GetUInt32Value(System.ReadOnlySpan{System.Byte})~System.UInt32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonTextParser.UnescapeJson(Microsoft.Azure.Cosmos.Json.Utf8Memory,System.Boolean)~Microsoft.Azure.Cosmos.Core.Utf8.Utf8String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonWriter.Create(Microsoft.Azure.Cosmos.Json.JsonSerializationFormat,Microsoft.Azure.Cosmos.Json.JsonWriteOptions,System.Int32,Microsoft.Azure.Cosmos.Json.IJsonStringDictionary)~Microsoft.Azure.Cosmos.Json.IJsonWriter")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonWriter.JsonBinaryWriter.FixReferenceStringOffsets(System.Span{System.Byte})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonWriter.JsonBinaryWriter.ForceRewriteRawJsonValue(System.ReadOnlyMemory{System.Byte},System.Int32,Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.UniformArrayInfo,System.Boolean,Microsoft.Azure.Cosmos.Json.IJsonStringDictionary)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonWriter.JsonBinaryWriter.GetResult~System.ReadOnlyMemory{System.Byte}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonWriter.JsonBinaryWriter.TryWriteUniformArrayOfNumberArrays(Microsoft.Azure.Cosmos.Json.JsonWriter.JsonBinaryWriter.JsonBinaryMemoryWriter,System.Int32,System.Int32,System.Int32)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonWriter.JsonBinaryWriter.TryWriteUniformNumberArray(Microsoft.Azure.Cosmos.Json.JsonWriter.JsonBinaryWriter.JsonBinaryMemoryWriter,System.Int32,System.Int32,System.Int32)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonWriter.JsonBinaryWriter.WriteBinaryValue(System.ReadOnlySpan{System.Byte})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonWriter.JsonBinaryWriter.WriteFieldNameOrString(System.Boolean,Microsoft.Azure.Cosmos.Core.Utf8.Utf8Span)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonWriter.JsonBinaryWriter.WriteRawNumberArray(System.ReadOnlySpan{System.Byte},Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.UniformArrayInfo)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonWriter.JsonBinaryWriter.WriteRawNumberArrayArray(System.ReadOnlySpan{System.Byte},Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.UniformArrayInfo)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonWriter.JsonBinaryWriter.WriteRawStringValue(Microsoft.Azure.Cosmos.Json.JsonWriter.JsonBinaryWriter.RawValueType,System.ReadOnlyMemory{System.Byte},System.Boolean,Microsoft.Azure.Cosmos.Json.IJsonStringDictionary)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonWriter.JsonBinaryWriter.WriteRawUniformArrayItem(System.ReadOnlySpan{System.Byte},Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding.UniformArrayInfo)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonWriter.JsonTextWriter.JsonTextMemoryWriter.Write(System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonWriter.JsonTextWriter.JsonTextMemoryWriter.Write(System.Guid)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonWriter.JsonTextWriter.JsonTextMemoryWriter.Write(System.Int16)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonWriter.JsonTextWriter.JsonTextMemoryWriter.Write(System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonWriter.JsonTextWriter.JsonTextMemoryWriter.Write(System.Int64)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonWriter.JsonTextWriter.JsonTextMemoryWriter.Write(System.SByte)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonWriter.JsonTextWriter.JsonTextMemoryWriter.Write(System.UInt32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.JsonWriter.JsonTextWriter.JsonTextMemoryWriter.Write(System.UInt64)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.Utf8Memory.Create(System.ReadOnlyMemory{System.Byte})~Microsoft.Azure.Cosmos.Json.Utf8Memory")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Json.UtfAllString.Create(System.String)~Microsoft.Azure.Cosmos.Json.UtfAllString")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ArrayBuiltinFunctions.Visit(System.Linq.Expressions.MethodCallExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.BuiltinFunctionVisitor.Visit(System.Linq.Expressions.MethodCallExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.BuiltinFunctionVisitor.VisitBuiltinFunctionCall(System.Linq.Expressions.MethodCallExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ChangeFeedQuery`1.#ctor(Microsoft.Azure.Cosmos.DocumentClient,Microsoft.Azure.Documents.ResourceType,System.String,Microsoft.Azure.Cosmos.ChangeFeedOptions)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ChangeFeedQuery`1.GetFeedResponseAsync(System.String,Microsoft.Azure.Documents.ResourceType,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.DocumentServiceResponse}")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.Collection.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlCollection)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.Collection.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlCollection)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ConstantFolding.Fold(System.Linq.Expressions.Expression)~System.Linq.Expressions.Expression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ConstantFolding.FoldBinding(System.Linq.Expressions.MemberBinding)~System.Linq.Expressions.MemberBinding")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosElementToSqlScalarExpressionVisitor.Visit(Microsoft.Azure.Cosmos.CosmosElements.CosmosBinary)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosElementToSqlScalarExpressionVisitor.Visit(Microsoft.Azure.Cosmos.CosmosElements.CosmosGuid)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosElementToSqlScalarExpressionVisitor.Visit(Microsoft.Azure.Cosmos.CosmosElements.CosmosNumber)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinq.InvokeUserDefinedFunction(System.String,System.Object[])~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.DocumentId(System.Object)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.FullTextContains(System.Object,System.String)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.FullTextContainsAll(System.Object,System.String[])~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.FullTextContainsAny(System.Object,System.String[])~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.FullTextScore``1(``0,System.String[])~System.Double")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.IsArray(System.Object)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.IsBool(System.Object)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.IsDefined(System.Object)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.IsNull(System.Object)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.IsNumber(System.Object)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.IsObject(System.Object)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.IsPrimitive(System.Object)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.IsString(System.Object)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.OrderByRank``2(System.Linq.IQueryable{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}})~System.Linq.IOrderedQueryable{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.RegexMatch(System.Object,System.String)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.RegexMatch(System.Object,System.String,System.String)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.RRF(System.Double[])~System.Double")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.ToFeedIterator``1(System.Linq.IQueryable{``0})~Microsoft.Azure.Cosmos.FeedIterator{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.ToQueryDefinition``1(System.Linq.IQueryable{``0})~Microsoft.Azure.Cosmos.QueryDefinition")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.ToQueryDefinition``1(System.Linq.IQueryable{``0},System.Collections.Generic.IDictionary{System.Object,System.String})~Microsoft.Azure.Cosmos.QueryDefinition")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.ToStreamIterator``1(System.Linq.IQueryable{``0})~Microsoft.Azure.Cosmos.FeedIterator")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.VectorDistance(System.Byte[],System.Byte[],System.Boolean,Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.VectorDistanceOptions)~System.Double")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.VectorDistance(System.SByte[],System.SByte[],System.Boolean,Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.VectorDistanceOptions)~System.Double")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.VectorDistance(System.Single[],System.Single[],System.Boolean,Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions.VectorDistanceOptions)~System.Double")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqQuery`1.#ctor(Microsoft.Azure.Cosmos.ContainerInternal,Microsoft.Azure.Cosmos.CosmosResponseFactoryInternal,Microsoft.Azure.Cosmos.CosmosQueryClientCore,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions,System.Linq.Expressions.Expression,System.Boolean,Microsoft.Azure.Cosmos.Serializer.CosmosLinqSerializerOptionsInternal)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqQuery`1.ExecuteScalar~`0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqQuery`1.GetEnumerator~System.Collections.Generic.IEnumerator{`0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqQuery`1.Microsoft#Azure#Cosmos#Linq#IDocumentQuery#ExecuteNextAsync(System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{System.Object}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.CosmosLinqQuery`1.Microsoft#Azure#Cosmos#Linq#IDocumentQuery#ExecuteNextAsync``1(System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{``0}}")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.DocumentQuery`1.#ctor(Microsoft.Azure.Cosmos.Query.IDocumentQueryClient,Microsoft.Azure.Documents.ResourceType,System.Type,System.String,System.Linq.Expressions.Expression,Microsoft.Azure.Cosmos.FeedOptions,System.Object)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.DocumentQuery`1.#ctor(Microsoft.Azure.Cosmos.Query.IDocumentQueryClient,Microsoft.Azure.Documents.ResourceType,System.Type,System.String,System.Linq.Expressions.Expression,Microsoft.Azure.Cosmos.FeedOptions,System.Object)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.DocumentQueryable.AsSQL``1(System.Linq.IOrderedQueryable{``0},Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec)~System.Linq.IQueryable{System.Object}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.DocumentQueryable.AsSQL``2(System.Linq.IOrderedQueryable{``0},Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec)~System.Linq.IQueryable{``1}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.DocumentQueryEvaluator.Evaluate(System.Linq.Expressions.Expression,Microsoft.Azure.Cosmos.Serializer.CosmosLinqSerializerOptionsInternal,System.Collections.Generic.IDictionary{System.Object,System.String})~Microsoft.Azure.Cosmos.Linq.LinqQueryOperation")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.DocumentQueryEvaluator.GetSqlQuerySpec(System.Object)~Microsoft.Azure.Cosmos.Linq.LinqQueryOperation")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.DocumentQueryEvaluator.HandleEmptyQuery(System.Linq.Expressions.ConstantExpression)~Microsoft.Azure.Cosmos.Linq.LinqQueryOperation")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.DocumentQueryEvaluator.HandleMethodCallExpression(System.Linq.Expressions.MethodCallExpression,System.Collections.Generic.IDictionary{System.Object,System.String},Microsoft.Azure.Cosmos.Serializer.CosmosLinqSerializerOptionsInternal)~Microsoft.Azure.Cosmos.Linq.LinqQueryOperation")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.ConvertMemberIndexerToPath(Microsoft.Azure.Cosmos.SqlObjects.SqlMemberIndexerScalarExpression)~Microsoft.Azure.Cosmos.SqlObjects.SqlInputPathCollection")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.ConvertPropertyRefToPath(Microsoft.Azure.Cosmos.SqlObjects.SqlPropertyRefScalarExpression)~Microsoft.Azure.Cosmos.SqlObjects.SqlInputPathCollection")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.ConvertToCollection(Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression)~Microsoft.Azure.Cosmos.Linq.Collection")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.CreateInitializers(System.Collections.ObjectModel.ReadOnlyCollection{System.Linq.Expressions.Expression},System.Collections.ObjectModel.ReadOnlyCollection{System.Reflection.MemberInfo},Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObjectProperty[]")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.CreateSelectItems(System.Collections.ObjectModel.ReadOnlyCollection{System.Linq.Expressions.Expression},System.Collections.ObjectModel.ReadOnlyCollection{System.Reflection.MemberInfo},Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlSelectItem[]")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.CreateSubquerySqlCollection(Microsoft.Azure.Cosmos.SqlObjects.SqlQuery,Microsoft.Azure.Cosmos.Linq.ExpressionToSql.SubqueryKind)~Microsoft.Azure.Cosmos.SqlObjects.SqlCollection")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.GetBinaryOperatorKind(System.Linq.Expressions.ExpressionType,System.Type)~Microsoft.Azure.Cosmos.SqlObjects.SqlBinaryScalarOperatorKind")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.GetUnaryOperatorKind(System.Linq.Expressions.ExpressionType)~Microsoft.Azure.Cosmos.SqlObjects.SqlUnaryScalarOperatorKind")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.ReverseExpressionTypeForStrings(System.Linq.Expressions.ExpressionType,System.String)~System.Linq.Expressions.ExpressionType")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.Translate(System.Linq.Expressions.Expression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.Linq.Collection")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.TranslateInput(System.Linq.Expressions.ConstantExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.Linq.Collection")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.TryMatchStringCompare(System.Linq.Expressions.MethodCallExpression,System.Linq.Expressions.ConstantExpression,System.Linq.Expressions.ExpressionType)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.TryMatchStringCompareTo(System.Linq.Expressions.MethodCallExpression,System.Linq.Expressions.ConstantExpression,System.Linq.Expressions.ExpressionType)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitAggregateFunction(System.Collections.ObjectModel.ReadOnlyCollection{System.Linq.Expressions.Expression},Microsoft.Azure.Cosmos.Linq.TranslationContext,System.String)~Microsoft.Azure.Cosmos.SqlObjects.SqlSelectClause")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitCollectionExpression(System.Linq.Expressions.Expression,Microsoft.Azure.Cosmos.Linq.TranslationContext,System.String)~Microsoft.Azure.Cosmos.Linq.Collection")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitCollectionLambda(System.Linq.Expressions.LambdaExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.Linq.Collection")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitCount(System.Collections.ObjectModel.ReadOnlyCollection{System.Linq.Expressions.Expression},Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlSelectClause")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitDistinct(System.Collections.ObjectModel.ReadOnlyCollection{System.Linq.Expressions.Expression},Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlSelectClause")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitGroupBy(System.Type,System.Collections.ObjectModel.ReadOnlyCollection{System.Linq.Expressions.Expression},Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.Linq.Collection")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitGroupByAggregateMethodCall(System.Linq.Expressions.MethodCallExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlSelectClause")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitInvocation(System.Linq.Expressions.InvocationExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitListInit(System.Linq.Expressions.ListInitExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitMemberListBinding(System.Linq.Expressions.MemberListBinding,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObjectProperty")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitMemberMemberBinding(System.Linq.Expressions.MemberMemberBinding,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObjectProperty")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitMethodCall(System.Linq.Expressions.MethodCallExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.Linq.Collection")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitMethodCallScalar(System.Linq.Expressions.MethodCallExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitNew(System.Linq.Expressions.NewExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitNewArray(System.Linq.Expressions.NewArrayExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitNonSubqueryScalarExpression(System.Linq.Expressions.Expression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitNonSubqueryScalarLambda(System.Linq.Expressions.LambdaExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitOrderBy(System.Collections.ObjectModel.ReadOnlyCollection{System.Linq.Expressions.Expression},System.Boolean,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlOrderByClause")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitOrderByRank(System.Collections.ObjectModel.ReadOnlyCollection{System.Linq.Expressions.Expression},Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlOrderByClause")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitSelect(System.Collections.ObjectModel.ReadOnlyCollection{System.Linq.Expressions.Expression},Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlSelectClause")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitSelectMany(System.Collections.ObjectModel.ReadOnlyCollection{System.Linq.Expressions.Expression},Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.Linq.Collection")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitSkip(System.Collections.ObjectModel.ReadOnlyCollection{System.Linq.Expressions.Expression},Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlOffsetSpec")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitTakeLimit(System.Collections.ObjectModel.ReadOnlyCollection{System.Linq.Expressions.Expression},Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlLimitSpec")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitTakeTop(System.Collections.ObjectModel.ReadOnlyCollection{System.Linq.Expressions.Expression},Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlTopSpec")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitTypeIs(System.Linq.Expressions.TypeBinaryExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ExpressionToSql.VisitWhere(System.Collections.ObjectModel.ReadOnlyCollection{System.Linq.Expressions.Expression},Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlWhereClause")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.FromParameterBindings.Binding.#ctor(System.Linq.Expressions.ParameterExpression,Microsoft.Azure.Cosmos.SqlObjects.SqlCollection,System.Boolean,System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.FromParameterBindings.SetInputParameter(System.Type,System.String,System.Collections.Generic.HashSet{System.Linq.Expressions.ParameterExpression})~System.Linq.Expressions.ParameterExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.GeometrySqlExpressionFactory.Construct(System.Linq.Expressions.Expression)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.GeometrySqlExpressionFactory.FromJToken(Newtonsoft.Json.Linq.JToken)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.MathBuiltinFunctions.Visit(System.Linq.Expressions.MethodCallExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.OtherBuiltinSystemFunctions.RRFVisit.VisitImplicit(System.Linq.Expressions.MethodCallExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.OtherBuiltinSystemFunctions.VectorDistanceVisit.VisitImplicit(System.Linq.Expressions.MethodCallExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.OtherBuiltinSystemFunctions.Visit(System.Linq.Expressions.MethodCallExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.ParameterSubstitution.AddSubstitution(System.Linq.Expressions.ParameterExpression,System.Linq.Expressions.Expression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.QueryUnderConstruction.AddSelectClause(Microsoft.Azure.Cosmos.SqlObjects.SqlSelectClause)~Microsoft.Azure.Cosmos.Linq.QueryUnderConstruction")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.QueryUnderConstruction.AddSelectClause(Microsoft.Azure.Cosmos.SqlObjects.SqlSelectClause,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.Linq.QueryUnderConstruction")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.QueryUnderConstruction.GetLimitCount(Microsoft.Azure.Cosmos.SqlObjects.SqlLimitSpec)~System.Int64")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.QueryUnderConstruction.GetOffsetCount(Microsoft.Azure.Cosmos.SqlObjects.SqlOffsetSpec)~System.Int64")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.QueryUnderConstruction.GetTopCount(Microsoft.Azure.Cosmos.SqlObjects.SqlTopSpec)~System.Int64")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.QueryUnderConstruction.Substitute(Microsoft.Azure.Cosmos.SqlObjects.SqlSelectClause,Microsoft.Azure.Cosmos.SqlObjects.SqlTopSpec,Microsoft.Azure.Cosmos.SqlObjects.SqlIdentifier,Microsoft.Azure.Cosmos.SqlObjects.SqlSelectClause)~Microsoft.Azure.Cosmos.SqlObjects.SqlSelectClause")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.QueryUnderConstruction.Substitute(Microsoft.Azure.Cosmos.SqlObjects.SqlSelectSpec,Microsoft.Azure.Cosmos.SqlObjects.SqlIdentifier,Microsoft.Azure.Cosmos.SqlObjects.SqlGroupByClause)~Microsoft.Azure.Cosmos.SqlObjects.SqlGroupByClause")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.QueryUnderConstruction.Substitute(Microsoft.Azure.Cosmos.SqlObjects.SqlSelectSpec,Microsoft.Azure.Cosmos.SqlObjects.SqlIdentifier,Microsoft.Azure.Cosmos.SqlObjects.SqlOrderByClause)~Microsoft.Azure.Cosmos.SqlObjects.SqlOrderByClause")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.QueryUnderConstruction.Substitute(Microsoft.Azure.Cosmos.SqlObjects.SqlSelectSpec,Microsoft.Azure.Cosmos.SqlObjects.SqlIdentifier,Microsoft.Azure.Cosmos.SqlObjects.SqlWhereClause)~Microsoft.Azure.Cosmos.SqlObjects.SqlWhereClause")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.SpatialBuiltinFunctions.Visit(System.Linq.Expressions.MethodCallExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.SqlExpressionManipulation.Substitute(Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression,Microsoft.Azure.Cosmos.SqlObjects.SqlIdentifier,Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.StringBuiltinFunctions.SqlStringWithComparisonVisitor.#ctor(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.StringBuiltinFunctions.Visit(System.Linq.Expressions.MethodCallExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.TranslationContext.PopSubqueryBinding~Microsoft.Azure.Cosmos.Linq.TranslationContext.SubqueryBinding")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.TranslationContext.PushCollection(Microsoft.Azure.Cosmos.Linq.Collection)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.TranslationContext.PushMethod(System.Linq.Expressions.MethodCallExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.TypeCheckFunctions.Visit(System.Linq.Expressions.MethodCallExpression,Microsoft.Azure.Cosmos.Linq.TranslationContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Linq.Utilities.GetLambda(System.Linq.Expressions.Expression)~System.Linq.Expressions.LambdaExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.MurmurHash3.Hash128(System.ReadOnlySpan{System.Byte},Microsoft.Azure.Cosmos.UInt128)~Microsoft.Azure.Cosmos.UInt128")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.MurmurHash3.Hash128(System.String,Microsoft.Azure.Cosmos.UInt128)~Microsoft.Azure.Cosmos.UInt128")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.MurmurHash3.Hash32(System.ReadOnlySpan{System.Byte},System.UInt32)~System.UInt32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.MurmurHash3.Hash32(System.String,System.UInt32)~System.UInt32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.MurmurHash3.RotateLeft32(System.UInt32,System.Int32)~System.UInt32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.MurmurHash3.RotateLeft64(System.UInt64,System.Int32)~System.UInt64")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.NameValueResponseHeaders.#ctor(Microsoft.Azure.Documents.Collections.INameValueCollection)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Number64.CompareTo(System.Object)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.OfferContentProperties.#ctor(Microsoft.Azure.Cosmos.OfferAutoscaleProperties)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.BufferedPartitionRangePageAsyncEnumerator`2.#ctor(Microsoft.Azure.Cosmos.Pagination.PartitionRangePageAsyncEnumerator{`0,`1})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.BufferedPartitionRangePageAsyncEnumerator`2.GetNextPageAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{`0}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.BufferedPartitionRangePageAsyncEnumerator`2.PrefetchAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.CrossFeedRangeState`1.#ctor(System.ReadOnlyMemory{Microsoft.Azure.Cosmos.Pagination.FeedRangeState{`0}})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.CrossFeedRangeStateSplitterAndMerger.Merge``1(System.Collections.Generic.IReadOnlyList{System.ReadOnlyMemory{Microsoft.Azure.Cosmos.Pagination.FeedRangeState{``0}}})~System.Memory{Microsoft.Azure.Cosmos.Pagination.FeedRangeState{``0}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.CrossPartitionRangePageAsyncEnumerator`2.#ctor(Microsoft.Azure.Cosmos.Pagination.IFeedRangeProvider,Microsoft.Azure.Cosmos.Pagination.CreatePartitionRangePageAsyncEnumerator{`0,`1},System.Collections.Generic.IComparer{Microsoft.Azure.Cosmos.Pagination.PartitionRangePageAsyncEnumerator{`0,`1}},System.Nullable{System.Int32},Microsoft.Azure.Cosmos.Pagination.PrefetchPolicy,Microsoft.Azure.Cosmos.Pagination.CrossFeedRangeState{`1})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.CrossPartitionRangePageAsyncEnumerator`2.CreateBufferedEnumerators(Microsoft.Azure.Cosmos.Pagination.PrefetchPolicy,Microsoft.Azure.Cosmos.Pagination.CreatePartitionRangePageAsyncEnumerator{`0,`1},System.ReadOnlyMemory{Microsoft.Azure.Cosmos.Pagination.FeedRangeState{`1}},System.Threading.CancellationToken)~System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Pagination.BufferedPartitionRangePageAsyncEnumeratorBase{`0,`1}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.CrossPartitionRangePageAsyncEnumerator`2.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.CrossPartitionRangePageAsyncEnumerator`2.PriorityQueueWrapper`1.#ctor(Microsoft.Azure.Cosmos.Query.Core.Collections.PriorityQueue{`2})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.CrossPartitionRangePageAsyncEnumerator`2.QueueWrapper`1.#ctor(System.Collections.Generic.Queue{`2})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.DocumentContainer.#ctor(Microsoft.Azure.Cosmos.Pagination.IMonadicDocumentContainer)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.ExecutionOptions.#ctor(System.Nullable{System.Int32},System.Collections.Generic.IReadOnlyDictionary{System.String,System.String})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.FeedRangeState`1.#ctor(Microsoft.Azure.Cosmos.FeedRangeInternal,`0)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.FullyBufferedPartitionRangeAsyncEnumerator`2.#ctor(Microsoft.Azure.Cosmos.Pagination.PartitionRangePageAsyncEnumerator{`0,`1},System.Collections.Generic.IReadOnlyList{`0})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.FullyBufferedPartitionRangeAsyncEnumerator`2.PrefetchAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.NetworkAttachedDocumentContainer.#ctor(Microsoft.Azure.Cosmos.ContainerInternal,Microsoft.Azure.Cosmos.Query.Core.QueryClient.CosmosQueryClient,Microsoft.Azure.Cosmos.Query.Core.QueryClient.ICosmosDistributedQueryClient,System.Guid,Microsoft.Azure.Cosmos.QueryRequestOptions,Microsoft.Azure.Cosmos.ChangeFeedRequestOptions,System.String,Microsoft.Azure.Documents.ResourceType)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.NetworkAttachedDocumentContainer.MonadicChangeFeedAsync(Microsoft.Azure.Cosmos.Pagination.FeedRangeState{Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedState},Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedExecutionOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.ChangeFeed.Pagination.ChangeFeedPage}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.NetworkAttachedDocumentContainer.MonadicQueryAsync(Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,Microsoft.Azure.Cosmos.Pagination.FeedRangeState{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryState},Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryExecutionOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryPage}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.NetworkAttachedDocumentContainer.MonadicReadItemAsync(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement,System.String,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Pagination.Record}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.Page`1.#ctor(System.Double,System.String,System.Collections.Generic.IReadOnlyDictionary{System.String,System.String},`0)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.ParallelPrefetch.CommonStartTaskAsync(Microsoft.Azure.Cosmos.Pagination.ParallelPrefetch.ParallelPrefetchTestConfig,Microsoft.Azure.Cosmos.Pagination.ParallelPrefetch.CommonPrefetchState,Microsoft.Azure.Cosmos.Pagination.IPrefetcher)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.ParallelPrefetch.LowConcurrencyPrefetchInParallelAsync(System.Collections.Generic.IEnumerable{Microsoft.Azure.Cosmos.Pagination.IPrefetcher},System.Int32,Microsoft.Azure.Cosmos.Tracing.ITrace,Microsoft.Azure.Cosmos.Pagination.ParallelPrefetch.ParallelPrefetchTestConfig,System.Threading.CancellationToken)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.ParallelPrefetch.PrefetchInParallelAsync(System.Collections.Generic.IEnumerable{Microsoft.Azure.Cosmos.Pagination.IPrefetcher},System.Int32,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.PartitionRangePageAsyncEnumerator`2.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.Record.#ctor(Microsoft.Azure.Documents.ResourceId,System.DateTime,System.String,Microsoft.Azure.Cosmos.CosmosElements.CosmosObject)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.ResourceIdentifier.Parse(System.String)~Microsoft.Azure.Cosmos.Pagination.ResourceIdentifier")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.ResourceIdentifier.Verify(System.String,System.Byte[]@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.RestFeedResponseParser.CreateNavigatorFromContent(System.ReadOnlyMemory{System.Byte},Microsoft.Azure.Cosmos.Serializer.JsonSerializationFormatOptions)~Microsoft.Azure.Cosmos.Json.IJsonNavigator")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.RestFeedResponseParser.GetResourceArrayFromNavigator(Microsoft.Azure.Cosmos.Json.IJsonNavigator,System.String)~Microsoft.Azure.Cosmos.CosmosElements.CosmosArray")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.RestFeedResponseParser.ResourceTypeToArrayKeyName(Microsoft.Azure.Documents.ResourceType)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.RestFeedResponseParser.StreamToBytes(System.IO.Stream)~System.ReadOnlyMemory{System.Byte}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Pagination.TracingAsyncEnumerator`1.#ctor(Microsoft.Azure.Cosmos.Pagination.ITracingAsyncEnumerator{`0},Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.PartitionKey.TryParseJsonString(System.String,Microsoft.Azure.Cosmos.PartitionKey@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.PartitionKeyBuilder.Build~Microsoft.Azure.Cosmos.PartitionKey")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.PartitionKeyMismatchRetryPolicy.#ctor(Microsoft.Azure.Cosmos.Common.CollectionCache,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.PartitionKeyMismatchRetryPolicy.#ctor(Microsoft.Azure.Cosmos.Common.CollectionCache,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.PartitionKeyRangeBatchResponse.GetOperationResultAtIndex``1(System.Int32)~Microsoft.Azure.Cosmos.TransactionalBatchOperationResult{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.PatchConstants.ToEnumMemberString(Microsoft.Azure.Cosmos.PatchOperationType)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.PatchOperationCore.#ctor(Microsoft.Azure.Cosmos.PatchOperationType,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.PatchOperationCore`1.#ctor(Microsoft.Azure.Cosmos.PatchOperationType,System.String,`0)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.PatchOperationsJsonConverter.#ctor(Microsoft.Azure.Cosmos.CosmosSerializer)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.PatchOperationsJsonConverter.ReadJson(Newtonsoft.Json.JsonReader,System.Type,System.Object,Newtonsoft.Json.JsonSerializer)~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.PatchOperationsJsonConverter.WriteJson(Newtonsoft.Json.JsonWriter,System.Object,Newtonsoft.Json.JsonSerializer)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.PatchSpec.#ctor(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.PatchOperation},Microsoft.Azure.Cosmos.Query.Core.Monads.Either{Microsoft.Azure.Cosmos.PatchItemRequestOptions,Microsoft.Azure.Cosmos.TransactionalBatchPatchItemRequestOptions})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.PermissionCore.ReplaceAsync(Microsoft.Azure.Cosmos.PermissionProperties,System.Nullable{System.Int32},Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.PermissionResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.PermissionCore.ReplacePermissionStreamAsync(Microsoft.Azure.Cosmos.PermissionProperties,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.AsyncLazy`1.#ctor(System.Func{Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken,System.Threading.Tasks.Task{`0}})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.ClientDistributionPlanDeserializer.CastToCosmosObject(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.CosmosElements.CosmosObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.ClientDistributionPlanDeserializer.DeserializeAggregate(Microsoft.Azure.Cosmos.CosmosElements.CosmosObject)~Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlAggregate")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.ClientDistributionPlanDeserializer.DeserializeCqlEnumerableExpression(Microsoft.Azure.Cosmos.CosmosElements.CosmosObject)~Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlEnumerableExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.ClientDistributionPlanDeserializer.DeserializeLiteral(Microsoft.Azure.Cosmos.CosmosElements.CosmosObject)~Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlLiteral")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.ClientDistributionPlanDeserializer.DeserializeScalarExpression(Microsoft.Azure.Cosmos.CosmosElements.CosmosObject)~Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.ClientDistributionPlanDeserializer.GetEnumValue``1(System.String)~``0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.ClientDistributionPlanDeserializer.GetValue``1(Microsoft.Azure.Cosmos.CosmosElements.CosmosObject,System.String)~``0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.ClientDistributionPlanDeserializer.TryGetValue``1(Microsoft.Azure.Cosmos.CosmosElements.CosmosObject,System.String,``0@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.ClientDistributionPlan.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlEnumerableExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlAggregateEnumerableExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlEnumerableExpression,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlAggregate)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlArrayCreateScalarExpression.#ctor(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlArrayIndexerScalarExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression,System.UInt64)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlArrayLiteral.#ctor(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlLiteral})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlBinaryScalarExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlBinaryScalarOperatorKind,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlDistinctEnumerableExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlEnumerableExpression,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlVariable,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlFunctionIdentifier.#ctor(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlGroupByEnumerableExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlEnumerableExpression,System.UInt64,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlAggregate})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlInputEnumerableExpression.#ctor(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlIsOperatorScalarExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlIsOperatorKind,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlLetScalarExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlVariable,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlLiteralScalarExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlLiteral)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlMuxScalarExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlObjectCreateScalarExpression.#ctor(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlObjectProperty})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlObjectLiteral.#ctor(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlObjectLiteralProperty})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlObjectLiteralProperty.#ctor(System.String,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlLiteral)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlObjectProperty.#ctor(System.String,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlOrderByEnumerableExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlEnumerableExpression,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlVariable,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlOrderByItem})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlOrderByItem.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlSortOrder)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlPropertyRefScalarExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarAsEnumerableExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlEnumerationKind)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlSelectEnumerableExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlEnumerableExpression,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlVariable,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlSelectManyEnumerableExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlEnumerableExpression,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlVariable,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlEnumerableExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlStringLiteral.#ctor(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlSystemFunctionCallScalarExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlBuiltinScalarFunctionKind,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlTakeEnumerableExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlEnumerableExpression,System.UInt64,System.UInt64)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlTupleAggregate.#ctor(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlAggregate})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlTupleCreateScalarExpression.#ctor(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlTupleItemRefScalarExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression,System.UInt64)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlUnaryScalarExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlUnaryScalarOperatorKind,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlUserDefinedFunctionCallScalarExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlFunctionIdentifier,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression},System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlVariable.#ctor(System.String,System.Int64)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlVariableRefScalarExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlVariable)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlWhereEnumerableExpression.#ctor(Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlEnumerableExpression,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlVariable,Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql.CqlScalarExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Collections.PriorityQueue`1.#ctor(System.Collections.Generic.List{`0},System.Collections.Generic.IComparer{`0},System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Collections.PriorityQueue`1.CopyTo(System.Array,System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Collections.PriorityQueue`1.DequeuePrivate~`0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Collections.PriorityQueue`1.PeekPrivate~`0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.DistributionPlanSpec.#ctor(System.String,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ExecutionContext.CosmosQueryExecutionContextFactory.Create(Microsoft.Azure.Cosmos.Pagination.DocumentContainer,Microsoft.Azure.Cosmos.Query.Core.QueryClient.CosmosQueryContext,Microsoft.Azure.Cosmos.Query.Core.ExecutionContext.CosmosQueryExecutionContextFactory.InputParameters,Microsoft.Azure.Cosmos.Tracing.ITrace)~Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ExecutionContext.CosmosQueryExecutionContextFactory.GetPartitionKeyDefinition(Microsoft.Azure.Cosmos.Query.Core.ExecutionContext.CosmosQueryExecutionContextFactory.InputParameters,Microsoft.Azure.Cosmos.Query.Core.QueryClient.ContainerQueryProperties)~Microsoft.Azure.Documents.PartitionKeyDefinition")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ExecutionContext.CosmosQueryExecutionContextFactory.InputParameters.#ctor(Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement,Microsoft.Azure.Cosmos.FeedRangeInternal,System.Int32,System.Int32,System.Int32,System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},System.Collections.Generic.IReadOnlyDictionary{System.String,System.Object},Microsoft.Azure.Cosmos.Query.Core.QueryPlan.PartitionedQueryExecutionInfo,System.Boolean,System.Boolean,System.Boolean,System.Boolean,Microsoft.Azure.Cosmos.Query.Core.TestInjections)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ExecutionContext.CosmosQueryExecutionContextFactory.InputParameters.Create(Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement,Microsoft.Azure.Cosmos.FeedRangeInternal,System.Nullable{System.Int32},System.Nullable{System.Int32},System.Nullable{System.Int32},System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},System.Collections.Generic.IReadOnlyDictionary{System.String,System.Object},Microsoft.Azure.Cosmos.Query.Core.QueryPlan.PartitionedQueryExecutionInfo,System.Nullable{System.Boolean},System.Boolean,System.Boolean,System.Boolean,Microsoft.Azure.Cosmos.Query.Core.TestInjections)~Microsoft.Azure.Cosmos.Query.Core.ExecutionContext.CosmosQueryExecutionContextFactory.InputParameters")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ExecutionContext.CosmosQueryExecutionContextFactory.TryGetEpkProperty(System.Collections.Generic.IReadOnlyDictionary{System.String,System.Object},System.String@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.ExecutionContext.CosmosQueryExecutionContextFactory.TryGetTargetRangeOptimisticDirectExecutionAsync(Microsoft.Azure.Cosmos.Query.Core.ExecutionContext.CosmosQueryExecutionContextFactory.InputParameters,Microsoft.Azure.Cosmos.Query.Core.QueryPlan.PartitionedQueryExecutionInfo,Microsoft.Azure.Cosmos.Query.Core.QueryClient.CosmosQueryContext,Microsoft.Azure.Cosmos.Query.Core.QueryClient.ContainerQueryProperties,Microsoft.Azure.Cosmos.Tracing.ITrace)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.PartitionKeyRange}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Metrics.ClientSideMetrics.#ctor(System.Int64,System.Double,System.Collections.Generic.IEnumerable{Microsoft.Azure.Cosmos.Query.Core.Metrics.FetchExecutionRange})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Metrics.ClientSideMetricsAccumulator.Accumulate(Microsoft.Azure.Cosmos.Query.Core.Metrics.ClientSideMetrics)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Metrics.IndexMetricsWriter.#ctor(System.Text.StringBuilder)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Metrics.IndexUtilizationInfoAccumulator.Accumulate(Microsoft.Azure.Cosmos.Query.Core.Metrics.IndexUtilizationInfo)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Metrics.QueryMetrics.#ctor(Microsoft.Azure.Cosmos.Query.Core.Metrics.ServerSideMetricsInternal,Microsoft.Azure.Cosmos.Query.Core.Metrics.IndexUtilizationInfo,Microsoft.Azure.Cosmos.Query.Core.Metrics.ClientSideMetrics)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Metrics.QueryMetrics.CreateFromIEnumerable(System.Collections.Generic.IEnumerable{Microsoft.Azure.Cosmos.Query.Core.Metrics.QueryMetrics})~Microsoft.Azure.Cosmos.Query.Core.Metrics.QueryMetrics")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Metrics.QueryMetricsAccumulator.Accumulate(Microsoft.Azure.Cosmos.Query.Core.Metrics.QueryMetrics)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Metrics.QueryMetricsTextWriter.#ctor(System.Text.StringBuilder)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Metrics.QueryPreparationTimesAccumulator.Accumulate(Microsoft.Azure.Cosmos.Query.Core.Metrics.QueryPreparationTimesInternal)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Metrics.RuntimeExecutionTimesAccumulator.Accumulate(Microsoft.Azure.Cosmos.Query.Core.Metrics.RuntimeExecutionTimesInternal)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Metrics.SchedulingTimeSpan.GetAverageTime(System.Collections.Generic.IEnumerable{Microsoft.Azure.Cosmos.Query.Core.Metrics.SchedulingTimeSpan},System.Func{Microsoft.Azure.Cosmos.Query.Core.Metrics.SchedulingTimeSpan,System.Int64})~System.TimeSpan")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Metrics.SchedulingTimeSpan.WriteJsonObject(Newtonsoft.Json.JsonWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Metrics.ServerSideMetricsInternal.#ctor(System.Int64,System.Int64,System.Int64,System.Int64,System.Double,System.TimeSpan,Microsoft.Azure.Cosmos.Query.Core.Metrics.QueryPreparationTimesInternal,System.TimeSpan,System.TimeSpan,System.TimeSpan,Microsoft.Azure.Cosmos.Query.Core.Metrics.RuntimeExecutionTimesInternal,System.TimeSpan,System.String,System.Nullable{System.Int32})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Metrics.ServerSideMetricsInternal.ParseFromDelimitedString(System.String)~Microsoft.Azure.Cosmos.Query.Core.Metrics.ServerSideMetricsInternal")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Metrics.ServerSideMetricsInternalAccumulator.Accumulate(Microsoft.Azure.Cosmos.Query.Core.Metrics.ServerSideMetricsInternal)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Metrics.ServerSideMetricsParser.TryParse(System.String,Microsoft.Azure.Cosmos.Query.Core.Metrics.ServerSideMetricsInternal@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Metrics.TextTable.GetRow(System.Object[])~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Monads.ExceptionWithStackTraceException.#ctor(System.String,System.Exception,System.Diagnostics.StackTrace)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitAdditive_operator(sqlParser.Additive_operatorContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitBinary_scalar_expression(sqlParser.Binary_scalar_expressionContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitBitwise_and_operator(sqlParser.Bitwise_and_operatorContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitBitwise_exclusive_or_operator(sqlParser.Bitwise_exclusive_or_operatorContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitBitwise_inclusive_or_operator(sqlParser.Bitwise_inclusive_or_operatorContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitEquality_operator(sqlParser.Equality_operatorContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitLimit_count(sqlParser.Limit_countContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitLiteral(sqlParser.LiteralContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitLogical_scalar_expression(sqlParser.Logical_scalar_expressionContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitMultiplicative_operator(sqlParser.Multiplicative_operatorContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitObject_property_list(sqlParser.Object_property_listContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitOffset_count(sqlParser.Offset_countContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitOrder_by_item(sqlParser.Order_by_itemContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitOrder_by_items(sqlParser.Order_by_itemsContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitRelational_operator(sqlParser.Relational_operatorContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitScalar_expression_list(sqlParser.Scalar_expression_listContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitScore_expression_order_by_item(sqlParser.Score_expression_order_by_itemContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitSort_order(sqlParser.Sort_orderContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitString_concat_operator(sqlParser.String_concat_operatorContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitTop_spec(sqlParser.Top_specContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitUnary_operator(sqlParser.Unary_operatorContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.CstToAstVisitor.VisitUnary_scalar_expression(sqlParser.Unary_scalar_expressionContext)~Microsoft.Azure.Cosmos.SqlObjects.SqlObject")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.LASets.closure(Antlr4.Runtime.Atn.ATNState)~System.Collections.Generic.HashSet{Antlr4.Runtime.Atn.ATNState}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.LASets.ComputeSingle(System.Collections.Generic.List{Microsoft.Azure.Cosmos.Query.Core.Parser.LASets.Edge})~System.Collections.Generic.HashSet{Antlr4.Runtime.Atn.ATNState}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.LASets.EnterState(Microsoft.Azure.Cosmos.Query.Core.Parser.LASets.Edge)~System.Collections.Generic.List{System.Collections.Generic.List{Microsoft.Azure.Cosmos.Query.Core.Parser.LASets.Edge}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.LASets.Validate(System.Collections.Generic.List{Microsoft.Azure.Cosmos.Query.Core.Parser.LASets.Edge},System.Collections.Generic.List{Antlr4.Runtime.IToken})~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.SqlQueryParser.Monadic.Parse(System.String)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.SqlObjects.SqlQuery}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Parser.SqlQueryParser.Monadic.ThrowExceptionOnErrors.RecoverInline(Antlr4.Runtime.Parser)~Antlr4.Runtime.IToken")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.AggregateQueryPipelineStage.#ctor(Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage,Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.SingleGroupAggregator,System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.AggregateQueryPipelineStage.MonadicCreate(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.AggregateOperator},System.Collections.Generic.IReadOnlyDictionary{System.String,System.Nullable{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.AggregateOperator}},System.Collections.Generic.IReadOnlyList{System.String},System.Boolean,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement,Microsoft.Azure.Cosmos.Query.Core.Pipeline.MonadicCreatePipelineStage)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.AggregateQueryPipelineStage.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.AggregateQueryPipelineStage.RewrittenAggregateProjections.#ctor(System.Boolean,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.AggregateItem.#ctor(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.AverageAggregator.Aggregate(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.AverageAggregator.AverageInfo.TryCreateFromCosmosElement(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.AverageAggregator.AverageInfo}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.CountAggregator.#ctor(System.Int64)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.CountAggregator.Aggregate(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.MakeListAggregator.Aggregate(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.MakeSetAggregator.Aggregate(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.MinMaxAggregator.MinMaxContinuationToken.#ctor(Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.MinMaxAggregator.MinMaxContinuationToken.MinMaxContinuationTokenType,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.MinMaxAggregator.MinMaxContinuationToken.EnumToCosmosString.ConvertEnumToCosmosString(Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.MinMaxAggregator.MinMaxContinuationToken.MinMaxContinuationTokenType)~Microsoft.Azure.Cosmos.CosmosElements.CosmosString")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.MinMaxAggregator.TryCreate(System.Boolean,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.IAggregator}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.SingleGroupAggregator.AggregateValue.AggregateAggregateValue.#ctor(Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.IAggregator)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.SingleGroupAggregator.AggregateValue.AggregateAggregateValue.TryCreate(Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.AggregateOperator,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.SingleGroupAggregator.AggregateValue}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.SingleGroupAggregator.SelectListAggregateValues.#ctor(System.Collections.Generic.IReadOnlyDictionary{System.String,Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.SingleGroupAggregator.AggregateValue},System.Collections.Generic.IReadOnlyList{System.String})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.SingleGroupAggregator.SelectListAggregateValues.AddValues(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.SingleGroupAggregator.SelectListAggregateValues.OrderedCosmosObject.#ctor(System.Collections.Generic.Dictionary{System.String,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement},System.Collections.Generic.IReadOnlyList{System.String})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.SingleGroupAggregator.SelectListAggregateValues.TryCreate(System.Collections.Generic.IReadOnlyDictionary{System.String,System.Nullable{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.AggregateOperator}},System.Collections.Generic.IReadOnlyList{System.String},Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.SingleGroupAggregator}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.SingleGroupAggregator.SelectValueAggregateValues.#ctor(Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.SingleGroupAggregator.AggregateValue)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.SingleGroupAggregator.TryCreate(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.AggregateOperator},System.Collections.Generic.IReadOnlyDictionary{System.String,System.Nullable{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.AggregateOperator}},System.Collections.Generic.IReadOnlyList{System.String},System.Boolean,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.SingleGroupAggregator}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.SumAggregator.Aggregate(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CatchAllQueryPipelineStage.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HierarchicalPartitionUtils.LimitFeedRangeToSinglePartition(System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},Microsoft.Azure.Cosmos.FeedRangeInternal,Microsoft.Azure.Cosmos.Query.Core.QueryClient.ContainerQueryProperties)~Microsoft.Azure.Cosmos.FeedRangeInternal")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HybridSearch.FullTextStatistics.#ctor(Microsoft.Azure.Cosmos.CosmosElements.CosmosObject)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HybridSearch.GlobalFullTextSearchStatistics.#ctor(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HybridSearch.GlobalFullTextSearchStatistics.#ctor(System.Int64,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HybridSearch.FullTextStatistics})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HybridSearch.HybridSearchCrossPartitionQueryPipelineStage.#ctor(Microsoft.Azure.Cosmos.Query.Core.QueryPlan.HybridSearchQueryInfo,Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HybridSearch.HybridSearchCrossPartitionQueryPipelineStage.HybridSearchComponentPipelineFactory,System.Int32,System.Int32,Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HybridSearch.HybridSearchCrossPartitionQueryPipelineStage.State,Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HybridSearch.HybridSearchCrossPartitionQueryPipelineStage.FullTextStatisticsAggregator.#ctor(Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HybridSearch.FullTextStatistics)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HybridSearch.HybridSearchCrossPartitionQueryPipelineStage.FullTextStatisticsAggregator.Add(Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HybridSearch.FullTextStatistics)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HybridSearch.HybridSearchCrossPartitionQueryPipelineStage.GlobalStatisticsAggregator.#ctor(Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HybridSearch.GlobalFullTextSearchStatistics)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HybridSearch.HybridSearchCrossPartitionQueryPipelineStage.GlobalStatisticsAggregator.Add(Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HybridSearch.GlobalFullTextSearchStatistics)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HybridSearch.HybridSearchCrossPartitionQueryPipelineStage.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HybridSearch.HybridSearchCrossPartitionQueryPipelineStage.QueryPipelineStagePrefetcher.#ctor(Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HybridSearch.HybridSearchQueryResult.#ctor(Microsoft.Azure.Cosmos.CosmosElements.CosmosString,Microsoft.Azure.Cosmos.CosmosElements.CosmosArray,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement,System.Double)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HybridSearch.HybridSearchQueryResult.Create(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.HybridSearch.HybridSearchQueryResult")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.BufferedOrderByResults.#ctor(System.Collections.Generic.IEnumerator{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryResult},System.Int32,System.Double,Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.QueryPageParameters)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.CosmosElementToQueryLiteral.#ctor(System.Text.StringBuilder)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.CosmosElementToQueryLiteral.CosmosNumberToQueryLiteral.#ctor(System.Text.StringBuilder)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.CosmosElementToQueryLiteral.Visit(Microsoft.Azure.Cosmos.CosmosElements.CosmosUndefined)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.ItemComparer.MaxValueItem.Accept(Microsoft.Azure.Cosmos.CosmosElements.ICosmosElementVisitor)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.ItemComparer.MaxValueItem.Accept``1(Microsoft.Azure.Cosmos.CosmosElements.ICosmosElementVisitor{``0})~``0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.ItemComparer.MaxValueItem.Accept``2(Microsoft.Azure.Cosmos.CosmosElements.ICosmosElementVisitor{``0,``1},``0)~``1")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.ItemComparer.MaxValueItem.WriteTo(Microsoft.Azure.Cosmos.Json.IJsonWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.ItemComparer.MinValueItem.Accept(Microsoft.Azure.Cosmos.CosmosElements.ICosmosElementVisitor)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.ItemComparer.MinValueItem.Accept``1(Microsoft.Azure.Cosmos.CosmosElements.ICosmosElementVisitor{``0})~``0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.ItemComparer.MinValueItem.Accept``2(Microsoft.Azure.Cosmos.CosmosElements.ICosmosElementVisitor{``0,``1},``0)~``1")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.ItemComparer.MinValueItem.WriteTo(Microsoft.Azure.Cosmos.Json.IJsonWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByColumn.#ctor(System.String,Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.SortOrder)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByContinuationToken.#ctor(Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.Parallel.ParallelContinuationToken,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByItem},System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue},System.String,System.Int32,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByContinuationToken.ToCosmosElement(Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByContinuationToken)~Microsoft.Azure.Cosmos.CosmosElements.CosmosElement")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByCrossPartitionEnumerator.#ctor(Microsoft.Azure.Cosmos.Query.Core.Collections.PriorityQueue{System.Collections.Generic.IEnumerator{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryResult}})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByCrossPartitionEnumerator.CreateAsync(Microsoft.Azure.Cosmos.Pagination.ITracingAsyncEnumerator{Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryPage}},System.Collections.Generic.IComparer{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryResult},System.Int32,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.BufferedOrderByResults}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByCrossPartitionEnumerator.EnumeratorComparer.#ctor(System.Collections.Generic.IComparer{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryResult})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByCrossPartitionEnumerator.PageEnumerator.#ctor(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.CosmosElements.CosmosElement})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByCrossPartitionEnumerator.Reset")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByCrossPartitionQueryPipelineStage.InitializationParameters.#ctor(Microsoft.Azure.Cosmos.Pagination.IDocumentContainer,Microsoft.Azure.Cosmos.Query.Core.QueryClient.ContainerQueryProperties,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.FeedRangeEpk},System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByColumn},Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryExecutionOptions,System.Boolean,System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByCrossPartitionQueryPipelineStage.MonadicCreate(Microsoft.Azure.Cosmos.Pagination.IDocumentContainer,Microsoft.Azure.Cosmos.Query.Core.QueryClient.ContainerQueryProperties,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.FeedRangeEpk},System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByColumn},Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryExecutionOptions,System.Int32,System.Boolean,System.Boolean,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByCrossPartitionQueryPipelineStage.MoveNextAsync_InitializeAsync_HandleSplitAsync(Microsoft.Azure.Cosmos.Pagination.IDocumentContainer,Microsoft.Azure.Cosmos.Query.Core.QueryClient.ContainerQueryProperties,System.Collections.Generic.Queue{System.ValueTuple{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryPartitionRangePageAsyncEnumerator,Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByContinuationToken}},Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryPartitionRangePageAsyncEnumerator,Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByContinuationToken,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByCrossPartitionQueryPipelineStage.NonStreamingOrderByPipelineStage.#ctor(Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByCrossPartitionQueryPipelineStage.InitializationParameters,System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByCrossPartitionQueryPipelineStage.OrderByCrossPartitionRangePageEnumerator.#ctor(Microsoft.Azure.Cosmos.Pagination.IDocumentContainer,System.Collections.Generic.Queue{System.ValueTuple{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryPartitionRangePageAsyncEnumerator,Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByContinuationToken}},Microsoft.Azure.Cosmos.Query.Core.QueryClient.ContainerQueryProperties)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByCrossPartitionQueryPipelineStage.OrderByCrossPartitionRangePageEnumerator.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByCrossPartitionQueryPipelineStage.StreamingOrderByCrossPartitionQueryPipelineStage.#ctor(Microsoft.Azure.Cosmos.Pagination.IDocumentContainer,Microsoft.Azure.Cosmos.Query.Core.QueryClient.ContainerQueryProperties,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.SortOrder},Microsoft.Azure.Cosmos.Query.Core.Collections.PriorityQueue{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryPartitionRangePageAsyncEnumerator},System.Collections.Generic.Queue{System.ValueTuple{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryPartitionRangePageAsyncEnumerator,Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByContinuationToken}},Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryExecutionOptions,System.Boolean,System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByCrossPartitionQueryPipelineStage.StreamingOrderByCrossPartitionQueryPipelineStage.#ctor(Microsoft.Azure.Cosmos.Pagination.IDocumentContainer,Microsoft.Azure.Cosmos.Query.Core.QueryClient.ContainerQueryProperties,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.SortOrder},Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryExecutionOptions,System.Boolean,System.Int32,System.Collections.Generic.IEnumerable{System.ValueTuple{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryPartitionRangePageAsyncEnumerator,Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByContinuationToken}},Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryState)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByCrossPartitionQueryPipelineStage.StreamingOrderByCrossPartitionQueryPipelineStage.MonadicGetOrderByContinuationTokenMapping(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.FeedRangeEpk},Microsoft.Azure.Cosmos.CosmosElements.CosmosElement,System.Int32)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.PartitionMapper.PartitionMapping{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByContinuationToken}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByCrossPartitionQueryPipelineStage.StreamingOrderByCrossPartitionQueryPipelineStage.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByCrossPartitionQueryPipelineStage.StreamingOrderByCrossPartitionQueryPipelineStage.MoveNextAsync_DrainPageAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByCrossPartitionQueryPipelineStage.StreamingOrderByCrossPartitionQueryPipelineStage.MoveNextAsync_Initialize_FilterAsync(Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryPartitionRangePageAsyncEnumerator,Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByContinuationToken,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByCrossPartitionQueryPipelineStage.StreamingOrderByCrossPartitionQueryPipelineStage.MoveNextAsync_Initialize_FromBeginningAsync(Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryPartitionRangePageAsyncEnumerator,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByItem.#ctor(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryPage.#ctor(Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryPage)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryPartitionRangePageAsyncEnumerator.#ctor(Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryPartitionRangePageAsyncEnumerator.InnerEnumerator,Microsoft.Azure.Cosmos.Pagination.BufferedPartitionRangePageAsyncEnumeratorBase{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryPage,Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryState},Microsoft.Azure.Cosmos.Pagination.FeedRangeState{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryState})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryPartitionRangePageAsyncEnumerator.CloneAsFullyBufferedEnumerator~Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryPartitionRangePageAsyncEnumerator")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryPartitionRangePageAsyncEnumerator.Create(Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.IQueryDataSource,Microsoft.Azure.Cosmos.Query.Core.QueryClient.ContainerQueryProperties,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,Microsoft.Azure.Cosmos.Pagination.FeedRangeState{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryState},System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryExecutionOptions,System.String,Microsoft.Azure.Cosmos.Pagination.PrefetchPolicy)~Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryPartitionRangePageAsyncEnumerator")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryPartitionRangePageAsyncEnumerator.InnerEnumerator.#ctor(Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.IQueryDataSource,Microsoft.Azure.Cosmos.Query.Core.QueryClient.ContainerQueryProperties,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,Microsoft.Azure.Cosmos.Pagination.FeedRangeState{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryState},System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryExecutionOptions,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryResult.#ctor(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryResult.GetOrderByItems(Microsoft.Azure.Cosmos.CosmosElements.CosmosObject)~System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByItem}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryResultComparer.#ctor(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.SortOrder})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.QueryPageParameters.#ctor(System.String,System.Lazy{Microsoft.Azure.Cosmos.Query.Core.QueryClient.CosmosQueryExecutionInfo},Microsoft.Azure.Cosmos.Query.Core.DistributionPlanSpec,System.Collections.Generic.IReadOnlyDictionary{System.String,System.String})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.Parallel.ParallelContinuationToken.#ctor(System.String,Microsoft.Azure.Documents.Routing.Range{System.String})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.Parallel.ParallelCrossPartitionQueryPipelineStage.#ctor(Microsoft.Azure.Cosmos.Pagination.CrossPartitionRangePageAsyncEnumerator{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryPage,Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryState})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.Parallel.ParallelCrossPartitionQueryPipelineStage.MonadicCreate(Microsoft.Azure.Cosmos.Pagination.IDocumentContainer,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.FeedRangeEpk},System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryExecutionOptions,Microsoft.Azure.Cosmos.Query.Core.QueryClient.ContainerQueryProperties,System.Int32,Microsoft.Azure.Cosmos.Pagination.PrefetchPolicy,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.Parallel.ParallelCrossPartitionQueryPipelineStage.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.Parallel.PartitionKeyRangeComparer.Compare(Microsoft.Azure.Documents.PartitionKeyRange,Microsoft.Azure.Documents.PartitionKeyRange)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.Parallel.QueryPartitionRangePageAsyncEnumerator.#ctor(Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.IQueryDataSource,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,Microsoft.Azure.Cosmos.Pagination.FeedRangeState{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryState},System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryExecutionOptions,Microsoft.Azure.Cosmos.Query.Core.QueryClient.ContainerQueryProperties)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.Parallel.QueryPartitionRangePageAsyncEnumerator.GetNextPageAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryPage}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.PartitionMapper.MonadicGetPartitionMapping``1(Microsoft.Azure.Cosmos.FeedRangeEpk,``0)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.PartitionMapper.PartitionMapping{``0}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.PartitionMapper.MonadicGetPartitionMapping``1(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.FeedRangeEpk},System.Collections.Generic.IReadOnlyList{``0})~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.PartitionMapper.PartitionMapping{``0}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.PartitionMapper.PartitionMapping`1.#ctor(System.Collections.Generic.IReadOnlyDictionary{Microsoft.Azure.Cosmos.FeedRangeEpk,`0},System.Collections.Generic.IReadOnlyDictionary{Microsoft.Azure.Cosmos.FeedRangeEpk,`0},System.Collections.Generic.IReadOnlyDictionary{Microsoft.Azure.Cosmos.FeedRangeEpk,`0})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.PartitionMapper.SplitRangesBasedOffContinuationToken``1(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.FeedRangeEpk},System.Collections.Generic.IReadOnlyList{``0})~System.Collections.Generic.List{System.ValueTuple{Microsoft.Azure.Cosmos.FeedRangeEpk,``0}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.DCount.DCountQueryPipelineStage.MonadicCreate(Microsoft.Azure.Cosmos.Query.Core.QueryPlan.DCountInfo,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement,Microsoft.Azure.Cosmos.Query.Core.Pipeline.MonadicCreatePipelineStage)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.DCount.DCountQueryPipelineStage.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Distinct.DistinctMap.OrderedDistinctMap.TryCreate(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Distinct.DistinctMap}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Distinct.DistinctMap.TryCreate(Microsoft.Azure.Cosmos.Query.Core.Pipeline.Distinct.DistinctQueryType,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Distinct.DistinctMap}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Distinct.DistinctMap.UnorderedDistinctMap.#ctor(System.Collections.Generic.HashSet{Microsoft.Azure.Cosmos.Number64},System.Collections.Generic.HashSet{System.UInt32},System.Collections.Generic.HashSet{System.UInt64},System.Collections.Generic.HashSet{Microsoft.Azure.Cosmos.UInt128},System.Collections.Generic.HashSet{Microsoft.Azure.Cosmos.UInt128},System.Collections.Generic.HashSet{Microsoft.Azure.Cosmos.UInt128},System.Collections.Generic.HashSet{Microsoft.Azure.Cosmos.UInt128},System.Collections.Generic.HashSet{Microsoft.Azure.Cosmos.UInt128},System.Collections.Generic.HashSet{Microsoft.Azure.Cosmos.UInt128},Microsoft.Azure.Cosmos.Query.Core.Pipeline.Distinct.DistinctMap.SimpleValues)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Distinct.DistinctMap.UnorderedDistinctMap.CosmosElementVisitor.#ctor(Microsoft.Azure.Cosmos.Query.Core.Pipeline.Distinct.DistinctMap.UnorderedDistinctMap)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Distinct.DistinctMap.UnorderedDistinctMap.Parse128BitHashes(Microsoft.Azure.Cosmos.CosmosElements.CosmosObject,System.String)~System.Collections.Generic.HashSet{Microsoft.Azure.Cosmos.UInt128}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Distinct.DistinctQueryPipelineStage.#ctor(Microsoft.Azure.Cosmos.Query.Core.Pipeline.Distinct.DistinctQueryType,Microsoft.Azure.Cosmos.Query.Core.Pipeline.Distinct.DistinctMap,Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Distinct.DistinctQueryPipelineStage.MonadicCreate(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement,Microsoft.Azure.Cosmos.Query.Core.Pipeline.MonadicCreatePipelineStage,Microsoft.Azure.Cosmos.Query.Core.Pipeline.Distinct.DistinctQueryType)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Distinct.DistinctQueryPipelineStage.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.DistributedQueryPipelineStage.#ctor(Microsoft.Azure.Cosmos.Pagination.IDocumentContainer,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,Microsoft.Azure.Cosmos.FeedRangeInternal,System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryExecutionOptions,Microsoft.Azure.Cosmos.Query.Core.Pipeline.DistributedQueryPipelineStage.ContinuationToken)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.DistributedQueryPipelineStage.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.FaultedQueryPipelineStage.#ctor(System.Exception)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.GroupBy.GroupByQueryPipelineStage.#ctor(Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage,Microsoft.Azure.Cosmos.Query.Core.Pipeline.GroupBy.GroupByQueryPipelineStage.GroupingTable,System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.GroupBy.GroupByQueryPipelineStage.GroupingTable.#ctor(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.AggregateOperator},System.Collections.Generic.IReadOnlyDictionary{System.String,System.Nullable{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.AggregateOperator}},System.Collections.Generic.IReadOnlyList{System.String},System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.GroupBy.GroupByQueryPipelineStage.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.GroupBy.GroupByQueryPipelineStage.RewrittenGroupByProjection.#ctor(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.LazyQueryPipelineStage.#ctor(Microsoft.Azure.Cosmos.Query.Core.AsyncLazy{Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage}})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.LazyQueryPipelineStage.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.NameCacheStaleRetryQueryPipelineStage.#ctor(Microsoft.Azure.Cosmos.Query.Core.QueryClient.CosmosQueryContext,System.Func{Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.OptimisticDirectExecutionQuery.OptimisticDirectExecutionQueryPipelineStage.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.OptimisticDirectExecutionQuery.OptimisticDirectExecutionQueryPipelineStage.OptimisticDirectExecutionQueryPipelineImpl.#ctor(Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.Parallel.QueryPartitionRangePageAsyncEnumerator)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.OptimisticDirectExecutionQuery.OptimisticDirectExecutionQueryPipelineStage.OptimisticDirectExecutionQueryPipelineImpl.MonadicCreate(Microsoft.Azure.Cosmos.Pagination.IDocumentContainer,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,Microsoft.Azure.Cosmos.FeedRangeEpk,System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryExecutionOptions,Microsoft.Azure.Cosmos.Query.Core.QueryClient.ContainerQueryProperties,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement,System.Threading.CancellationToken)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.OptimisticDirectExecutionQuery.OptimisticDirectExecutionQueryPipelineStage.OptimisticDirectExecutionQueryPipelineImpl.MonadicExtractState(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement,Microsoft.Azure.Cosmos.FeedRangeEpk)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Pagination.FeedRangeState{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryState}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.OptimisticDirectExecutionQuery.OptimisticDirectExecutionQueryPipelineStage.OptimisticDirectExecutionQueryPipelineImpl.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryPage.#ctor(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.CosmosElements.CosmosElement},System.Double,System.String,System.Lazy{Microsoft.Azure.Cosmos.Query.Core.QueryClient.CosmosQueryExecutionInfo},Microsoft.Azure.Cosmos.Query.Core.DistributionPlanSpec,System.String,System.Collections.Generic.IReadOnlyDictionary{System.String,System.String},Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryState,System.Nullable{System.Boolean})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryState.#ctor(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.PipelineFactory.MonadicCreate(Microsoft.Azure.Cosmos.Pagination.IDocumentContainer,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.FeedRangeEpk},System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},Microsoft.Azure.Cosmos.Query.Core.QueryPlan.QueryInfo,Microsoft.Azure.Cosmos.Pagination.PrefetchPolicy,Microsoft.Azure.Cosmos.Query.Core.QueryClient.ContainerQueryProperties,System.Int32,System.Boolean,System.Boolean,System.Int32,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.PipelineFactory.MonadicCreate(Microsoft.Azure.Cosmos.Pagination.IDocumentContainer,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.FeedRangeEpk},System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},Microsoft.Azure.Cosmos.Query.Core.QueryPlan.QueryInfo,Microsoft.Azure.Cosmos.Query.Core.QueryPlan.HybridSearchQueryInfo,System.Int32,Microsoft.Azure.Cosmos.Query.Core.QueryClient.ContainerQueryProperties,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.FeedRangeEpk},System.Boolean,System.Int32,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.QueryPipelineStageBase.#ctor(Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Skip.SkipQueryPipelineStage.#ctor(Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage,System.Int64)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Skip.SkipQueryPipelineStage.ClientSkipQueryPipelineStage.MonadicCreate(System.Int32,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement,Microsoft.Azure.Cosmos.Query.Core.Pipeline.MonadicCreatePipelineStage)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Skip.SkipQueryPipelineStage.ClientSkipQueryPipelineStage.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Skip.SkipQueryPipelineStage.ClientSkipQueryPipelineStage.OffsetContinuationToken.#ctor(System.Int32,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.SkipEmptyPageQueryPipelineStage.#ctor(Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.SkipEmptyPageQueryPipelineStage.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Take.TakeQueryPipelineStage.ClientTakeQueryPipelineStage.LimitContinuationToken.#ctor(System.Int32,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Take.TakeQueryPipelineStage.ClientTakeQueryPipelineStage.MonadicCreateLimitStage(System.Int32,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement,Microsoft.Azure.Cosmos.Query.Core.Pipeline.MonadicCreatePipelineStage)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Take.TakeQueryPipelineStage.ClientTakeQueryPipelineStage.MonadicCreateTopStage(System.Int32,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement,Microsoft.Azure.Cosmos.Query.Core.Pipeline.MonadicCreatePipelineStage)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Take.TakeQueryPipelineStage.ClientTakeQueryPipelineStage.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Tokens.PipelineContinuationToken.TryConvertToLatest(Microsoft.Azure.Cosmos.Query.Core.Pipeline.Tokens.PipelineContinuationToken,Microsoft.Azure.Cosmos.Query.Core.Pipeline.Tokens.PipelineContinuationTokenV1_1@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Tokens.PipelineContinuationToken.TryCreateFromCosmosElement(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement,Microsoft.Azure.Cosmos.Query.Core.Pipeline.Tokens.PipelineContinuationToken@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Tokens.PipelineContinuationToken.TryParseVersion(Microsoft.Azure.Cosmos.CosmosElements.CosmosObject,System.Version@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Tokens.PipelineContinuationTokenV0.#ctor(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Tokens.PipelineContinuationTokenV0.TryCreateFromCosmosElement(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement,Microsoft.Azure.Cosmos.Query.Core.Pipeline.Tokens.PipelineContinuationTokenV0@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Tokens.PipelineContinuationTokenV1.#ctor(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Tokens.PipelineContinuationTokenV1.CreateFromV0Token(Microsoft.Azure.Cosmos.Query.Core.Pipeline.Tokens.PipelineContinuationTokenV0)~Microsoft.Azure.Cosmos.Query.Core.Pipeline.Tokens.PipelineContinuationTokenV1")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Tokens.PipelineContinuationTokenV1.TryCreateFromCosmosElement(Microsoft.Azure.Cosmos.CosmosElements.CosmosObject,Microsoft.Azure.Cosmos.Query.Core.Pipeline.Tokens.PipelineContinuationTokenV1@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Tokens.PipelineContinuationTokenV1_1.#ctor(Microsoft.Azure.Cosmos.Query.Core.QueryPlan.PartitionedQueryExecutionInfo,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Tokens.PipelineContinuationTokenV1_1.TryCreateFromCosmosElement(Microsoft.Azure.Cosmos.CosmosElements.CosmosObject,Microsoft.Azure.Cosmos.Query.Core.Pipeline.Tokens.PipelineContinuationTokenV1_1@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Tokens.PipelineContinuationTokenV1_1.TryParseQueryPlan(Microsoft.Azure.Cosmos.CosmosElements.CosmosObject,Microsoft.Azure.Cosmos.Query.Core.QueryPlan.PartitionedQueryExecutionInfo@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.QueryClient.CosmosDistributedQueryClient.#ctor(Microsoft.Azure.Cosmos.CosmosClientContext,System.String,System.Guid)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.QueryClient.CosmosDistributedQueryClient.MonadicQueryAsync(System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},Microsoft.Azure.Cosmos.FeedRangeInternal,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,System.String,Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryExecutionOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination.QueryPage}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.QueryClient.CosmosQueryContext.#ctor(Microsoft.Azure.Cosmos.Query.Core.QueryClient.CosmosQueryClient,Microsoft.Azure.Documents.ResourceType,Microsoft.Azure.Documents.OperationType,System.Type,System.String,System.Guid,System.Boolean,System.Boolean,System.Boolean,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.QueryPlan.PartitionedQueryExecutionInfo.TryParse(System.String,Microsoft.Azure.Cosmos.Query.Core.QueryPlan.PartitionedQueryExecutionInfo@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.QueryPlan.QueryPartitionProvider.#ctor(System.Collections.Generic.IDictionary{System.String,System.Object})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.QueryPlan.QueryPartitionProvider.Initialize")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.QueryPlan.QueryPartitionProvider.Update(System.Collections.Generic.IDictionary{System.String,System.Object})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.QueryPlan.QueryPlanHandler.#ctor(Microsoft.Azure.Cosmos.Query.Core.QueryClient.CosmosQueryClient)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.QueryPlan.QueryPlanHandler.TryGetQueryPlanAsync(Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,Microsoft.Azure.Documents.ResourceType,Microsoft.Azure.Documents.PartitionKeyDefinition,Microsoft.Azure.Cosmos.VectorEmbeddingPolicy,System.Boolean,System.Boolean,System.Boolean,Microsoft.Azure.Cosmos.GeospatialType,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Query.Core.QueryPlan.PartitionedQueryExecutionInfo}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.QueryPlan.QueryPlanRetriever.GetQueryPlanThroughGatewayAsync(Microsoft.Azure.Cosmos.Query.Core.QueryClient.CosmosQueryContext,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,System.String,System.Nullable{Microsoft.Azure.Cosmos.PartitionKey},System.Boolean,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.Query.Core.QueryPlan.PartitionedQueryExecutionInfo}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.QueryPlan.QueryPlanRetriever.GetQueryPlanWithServiceInteropAsync(Microsoft.Azure.Cosmos.Query.Core.QueryClient.CosmosQueryClient,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,Microsoft.Azure.Documents.ResourceType,Microsoft.Azure.Documents.PartitionKeyDefinition,Microsoft.Azure.Cosmos.VectorEmbeddingPolicy,System.Boolean,Microsoft.Azure.Cosmos.GeospatialType,System.Boolean,System.Boolean,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.Query.Core.QueryPlan.PartitionedQueryExecutionInfo}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.SqlParameterCollection.#ctor(System.Collections.Generic.IEnumerable{Microsoft.Azure.Cosmos.Query.Core.SqlParameter})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeFilter.#ctor(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue},System.String,System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue.CompareTo(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue.CosmosElementToResumeValueVisitor.Visit(Microsoft.Azure.Cosmos.CosmosElements.CosmosArray)~Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue.CosmosElementToResumeValueVisitor.Visit(Microsoft.Azure.Cosmos.CosmosElements.CosmosBinary)~Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue.CosmosElementToResumeValueVisitor.Visit(Microsoft.Azure.Cosmos.CosmosElements.CosmosGuid)~Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue.CosmosElementToResumeValueVisitor.Visit(Microsoft.Azure.Cosmos.CosmosElements.CosmosNumber)~Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue.CosmosElementToResumeValueVisitor.Visit(Microsoft.Azure.Cosmos.CosmosElements.CosmosObject)~Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue.OrderByValueToResumeValueVisitor.Visit(Microsoft.Azure.Cosmos.CosmosElements.CosmosBinary)~Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue.OrderByValueToResumeValueVisitor.Visit(Microsoft.Azure.Cosmos.CosmosElements.CosmosGuid)~Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue.OrderByValueToResumeValueVisitor.Visit(Microsoft.Azure.Cosmos.CosmosElements.CosmosNumber)~Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue.PrimitiveResumeValue.Create(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue.PrimitiveResumeValue")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue.Serialize(Newtonsoft.Json.JsonWriter,Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue,Newtonsoft.Json.JsonSerializer)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue.ToCosmosElement(Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeValue)~Microsoft.Azure.Cosmos.CosmosElements.CosmosElement")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec.#ctor(System.String,Microsoft.Azure.Cosmos.Query.Core.SqlParameterCollection,Microsoft.Azure.Cosmos.Query.Core.SqlQueryResumeFilter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.DefaultDocumentQueryExecutionContext.ExecuteOnceAsync(Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,System.Threading.CancellationToken)~System.Threading.Tasks.Task{System.Tuple{Microsoft.Azure.Cosmos.DocumentFeedResponse{Microsoft.Azure.Cosmos.CosmosElements.CosmosElement},System.String}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.DefaultDocumentQueryExecutionContext.TryGetTargetPartitionKeyRangeAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Cosmos.ContainerProperties,Microsoft.Azure.Cosmos.Query.Core.QueryPlan.QueryPartitionProvider,Microsoft.Azure.Cosmos.Routing.IRoutingMapProvider,Microsoft.Azure.Documents.Routing.Range{System.String},System.Collections.Generic.List{Microsoft.Azure.Cosmos.Routing.CompositeContinuationToken})~System.Threading.Tasks.Task{System.Tuple{Microsoft.Azure.Cosmos.Routing.PartitionRoutingHelper.ResolvedRangeInfo,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Documents.Routing.Range{System.String}}}}")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.DocumentQueryClient.#ctor(Microsoft.Azure.Cosmos.DocumentClient)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.DocumentQueryClient.#ctor(Microsoft.Azure.Cosmos.DocumentClient)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.DocumentQueryExecutionContextBase.CreateQueryDocumentServiceRequest(Microsoft.Azure.Documents.Collections.INameValueCollection,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec)~Microsoft.Azure.Documents.DocumentServiceRequest")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.DocumentQueryExecutionContextBase.ExecuteNextFeedResponseAsync(System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{Microsoft.Azure.Cosmos.CosmosElements.CosmosElement}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.DocumentQueryExecutionContextBase.GetFeedResponse(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.DocumentServiceResponse)~Microsoft.Azure.Cosmos.DocumentFeedResponse{Microsoft.Azure.Cosmos.CosmosElements.CosmosElement}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.DocumentQueryExecutionContextBase.GetPartitionedQueryExecutionInfoAsync(Microsoft.Azure.Documents.PartitionKeyDefinition,Microsoft.Azure.Cosmos.VectorEmbeddingPolicy,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,Microsoft.Azure.Cosmos.GeospatialType,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.Query.Core.QueryPlan.PartitionedQueryExecutionInfo}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.DocumentQueryExecutionContextBase.GetReplacementRangesAsync(Microsoft.Azure.Documents.PartitionKeyRange,System.String)~System.Threading.Tasks.Task{System.Collections.Generic.List{Microsoft.Azure.Documents.PartitionKeyRange}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.DocumentQueryExecutionContextBase.GetTargetPartitionKeyRangeByIdAsync(System.String,System.String)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.PartitionKeyRange}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.DocumentQueryExecutionContextBase.GetTargetPartitionKeyRangesAsync(System.String,System.Collections.Generic.List{Microsoft.Azure.Documents.Routing.Range{System.String}})~System.Threading.Tasks.Task{System.Collections.Generic.List{Microsoft.Azure.Documents.PartitionKeyRange}}")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.DocumentQueryExecutionContextBase.InitParams.#ctor(Microsoft.Azure.Cosmos.Query.IDocumentQueryClient,Microsoft.Azure.Documents.ResourceType,System.Type,System.Linq.Expressions.Expression,Microsoft.Azure.Cosmos.FeedOptions,System.String,System.Boolean,System.Guid)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.DocumentQueryExecutionContextBase.InitParams.#ctor(Microsoft.Azure.Cosmos.Query.IDocumentQueryClient,Microsoft.Azure.Documents.ResourceType,System.Type,System.Linq.Expressions.Expression,Microsoft.Azure.Cosmos.FeedOptions,System.String,System.Boolean,System.Guid)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.DocumentQueryExecutionContextBase.PopulatePartitionKeyInfo(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.Routing.PartitionKeyInternal)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.DocumentQueryExecutionContextBase.PopulatePartitionKeyRangeInfo(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.PartitionKeyRange,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.DocumentQueryExecutionContextFactory.CreateDocumentQueryExecutionContextAsync(Microsoft.Azure.Cosmos.Query.IDocumentQueryClient,Microsoft.Azure.Documents.ResourceType,System.Type,System.Linq.Expressions.Expression,Microsoft.Azure.Cosmos.FeedOptions,System.String,System.Boolean,System.Threading.CancellationToken,System.Guid)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.Query.IDocumentQueryExecutionContext}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.DocumentQueryExecutionContextFactory.TryGetEpkProperty(Microsoft.Azure.Cosmos.FeedOptions,System.String@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.ProxyDocumentQueryExecutionContext.ExecuteNextFeedResponseAsync(System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.DocumentFeedResponse{Microsoft.Azure.Cosmos.CosmosElements.CosmosElement}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.QueryIterator.#ctor(Microsoft.Azure.Cosmos.Query.CosmosQueryContextCore,Microsoft.Azure.Cosmos.Query.Core.Pipeline.IQueryPipelineStage,Microsoft.Azure.Cosmos.CosmosSerializationFormatOptions,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.CosmosClientContext,System.Guid,Microsoft.Azure.Cosmos.ContainerInternal,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Query.QueryIterator.ReadNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.QueryDefinition.#ctor(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.QueryDefinition.WithParameter(System.String,System.Object)~Microsoft.Azure.Cosmos.QueryDefinition")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.QueryRequestOptions.PopulateRequestOptions(Microsoft.Azure.Cosmos.RequestMessage)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.QueryResponse.CreateSuccess(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.CosmosElements.CosmosElement},System.Int32,Microsoft.Azure.Cosmos.CosmosQueryResponseMessageHeaders,Microsoft.Azure.Cosmos.CosmosSerializationFormatOptions,Microsoft.Azure.Cosmos.Tracing.ITrace)~Microsoft.Azure.Cosmos.QueryResponse")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadFeed.Pagination.CrossPartitionReadFeedAsyncEnumerator.#ctor(Microsoft.Azure.Cosmos.Pagination.CrossPartitionRangePageAsyncEnumerator{Microsoft.Azure.Cosmos.ReadFeed.Pagination.ReadFeedPage,Microsoft.Azure.Cosmos.ReadFeed.Pagination.ReadFeedState})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadFeed.Pagination.CrossPartitionReadFeedAsyncEnumerator.Create(Microsoft.Azure.Cosmos.Pagination.IDocumentContainer,Microsoft.Azure.Cosmos.Pagination.CrossFeedRangeState{Microsoft.Azure.Cosmos.ReadFeed.Pagination.ReadFeedState},Microsoft.Azure.Cosmos.ReadFeed.Pagination.ReadFeedExecutionOptions)~Microsoft.Azure.Cosmos.ReadFeed.Pagination.CrossPartitionReadFeedAsyncEnumerator")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadFeed.Pagination.CrossPartitionReadFeedAsyncEnumerator.MoveNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.ValueTask{System.Boolean}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadFeed.Pagination.ReadFeedContinuationState.#ctor(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadFeed.Pagination.ReadFeedFeedRangeStateSerializer.Monadic.CreateFromCosmosElement(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.Pagination.FeedRangeState{Microsoft.Azure.Cosmos.ReadFeed.Pagination.ReadFeedState}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadFeed.Pagination.ReadFeedFeedRangeStateSerializer.ToCosmosElement(Microsoft.Azure.Cosmos.Pagination.FeedRangeState{Microsoft.Azure.Cosmos.ReadFeed.Pagination.ReadFeedState})~Microsoft.Azure.Cosmos.CosmosElements.CosmosElement")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadFeed.Pagination.ReadFeedPage.#ctor(System.IO.Stream,System.Double,System.Int32,System.String,System.Collections.Generic.IReadOnlyDictionary{System.String,System.String},Microsoft.Azure.Cosmos.ReadFeed.Pagination.ReadFeedState)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadFeed.ReadFeedCrossFeedRangeAsyncEnumerable.#ctor(Microsoft.Azure.Cosmos.Pagination.IDocumentContainer,Microsoft.Azure.Cosmos.ReadFeed.ReadFeedCrossFeedRangeState,Microsoft.Azure.Cosmos.ReadFeed.Pagination.ReadFeedExecutionOptions)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadFeed.ReadFeedCrossFeedRangeAsyncEnumerator.#ctor(Microsoft.Azure.Cosmos.ReadFeed.Pagination.CrossPartitionReadFeedAsyncEnumerator)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadFeed.ReadFeedCrossFeedRangeState.#ctor(System.ReadOnlyMemory{Microsoft.Azure.Cosmos.Pagination.FeedRangeState{Microsoft.Azure.Cosmos.ReadFeed.Pagination.ReadFeedState}})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadFeed.ReadFeedCrossFeedRangeState.CreateFromBeginning(Microsoft.Azure.Cosmos.FeedRange)~Microsoft.Azure.Cosmos.ReadFeed.ReadFeedCrossFeedRangeState")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadFeed.ReadFeedCrossFeedRangeState.CreateFromContinuation(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement,Microsoft.Azure.Cosmos.FeedRange)~Microsoft.Azure.Cosmos.ReadFeed.ReadFeedCrossFeedRangeState")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadFeed.ReadFeedCrossFeedRangeState.Monadic.CreateFromCosmosElement(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.ReadFeed.ReadFeedCrossFeedRangeState}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadFeed.ReadFeedCrossFeedRangeState.Monadic.Parse(System.String)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.ReadFeed.ReadFeedCrossFeedRangeState}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadFeed.ReadFeedCrossFeedRangeState.Parse(System.String)~Microsoft.Azure.Cosmos.ReadFeed.ReadFeedCrossFeedRangeState")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadFeed.ReadFeedCrossFeedRangeState.TryParse(System.String,Microsoft.Azure.Cosmos.ReadFeed.ReadFeedCrossFeedRangeState@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadFeed.ReadFeedIteratorCore.#ctor(Microsoft.Azure.Cosmos.Pagination.IDocumentContainer,System.String,Microsoft.Azure.Cosmos.ReadFeed.Pagination.ReadFeedExecutionOptions,Microsoft.Azure.Cosmos.QueryRequestOptions,Microsoft.Azure.Cosmos.ContainerInternal,System.Threading.CancellationToken)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadFeed.ReadFeedIteratorCore.ReadNextAsync(Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadFeed.ReadFeedPage.#ctor(Microsoft.Azure.Cosmos.CosmosElements.CosmosArray,System.Double,System.String,System.Nullable{Microsoft.Azure.Cosmos.ReadFeed.ReadFeedCrossFeedRangeState},System.Collections.Generic.IReadOnlyDictionary{System.String,System.String})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadManyQueryHelper.CombineStreamsFromQueryResponses(System.Collections.Generic.List{Microsoft.Azure.Cosmos.ResponseMessage}[],System.String,Microsoft.Azure.Cosmos.Tracing.ITrace)~Microsoft.Azure.Cosmos.ResponseMessage")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadManyQueryHelper.CreateReadManyQueryDefinitionForOther(System.Collections.Generic.List{System.ValueTuple{System.String,Microsoft.Azure.Cosmos.PartitionKey}},System.Int32)~Microsoft.Azure.Cosmos.QueryDefinition")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ReadManyQueryHelper.GenerateStreamResponsesForPartitionAsync(Microsoft.Azure.Cosmos.QueryDefinition,Microsoft.Azure.Documents.PartitionKeyRange,Microsoft.Azure.Cosmos.ReadManyRequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{System.Collections.Generic.List{Microsoft.Azure.Cosmos.ResponseMessage}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.RequestHandler.SendAsync(Microsoft.Azure.Cosmos.RequestMessage,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.RequestMessage.#ctor(System.Net.Http.HttpMethod,System.String,Microsoft.Azure.Cosmos.Tracing.ITrace)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.RequestMessage.#ctor(System.Net.Http.HttpMethod,System.String,Microsoft.Azure.Cosmos.Tracing.ITrace,Microsoft.Azure.Cosmos.Headers,System.Collections.Generic.Dictionary{System.String,System.Object})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.RequestMessage.AddThroughputPropertiesHeader(Microsoft.Azure.Cosmos.ThroughputProperties)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.RequestMessage.AssertPartitioningPropertiesAndHeaders~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.RequestMessage.CheckDisposed")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.RequestOptions.TryGetResourceUri(System.Uri@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Resource.CosmosExceptions.CosmosExceptionFactory.Create(Microsoft.Azure.Documents.DocumentServiceResponse,Microsoft.Azure.Cosmos.Headers,Microsoft.Azure.Cosmos.Tracing.ITrace)~Microsoft.Azure.Cosmos.CosmosException")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Resource.CosmosExceptions.CosmosExceptionFactory.Create(Microsoft.Azure.Documents.StoreResponse,Microsoft.Azure.Cosmos.RequestMessage)~Microsoft.Azure.Cosmos.CosmosException")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Resource.FullFidelity.Converters.ChangeFeedMetadataConverter.Read(System.Text.Json.Utf8JsonReader@,System.Type,System.Text.Json.JsonSerializerOptions)~Microsoft.Azure.Cosmos.ChangeFeedMetadata")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ResourceThrottleRetryPolicy.#ctor(System.Int32,System.Int32,System.UInt32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ResponseMessage.#ctor(System.Net.HttpStatusCode,Microsoft.Azure.Cosmos.RequestMessage,Microsoft.Azure.Cosmos.Headers,Microsoft.Azure.Cosmos.CosmosException,Microsoft.Azure.Cosmos.Tracing.ITrace)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ResponseMessage.#ctor(System.Net.HttpStatusCode,Microsoft.Azure.Cosmos.RequestMessage,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ResponseMessage.CheckDisposed")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ResponseMessage.EnsureSuccessStatusCode~Microsoft.Azure.Cosmos.ResponseMessage")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Rntbd.RntbdOpenConnectionHandler.#ctor(Microsoft.Azure.Documents.TransportClient)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Rntbd.RntbdStreamReader.CopyFromAvailableBytes(System.Byte[],System.Int32,System.Int32)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Rntbd.RntbdStreamReader.CopyFromAvailableBytes(System.IO.MemoryStream,System.Int32)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Rntbd.RntbdStreamReader.ReadAsync(System.Byte[],System.Int32,System.Int32)~System.Threading.Tasks.ValueTask{System.Int32}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.ClientCollectionCache.#ctor(Microsoft.Azure.Documents.ISessionContainer,Microsoft.Azure.Documents.IStoreModel,Microsoft.Azure.Cosmos.ICosmosAuthorizationTokenProvider,Microsoft.Azure.Cosmos.IRetryPolicyFactory,Microsoft.Azure.Cosmos.Telemetry.TelemetryToServiceHelper,System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.ClientCollectionCache.ReadCollectionAsync(System.String,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy,Microsoft.Azure.Cosmos.Tracing.ITrace,Microsoft.Azure.Documents.IClientSideRequestStatistics,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ContainerProperties}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.CollectionRoutingMap.#ctor(System.Collections.Generic.Dictionary{System.String,System.Tuple{Microsoft.Azure.Documents.PartitionKeyRange,Microsoft.Azure.Documents.ServiceIdentity}},System.Collections.Generic.List{Microsoft.Azure.Documents.PartitionKeyRange},System.String,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.CollectionRoutingMap.GetOverlappingRanges(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Documents.Routing.Range{System.String}})~System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Documents.PartitionKeyRange}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.CollectionRoutingMap.GetRangeByEffectivePartitionKey(System.String)~Microsoft.Azure.Documents.PartitionKeyRange")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.CollectionRoutingMap.IsCompleteSetOfRanges(System.Collections.Generic.IList{Microsoft.Azure.Documents.PartitionKeyRange})~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.GatewayAddressCache.GetAddressesForRangeIdAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.PartitionAddressInformation,System.String,System.String,System.Boolean)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.PartitionAddressInformation}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.GatewayAddressCache.MarkAddressesToUnhealthyAsync(Microsoft.Azure.Documents.Rntbd.ServerKey)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.GatewayAddressCache.MergeAddresses(Microsoft.Azure.Documents.PartitionAddressInformation,Microsoft.Azure.Documents.PartitionAddressInformation)~Microsoft.Azure.Documents.PartitionAddressInformation")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.GatewayAddressCache.ProtocolFromString(System.String)~Microsoft.Azure.Documents.Client.Protocol")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.GatewayAddressCache.ProtocolString(Microsoft.Azure.Documents.Client.Protocol)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.GatewayAddressCache.ResolveMasterAsync(Microsoft.Azure.Documents.DocumentServiceRequest,System.Boolean)~System.Threading.Tasks.Task{System.Tuple{Microsoft.Azure.Documents.PartitionKeyRangeIdentity,Microsoft.Azure.Documents.PartitionAddressInformation}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.GatewayAddressCache.TryGetAddressesAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.PartitionKeyRangeIdentity,Microsoft.Azure.Documents.ServiceIdentity,System.Boolean,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.PartitionAddressInformation}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.GatewayAddressCache.ValidateReplicaAddresses(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Documents.TransportAddressUri})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.GlobalAddressResolver.OpenConnectionsToAllReplicasAsync(System.String,System.String,System.Threading.CancellationToken)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.GlobalEndpointManager.GetAccountPropertiesHelper.GetAccountPropertiesAsync~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.AccountProperties}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.GlobalEndpointManager.GetAccountPropertiesHelper.GetOnlyGlobalEndpointAsync~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.AccountProperties}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.GlobalEndpointManager.InitializeAccountPropertiesAndStartBackgroundRefresh(Microsoft.Azure.Cosmos.AccountProperties)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.GlobalPartitionEndpointManagerCore.#ctor(Microsoft.Azure.Cosmos.Routing.IGlobalEndpointManager,System.Boolean,System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.GlobalPartitionEndpointManagerCore.InitializeAndStartCircuitBreakerFailbackBackgroundRefresh")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.GlobalPartitionEndpointManagerCore.IsRequestEligibleForPartitionFailover(Microsoft.Azure.Documents.DocumentServiceRequest,System.Boolean,Microsoft.Azure.Documents.PartitionKeyRange@,System.Uri@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.InvalidPartitionExceptionRetryPolicy.ShouldRetryInternal(System.Nullable{System.Net.HttpStatusCode},System.Nullable{Microsoft.Azure.Documents.SubStatusCodes},System.String)~Microsoft.Azure.Documents.ShouldRetryResult")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.LocationCache.GetApplicableRegions(System.Collections.Generic.IEnumerable{System.String},System.Boolean)~System.Collections.ObjectModel.ReadOnlyCollection{System.String}")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.NonRetriableInvalidPartitionExceptionRetryPolicy.#ctor(Microsoft.Azure.Cosmos.Common.CollectionCache,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.NonRetriableInvalidPartitionExceptionRetryPolicy.#ctor(Microsoft.Azure.Cosmos.Common.CollectionCache,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.NonRetriableInvalidPartitionExceptionRetryPolicy.ShouldRetryAsync(Microsoft.Azure.Cosmos.ResponseMessage,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.ShouldRetryResult}")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.PartitionKeyRangeCache.ExecutePartitionKeyRangeReadChangeFeedAsync(System.String,Microsoft.Azure.Documents.Collections.INameValueCollection,Microsoft.Azure.Cosmos.Tracing.ITrace,Microsoft.Azure.Documents.IClientSideRequestStatistics,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.DocumentServiceResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.PartitionKeyRangeCache.ExecutePartitionKeyRangeReadChangeFeedAsync(System.String,Microsoft.Azure.Documents.Collections.INameValueCollection,Microsoft.Azure.Cosmos.Tracing.ITrace,Microsoft.Azure.Documents.IClientSideRequestStatistics,Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.DocumentServiceResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.PartitionKeyRangeCache.GetRoutingMapForCollectionAsync(System.String,Microsoft.Azure.Cosmos.Routing.CollectionRoutingMap,Microsoft.Azure.Cosmos.Tracing.ITrace,Microsoft.Azure.Documents.IClientSideRequestStatistics)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.Routing.CollectionRoutingMap}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.PartitionKeyRangeCache.TryLookupAsync(System.String,Microsoft.Azure.Cosmos.Routing.CollectionRoutingMap,Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Cosmos.Tracing.ITrace)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.Routing.CollectionRoutingMap}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.PartitionRoutingHelper.ExtractPartitionKeyRangeFromContinuationToken(Microsoft.Azure.Documents.Collections.INameValueCollection,System.Collections.Generic.List{Microsoft.Azure.Cosmos.Routing.CompositeContinuationToken}@)~Microsoft.Azure.Documents.Routing.Range{System.String}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.PartitionRoutingHelper.GetProvidedPartitionKeyRanges(System.String,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,Microsoft.Azure.Documents.PartitionKeyDefinition,Microsoft.Azure.Cosmos.VectorEmbeddingPolicy,Microsoft.Azure.Cosmos.Query.Core.QueryPlan.QueryPartitionProvider,System.String,Microsoft.Azure.Cosmos.GeospatialType,Microsoft.Azure.Cosmos.Query.Core.QueryPlan.QueryInfo@)~System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Documents.Routing.Range{System.String}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.PartitionRoutingHelper.Min``1(System.Collections.Generic.IReadOnlyList{``0},System.Collections.Generic.IComparer{``0})~``0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.PartitionRoutingHelper.MinAfter``1(System.Collections.Generic.IReadOnlyList{``0},``0,System.Collections.Generic.IComparer{``0})~``0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.PartitionRoutingHelper.MinBefore(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Documents.PartitionKeyRange},Microsoft.Azure.Documents.PartitionKeyRange)~Microsoft.Azure.Documents.PartitionKeyRange")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.PathParser.GetEscapedToken(System.String,System.Int32@)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.PathParser.GetPathParts(System.String)~System.Collections.Generic.IReadOnlyList{System.String}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.RangeJsonConverter.ReadJson(Newtonsoft.Json.JsonReader,System.Type,System.Object,Newtonsoft.Json.JsonSerializer)~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Routing.RangeJsonConverter.WriteJson(Newtonsoft.Json.JsonWriter,System.Object,Newtonsoft.Json.JsonSerializer)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Scripts.ScriptsCore.CreateTriggerStreamAsync(Microsoft.Azure.Cosmos.Scripts.TriggerProperties,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Scripts.ScriptsCore.CreateUserDefinedFunctionStreamAsync(Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionProperties,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Scripts.ScriptsCore.DeleteStoredProcedureStreamAsync(System.String,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Scripts.ScriptsCore.DeleteTriggerStreamAsync(System.String,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Scripts.ScriptsCore.DeleteUserDefinedFunctionStreamAsync(System.String,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Scripts.ScriptsCore.ExecuteStoredProcedureStreamAsync(System.String,System.IO.Stream,Microsoft.Azure.Cosmos.PartitionKey,Microsoft.Azure.Cosmos.Scripts.StoredProcedureRequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Scripts.ScriptsCore.GetStoredProcedureQueryIterator``1(Microsoft.Azure.Cosmos.QueryDefinition,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)~Microsoft.Azure.Cosmos.FeedIterator{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Scripts.ScriptsCore.GetTriggerQueryIterator``1(Microsoft.Azure.Cosmos.QueryDefinition,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)~Microsoft.Azure.Cosmos.FeedIterator{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Scripts.ScriptsCore.GetUserDefinedFunctionQueryIterator``1(Microsoft.Azure.Cosmos.QueryDefinition,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)~Microsoft.Azure.Cosmos.FeedIterator{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Scripts.ScriptsCore.ReadStoredProcedureStreamAsync(System.String,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Scripts.ScriptsCore.ReadTriggerStreamAsync(System.String,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Scripts.ScriptsCore.ReadUserDefinedFunctionStreamAsync(System.String,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Scripts.ScriptsCore.ReplaceTriggerStreamAsync(Microsoft.Azure.Cosmos.Scripts.TriggerProperties,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Scripts.ScriptsCore.ReplaceUserDefinedFunctionStreamAsync(Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionProperties,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SecureStringHMACSHA256Helper.#ctor(System.Security.SecureString)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SecureStringHMACSHA256Helper.AddData(System.IntPtr,System.ArraySegment{System.Byte})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SecureStringHMACSHA256Helper.FinishHash(System.IntPtr)~System.Byte[]")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SecureStringHMACSHA256Helper.InitializeBCryptHash(System.Security.SecureString,System.Int32,System.IntPtr@)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SecureStringUtility.ConvertToSecureString(System.String)~System.Security.SecureString")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Serializer.CosmosBufferedStreamWrapper.#ctor(Microsoft.Azure.Documents.CloneableStream,System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Serializer.CosmosBufferedStreamWrapper.Read(System.Byte[],System.Int32,System.Int32)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Serializer.CosmosLinqSerializerOptionsInternal.Create(Microsoft.Azure.Cosmos.CosmosLinqSerializerOptions,Microsoft.Azure.Cosmos.CosmosSerializer)~Microsoft.Azure.Cosmos.Serializer.CosmosLinqSerializerOptionsInternal")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Serializer.JsonSerializationFormatOptions.CustomJsonSerializationFormatOptions.#ctor(Microsoft.Azure.Cosmos.Json.JsonSerializationFormat,Microsoft.Azure.Cosmos.Serializer.JsonSerializationFormatOptions.CreateNavigator)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ServiceFramework.Core.SystemSynchronizationScope.#ctor(System.String,System.TimeSpan)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ServiceFramework.Core.SystemSynchronizationScope.ExecuteWithSynchronization``1(System.String,System.Func{``0},System.TimeSpan)~``0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ServicePointAccessor.#ctor(System.Net.ServicePoint)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.BoundingBox.#ctor(Microsoft.Azure.Cosmos.Spatial.Position,Microsoft.Azure.Cosmos.Spatial.Position)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.Converters.BoundingBoxJsonConverter.ReadJson(Newtonsoft.Json.JsonReader,System.Type,System.Object,Newtonsoft.Json.JsonSerializer)~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.Converters.CrsJsonConverter.ReadJson(Newtonsoft.Json.JsonReader,System.Type,System.Object,Newtonsoft.Json.JsonSerializer)~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.Converters.GeometryJsonConverter.ReadJson(Newtonsoft.Json.JsonReader,System.Type,System.Object,Newtonsoft.Json.JsonSerializer)~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.Converters.GeometryJsonConverter.WriteJson(Newtonsoft.Json.JsonWriter,System.Object,Newtonsoft.Json.JsonSerializer)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.Converters.PositionJsonConverter.ReadJson(Newtonsoft.Json.JsonReader,System.Type,System.Object,Newtonsoft.Json.JsonSerializer)~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.Geometry.#ctor(Microsoft.Azure.Cosmos.Spatial.GeometryType,Microsoft.Azure.Cosmos.Spatial.GeometryParams)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.Geometry.Distance(Microsoft.Azure.Cosmos.Spatial.Geometry)~System.Double")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.Geometry.Intersects(Microsoft.Azure.Cosmos.Spatial.Geometry)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.Geometry.IsValid~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.Geometry.IsValidDetailed~Microsoft.Azure.Cosmos.Spatial.GeometryValidationResult")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.Geometry.Within(Microsoft.Azure.Cosmos.Spatial.Geometry)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.GeometryCollection.#ctor(System.Collections.Generic.IList{Microsoft.Azure.Cosmos.Spatial.Geometry},Microsoft.Azure.Cosmos.Spatial.GeometryParams)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.LinearRing.#ctor(System.Collections.Generic.IList{Microsoft.Azure.Cosmos.Spatial.Position})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.LineString.#ctor(System.Collections.Generic.IList{Microsoft.Azure.Cosmos.Spatial.Position},Microsoft.Azure.Cosmos.Spatial.GeometryParams)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.LineStringCoordinates.#ctor(System.Collections.Generic.IList{Microsoft.Azure.Cosmos.Spatial.Position})")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.LinkedCrs.#ctor(System.String,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.LinkedCrs.#ctor(System.String,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.MultiLineString.#ctor(System.Collections.Generic.IList{Microsoft.Azure.Cosmos.Spatial.LineStringCoordinates},Microsoft.Azure.Cosmos.Spatial.GeometryParams)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.MultiPoint.#ctor(System.Collections.Generic.IList{Microsoft.Azure.Cosmos.Spatial.Position},Microsoft.Azure.Cosmos.Spatial.GeometryParams)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.MultiPolygon.#ctor(System.Collections.Generic.IList{Microsoft.Azure.Cosmos.Spatial.PolygonCoordinates},Microsoft.Azure.Cosmos.Spatial.GeometryParams)")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.NamedCrs.#ctor(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.NamedCrs.#ctor(System.String)")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.Point.#ctor(Microsoft.Azure.Cosmos.Spatial.Position,Microsoft.Azure.Cosmos.Spatial.GeometryParams)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.Point.#ctor(Microsoft.Azure.Cosmos.Spatial.Position,Microsoft.Azure.Cosmos.Spatial.GeometryParams)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.Polygon.#ctor(System.Collections.Generic.IList{Microsoft.Azure.Cosmos.Spatial.LinearRing},Microsoft.Azure.Cosmos.Spatial.GeometryParams)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.PolygonCoordinates.#ctor(System.Collections.Generic.IList{Microsoft.Azure.Cosmos.Spatial.LinearRing})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Spatial.Position.#ctor(System.Collections.Generic.IList{System.Double})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlAliasedCollectionExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlCollection,Microsoft.Azure.Cosmos.SqlObjects.SqlIdentifier)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlAllScalarExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlQuery)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlArrayCreateScalarExpression.#ctor(System.Collections.Immutable.ImmutableArray{Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlArrayIteratorCollectionExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlIdentifier,Microsoft.Azure.Cosmos.SqlObjects.SqlCollection)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlArrayScalarExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlQuery)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlBinaryScalarExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlBinaryScalarOperatorKind,Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression,Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlCoalesceScalarExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression,Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlConditionalScalarExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression,Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression,Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlExistsScalarExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlQuery)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlFirstScalarExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlQuery)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlFromClause.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlCollectionExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlFunctionCallScalarExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlIdentifier,System.Boolean,System.Collections.Immutable.ImmutableArray{Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlGroupByClause.#ctor(System.Collections.Immutable.ImmutableArray{Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlIdentifierPathExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlPathExpression,Microsoft.Azure.Cosmos.SqlObjects.SqlIdentifier)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlInputPathCollection.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlIdentifier,Microsoft.Azure.Cosmos.SqlObjects.SqlPathExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlInScalarExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression,System.Boolean,System.Collections.Immutable.ImmutableArray{Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlLastScalarExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlQuery)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlLikeScalarExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression,Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression,System.Boolean,Microsoft.Azure.Cosmos.SqlObjects.SqlStringLiteral)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlLimitSpec.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlLimitSpec.Create(Microsoft.Azure.Cosmos.SqlObjects.SqlNumberLiteral)~Microsoft.Azure.Cosmos.SqlObjects.SqlLimitSpec")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlLimitSpec.Create(Microsoft.Azure.Cosmos.SqlObjects.SqlParameter)~Microsoft.Azure.Cosmos.SqlObjects.SqlLimitSpec")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlLiteralScalarExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlLiteral)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlMemberIndexerScalarExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression,Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlObjectCreateScalarExpression.#ctor(System.Collections.Immutable.ImmutableArray{Microsoft.Azure.Cosmos.SqlObjects.SqlObjectProperty})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlObjectProperty.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlPropertyName,Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlOffsetLimitClause.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlOffsetSpec,Microsoft.Azure.Cosmos.SqlObjects.SqlLimitSpec)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlOffsetSpec.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlOffsetSpec.Create(Microsoft.Azure.Cosmos.SqlObjects.SqlNumberLiteral)~Microsoft.Azure.Cosmos.SqlObjects.SqlOffsetSpec")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlOffsetSpec.Create(Microsoft.Azure.Cosmos.SqlObjects.SqlParameter)~Microsoft.Azure.Cosmos.SqlObjects.SqlOffsetSpec")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlOrderByClause.#ctor(System.Boolean,System.Collections.Immutable.ImmutableArray{Microsoft.Azure.Cosmos.SqlObjects.SqlOrderByItem})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlOrderByItem.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression,System.Nullable{System.Boolean})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlParameter.#ctor(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlParameterRefScalarExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlParameter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlProgram.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlQuery)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlPropertyName.#ctor(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlPropertyRefScalarExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression,Microsoft.Azure.Cosmos.SqlObjects.SqlIdentifier)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlQuery.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlSelectClause,Microsoft.Azure.Cosmos.SqlObjects.SqlFromClause,Microsoft.Azure.Cosmos.SqlObjects.SqlWhereClause,Microsoft.Azure.Cosmos.SqlObjects.SqlGroupByClause,Microsoft.Azure.Cosmos.SqlObjects.SqlOrderByClause,Microsoft.Azure.Cosmos.SqlObjects.SqlOffsetLimitClause)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlSelectClause.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlSelectSpec,Microsoft.Azure.Cosmos.SqlObjects.SqlTopSpec,System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlSelectItem.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression,Microsoft.Azure.Cosmos.SqlObjects.SqlIdentifier)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlSelectListSpec.#ctor(System.Collections.Immutable.ImmutableArray{Microsoft.Azure.Cosmos.SqlObjects.SqlSelectItem})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlSelectValueSpec.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlStringLiteral.#ctor(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlStringPathExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlPathExpression,Microsoft.Azure.Cosmos.SqlObjects.SqlStringLiteral)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlSubqueryCollection.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlQuery)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlSubqueryScalarExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlQuery)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlTopSpec.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlTopSpec.Create(Microsoft.Azure.Cosmos.SqlObjects.SqlNumberLiteral)~Microsoft.Azure.Cosmos.SqlObjects.SqlTopSpec")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlTopSpec.Create(Microsoft.Azure.Cosmos.SqlObjects.SqlParameter)~Microsoft.Azure.Cosmos.SqlObjects.SqlTopSpec")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlUnaryScalarExpression.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlUnaryScalarOperatorKind,Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.SqlWhereClause.#ctor(Microsoft.Azure.Cosmos.SqlObjects.SqlScalarExpression)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.Visitors.SqlObjectHasher.SqlBinaryScalarOperatorKindGetHashCode(Microsoft.Azure.Cosmos.SqlObjects.SqlBinaryScalarOperatorKind)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.Visitors.SqlObjectHasher.SqlUnaryScalarOperatorKindGetHashCode(Microsoft.Azure.Cosmos.SqlObjects.SqlUnaryScalarOperatorKind)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.Visitors.SqlObjectTextSerializer.SqlBinaryScalarOperatorKindToString(Microsoft.Azure.Cosmos.SqlObjects.SqlBinaryScalarOperatorKind)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.Visitors.SqlObjectTextSerializer.SqlUnaryScalarOperatorKindToString(Microsoft.Azure.Cosmos.SqlObjects.SqlUnaryScalarOperatorKind)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.Visitors.SqlObjectTextSerializer.Visit(Microsoft.Azure.Cosmos.SqlObjects.SqlSelectListSpec)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.SqlObjects.Visitors.SqlObjectTextSerializer.WriteNumber64(System.Text.StringBuilder,Microsoft.Azure.Cosmos.Number64)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.StoredProcedureResponse`1.#ctor(Microsoft.Azure.Documents.DocumentServiceResponse,Newtonsoft.Json.JsonSerializerSettings)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.StoreResponseHeaders.#ctor(Microsoft.Azure.Documents.Collections.StoreResponseNameValueCollection)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Telemetry.ClientTelemetry.#ctor(System.String,Microsoft.Azure.Cosmos.CosmosHttpClient,System.String,Microsoft.Azure.Cosmos.ConnectionMode,Microsoft.Azure.Cosmos.AuthorizationTokenProvider,Microsoft.Azure.Cosmos.Handler.DiagnosticsHandlerHelper,System.Collections.Generic.IReadOnlyList{System.String},Microsoft.Azure.Cosmos.Routing.GlobalEndpointManager,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Telemetry.ClientTelemetry.PushCacheDatapoint(System.String,Microsoft.Azure.Cosmos.Telemetry.Collector.TelemetryInformation)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Telemetry.ClientTelemetryPayloadWriter.SerializedPayloadChunksAsync(Microsoft.Azure.Cosmos.Telemetry.Models.ClientTelemetryProperties,System.Collections.Concurrent.ConcurrentDictionary{Microsoft.Azure.Cosmos.Telemetry.Models.OperationInfo,System.ValueTuple{HdrHistogram.LongConcurrentHistogram,HdrHistogram.LongConcurrentHistogram}},System.Collections.Concurrent.ConcurrentDictionary{Microsoft.Azure.Cosmos.Telemetry.Models.CacheRefreshInfo,HdrHistogram.LongConcurrentHistogram},System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Cosmos.Telemetry.Models.RequestInfo},System.Func{System.String,System.Threading.Tasks.Task})~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Telemetry.ClientTelemetryProcessor.#ctor(Microsoft.Azure.Cosmos.CosmosHttpClient,Microsoft.Azure.Cosmos.AuthorizationTokenProvider)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Telemetry.OpenTelemetryCoreRecorder.#ctor(Azure.Core.DiagnosticScope,System.String,System.String,System.String,Microsoft.Azure.Documents.OperationType,Microsoft.Azure.Cosmos.CosmosClientContext,Microsoft.Azure.Cosmos.CosmosThresholdOptions,Microsoft.Azure.Cosmos.QueryTextMode)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Tests.Pagination.ReadFeedPartitionRangeEnumerator.#ctor(Microsoft.Azure.Cosmos.ReadFeed.Pagination.IReadFeedDataSource,Microsoft.Azure.Cosmos.Pagination.FeedRangeState{Microsoft.Azure.Cosmos.ReadFeed.Pagination.ReadFeedState},Microsoft.Azure.Cosmos.ReadFeed.Pagination.ReadFeedExecutionOptions)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ThinClientStoreClient.ObjectPool`1.#ctor(System.Func{`0})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ThinClientStoreClient.PrepareRequestForProxyAsync(Microsoft.Azure.Documents.DocumentServiceRequest,System.Uri,System.Uri,System.String,Microsoft.Azure.Cosmos.Routing.ClientCollectionCache)~System.Threading.Tasks.ValueTask{System.Net.Http.HttpRequestMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ThinClientStoreModel.GetDatabaseAccountPropertiesAsync~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.AccountProperties}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ThinClientStoreModel.ProcessMessageAsync(Microsoft.Azure.Documents.DocumentServiceRequest,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.DocumentServiceResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ThinClientTransportSerializer.ConvertProxyResponseAsync(System.Net.Http.HttpResponseMessage)~System.Threading.Tasks.Task{System.Net.Http.HttpResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ThinClientTransportSerializer.ReadBodyLengthAsync(System.IO.Stream)~System.Threading.Tasks.Task{System.Int32}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ThinClientTransportSerializer.ReadHeaderAndMetadataAsync(System.IO.Stream)~System.Threading.Tasks.Task{System.ValueTuple{Microsoft.Azure.Documents.StatusCodes,System.Byte[]}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ThinClientTransportSerializer.SerializeProxyRequestAsync(Microsoft.Azure.Cosmos.ThinClientTransportSerializer.BufferProviderWrapper,System.String,Microsoft.Azure.Cosmos.Routing.ClientCollectionCache,System.Net.Http.HttpRequestMessage)~System.Threading.Tasks.Task{System.IO.Stream}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ThroughputProperties.CreateAutoscaleThroughput(System.Int32)~Microsoft.Azure.Cosmos.ThroughputProperties")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ThroughputProperties.CreateManualThroughput(System.Int32)~Microsoft.Azure.Cosmos.ThroughputProperties")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Timers.TimerWheelCore.#ctor(System.Double,System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Timers.TimerWheelCore.CreateTimer(System.TimeSpan)~Microsoft.Azure.Cosmos.TimerWheelTimer")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Timers.TimerWheelCore.ThrowIfDisposed")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Timers.TimerWheelTimerCore.#ctor(System.TimeSpan,Microsoft.Azure.Cosmos.TimerWheel)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Timers.TimerWheelTimerCore.StartTimerAsync~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.TokenCredentialCache.#ctor(Azure.Core.TokenCredential,System.Uri,System.Nullable{System.TimeSpan})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.TokenCredentialCache.GetTokenAsync(Microsoft.Azure.Cosmos.Tracing.ITrace)~System.Threading.Tasks.ValueTask{System.String}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.TokenCredentialCache.RefreshCachedTokenWithRetryHelperAsync(Microsoft.Azure.Cosmos.Tracing.ITrace)~System.Threading.Tasks.ValueTask{Azure.Core.AccessToken}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.TokenCredentialCache.StartBackgroundTokenRefreshLoop")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Tracing.CallerInfo.#ctor(System.String,System.String,System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Tracing.Trace.#ctor(System.String,Microsoft.Azure.Cosmos.Tracing.TraceLevel,Microsoft.Azure.Cosmos.Tracing.TraceComponent,Microsoft.Azure.Cosmos.Tracing.Trace,Microsoft.Azure.Cosmos.Tracing.TraceSummary)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Tracing.TraceData.ClientSideRequestStatisticsTraceDatum.AddressResolutionStatistics.#ctor(System.DateTime,System.DateTime,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Tracing.TraceData.ClientSideRequestStatisticsTraceDatum.AppendToBuilder(System.Text.StringBuilder)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Tracing.TraceData.ClientSideRequestStatisticsTraceDatum.RecordAddressResolutionEnd(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Tracing.TraceData.CpuHistoryTraceDatum.#ctor(Microsoft.Azure.Documents.Rntbd.SystemUsageHistory)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Tracing.TraceData.QueryMetricsTraceDatum.#ctor(System.Lazy{Microsoft.Azure.Cosmos.Query.Core.Metrics.QueryMetrics})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Tracing.TraceWriter.TraceDatumJsonWriter.#ctor(Microsoft.Azure.Cosmos.Json.IJsonWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Tracing.TraceWriter.TraceDatumJsonWriter.Visit(Microsoft.Azure.Cosmos.Tracing.TraceData.ClientConfigurationTraceDatum)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Tracing.TraceWriter.TraceDatumJsonWriter.Visit(Microsoft.Azure.Cosmos.Tracing.TraceData.CpuHistoryTraceDatum)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Tracing.TraceWriter.TraceDatumJsonWriter.VisitTransportRequestStats(Microsoft.Azure.Documents.TransportRequestStats)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Tracing.TraceWriter.TraceJsonWriter.WriteTrace(Microsoft.Azure.Cosmos.Json.IJsonWriter,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Tracing.TraceWriter.TraceTextWriter.WriteTrace(System.IO.TextWriter,Microsoft.Azure.Cosmos.Tracing.ITrace,Microsoft.Azure.Cosmos.Tracing.TraceLevel,Microsoft.Azure.Cosmos.Tracing.TraceWriter.AsciiType)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.UInt128.CompareTo(System.Object)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.UInt128.FromByteArray(System.ReadOnlySpan{System.Byte})~Microsoft.Azure.Cosmos.UInt128")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.UInt128.op_Division(Microsoft.Azure.Cosmos.UInt128,Microsoft.Azure.Cosmos.UInt128)~Microsoft.Azure.Cosmos.UInt128")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.UInt128.op_Multiply(Microsoft.Azure.Cosmos.UInt128,Microsoft.Azure.Cosmos.UInt128)~Microsoft.Azure.Cosmos.UInt128")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.UInt128.TryParse(System.String,Microsoft.Azure.Cosmos.UInt128@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.UserCore.CreatePermissionAsync(Microsoft.Azure.Cosmos.PermissionProperties,System.Nullable{System.Int32},Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.PermissionResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.UserCore.CreatePermissionStreamAsync(Microsoft.Azure.Cosmos.PermissionProperties,System.Nullable{System.Int32},Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.UserCore.GetPermission(System.String)~Microsoft.Azure.Cosmos.Permission")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.UserCore.GetPermissionQueryIterator``1(Microsoft.Azure.Cosmos.QueryDefinition,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)~Microsoft.Azure.Cosmos.FeedIterator{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.UserCore.ReplaceAsync(Microsoft.Azure.Cosmos.UserProperties,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.UserResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.UserCore.ReplaceStreamAsync(Microsoft.Azure.Cosmos.UserProperties,Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.ResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.UserCore.UpsertPermissionAsync(Microsoft.Azure.Cosmos.PermissionProperties,System.Nullable{System.Int32},Microsoft.Azure.Cosmos.RequestOptions,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Cosmos.PermissionResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Util.HashingExtension.ComputeHash(System.String)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.ValidationHelpers.IsValidConsistencyLevelOverwrite(Microsoft.Azure.Documents.ConsistencyLevel,Microsoft.Azure.Documents.ConsistencyLevel)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.VersionedAndRidCheckedCompositeToken.#ctor(Microsoft.Azure.Cosmos.VersionedAndRidCheckedCompositeToken.Version,Microsoft.Azure.Cosmos.CosmosElements.CosmosElement,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.VersionedAndRidCheckedCompositeToken.MonadicCreateFromCosmosElement(Microsoft.Azure.Cosmos.CosmosElements.CosmosElement)~Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch{Microsoft.Azure.Cosmos.VersionedAndRidCheckedCompositeToken}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.WebExceptionRetryPolicy.ShouldRetryAsync(Microsoft.Azure.Cosmos.ResponseMessage,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.ShouldRetryResult}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.AddressEnumerator.GetTransportAddresses(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Documents.TransportAddressUri})~System.Collections.Generic.IEnumerable{Microsoft.Azure.Documents.TransportAddressUri}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.AddressEnumerator.GetTransportAddresses(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Documents.TransportAddressUri},System.Lazy{System.Collections.Concurrent.ConcurrentDictionary{Microsoft.Azure.Documents.TransportAddressUri,System.Boolean}},System.Boolean)~System.Collections.Generic.IEnumerable{Microsoft.Azure.Documents.TransportAddressUri}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Attachment.GetProperty(System.String,System.Type)~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.BackoffRetryUtility`1.ExecuteRetryAsync``2(System.Func{System.Threading.Tasks.Task{`0}},System.Func{``0,System.Threading.CancellationToken,System.Threading.Tasks.Task{`0}},System.Func{``1,System.Threading.Tasks.Task{`0}},``0,Microsoft.Azure.Documents.IRetryPolicy,Microsoft.Azure.Documents.IRetryPolicy{``1},System.Func{System.Threading.Tasks.Task{`0}},System.Func{``1,System.Threading.Tasks.Task{`0}},System.TimeSpan,System.Threading.CancellationToken,System.Action{System.Exception})~System.Threading.Tasks.Task{`0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.BarrierRequestHelper.CreateAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.IAuthorizationTokenProvider,System.Nullable{System.Int64},System.Nullable{System.Int64},System.Boolean)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.DocumentServiceRequest}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ClientSideRequestStatistics.AddressResolutionStatistics.AppendToBuilder(System.Text.StringBuilder)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ClientSideRequestStatistics.AppendToBuilder(System.Text.StringBuilder)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ClientSideRequestStatistics.HttpResponseStatistics.AppendToBuilder(System.Text.StringBuilder)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ClientSideRequestStatistics.RecordAddressResolutionEnd(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ClientSideRequestStatistics.StoreResponseStatistics.AppendToBuilder(System.Text.StringBuilder)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.CloneableStream.CloneStream~System.IO.MemoryStream")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.CloneableStream.GetBuffer~System.ArraySegment{System.Byte}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Collections.DictionaryNameValueCollection.#ctor(Microsoft.Azure.Documents.Collections.INameValueCollection)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Collections.DictionaryNameValueCollection.#ctor(System.Collections.Specialized.NameValueCollection)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Collections.DictionaryNameValueCollection.Add(Microsoft.Azure.Documents.Collections.INameValueCollection)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Collections.NameValueCollectionWrapper.#ctor(Microsoft.Azure.Documents.Collections.INameValueCollection)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Collections.NameValueCollectionWrapper.Add(Microsoft.Azure.Documents.Collections.INameValueCollection)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Collections.RequestNameValueCollection.Add(Microsoft.Azure.Documents.Collections.INameValueCollection)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Collections.RequestNameValueCollection.Add(System.String,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Collections.RequestNameValueCollection.Get(System.String)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Collections.RequestNameValueCollection.Remove(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Collections.RequestNameValueCollection.Set(System.String,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Collections.RequestNameValueCollection.UpdateHelper(System.String,System.String,System.Boolean,System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Collections.StoreResponseNameValueCollection.Add(Microsoft.Azure.Documents.Collections.INameValueCollection)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Collections.StoreResponseNameValueCollection.Add(System.String,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Collections.StoreResponseNameValueCollection.Get(System.String)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Collections.StoreResponseNameValueCollection.Remove(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Collections.StoreResponseNameValueCollection.Set(System.String,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Collections.StoreResponseNameValueCollection.UpdateHelper(System.String,System.String,System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Conflict.GetResource``1~``0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Conflict.SetResource``1(``0)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ConnectionHealthChecker.#ctor(System.TimeSpan,System.TimeSpan,System.TimeSpan)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ConnectionStateMuxListener.OnConnectionEventAsync(Microsoft.Azure.Documents.ConnectionEvent,System.DateTime,Microsoft.Azure.Documents.Rntbd.ServerKey)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ConnectionStateMuxListener.Register(Microsoft.Azure.Documents.Rntbd.ServerKey,System.Func{Microsoft.Azure.Documents.Rntbd.ServerKey,System.Threading.Tasks.Task})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ConnectionStateMuxListener.UnRegister(Microsoft.Azure.Documents.Rntbd.ServerKey,System.Func{Microsoft.Azure.Documents.Rntbd.ServerKey,System.Threading.Tasks.Task})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ConsistencyReader.DeduceReadMode(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.ConsistencyLevel@,System.Boolean@)~Microsoft.Azure.Documents.ReadMode")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ConsistencyReader.ReadAnyAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.ReadMode)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.StoreResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ConsistencyReader.ReadAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.TimeoutHelper,System.Boolean,System.Boolean,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.StoreResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ConsistencyReader.ReadSessionAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.ReadMode)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.StoreResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ConsistencyWriter.WritePrivateAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.TimeoutHelper,System.Boolean)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.StoreResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Document.GetProperty(System.String,System.Type)~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.DocumentServiceRequest.#ctor(Microsoft.Azure.Documents.OperationType,Microsoft.Azure.Documents.ResourceType,System.String,System.IO.Stream,Microsoft.Azure.Documents.AuthorizationTokenType,Microsoft.Azure.Documents.Collections.INameValueCollection)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.DocumentServiceRequest.Clone(System.Boolean)~Microsoft.Azure.Documents.DocumentServiceRequest")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.DocumentServiceRequest.InitializeWithDataParsedFromUri(System.String,System.Boolean,System.Boolean,System.String,System.String,System.String,System.String,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.DocumentServiceRequest.RouteTo(Microsoft.Azure.Documents.PartitionKeyRangeIdentity)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.DocumentServiceRequest.RouteTo(Microsoft.Azure.Documents.ServiceIdentity)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.DocumentServiceResponse.Create(System.IO.Stream)~Newtonsoft.Json.JsonReader")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.GoneAndRetryWithRequestRetryPolicy`1.#ctor(System.Boolean,System.Nullable{System.Int32},System.TimeSpan,System.Boolean,Microsoft.Azure.Documents.RetryWithConfiguration)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.GoneAndRetryWithRequestRetryPolicy`1.ShouldRetryAsync(Microsoft.Azure.Documents.DocumentServiceRequest,`0,System.Exception,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.ShouldRetryResult}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.GoneOnlyRequestRetryPolicy`1.ShouldRetryAsync(Microsoft.Azure.Documents.DocumentServiceRequest,`0,System.Exception,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.ShouldRetryResult}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Helpers.GetAppSpecificUserAgentSuffix(System.String,System.String)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Helpers.GetEnvironmentVariable``1(System.String,``0)~``0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Helpers.ValidateEnumProperties``1(``0)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Helpers.ValidateNonNegativeInteger(System.String,System.Int32)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Helpers.ValidatePositiveInteger(System.String,System.Int32)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.HttpClientExtension.GetHttpAsync(System.Net.Http.HttpClient,System.Uri,System.Threading.CancellationToken)~System.Threading.Tasks.Task{System.Net.Http.HttpResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.HttpClientExtension.SendHttpAsync(System.Net.Http.HttpClient,System.Net.Http.HttpRequestMessage,System.Net.Http.HttpCompletionOption,System.Threading.CancellationToken)~System.Threading.Tasks.Task{System.Net.Http.HttpResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.HttpClientExtension.SendHttpAsync(System.Net.Http.HttpClient,System.Net.Http.HttpRequestMessage,System.Threading.CancellationToken)~System.Threading.Tasks.Task{System.Net.Http.HttpResponseMessage}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.HttpTransportClient.CreateErrorResponseFromHttpResponse(System.String,System.String,System.Net.Http.HttpResponseMessage,Microsoft.Azure.Documents.DocumentServiceRequest)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.StoreResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.HttpTransportClient.GetResourceEntryUri(Microsoft.Azure.Documents.ResourceType,System.Uri,Microsoft.Azure.Documents.DocumentServiceRequest)~System.Uri")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.HttpTransportClient.GetResourceFeedUri(Microsoft.Azure.Documents.ResourceType,System.Uri,Microsoft.Azure.Documents.DocumentServiceRequest)~System.Uri")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.HttpTransportClient.GetSubsStatusFromHeader(System.Net.Http.HttpResponseMessage)~System.UInt32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.HttpTransportClient.GetSystemResourceUri(Microsoft.Azure.Documents.ResourceType,System.Uri,Microsoft.Azure.Documents.DocumentServiceRequest)~System.Uri")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.HttpTransportClient.InvokeStoreAsync(System.Uri,Microsoft.Azure.Documents.ResourceOperation,Microsoft.Azure.Documents.DocumentServiceRequest)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.StoreResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.HttpTransportClient.PrepareHttpMessage(System.Guid,System.Uri,Microsoft.Azure.Documents.ResourceOperation,Microsoft.Azure.Documents.DocumentServiceRequest)~System.Net.Http.HttpRequestMessage")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.HttpTransportClient.ProcessHttpResponse(System.String,System.String,System.Net.Http.HttpResponseMessage,System.Uri,Microsoft.Azure.Documents.DocumentServiceRequest)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.StoreResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.HttpUtility.UrlDecode(System.Byte[],System.Int32,System.Int32,System.Text.Encoding)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.HttpUtility.UrlDecodeToBytes(System.Byte[],System.Int32,System.Int32)~System.Byte[]")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.HttpUtility.UrlEncodeToBytes(System.Byte[],System.Int32,System.Int32)~System.Byte[]")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.InAccountRestoreParameters.Validate")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.IndexingDirectiveStrings.FromIndexingDirective(Microsoft.Azure.Documents.IndexingDirective)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.IndexingPolicy.#ctor(Microsoft.Azure.Documents.Index[])")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.IndexingPolicy.IndexEqualityComparer.Equals(Microsoft.Azure.Documents.Index,Microsoft.Azure.Documents.Index)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.IndexingPolicy.IndexEqualityComparer.GetHashCode(Microsoft.Azure.Documents.Index)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.IndexJsonConverter.ReadJson(Newtonsoft.Json.JsonReader,System.Type,System.Object,Newtonsoft.Json.JsonSerializer)~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.IndexJsonConverter.WriteJson(Newtonsoft.Json.JsonWriter,System.Object,Newtonsoft.Json.JsonSerializer)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.JsonSerializable.GetEnumValue``1(System.String)~System.Nullable{``0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.JsonSerializable.GetObjectWithResolver``1(System.String,Microsoft.Azure.Documents.ITypeResolver{``0},System.Boolean)~``0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.JsonSerializable.GetValueByPath``1(System.String[],``0)~``0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.JsonSerializable.LoadFrom(Newtonsoft.Json.JsonReader)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.JsonSerializable.LoadFrom(Newtonsoft.Json.JsonReader,Newtonsoft.Json.JsonSerializerSettings)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.JsonSerializable.LoadFrom``1(System.IO.Stream,Microsoft.Azure.Documents.ITypeResolver{``0},Newtonsoft.Json.JsonSerializerSettings)~``0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.JsonSerializable.LoadFrom``1(System.String,Microsoft.Azure.Documents.ITypeResolver{``0},Newtonsoft.Json.JsonSerializerSettings)~``0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.JsonSerializable.LoadFromWithConstructor``1(System.IO.Stream,System.Func{``0},Newtonsoft.Json.JsonSerializerSettings)~``0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.JsonSerializable.LoadFromWithResolver``1(System.IO.Stream,Microsoft.Azure.Documents.ITypeResolver{``0},Newtonsoft.Json.JsonSerializerSettings)~``0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.JsonSerializable.LoadFromWithResolver``1(System.String,Microsoft.Azure.Documents.ITypeResolver{``0},Newtonsoft.Json.JsonSerializerSettings)~``0")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.JsonSerializable.SaveTo(Newtonsoft.Json.JsonWriter,Newtonsoft.Json.JsonSerializer,Microsoft.Azure.Documents.SerializationFormattingPolicy)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.JsonSerializable.SaveTo(System.IO.Stream,Microsoft.Azure.Documents.SerializationFormattingPolicy,Newtonsoft.Json.JsonSerializerSettings)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.JsonSerializable.SaveTo(System.Text.StringBuilder,Microsoft.Azure.Documents.SerializationFormattingPolicy)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.JsonSerializable.SetValueByPath``1(System.String[],``0)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.JsonSerializableList`1.LoadFrom(System.String)~System.Collections.Generic.List{`0}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.MathUtils.CeilingMultiple(System.Int32,System.Int32)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.NativeMethods.Darwin.GetKernelRelease~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.NativeMethods.Unix.GetUname~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.NetUtil.GetLocalEmulatorIpV4Address~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.NetUtil.GetNonLoopbackIpV4Address~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.OfferTypeResolver.Microsoft#Azure#Documents#ITypeResolver#Resolve(Newtonsoft.Json.Linq.JObject)~Microsoft.Azure.Documents.Offer")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.PartitionAddressInformation.#ctor(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Documents.AddressInformation},System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.PartitionKey.FromInternalKey(Microsoft.Azure.Documents.Routing.PartitionKeyInternal)~Microsoft.Azure.Documents.PartitionKey")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.PartitionKey.FromJsonString(System.String)~Microsoft.Azure.Documents.PartitionKey")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.PartitionKeyRangeIdentity.#ctor(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.PartitionKeyRangeIdentity.#ctor(System.String)")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.PartitionKeyRangeIdentity.#ctor(System.String,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.PartitionKeyRangeIdentity.#ctor(System.String,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.PartitionKeyRangeIdentity.FromHeader(System.String)~Microsoft.Azure.Documents.PartitionKeyRangeIdentity")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.PathsHelper.GeneratePath(Microsoft.Azure.Documents.ResourceType,System.String,System.Boolean,Microsoft.Azure.Documents.OperationType)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.PathsHelper.GeneratePathForNameBased(Microsoft.Azure.Documents.ResourceType,System.String,System.Boolean,Microsoft.Azure.Documents.OperationType,System.Boolean)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.PathsHelper.GeneratePathForNameBased(System.Type,System.String,System.String)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.PathsHelper.GenerateRootOperationPath(Microsoft.Azure.Documents.OperationType)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.PathsHelper.GetResourcePath(Microsoft.Azure.Documents.ResourceType)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.PathsHelper.GetResourcePathSegment(System.String)~Microsoft.Azure.Documents.ResourceType")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.PathsHelper.ParseCollectionSelfLink(System.String,System.String@,System.String@)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.PerProtocolPartitionAddressInformation.#ctor(Microsoft.Azure.Documents.Client.Protocol,System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Documents.AddressInformation})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.PerProtocolPartitionAddressInformation.GetPrimaryAddressUri(Microsoft.Azure.Documents.DocumentServiceRequest)~Microsoft.Azure.Documents.TransportAddressUri")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.PooledTimer.StartTimerAsync~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.QueryResult.GetProperty(System.String,System.Type)~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.QuorumReader.ReadPrimaryAsync(Microsoft.Azure.Documents.DocumentServiceRequest,System.Int32,System.Boolean)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.QuorumReader.ReadPrimaryResult}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.QuorumReader.ReadResult.GetResponseAndSkipStoreResultDispose~Microsoft.Azure.Documents.StoreResponse")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.QuorumReader.ReadStrongAsync(Microsoft.Azure.Documents.DocumentServiceRequest,System.Int32,Microsoft.Azure.Documents.ReadMode)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.StoreResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ReferenceCountedDisposable`1.#ctor(`0,Microsoft.Azure.Documents.ReferenceCountedDisposable`1.BoxedReferenceCount)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.RegionProximityUtil.GeneratePreferredRegionList(System.String)~System.Collections.Generic.List{System.String}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.RegionProximityUtil.GetLinkTypeThresholdInMs(Microsoft.Azure.Documents.GeoLinkTypes)~System.Int64")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.RegionProximityUtil.GetRegionsForLinkType(Microsoft.Azure.Documents.GeoLinkTypes,System.Collections.Generic.List{System.String})~System.Collections.Generic.List{System.String}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.RegionProximityUtil.GetRegionsForLinkType(Microsoft.Azure.Documents.GeoLinkTypes,System.String)~System.Collections.Generic.List{System.String}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ReplicatedResourceClient.#ctor(Microsoft.Azure.Documents.IAddressResolver,Microsoft.Azure.Documents.ISessionContainer,Microsoft.Azure.Documents.Client.Protocol,Microsoft.Azure.Documents.TransportClient,Microsoft.Azure.Documents.IServiceConfigurationReader,Microsoft.Azure.Documents.IAuthorizationTokenProvider,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,Microsoft.Azure.Documents.AccountConfigurationProperties,Microsoft.Azure.Documents.RetryWithConfiguration,Microsoft.Azure.Documents.ISessionRetryOptions)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ReplicatedResourceClient.InvokeAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.TimeoutHelper,System.Boolean,System.Boolean,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.StoreResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ReplicatedResourceClient.OpenConnectionsToAllReplicasAsync(System.String,System.String,System.Threading.CancellationToken)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.RequestHelper.GetConsistencyLevelToUse(Microsoft.Azure.Documents.IServiceConfigurationReader,Microsoft.Azure.Documents.DocumentServiceRequest)~Microsoft.Azure.Documents.ConsistencyLevel")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.RequestRetryUtility.ProcessRequestAsync``2(System.Func{System.Threading.Tasks.Task{``1}},System.Func{``0},Microsoft.Azure.Documents.IRequestRetryPolicy{``0,``1},System.Threading.CancellationToken,System.Func{System.Threading.Tasks.Task{``1}},System.Nullable{System.TimeSpan})~System.Threading.Tasks.Task{``1}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ResourceId.CreateNewCollectionChildResourceId(System.Int32,Microsoft.Azure.Documents.ResourceType,System.String)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ResourceId.GetHashCode~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ResourceId.NewCollectionChildResourceId(System.String,System.UInt64,Microsoft.Azure.Documents.ResourceType)~Microsoft.Azure.Documents.ResourceId")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ResourceId.Parse(System.String)~Microsoft.Azure.Documents.ResourceId")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ResourceId.Verify(System.String,System.Byte[]@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Channel.InitializeAsync(System.Guid,System.Func{System.Guid,System.Guid,System.Uri,Microsoft.Azure.Documents.Rntbd.Channel,System.Threading.Tasks.Task})~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Channel.OpenChannelAsync(System.Guid)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Channel.RequestAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.TransportAddressUri,Microsoft.Azure.Documents.ResourceOperation,System.Guid,Microsoft.Azure.Documents.TransportRequestStats)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.StoreResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Channel.ThrowIfDisposed")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.ChannelCommonArguments.SetPayloadSent")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.ChannelCommonArguments.SetTimeoutCode(Microsoft.Azure.Documents.TransportErrorCode)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.ChannelDictionary.ThrowIfDisposed")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Connection.ConnectReuseAddrAsync(System.Uri,System.Net.IPAddress,System.UInt16,System.Guid)~System.Threading.Tasks.Task{System.Tuple{System.Net.Sockets.TcpClient,System.Boolean}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Connection.GetUInt32FromEnvironmentVariableOrDefault(System.String,System.UInt32,System.UInt32,System.UInt32)~System.UInt32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Connection.NegotiateSslAsync(Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Connection.OpenSocketAsync(Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Connection.ReadResponseBodyAsync(Microsoft.Azure.Documents.Rntbd.ChannelCommonArguments)~System.Threading.Tasks.Task{System.IO.MemoryStream}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Connection.ReadResponseMetadataAsync(Microsoft.Azure.Documents.Rntbd.ChannelCommonArguments)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.Rntbd.Connection.ResponseMetadata}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Connection.ResolveHostAsync(System.String,System.Boolean)~System.Threading.Tasks.Task{System.Net.IPAddress}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Connection.ThrowIfDisposed")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Connection.TraceAndThrowEndOfStream(System.String,Microsoft.Azure.Documents.Rntbd.ChannelCommonArguments)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Connection.TraceAndThrowReceiveFailedException(System.IO.IOException,System.String,Microsoft.Azure.Documents.Rntbd.ChannelCommonArguments)")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.CpuLoadHistory.#ctor(System.Collections.ObjectModel.ReadOnlyCollection{Microsoft.Azure.Documents.Rntbd.CpuLoad},System.TimeSpan)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.CpuLoadHistory.#ctor(System.Collections.ObjectModel.ReadOnlyCollection{Microsoft.Azure.Documents.Rntbd.CpuLoad},System.TimeSpan)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.CpuMonitor.GetCpuLoad~Microsoft.Azure.Documents.Rntbd.CpuLoadHistory")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.CpuMonitor.Start")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.CpuMonitor.StopCoreUnderWriteLock(System.Threading.CancellationTokenSource@,System.Threading.Tasks.Task@)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.CpuMonitor.ThrowIfDisposed")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Dispatcher.#ctor(System.Uri,Microsoft.Azure.Documents.UserAgentContainer,Microsoft.Azure.Documents.IConnectionStateListener,Microsoft.Azure.Documents.TimerPool,System.Boolean,Microsoft.Azure.Documents.FaultInjection.IChaosInterceptor,Microsoft.Azure.Documents.Rntbd.IConnection)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Dispatcher.CallAsync(Microsoft.Azure.Documents.Rntbd.ChannelCallArguments,Microsoft.Azure.Documents.TransportRequestStats)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.StoreResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Dispatcher.CallInfo.CompleteSend(Microsoft.Azure.Documents.Rntbd.Dispatcher.CallInfo.State)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Dispatcher.CallInfo.ThrowIfDisposed")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Dispatcher.NegotiateRntbdContextAsync(Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Dispatcher.OpenAsync(Microsoft.Azure.Documents.Rntbd.ChannelOpenArguments)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Dispatcher.ReceiveLoopAsync~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.Dispatcher.ThrowIfDisposed")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.HeadersTransportSerialization.AdvanceByRntbdHeader(Microsoft.Azure.Cosmos.Rntbd.BytesDeserializer@,Microsoft.Azure.Documents.RntbdConstants.ResponseIdentifiers)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.HeadersTransportSerialization.BuildStoreResponseNameValueCollection(System.Guid,System.String,Microsoft.Azure.Cosmos.Rntbd.BytesDeserializer@)~Microsoft.Azure.Documents.Collections.StoreResponseNameValueCollection")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.LinuxSystemUtilizationReader.ProcMemInfoFileParser.#ctor(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.LinuxSystemUtilizationReader.ProcMemInfoFileParser.TryParseMemInfoFile(System.Nullable{System.Int64}@,System.Nullable{System.Int64}@)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.LinuxSystemUtilizationReader.ProcStatFileParser.#ctor(System.String)")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.LinuxSystemUtilizationReader.StringParser.#ctor(System.String,System.Char,System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.LinuxSystemUtilizationReader.StringParser.#ctor(System.String,System.Char,System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.LinuxSystemUtilizationReader.StringParser.ExtractCurrent~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.LinuxSystemUtilizationReader.StringParser.MoveNext~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.LinuxSystemUtilizationReader.StringParser.ThrowForInvalidData")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.LoadBalancingChannel.#ctor(System.Uri,Microsoft.Azure.Documents.Rntbd.ChannelProperties,System.Boolean,Microsoft.Azure.Documents.FaultInjection.IChaosInterceptor)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.LoadBalancingChannel.ThrowIfDisposed")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.LoadBalancingPartition.OpenChannelAndIncrementCapacity(System.Guid,System.Func{System.Guid,System.Guid,System.Uri,Microsoft.Azure.Documents.Rntbd.Channel,System.Threading.Tasks.Task})~Microsoft.Azure.Documents.Rntbd.IChannel")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.LoadBalancingPartition.OpenChannelAsync(System.Guid)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.LoadBalancingPartition.RequestAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.TransportAddressUri,Microsoft.Azure.Documents.ResourceOperation,System.Guid,Microsoft.Azure.Documents.TransportRequestStats)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.StoreResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.SystemUsageHistory.#ctor(System.Collections.ObjectModel.ReadOnlyCollection{Microsoft.Azure.Documents.Rntbd.SystemUsageLoad},System.TimeSpan)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.SystemUsageLoad.#ctor(System.DateTime,Microsoft.Azure.Documents.Rntbd.ThreadInformation,System.Nullable{System.Single},System.Nullable{System.Int64},System.Nullable{System.Int32})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.SystemUsageMonitor.#ctor(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Documents.Rntbd.SystemUsageRecorder})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.SystemUsageMonitor.GetRecorder(System.String)~Microsoft.Azure.Documents.Rntbd.SystemUsageRecorder")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.SystemUsageMonitor.Start")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.SystemUsageMonitor.Stop")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.SystemUsageMonitor.ThrowIfDisposed")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.SystemUsageRecorder.#ctor(System.String,System.Int32,System.TimeSpan)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportClient.#ctor(Microsoft.Azure.Documents.Rntbd.TransportClient.Options,Microsoft.Azure.Documents.FaultInjection.IChaosInterceptor)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportClient.InvokeStoreAsync(Microsoft.Azure.Documents.TransportAddressUri,Microsoft.Azure.Documents.ResourceOperation,Microsoft.Azure.Documents.DocumentServiceRequest)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.StoreResponse}")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportClient.SetTransportPerformanceCounters(Microsoft.Azure.Documents.TransportPerformanceCounters)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportClient.SetTransportPerformanceCounters(Microsoft.Azure.Documents.TransportPerformanceCounters)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportClient.ThrowIfDisposed")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddBinaryIdIfPresent(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddCollectionChildResourceContentLengthLimitInKB(Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddCollectionChildResourceNameLimitInBytes(Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddConsistencyLevelHeader(Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddContentSerializationFormat(Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddCorrelatedActivityId(Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddCosmosGatewayTransactionId(Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddEffectivePartitionKeyIfPresent(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddEffectivePartitionKeyIfPresent(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddEnumerationDirection(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddFanoutOperationStateHeader(Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddIndexingDirectiveHeader(Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddMergeStaticIdIfPresent(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddMigrateCollectionDirectiveHeader(Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddPageSize(Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddPriorityLevelHeader(Microsoft.Azure.Documents.DocumentServiceRequest,System.String,System.String,Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddRemoteStorageType(Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddRequestedCollectionType(Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddResponseContinuationTokenLimitInKb(Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddRetriableWriteRequestMetadata(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddRetriableWriteRequestMetadata(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddStartAndEndKeys(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddStartAndEndKeysFromHeaders(Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddSupportedSerializationFormats(Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddSystemDocumentTypeHeader(Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddTransactionCompletionFlag(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddTransactionMetaData(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddTransactionMetaData(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddUniqueIndexNameEncodingMode(Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddUniqueIndexReIndexingState(Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.AddUpdateMaxthroughputEverProvisioned(Microsoft.Azure.Documents.Collections.RequestNameValueCollection,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.BuildRequestCore(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.RntbdConstants.Request@,System.String,Microsoft.Azure.Documents.ResourceOperation,System.Guid,Microsoft.Azure.Documents.BufferProvider,System.Int32@,System.Nullable{System.Int32}@)~Microsoft.Azure.Documents.Rntbd.TransportSerialization.SerializedRequest")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.BuildRequestForProxy(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.ResourceOperation,System.Guid,Microsoft.Azure.Documents.BufferProvider,System.String,System.String,System.Int32@,System.Nullable{System.Int32}@)~Microsoft.Azure.Documents.Rntbd.TransportSerialization.SerializedRequest")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.FillTokenFromHeader(Microsoft.Azure.Documents.DocumentServiceRequest,System.String,System.String,Microsoft.Azure.Documents.RntbdToken,Microsoft.Azure.Documents.RntbdConstants.Request,System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.GetRntbdOperationType(Microsoft.Azure.Documents.OperationType)~Microsoft.Azure.Documents.RntbdConstants.RntbdOperationType")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.GetRntbdResourceType(Microsoft.Azure.Documents.ResourceType)~Microsoft.Azure.Documents.RntbdConstants.RntbdResourceType")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.SerializedRequest.CopyTo(System.ArraySegment{System.Byte})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.SetBytesValue(Microsoft.Azure.Documents.DocumentServiceRequest,System.String,Microsoft.Azure.Documents.RntbdToken)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.SetResourceIdHeadersFromDocumentServiceRequest(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.TransportSerialization.SetResourceIdHeadersFromUri(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.RntbdConstants.Request)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.UserPortPool.#ctor(System.Int32,System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Rntbd.UserPortPool.GetPool(System.Net.Sockets.AddressFamily)~Microsoft.Azure.Documents.Rntbd.UserPortPool.Pool")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.RntbdToken.SerializeToBinaryWriter(Microsoft.Azure.Cosmos.Rntbd.BytesSerializer@,System.Int32@)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.RntbdTokenStream`1.CalculateLength~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.RntbdTokenStream`1.ParseFrom(Microsoft.Azure.Cosmos.Rntbd.BytesDeserializer@)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.BoolPartitionKeyComponent.CompareTo(Microsoft.Azure.Documents.Routing.IPartitionKeyComponent)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.InfinityPartitionKeyComponent.CompareTo(Microsoft.Azure.Documents.Routing.IPartitionKeyComponent)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.InfinityPartitionKeyComponent.JsonEncode(Newtonsoft.Json.JsonWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.InfinityPartitionKeyComponent.ToObject~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.InfinityPartitionKeyComponent.Truncate~Microsoft.Azure.Documents.Routing.IPartitionKeyComponent")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.InfinityPartitionKeyComponent.WriteForHashing(System.IO.BinaryWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.InfinityPartitionKeyComponent.WriteForHashingV2(System.IO.BinaryWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.MaxNumberPartitionKeyComponent.CompareTo(Microsoft.Azure.Documents.Routing.IPartitionKeyComponent)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.MaxNumberPartitionKeyComponent.Truncate~Microsoft.Azure.Documents.Routing.IPartitionKeyComponent")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.MaxNumberPartitionKeyComponent.WriteForHashing(System.IO.BinaryWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.MaxNumberPartitionKeyComponent.WriteForHashingV2(System.IO.BinaryWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.MaxStringPartitionKeyComponent.CompareTo(Microsoft.Azure.Documents.Routing.IPartitionKeyComponent)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.MaxStringPartitionKeyComponent.Truncate~Microsoft.Azure.Documents.Routing.IPartitionKeyComponent")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.MaxStringPartitionKeyComponent.WriteForHashing(System.IO.BinaryWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.MaxStringPartitionKeyComponent.WriteForHashingV2(System.IO.BinaryWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.MinNumberPartitionKeyComponent.CompareTo(Microsoft.Azure.Documents.Routing.IPartitionKeyComponent)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.MinNumberPartitionKeyComponent.Truncate~Microsoft.Azure.Documents.Routing.IPartitionKeyComponent")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.MinNumberPartitionKeyComponent.WriteForHashing(System.IO.BinaryWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.MinNumberPartitionKeyComponent.WriteForHashingV2(System.IO.BinaryWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.MinStringPartitionKeyComponent.CompareTo(Microsoft.Azure.Documents.Routing.IPartitionKeyComponent)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.MinStringPartitionKeyComponent.Truncate~Microsoft.Azure.Documents.Routing.IPartitionKeyComponent")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.MinStringPartitionKeyComponent.WriteForHashing(System.IO.BinaryWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.MinStringPartitionKeyComponent.WriteForHashingV2(System.IO.BinaryWriter)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.NullPartitionKeyComponent.CompareTo(Microsoft.Azure.Documents.Routing.IPartitionKeyComponent)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.NumberPartitionKeyComponent.CompareTo(Microsoft.Azure.Documents.Routing.IPartitionKeyComponent)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.NumberPartitionKeyComponent.FromHexEncodedBinaryString(System.Byte[],System.Int32@)~Microsoft.Azure.Documents.Routing.IPartitionKeyComponent")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.#ctor(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Documents.Routing.IPartitionKeyComponent})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.#ctor(System.Collections.Generic.IReadOnlyList{Microsoft.Azure.Documents.Routing.IPartitionKeyComponent})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.CompareTo(Microsoft.Azure.Documents.Routing.PartitionKeyInternal)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.FromJsonString(System.String)~Microsoft.Azure.Documents.Routing.PartitionKeyInternal")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.FromObjectArray(System.Collections.Generic.IEnumerable{System.Object},System.Boolean)~Microsoft.Azure.Documents.Routing.PartitionKeyInternal")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.FromObjectToPartitionKeyComponent(System.Object,System.Boolean)~Microsoft.Azure.Documents.Routing.IPartitionKeyComponent")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.GetEffectivePartitionKeyRange(Microsoft.Azure.Documents.PartitionKeyDefinition,Microsoft.Azure.Documents.Routing.Range{Microsoft.Azure.Documents.Routing.PartitionKeyInternal})~Microsoft.Azure.Documents.Routing.Range{System.String}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.GetEffectivePartitionKeyString(Microsoft.Azure.Documents.PartitionKeyDefinition,System.Boolean)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.GetEPKRangeForPrefixPartitionKey(Microsoft.Azure.Documents.PartitionKeyDefinition)~Microsoft.Azure.Documents.Routing.Range{System.String}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.GetMaxExclusiveEffectivePartitionKey(System.Int32,System.Int32,Microsoft.Azure.Documents.PartitionKeyDefinition,System.Boolean)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.GetMiddleRangeEffectivePartitionKey(System.String,System.String,Microsoft.Azure.Documents.PartitionKeyDefinition)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.GetMiddleRangeEffectivePartitionKeyForHash(System.String,System.String,Microsoft.Azure.Documents.PartitionKeyDefinition)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.GetMiddleRangeEffectivePartitionKeyForMultiHash(System.String,System.String,Microsoft.Azure.Documents.PartitionKeyDefinition)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.GetMinInclusiveEffectivePartitionKey(System.Int32,System.Int32,Microsoft.Azure.Documents.PartitionKeyDefinition,System.Boolean)~System.String")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.GetNEqualRangeEffectivePartitionKeys(System.String,System.String,Microsoft.Azure.Documents.PartitionKeyDefinition,System.Int32)~System.String[]")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.GetWidth(System.String,System.String,Microsoft.Azure.Documents.PartitionKeyDefinition)~System.Double")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.GetWidthForHashPartitioningScheme(System.String,System.String,Microsoft.Azure.Documents.PartitionKeyDefinition)~System.Double")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.GetWidthForRangePartitioningScheme(System.String,System.String,Microsoft.Azure.Documents.PartitionKeyDefinition)~System.Double")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.PartitionKeyInternal.HexStringToByteArray(System.String)~System.Byte[]")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.PartitionKeyInternalJsonConverter.ReadJson(Newtonsoft.Json.JsonReader,System.Type,System.Object,Newtonsoft.Json.JsonSerializer)~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.Range`1.#ctor(`0,`0,System.Boolean,System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.Range`1.Contains(`0)~System.Boolean")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.StringPartitionKeyComponent.#ctor(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.StringPartitionKeyComponent.#ctor(System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.StringPartitionKeyComponent.CompareTo(Microsoft.Azure.Documents.Routing.IPartitionKeyComponent)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Routing.UndefinedPartitionKeyComponent.CompareTo(Microsoft.Azure.Documents.Routing.IPartitionKeyComponent)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Schema.GetProperty(System.String,System.Type)~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ServerStoreModel.ProcessMessageAsync(Microsoft.Azure.Documents.DocumentServiceRequest,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.DocumentServiceResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.SessionTokenHelper.GetLocalSessionToken(Microsoft.Azure.Documents.DocumentServiceRequest,System.String,System.String)~Microsoft.Azure.Documents.ISessionToken")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.SessionTokenHelper.Parse(System.String)~Microsoft.Azure.Documents.ISessionToken")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.SessionTokenHelper.Parse(System.String,System.String)~Microsoft.Azure.Documents.ISessionToken")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.SessionTokenHelper.SetOriginalSessionToken(Microsoft.Azure.Documents.DocumentServiceRequest,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.SessionTokenHelper.SetPartitionLocalSessionToken(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.ISessionContainer)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.SessionTokenMismatchRetryPolicy.ShouldRetryAsync(Microsoft.Azure.Documents.DocumentServiceRequest,Microsoft.Azure.Documents.StoreResponse,System.Exception,System.Threading.CancellationToken)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.ShouldRetryResult}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.SharedFiles.Routing.Int128.#ctor(System.Byte[])")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.ShouldRetryResult.ThrowIfDoneTrying(System.Runtime.ExceptionServices.ExceptionDispatchInfo)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.SimpleSessionToken.IsValid(Microsoft.Azure.Documents.ISessionToken)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.SimpleSessionToken.Merge(Microsoft.Azure.Documents.ISessionToken)~Microsoft.Azure.Documents.ISessionToken")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Snapshot.CloneSystemSnapshot(Microsoft.Azure.Documents.Snapshot,Microsoft.Azure.Documents.OperationType,System.Boolean)~Microsoft.Azure.Documents.Snapshot")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.Snapshot.CloneSystemSnapshot(Microsoft.Azure.Documents.Snapshot,Microsoft.Azure.Documents.SnapshotContent)~Microsoft.Azure.Documents.Snapshot")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.SnapshotContent.#ctor(Microsoft.Azure.Documents.OperationType,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.SnapshotContent.#ctor(Microsoft.Azure.Documents.OperationType,System.String,System.String,Microsoft.Azure.Documents.SerializableNameValueCollection)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.SnapshotContent.#ctor(Microsoft.Azure.Documents.OperationType,System.String,System.String,System.Collections.Generic.IList{System.String},Microsoft.Azure.Documents.SerializableNameValueCollection)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.SnapshotContent.#ctor(Microsoft.Azure.Documents.OperationType,System.String,System.String,System.String,System.Collections.Generic.IList{System.String})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.SnapshotContent.ArgumentStringNotNullOrWhiteSpace(System.String,System.String)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StoreClient.ProcessMessageAsync(Microsoft.Azure.Documents.DocumentServiceRequest,System.Threading.CancellationToken,Microsoft.Azure.Documents.IRetryPolicy)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.DocumentServiceResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StoreClientFactory.#ctor(Microsoft.Azure.Documents.Client.Protocol,System.Int32,System.Int32,Microsoft.Azure.Documents.UserAgentContainer,Microsoft.Azure.Documents.ICommunicationEventSource,System.String,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,Microsoft.Azure.Documents.PortReuseMode,System.Int32,System.Int32,System.Int32,System.Int32,System.Boolean,Microsoft.Azure.Documents.RetryWithConfiguration,Microsoft.Azure.Documents.RntbdConstants.CallerId,System.Boolean,System.TimeSpan,System.Boolean,System.Int32,Microsoft.Azure.Documents.MemoryStreamPool,System.Net.Security.RemoteCertificateValidationCallback,System.Func{System.String,System.Threading.Tasks.Task{System.Net.IPAddress}},Microsoft.Azure.Documents.Telemetry.DistributedTracingOptions,Microsoft.Azure.Documents.FaultInjection.IChaosInterceptor)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StoreClientFactory.ThrowIfDisposed")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StoreClientFactory.ValidateRntbdMaxConcurrentOpeningConnectionCount(System.Int32@)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StoreClientFactory.WithTransportInterceptor(System.Func{Microsoft.Azure.Documents.TransportClient,Microsoft.Azure.Documents.TransportClient})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StoreReader.#ctor(Microsoft.Azure.Documents.TransportClient,Microsoft.Azure.Documents.AddressSelector,Microsoft.Azure.Documents.IAddressEnumerator,Microsoft.Azure.Documents.ISessionContainer,System.Boolean)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StoreReader.CompleteActivity(System.Threading.Tasks.Task{Microsoft.Azure.Documents.StoreResponse},Microsoft.Azure.Documents.QueryRequestPerformanceActivity)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.StoreResponse}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StoreReader.GetStoreResultOrThrowGoneException(Microsoft.Azure.Documents.StoreReader.ReadReplicaResult)~Microsoft.Azure.Documents.ReferenceCountedDisposable{Microsoft.Azure.Documents.StoreResult}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StoreReader.ReadFromStoreAsync(Microsoft.Azure.Documents.TransportAddressUri,Microsoft.Azure.Documents.DocumentServiceRequest)~System.Threading.Tasks.Task{System.ValueTuple{Microsoft.Azure.Documents.StoreResponse,System.DateTime}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StoreReader.ReadMultipleReplicasInternalAsync(Microsoft.Azure.Documents.DocumentServiceRequest,System.Boolean,System.Int32,System.Boolean,System.Boolean,Microsoft.Azure.Documents.ReadMode,System.Boolean,System.Boolean)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.StoreReader.ReadReplicaResult}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StoreReader.ReadPrimaryInternalAsync(Microsoft.Azure.Documents.DocumentServiceRequest,System.Boolean,System.Boolean,System.Boolean)~System.Threading.Tasks.Task{Microsoft.Azure.Documents.StoreReader.ReadReplicaResult}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StoreReader.StoreResultList.#ctor(System.Collections.Generic.IList{Microsoft.Azure.Documents.ReferenceCountedDisposable{Microsoft.Azure.Documents.StoreResult}})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StoreReader.StoreResultList.GetValueOrThrow~System.Collections.Generic.IList{Microsoft.Azure.Documents.ReferenceCountedDisposable{Microsoft.Azure.Documents.StoreResult}}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StoreReader.UpdateContinuationTokenIfReadFeedOrQuery(Microsoft.Azure.Documents.DocumentServiceRequest)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StoreResult.#ctor(Microsoft.Azure.Documents.StoreResponse,Microsoft.Azure.Documents.DocumentClientException,System.String,System.Int64,System.Int64,System.Double,System.Int32,System.Int32,System.Boolean,System.Uri,System.Int64,System.Int32,System.Int64,Microsoft.Azure.Documents.ISessionToken,System.Boolean,System.String,System.String,System.String,Microsoft.Azure.Documents.TransportRequestStats,System.Collections.Generic.IEnumerable{System.String})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StoreResult.AppendToBuilder(System.Text.StringBuilder)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StoreResult.CreateStoreResult(Microsoft.Azure.Documents.StoreResponse,System.Exception,System.Boolean,System.Boolean,System.Collections.Generic.IEnumerable{System.String},System.Uri)~Microsoft.Azure.Documents.ReferenceCountedDisposable{Microsoft.Azure.Documents.StoreResult}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StoreResult.GetException~Microsoft.Azure.Documents.DocumentClientException")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StoreResult.ToResponse(Microsoft.Azure.Documents.RequestChargeTracker)~Microsoft.Azure.Documents.StoreResponse")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StreamExtension.CopyToAsync(System.IO.Stream,System.IO.Stream,System.Int64)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StringSegment.#ctor(System.String,System.Int32,System.Int32)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.StringSegment.Substring(System.Int32,System.Int32)~Microsoft.Azure.Documents.StringSegment")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.TimeoutHelper.ThrowGoneIfElapsed")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.TimeoutHelper.ThrowTimeoutIfElapsed")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.TimerPool.ThrowIfDisposed")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.TransportAddressHealthState.#ctor(System.Uri,Microsoft.Azure.Documents.TransportAddressHealthState.HealthStatus,System.Nullable{System.DateTime},System.Nullable{System.DateTime},System.Nullable{System.DateTime})")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.TransportAddressHealthState.GetLastKnownTimestampByHealthStatus(Microsoft.Azure.Documents.TransportAddressHealthState.HealthStatus)~System.Nullable{System.DateTime}")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.TransportAddressUri.#ctor(System.Uri)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.TransportAddressUri.GetEffectiveHealthStatus~Microsoft.Azure.Documents.TransportAddressHealthState.HealthStatus")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.TransportAddressUri.SetHealthStatus(Microsoft.Azure.Documents.TransportAddressHealthState,Microsoft.Azure.Documents.TransportAddressHealthState.HealthStatus)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.TransportClient.GetExceptionSubStatus(Microsoft.Azure.Documents.Collections.INameValueCollection,System.String,System.Uri)~System.UInt32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.TransportClient.OpenConnectionAsync(System.Uri)~System.Threading.Tasks.Task")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.TransportClient.ThrowServerException(System.String,Microsoft.Azure.Documents.StoreResponse,System.Uri,System.Guid,Microsoft.Azure.Documents.DocumentServiceRequest)")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.TransportException.SetCounters(Microsoft.Azure.Documents.TransportExceptionCounters)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.TransportException.SetCounters(Microsoft.Azure.Documents.TransportExceptionCounters)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.TransportRequestStats.RecordState(Microsoft.Azure.Documents.TransportRequestStats.RequestStage)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.UInt128.CompareTo(System.Object)~System.Int32")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.UnixDateTimeConverter.ReadJson(Newtonsoft.Json.JsonReader,System.Type,System.Object,Newtonsoft.Json.JsonSerializer)~System.Object")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.UnixDateTimeConverter.WriteJson(Newtonsoft.Json.JsonWriter,System.Object,Newtonsoft.Json.JsonSerializer)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.UrlUtility.ExtractTargetInfo(System.Uri,System.String@,System.String@,System.String@,System.String@,System.String@)")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.UrlUtility.IsLocalHostUri(System.Uri)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.UrlUtility.SetQuery(System.Uri,System.String)~System.Uri")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.VectorSessionToken.IsValid(Microsoft.Azure.Documents.ISessionToken)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.VectorSessionToken.Merge(Microsoft.Azure.Documents.ISessionToken)~Microsoft.Azure.Documents.ISessionToken")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.VersionUtility.IsLaterThan(System.String,System.DateTime)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.VersionUtility.IsLaterThan(System.String,System.String)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Documents.VersionUtility.IsLaterThanNotEqualTo(System.String,System.DateTime)~System.Boolean")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedEstimatorIterator.ChangeFeedEstimatorEmptyFeedResponse.ContinuationToken")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedEstimatorIterator.ChangeFeedEstimatorEmptyFeedResponse.Headers")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ChangeFeed.ChangeFeedEstimatorIterator.ChangeFeedEstimatorFeedResponse.ContinuationToken")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ChangeFeed.Configuration.ChangeFeedProcessorOptions.StartTime")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ChangeFeedOptions.StartTime")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ChangeFeedPolicy.FullFidelityRetention")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ChangeFeedRequestOptions.IfMatchEtag")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ChangeFeedRequestOptions.IfNoneMatchEtag")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ChangeFeedRequestOptions.PageSizeHint")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ClientPipelineBuilder.CustomHandlers")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ConnectionPolicy.ConnectionProtocol")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ContainerProperties.ComputedProperties")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ContainerProperties.ComputedProperties")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ContainerProperties.ConflictResolutionPolicy")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ContainerProperties.Id")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ContainerProperties.IndexingPolicy")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ContainerProperties.IndexingPolicy")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ContainerProperties.PartitionKeyDefinitionVersion")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ContainerProperties.PartitionKeyPath")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ContainerProperties.PartitionKeyPaths")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ContainerProperties.PartitionKeyPathTokens")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ContainerProperties.UniqueKeyPolicy")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ContainerProperties.UniqueKeyPolicy")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.CosmosAccountServiceConfiguration.DatabaseAccountApiEndpoint")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.CosmosAccountServiceConfiguration.DatabaseAccountId")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.CosmosAccountServiceConfiguration.PrimaryMasterKey")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.CosmosAccountServiceConfiguration.PrimaryReadonlyMasterKey")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.CosmosAccountServiceConfiguration.ResourceSeedKey")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.CosmosAccountServiceConfiguration.SecondaryMasterKey")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.CosmosAccountServiceConfiguration.SecondaryReadonlyMasterKey")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.CosmosAccountServiceConfiguration.SubscriptionId")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.CosmosClientOptions.ApplicationName")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.CosmosClientOptions.GatewayModeMaxConnectionLimit")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.CosmosClientOptions.HttpClientFactory")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.CosmosClientOptions.Serializer")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.CosmosClientOptions.SerializerOptions")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.CosmosClientOptions.UseSystemTextJsonSerializerWithOptions")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.CosmosClientOptions.WebProxy")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.CosmosQueryResponseMessageHeaders.ContinuationToken")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.DatabaseProperties.Id")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.DocumentClient.AuthKey")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.DocumentClient.Session")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.DocumentFeedResponse`1.ResponseContinuation")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Json.Interop.NewtonsoftToCosmosDBWriter.CurrentLength")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Linq.CosmosLinqQuery`1.HasMoreResults")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Linq.TranslationContext.CurrentSubqueryBinding")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Query.Core.AsyncLazy`1.Result")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch`1.Exception")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Query.Core.Monads.TryCatch`1.Result")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Query.Core.Pipeline.Aggregate.Aggregators.SingleGroupAggregator.AggregateValue.ScalarAggregateValue.Result")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByCrossPartitionEnumerator.EmptyEnumerator.Current")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy.OrderByQueryResult.Rid")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Query.Core.Pipeline.GroupBy.GroupByQueryPipelineStage.RewrittenGroupByProjection.GroupByItems")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec.Parameters")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Query.DocumentQueryExecutionContextBase.QuerySpec")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.ResponseMessage.Diagnostics")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.RetryOptions.InitialRetryForRetryWithMilliseconds")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.RetryOptions.MaximumRetryForRetryWithMilliseconds")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.RetryOptions.MaxRetryAttemptsOnThrottledRequests")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.RetryOptions.MaxRetryWaitTimeInSeconds")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.RetryOptions.RandomSaltForRetryWithMilliseconds")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.RetryOptions.TotalWaitTimeForRetryWithMilliseconds")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Scripts.StoredProcedureProperties.Body")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Scripts.StoredProcedureProperties.Id")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.SpatialPath.SpatialTypes")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.UserProperties.Id")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ClientEncryptionPolicy.IncludedPaths")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ClientEncryptionPolicy.IncludedPaths")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Conflict.OperationKind")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.Conflict.ResourceType")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DataMaskingPolicy.IncludedPaths")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DataMaskingPolicy.IncludedPaths")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DataMaskingPolicy.IsPolicyEnabled")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.ChangeFeedPolicy")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.ChangeFeedPolicy")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.ClientEncryptionPolicy")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.ClientEncryptionPolicy")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.CollectionBackupPolicy")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.CollectionBackupPolicy")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.CollectionTieringPolicy")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.CollectionTieringPolicy")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.ComputedProperties")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.ComputedProperties")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.ConflictResolutionPolicy")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.ConflictResolutionPolicy")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.DataMaskingPolicy")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.DataMaskingPolicy")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.FullTextPolicy")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.FullTextPolicy")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.IndexingPolicy")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.IndexingPolicy")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.PartitionKey")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.PartitionKey")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.SchemaDiscoveryPolicy")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.SchemaDiscoveryPolicy")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.UniqueIndexNameEncodingMode")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.UniqueIndexReIndexContext")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.UniqueIndexReIndexContext")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.UniqueKeyPolicy")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.UniqueKeyPolicy")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.VectorEmbeddingPolicy")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentCollection.VectorEmbeddingPolicy")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.DocumentServiceRequest.HttpMethod")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.FullTextPolicy.FullTextPaths")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.FullTextPolicy.FullTextPaths")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.IncludedPath.Indexes")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.IncludedPath.Indexes")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.IndexingPolicy.CompositeIndexes")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.IndexingPolicy.CompositeIndexes")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.IndexingPolicy.ExcludedPaths")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.IndexingPolicy.ExcludedPaths")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.IndexingPolicy.FullTextIndexPaths")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.IndexingPolicy.FullTextIndexPaths")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.IndexingPolicy.IncludedPaths")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.IndexingPolicy.IncludedPaths")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.IndexingPolicy.SpatialIndexes")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.IndexingPolicy.SpatialIndexes")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.IndexingPolicy.VectorIndexPaths")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.IndexingPolicy.VectorIndexPaths")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.ReferenceCountedDisposable`1.Target")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.SpatialSpec.SpatialTypes")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.SpatialSpec.SpatialTypes")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.UniqueIndexReIndexContext.UniqueKeys")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.UniqueIndexReIndexContext.UniqueKeys")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.UniqueKeyPolicy.UniqueKeys")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.UniqueKeyPolicy.UniqueKeys")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.VectorEmbeddingPolicy.Embeddings")] +[assembly: SuppressMessage("RestrictedApi", "CDX1005:Experimental - DontThrowExceptions", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Documents.VectorEmbeddingPolicy.Embeddings")] diff --git a/Microsoft.Azure.Cosmos/src/Handler/AbstractRetryHandler.cs b/Microsoft.Azure.Cosmos/src/Handler/AbstractRetryHandler.cs index 819064c958..af812b0abb 100644 --- a/Microsoft.Azure.Cosmos/src/Handler/AbstractRetryHandler.cs +++ b/Microsoft.Azure.Cosmos/src/Handler/AbstractRetryHandler.cs @@ -53,6 +53,10 @@ public override async Task SendAsync( throw; } + catch (OperationCanceledException ex) + { + throw new CosmosOperationCanceledException(ex, request.Trace); + } finally { request.OnBeforeSendRequestActions -= retryPolicyInstance.OnBeforeSendRequest; @@ -67,11 +71,10 @@ private static async Task ExecuteHttpRequestAsync( { while (true) { - cancellationToken.ThrowIfCancellationRequested(); ShouldRetryResult result; - try { + cancellationToken.ThrowIfCancellationRequested(); ResponseMessage cosmosResponseMessage = await callbackMethod(); if (cosmosResponseMessage.IsSuccessStatusCode) { @@ -94,6 +97,14 @@ private static async Task ExecuteHttpRequestAsync( throw; } } + catch (OperationCanceledException oce) + { + result = await callShouldRetryException(oce, cancellationToken); + if (!result.ShouldRetry) + { + throw; + } + } TimeSpan backoffTime = result.BackoffTime; if (backoffTime != TimeSpan.Zero) diff --git a/Microsoft.Azure.Cosmos/src/Handler/DiagnosticsHandlerHelper.cs b/Microsoft.Azure.Cosmos/src/Handler/DiagnosticsHandlerHelper.cs index 266524e38b..69bc8144fe 100644 --- a/Microsoft.Azure.Cosmos/src/Handler/DiagnosticsHandlerHelper.cs +++ b/Microsoft.Azure.Cosmos/src/Handler/DiagnosticsHandlerHelper.cs @@ -25,7 +25,9 @@ internal class DiagnosticsHandlerHelper private static readonly TimeSpan ClientTelemetryRefreshInterval = TimeSpan.FromSeconds(5); // Need to reset it in Tests hence kept it non-readonly. +#pragma warning disable IDE0044 // Add readonly modifier private static SystemUsageRecorder DiagnosticSystemUsageRecorder = new SystemUsageRecorder( +#pragma warning restore IDE0044 // Add readonly modifier identifier: Diagnostickey, historyLength: 6, refreshInterval: DiagnosticsHandlerHelper.DiagnosticsRefreshInterval); @@ -79,7 +81,7 @@ private void StopSystemMonitor() } catch (ObjectDisposedException ex) { - DefaultTrace.TraceError("Error while stopping system usage monitor. {0} ", ex); + DefaultTrace.TraceError("Error while stopping system usage monitor. {0} ", ex.Message); } } diff --git a/Microsoft.Azure.Cosmos/src/Handler/RequestInvokerHandler.cs b/Microsoft.Azure.Cosmos/src/Handler/RequestInvokerHandler.cs index 01d37d3378..48cee8bf34 100644 --- a/Microsoft.Azure.Cosmos/src/Handler/RequestInvokerHandler.cs +++ b/Microsoft.Azure.Cosmos/src/Handler/RequestInvokerHandler.cs @@ -127,7 +127,7 @@ public override async Task SendAsync( public AvailabilityStrategyInternal AvailabilityStrategy(RequestMessage request) { AvailabilityStrategy strategy = request.RequestOptions?.AvailabilityStrategy - ?? this.client.ClientOptions.AvailabilityStrategy; + ?? this.client.DocumentClient.ConnectionPolicy.AvailabilityStrategy; if (strategy == null) { @@ -305,17 +305,22 @@ public virtual async Task SendAsync( // For epk range filtering we can end up in one of 3 cases: if (overlappingRanges.Count > 1) { - // 1) The EpkRange spans more than one physical partition - // In this case it means we have encountered a split and - // we need to bubble that up to the higher layers to update their datastructures - CosmosException goneException = new CosmosException( - message: $"Epk Range: {feedRangeEpk.Range} is gone.", - statusCode: System.Net.HttpStatusCode.Gone, - subStatusCode: (int)SubStatusCodes.PartitionKeyRangeGone, - activityId: Guid.NewGuid().ToString(), - requestCharge: default); - - return goneException.ToCosmosResponseMessage(request); + //If we are running a query plan and our provided partition key results in a hash that resolves to more than one EPKRanges then its a valid use case + bool isQueryPlanOperation = request.ResourceType == ResourceType.Document && request.OperationType == OperationType.QueryPlan; + if (!isQueryPlanOperation) + { + // 1) The EpkRange spans more than one physical partition + // In this case it means we have encountered a split and + // we need to bubble that up to the higher layers to update their datastructures + CosmosException goneException = new CosmosException( + message: $"Epk Range: {feedRangeEpk.Range} is gone.", + statusCode: System.Net.HttpStatusCode.Gone, + subStatusCode: (int)SubStatusCodes.PartitionKeyRangeGone, + activityId: Guid.NewGuid().ToString(), + requestCharge: default); + + return goneException.ToCosmosResponseMessage(request); + } } // overlappingRanges.Count == 1 else diff --git a/Microsoft.Azure.Cosmos/src/Handler/TelemetryHandler.cs b/Microsoft.Azure.Cosmos/src/Handler/TelemetryHandler.cs index 039373718f..faa2f84237 100644 --- a/Microsoft.Azure.Cosmos/src/Handler/TelemetryHandler.cs +++ b/Microsoft.Azure.Cosmos/src/Handler/TelemetryHandler.cs @@ -49,7 +49,7 @@ public override async Task SendAsync( } catch (Exception ex) { - DefaultTrace.TraceError("Error while collecting telemetry information : {0}", ex); + DefaultTrace.TraceError("Error while collecting telemetry information : {0}", ex.Message); } } return response; diff --git a/Microsoft.Azure.Cosmos/src/Handler/TransportHandler.cs b/Microsoft.Azure.Cosmos/src/Handler/TransportHandler.cs index 7baf8a7254..29a94fd683 100644 --- a/Microsoft.Azure.Cosmos/src/Handler/TransportHandler.cs +++ b/Microsoft.Azure.Cosmos/src/Handler/TransportHandler.cs @@ -108,6 +108,19 @@ internal async Task ProcessMessageAsync( serviceRequest.Headers[HttpConstants.HttpHeaders.Authorization] = authorization; IStoreModel storeProxy = this.client.DocumentClient.GetStoreProxy(serviceRequest); + if (storeProxy == null) + { + // storeProxy being null should indicate that there was a race condition and the Client was + // disposed between getting teh DocumentClient and calling GetStoreProxy + // in this case repeating this call will result in throwing an ObjectDisposedException + storeProxy = this.client.DocumentClient.GetStoreProxy(serviceRequest); + + if (storeProxy == null) + { + throw new InvalidOperationException("StoreProxy cannot be null"); + } + } + using (ITrace processMessageAsyncTrace = request.Trace.StartChild( name: $"{storeProxy.GetType().FullName} Transport Request", component: TraceComponent.Transport, diff --git a/Microsoft.Azure.Cosmos/src/HttpClient/CosmosHttpClientCore.cs b/Microsoft.Azure.Cosmos/src/HttpClient/CosmosHttpClientCore.cs index 399a7b52ad..75b42b2bf9 100644 --- a/Microsoft.Azure.Cosmos/src/HttpClient/CosmosHttpClientCore.cs +++ b/Microsoft.Azure.Cosmos/src/HttpClient/CosmosHttpClientCore.cs @@ -127,7 +127,7 @@ public static HttpMessageHandler CreateHttpClientHandler( } catch (Exception e) { - DefaultTrace.TraceError("Failed to create SocketsHttpHandler: {0}", e); + DefaultTrace.TraceError("Failed to create SocketsHttpHandler: {0}", e.Message); } } @@ -359,6 +359,7 @@ private async Task SendHttpHelperAsync( { if (this.chaosInterceptor != null && documentServiceRequest != null) { + this.SetFaultInjectionHeader(documentServiceRequest, requestMessage); (bool hasFault, HttpResponseMessage fiResponseMessage) = await this.InjectFaultsAsync(cancellationTokenSource, documentServiceRequest, requestMessage); if (hasFault) { @@ -373,9 +374,10 @@ private async Task SendHttpHelperAsync( if (this.chaosInterceptor != null && documentServiceRequest != null) { + this.SetFaultInjectionHeader(documentServiceRequest, requestMessage); CancellationToken fiToken = cancellationTokenSource.Token; fiToken.ThrowIfCancellationRequested(); - await this.chaosInterceptor.OnAfterHttpSendAsync(documentServiceRequest); + await this.chaosInterceptor.OnAfterHttpSendAsync(documentServiceRequest, fiToken); } if (clientSideRequestStatistics is ClientSideRequestStatisticsTraceDatum datum) @@ -467,6 +469,11 @@ private async Task SendHttpHelperAsync( } } + private void SetFaultInjectionHeader(DocumentServiceRequest documentServiceRequest, HttpRequestMessage requestMessage) + { + documentServiceRequest.Headers.Set("FAULTINJECTION_GW_URI", requestMessage.RequestUri.ToString()); + } + private async Task<(bool, HttpResponseMessage)> InjectFaultsAsync( CancellationTokenSource cancellationTokenSource, DocumentServiceRequest documentServiceRequest, @@ -480,10 +487,10 @@ private async Task SendHttpHelperAsync( { documentServiceRequest.Headers.Set(CosmosHttpClientCore.FautInjecitonId, Guid.NewGuid().ToString()); } - await this.chaosInterceptor.OnBeforeHttpSendAsync(documentServiceRequest); + await this.chaosInterceptor.OnBeforeHttpSendAsync(documentServiceRequest, fiToken); (bool hasFault, - HttpResponseMessage fiResponseMessage) = await this.chaosInterceptor.OnHttpRequestCallAsync(documentServiceRequest); + HttpResponseMessage fiResponseMessage) = await this.chaosInterceptor.OnHttpRequestCallAsync(documentServiceRequest, fiToken); if (hasFault) { diff --git a/Microsoft.Azure.Cosmos/src/HttpClient/HttpTimeoutPolicy.cs b/Microsoft.Azure.Cosmos/src/HttpClient/HttpTimeoutPolicy.cs index 5b39a2c113..1620e1b36c 100644 --- a/Microsoft.Azure.Cosmos/src/HttpClient/HttpTimeoutPolicy.cs +++ b/Microsoft.Azure.Cosmos/src/HttpClient/HttpTimeoutPolicy.cs @@ -20,7 +20,9 @@ internal abstract class HttpTimeoutPolicy public virtual bool ShouldThrow503OnTimeout => false; public static HttpTimeoutPolicy GetTimeoutPolicy( - DocumentServiceRequest documentServiceRequest) + DocumentServiceRequest documentServiceRequest, + bool isPartitionLevelFailoverEnabled = false, + bool isThinClientEnabled = false) { //Query Plan Requests if (documentServiceRequest.ResourceType == ResourceType.Document @@ -39,13 +41,25 @@ public static HttpTimeoutPolicy GetTimeoutPolicy( //Get Addresses Requests if (documentServiceRequest.ResourceType == ResourceType.Address) { - return HttpTimeoutPolicyControlPlaneRetriableHotPath.Instance; + return HttpTimeoutPolicyControlPlaneRetriableHotPath.InstanceShouldThrow503OnTimeout; } - //Data Plane Read - if (!HttpTimeoutPolicy.IsMetaData(documentServiceRequest) && documentServiceRequest.IsReadOnlyRequest) + //Data Plane Operations + if (!HttpTimeoutPolicy.IsMetaData(documentServiceRequest)) { - return HttpTimeoutPolicyDefault.InstanceShouldThrow503OnTimeout; + if (isThinClientEnabled) + { + return documentServiceRequest.IsReadOnlyRequest + ? HttpTimeoutPolicyForThinClient.InstanceShouldRetryAndThrow503OnTimeout + : HttpTimeoutPolicyForThinClient.InstanceShouldNotRetryAndThrow503OnTimeout; + } + // Data Plane Reads. + else if (documentServiceRequest.IsReadOnlyRequest) + { + return isPartitionLevelFailoverEnabled + ? HttpTimeoutPolicyForPartitionFailover.InstanceShouldThrow503OnTimeout + : HttpTimeoutPolicyDefault.InstanceShouldThrow503OnTimeout; + } } //Meta Data Read diff --git a/Microsoft.Azure.Cosmos/src/HttpClient/HttpTimeoutPolicyForPartitionFailover.cs b/Microsoft.Azure.Cosmos/src/HttpClient/HttpTimeoutPolicyForPartitionFailover.cs new file mode 100644 index 0000000000..3e623a5aed --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/HttpClient/HttpTimeoutPolicyForPartitionFailover.cs @@ -0,0 +1,52 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ +namespace Microsoft.Azure.Cosmos +{ + using System; + using System.Collections.Generic; + using System.Net.Http; + + internal sealed class HttpTimeoutPolicyForPartitionFailover : HttpTimeoutPolicy + { + public static readonly HttpTimeoutPolicy Instance = new HttpTimeoutPolicyForPartitionFailover(false); + public static readonly HttpTimeoutPolicy InstanceShouldThrow503OnTimeout = new HttpTimeoutPolicyForPartitionFailover(true); + public bool shouldThrow503OnTimeout; + private static readonly string Name = nameof(HttpTimeoutPolicyDefault); + + private HttpTimeoutPolicyForPartitionFailover(bool shouldThrow503OnTimeout) + { + this.shouldThrow503OnTimeout = shouldThrow503OnTimeout; + } + + private readonly IReadOnlyList<(TimeSpan requestTimeout, TimeSpan delayForNextRequest)> TimeoutsAndDelays = new List<(TimeSpan requestTimeout, TimeSpan delayForNextRequest)>() + { + (TimeSpan.FromSeconds(.5), TimeSpan.Zero), + (TimeSpan.FromSeconds(.5), TimeSpan.Zero), + (TimeSpan.FromSeconds(1), TimeSpan.Zero), + }; + + public override string TimeoutPolicyName => HttpTimeoutPolicyForPartitionFailover.Name; + + public override int TotalRetryCount => this.TimeoutsAndDelays.Count; + + public override IEnumerator<(TimeSpan requestTimeout, TimeSpan delayForNextRequest)> GetTimeoutEnumerator() + { + return this.TimeoutsAndDelays.GetEnumerator(); + } + + // Assume that it is not safe to retry unless it is a get method. + // Create and other operations could have succeeded even though a timeout occurred. + public override bool IsSafeToRetry(HttpMethod httpMethod) + { + return httpMethod == HttpMethod.Get; + } + + public override bool ShouldRetryBasedOnResponse(HttpMethod requestHttpMethod, HttpResponseMessage responseMessage) + { + return false; + } + + public override bool ShouldThrow503OnTimeout => this.shouldThrow503OnTimeout; + } +} diff --git a/Microsoft.Azure.Cosmos/src/HttpClient/HttpTimeoutPolicyForThinClient.cs b/Microsoft.Azure.Cosmos/src/HttpClient/HttpTimeoutPolicyForThinClient.cs new file mode 100644 index 0000000000..91201a8538 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/HttpClient/HttpTimeoutPolicyForThinClient.cs @@ -0,0 +1,69 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ +namespace Microsoft.Azure.Cosmos +{ + using System; + using System.Collections.Generic; + using System.Net.Http; + + internal sealed class HttpTimeoutPolicyForThinClient : HttpTimeoutPolicy + { + public bool shouldRetry; + public bool shouldThrow503OnTimeout; + private static readonly string Name = nameof(HttpTimeoutPolicyForThinClient); + public static readonly HttpTimeoutPolicy InstanceShouldRetryAndThrow503OnTimeout = new HttpTimeoutPolicyForThinClient(true, true); + public static readonly HttpTimeoutPolicy InstanceShouldNotRetryAndThrow503OnTimeout = new HttpTimeoutPolicyForThinClient(true, false); + + private HttpTimeoutPolicyForThinClient( + bool shouldThrow503OnTimeout, + bool shouldRetry) + { + this.shouldThrow503OnTimeout = shouldThrow503OnTimeout; + this.shouldRetry = shouldRetry; + } + + private readonly IReadOnlyList<(TimeSpan requestTimeout, TimeSpan delayForNextRequest)> TimeoutsAndDelays = new List<(TimeSpan requestTimeout, TimeSpan delayForNextRequest)>() + { + (TimeSpan.FromSeconds(.5), TimeSpan.Zero), + (TimeSpan.FromSeconds(1), TimeSpan.Zero), + (TimeSpan.FromSeconds(5), TimeSpan.Zero), + }; + + public override string TimeoutPolicyName => HttpTimeoutPolicyForThinClient.Name; + + public override int TotalRetryCount => this.TimeoutsAndDelays.Count; + + public override IEnumerator<(TimeSpan requestTimeout, TimeSpan delayForNextRequest)> GetTimeoutEnumerator() + { + return this.TimeoutsAndDelays.GetEnumerator(); + } + + public override bool IsSafeToRetry(HttpMethod httpMethod) + { + return this.shouldRetry; + } + + public override bool ShouldRetryBasedOnResponse(HttpMethod requestHttpMethod, HttpResponseMessage responseMessage) + { + if (responseMessage == null) + { + return false; + } + + if (responseMessage.StatusCode != System.Net.HttpStatusCode.RequestTimeout) + { + return false; + } + + if (!this.IsSafeToRetry(requestHttpMethod)) + { + return false; + } + + return true; + } + + public override bool ShouldThrow503OnTimeout => this.shouldThrow503OnTimeout; + } +} diff --git a/Microsoft.Azure.Cosmos/src/Json/IJsonBinaryWriterExtensions.cs b/Microsoft.Azure.Cosmos/src/Json/IJsonBinaryWriterExtensions.cs index a4acea74f4..50a0477ea1 100644 --- a/Microsoft.Azure.Cosmos/src/Json/IJsonBinaryWriterExtensions.cs +++ b/Microsoft.Azure.Cosmos/src/Json/IJsonBinaryWriterExtensions.cs @@ -12,6 +12,7 @@ void WriteRawJsonValue( ReadOnlyMemory rootBuffer, int valueOffset, JsonBinaryEncoding.UniformArrayInfo externalArrayInfo, - bool isFieldName); + bool isFieldName, + IJsonStringDictionary jsonStringDictionary = null); } } diff --git a/Microsoft.Azure.Cosmos/src/Json/IJsonStringDictionary.cs b/Microsoft.Azure.Cosmos/src/Json/IJsonStringDictionary.cs new file mode 100644 index 0000000000..c9afc8df97 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Json/IJsonStringDictionary.cs @@ -0,0 +1,24 @@ +// ------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// ------------------------------------------------------------ +namespace Microsoft.Azure.Cosmos.Json +{ + using System; + using Microsoft.Azure.Cosmos.Core.Utf8; + +#if INTERNAL +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member +#pragma warning disable SA1600 // Elements should be documented + public +#else + internal +#endif + interface IJsonStringDictionary : IEquatable + { + bool TryGetString(int stringId, out UtfAllString value); + + bool TryGetStringId(Utf8Span value, out int stringId); + + public int GetCount(); + } +} diff --git a/Microsoft.Azure.Cosmos/src/Json/Interop/CosmosDBToNewtonsoftWriter.cs b/Microsoft.Azure.Cosmos/src/Json/Interop/CosmosDBToNewtonsoftWriter.cs index f3b4c04681..f8e4e289c1 100644 --- a/Microsoft.Azure.Cosmos/src/Json/Interop/CosmosDBToNewtonsoftWriter.cs +++ b/Microsoft.Azure.Cosmos/src/Json/Interop/CosmosDBToNewtonsoftWriter.cs @@ -3,7 +3,7 @@ //------------------------------------------------------------ namespace Microsoft.Azure.Cosmos.Json.Interop { - using System; + using System; using System.IO; using System.Text; @@ -17,7 +17,13 @@ namespace Microsoft.Azure.Cosmos.Json.Interop internal #endif sealed class CosmosDBToNewtonsoftWriter : Newtonsoft.Json.JsonWriter - { + { + /// + /// The built-in DateTime format "o"/ "O" is comparable to the custom format of: "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK". + /// In order to remove the trailing zeros from the milli-second precision, we replace the lower-case f's with upper case ones. + /// + private const string RoundTripFormatWithoutTrailingZeros = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'FFFFFFFK"; + /// /// A CosmosDB JSON writer used for the actual implementation. /// @@ -314,17 +320,21 @@ public override void WriteValue(sbyte value) public override void WriteValue(decimal value) { this.WriteValue((double)value); - } - + } + /// /// Writes a value. /// - /// The value to write. - public override void WriteValue(DateTime value) - { - this.WriteValue(value.ToString()); - } - + /// The value to write. + public override void WriteValue(DateTime value) + { + // We use rount trip format for datetime parsing and trim the additional trailing zeros using a custom "O" format + // to maintain milliseconds precision. + this.WriteValue( + value.ToString( + format: CosmosDBToNewtonsoftWriter.RoundTripFormatWithoutTrailingZeros)); + } + /// /// Writes a [] value. /// diff --git a/Microsoft.Azure.Cosmos/src/Json/JsonBinaryEncoding.Strings.cs b/Microsoft.Azure.Cosmos/src/Json/JsonBinaryEncoding.Strings.cs index f0af32b43e..9488f12500 100644 --- a/Microsoft.Azure.Cosmos/src/Json/JsonBinaryEncoding.Strings.cs +++ b/Microsoft.Azure.Cosmos/src/Json/JsonBinaryEncoding.Strings.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Cosmos.Json using System.Linq; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - using Microsoft.Azure.Cosmos.Core; using Microsoft.Azure.Cosmos.Core.Utf8; internal static partial class JsonBinaryEncoding @@ -175,13 +174,14 @@ internal static partial class JsonBinaryEncoding public static string GetStringValue( ReadOnlyMemory buffer, - ReadOnlyMemory stringToken) + ReadOnlyMemory stringToken, + IJsonStringDictionary jsonStringDictionary) { // First retrieve the string length - GetStringValue(buffer, stringToken, destinationBuffer: Span.Empty, out int valueLength); + GetStringValue(buffer, stringToken, jsonStringDictionary, destinationBuffer: Span.Empty, out int valueLength); Span destinationBuffer = valueLength < MaxStackAlloc ? stackalloc byte[valueLength] : new byte[valueLength]; - GetStringValue(buffer, stringToken, destinationBuffer, out valueLength); + GetStringValue(buffer, stringToken, jsonStringDictionary, destinationBuffer, out valueLength); return Utf8Span.UnsafeFromUtf8BytesNoValidation(destinationBuffer).ToString(); } @@ -189,22 +189,25 @@ public static string GetStringValue( [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Utf8Span GetUtf8SpanValue( ReadOnlyMemory buffer, - ReadOnlyMemory stringToken) + ReadOnlyMemory stringToken, + IJsonStringDictionary jsonStringDictionary) { - return Utf8Span.UnsafeFromUtf8BytesNoValidation(GetUtf8MemoryValue(buffer, stringToken).Span); + return Utf8Span.UnsafeFromUtf8BytesNoValidation(GetUtf8MemoryValue(buffer, stringToken, jsonStringDictionary).Span); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Utf8String GetUtf8StringValue( ReadOnlyMemory buffer, - ReadOnlyMemory stringToken) + ReadOnlyMemory stringToken, + IJsonStringDictionary jsonStringDictionary) { - return Utf8String.UnsafeFromUtf8BytesNoValidation(GetUtf8MemoryValue(buffer, stringToken)); + return Utf8String.UnsafeFromUtf8BytesNoValidation(GetUtf8MemoryValue(buffer, stringToken, jsonStringDictionary)); } public static bool TryGetBufferedStringValue( ReadOnlyMemory buffer, ReadOnlyMemory stringToken, + IJsonStringDictionary jsonStringDictionary, out Utf8Memory value) { if (stringToken.IsEmpty) @@ -216,6 +219,7 @@ public static bool TryGetBufferedStringValue( if (JsonBinaryEncoding.TryGetBufferedLengthPrefixedString( buffer, stringToken, + jsonStringDictionary, out value)) { return true; @@ -223,6 +227,7 @@ public static bool TryGetBufferedStringValue( if (JsonBinaryEncoding.TryGetEncodedStringValue( stringToken.Span, + jsonStringDictionary, out UtfAllString encodedStringValue)) { value = encodedStringValue.Utf8EscapedString; @@ -235,13 +240,19 @@ public static bool TryGetBufferedStringValue( public static bool TryGetDictionaryEncodedStringValue( ReadOnlySpan stringToken, - out UtfAllString value) => TryGetEncodedStringValue( + IJsonStringDictionary jsonStringDictionary, + out UtfAllString value) + { + return TryGetEncodedStringValue( stringToken, + jsonStringDictionary, out value); + } private static ReadOnlyMemory GetUtf8MemoryValue( ReadOnlyMemory buffer, - ReadOnlyMemory stringToken) + ReadOnlyMemory stringToken, + IJsonStringDictionary jsonStringDictionary) { byte typeMarker = stringToken.Span[0]; @@ -250,6 +261,7 @@ private static ReadOnlyMemory GetUtf8MemoryValue( if (!TryGetBufferedStringValue( buffer, stringToken, + jsonStringDictionary, out Utf8Memory bufferedStringValue)) { throw new JsonInvalidTokenException(); @@ -272,6 +284,7 @@ private static ReadOnlyMemory GetUtf8MemoryValue( private static void GetStringValue( ReadOnlyMemory buffer, ReadOnlyMemory stringToken, + IJsonStringDictionary jsonStringDictionary, Span destinationBuffer, out int valueLength) { @@ -286,6 +299,7 @@ private static void GetStringValue( if (!TryGetBufferedStringValue( buffer, stringToken, + jsonStringDictionary, out Utf8Memory bufferedStringValue)) { throw new JsonInvalidTokenException(); @@ -317,10 +331,12 @@ private static void GetStringValue( /// Try Get Encoded String Value /// /// The string token to read from. + /// The JSON string dictionary. /// The encoded string if found. /// Encoded String Value private static bool TryGetEncodedStringValue( ReadOnlySpan stringToken, + IJsonStringDictionary jsonStringDictionary, out UtfAllString value) { if (JsonBinaryEncoding.TryGetEncodedSystemStringValue(stringToken, out value)) @@ -328,7 +344,7 @@ private static bool TryGetEncodedStringValue( return true; } - if (JsonBinaryEncoding.TryGetEncodedUserStringValue(stringToken, out value)) + if (JsonBinaryEncoding.TryGetEncodedUserStringValue(stringToken, jsonStringDictionary, out value)) { return true; } @@ -367,14 +383,22 @@ private static bool TryGetEncodedSystemStringValue( /// Try Get Encoded User String Value /// /// The string token to read from. + /// The JSON string dictionary. /// The encoded user string value if found. /// Whether or not the Encoded User String Value was found private static bool TryGetEncodedUserStringValue( ReadOnlySpan stringToken, + IJsonStringDictionary jsonStringDictionary, out UtfAllString encodedUserStringValue) { - encodedUserStringValue = default; - return false; + if ((jsonStringDictionary == null) + || (!JsonBinaryEncoding.TryGetUserStringId(stringToken, out int userStringId))) + { + encodedUserStringValue = default; + return false; + } + + return jsonStringDictionary.TryGetString(userStringId, out encodedUserStringValue); } private static bool TryGetUserStringId(ReadOnlySpan stringToken, out int userStringId) @@ -407,7 +431,7 @@ private static bool TryGetUserStringId(ReadOnlySpan stringToken, out int u const byte OneByteCount = JsonBinaryEncoding.TypeMarker.UserString1ByteLengthMax - JsonBinaryEncoding.TypeMarker.UserString1ByteLengthMin; userStringId = OneByteCount + stringToken[1] - + ((stringToken[0] - JsonBinaryEncoding.TypeMarker.UserString2ByteLengthMin) * 0xFF); + + ((stringToken[0] - JsonBinaryEncoding.TypeMarker.UserString2ByteLengthMin) * 256); } return true; @@ -416,6 +440,7 @@ private static bool TryGetUserStringId(ReadOnlySpan stringToken, out int u private static bool TryGetBufferedLengthPrefixedString( ReadOnlyMemory buffer, ReadOnlyMemory stringToken, + IJsonStringDictionary jsonStringDictionary, out Utf8Memory value) { ReadOnlySpan stringTokenSpan = stringToken.Span; @@ -476,6 +501,7 @@ private static bool TryGetBufferedLengthPrefixedString( return TryGetBufferedStringValue( buffer, buffer.Slice(start: stringTokenSpan[0]), + jsonStringDictionary, out value); case JsonBinaryEncoding.TypeMarker.StrR2: @@ -488,6 +514,7 @@ private static bool TryGetBufferedLengthPrefixedString( return TryGetBufferedStringValue( buffer, buffer.Slice(start: MemoryMarshal.Read(stringTokenSpan)), + jsonStringDictionary, out value); case JsonBinaryEncoding.TypeMarker.StrR3: @@ -500,6 +527,7 @@ private static bool TryGetBufferedLengthPrefixedString( return TryGetBufferedStringValue( buffer, buffer.Slice(start: MemoryMarshal.Read(stringTokenSpan)), + jsonStringDictionary, out value); case JsonBinaryEncoding.TypeMarker.StrR4: @@ -512,6 +540,7 @@ private static bool TryGetBufferedLengthPrefixedString( return TryGetBufferedStringValue( buffer, buffer.Slice(start: (int)MemoryMarshal.Read(stringTokenSpan)), + jsonStringDictionary, out value); default: @@ -534,10 +563,12 @@ private static bool TryGetBufferedLengthPrefixedString( /// Try Get Encoded String Type Marker /// /// the value + /// The JSON string dictionary. /// The encoded string type marker if found. /// Whether or not the type marker was found. public static bool TryGetEncodedStringTypeMarker( Utf8Span utf8Span, + IJsonStringDictionary jsonStringDictionary, out MultiByteTypeMarker multiByteTypeMarker) { if (JsonBinaryEncoding.TryGetEncodedSystemStringTypeMarker(utf8Span, out multiByteTypeMarker)) @@ -545,7 +576,7 @@ public static bool TryGetEncodedStringTypeMarker( return true; } - if (JsonBinaryEncoding.TryGetEncodedUserStringTypeMarker(utf8Span, out multiByteTypeMarker)) + if (JsonBinaryEncoding.TryGetEncodedUserStringTypeMarker(utf8Span, jsonStringDictionary, out multiByteTypeMarker)) { return true; } @@ -581,14 +612,53 @@ private static bool TryGetEncodedSystemStringTypeMarker( /// Try Get Encoded User String Type Marker /// /// The value. + /// The optional json string dictionary. /// The multi byte type marker if found. /// Whether or not the Encoded User String Type Marker was found. private static bool TryGetEncodedUserStringTypeMarker( Utf8Span utf8Span, + IJsonStringDictionary jsonStringDictionary, out MultiByteTypeMarker multiByteTypeMarker) { - multiByteTypeMarker = default; - return false; + if (jsonStringDictionary == null) + { + multiByteTypeMarker = default; + return false; + } + + if (!jsonStringDictionary.TryGetStringId(utf8Span, out int stringId)) + { + multiByteTypeMarker = default; + return false; + } + + // Convert the stringId to a multibyte type marker + const byte OneByteCount = TypeMarker.UserString1ByteLengthMax - TypeMarker.UserString1ByteLengthMin; + const int TwoByteCount = (TypeMarker.UserString2ByteLengthMax - TypeMarker.UserString2ByteLengthMin) * 256; + const int MaxStringId = OneByteCount + TwoByteCount; + + if (stringId < OneByteCount) + { + multiByteTypeMarker = new MultiByteTypeMarker( + length: 1, + one: (byte)(TypeMarker.UserString1ByteLengthMin + stringId)); + } + else if (stringId < MaxStringId) + { + int twoByteOffset = stringId - OneByteCount; + multiByteTypeMarker = new MultiByteTypeMarker( + length: 2, + one: (byte)((twoByteOffset / 256) + TypeMarker.UserString2ByteLengthMin), + two: (byte)(twoByteOffset % 256)); + } + else + { + // String id out of range + multiByteTypeMarker = default; + return false; + } + + return true; } [Flags] diff --git a/Microsoft.Azure.Cosmos/src/Json/JsonNavigator.JsonBinaryNavigator.cs b/Microsoft.Azure.Cosmos/src/Json/JsonNavigator.JsonBinaryNavigator.cs index 18803cf9b2..db2dd59bc7 100644 --- a/Microsoft.Azure.Cosmos/src/Json/JsonNavigator.JsonBinaryNavigator.cs +++ b/Microsoft.Azure.Cosmos/src/Json/JsonNavigator.JsonBinaryNavigator.cs @@ -26,13 +26,17 @@ abstract partial class JsonNavigator : IJsonNavigator private sealed class JsonBinaryNavigator : JsonNavigator { private readonly ReadOnlyMemory rootBuffer; + private readonly IJsonStringDictionary jsonStringDictionary; private readonly IJsonNavigatorNode rootNode; /// /// Initializes a new instance of the JsonBinaryNavigator class /// /// The (UTF-8) buffer to navigate. - public JsonBinaryNavigator(ReadOnlyMemory buffer) + /// The JSON string dictionary. + public JsonBinaryNavigator( + ReadOnlyMemory buffer, + IJsonStringDictionary jsonStringDictionary) { if (buffer.Length < 2) { @@ -56,6 +60,7 @@ public JsonBinaryNavigator(ReadOnlyMemory buffer) throw new ArgumentException("Input buffer is shorter than the root node length."); } + this.jsonStringDictionary = jsonStringDictionary; JsonNodeType nodeType = JsonBinaryEncoding.NodeTypes.Lookup[buffer.Span[0]]; this.rootNode = new BinaryNavigatorNode(nodeType, 1); } @@ -100,6 +105,7 @@ public override bool TryGetBufferedStringValue( return JsonBinaryEncoding.TryGetBufferedStringValue( this.rootBuffer, this.rootBuffer.Slice(binaryNavigatorNode.Offset), + this.jsonStringDictionary, out value); } @@ -109,7 +115,8 @@ public override UtfAnyString GetStringValue(IJsonNavigatorNode stringNode) BinaryNavigatorNode binaryNavigatorNode = this.GetNodeOfType(JsonNodeType.String, stringNode); return JsonBinaryEncoding.GetUtf8StringValue( this.rootBuffer, - this.rootBuffer.Slice(binaryNavigatorNode.Offset)); + this.rootBuffer.Slice(binaryNavigatorNode.Offset), + this.jsonStringDictionary); } /// @@ -400,7 +407,7 @@ public override IJsonReader CreateReader(IJsonNavigatorNode jsonNavigatorNode) throw new InvalidOperationException("Failed to get segment"); } - return JsonReader.CreateBinaryFromOffset(this.rootBuffer, segment.Offset); + return JsonReader.CreateBinaryFromOffset(this.rootBuffer, segment.Offset, this.jsonStringDictionary); } public override void WriteNode(IJsonNavigatorNode jsonNavigatorNode, IJsonWriter jsonWriter) @@ -423,7 +430,8 @@ public override void WriteNode(IJsonNavigatorNode jsonNavigatorNode, IJsonWriter this.rootBuffer, valueOffset: binaryNavigatorNode.Offset, externalArrayInfo: binaryNavigatorNode.ExternalArrayInfo, - isFieldName); + isFieldName, + this.jsonStringDictionary); } else { @@ -503,6 +511,7 @@ private void WriteToInternal(BinaryNavigatorNode binaryNavigatorNode, IJsonWrite if (JsonBinaryEncoding.TryGetBufferedStringValue( this.rootBuffer, buffer, + this.jsonStringDictionary, out Utf8Memory bufferedStringValue)) { if (fieldName) @@ -516,7 +525,7 @@ private void WriteToInternal(BinaryNavigatorNode binaryNavigatorNode, IJsonWrite } else { - string value = JsonBinaryEncoding.GetStringValue(this.rootBuffer, buffer); + string value = JsonBinaryEncoding.GetStringValue(this.rootBuffer, buffer, this.jsonStringDictionary); if (fieldName) { jsonWriter.WriteFieldName(value); diff --git a/Microsoft.Azure.Cosmos/src/Json/JsonNavigator.JsonTextNavigator.cs b/Microsoft.Azure.Cosmos/src/Json/JsonNavigator.JsonTextNavigator.cs index 203003b005..4db89205a1 100644 --- a/Microsoft.Azure.Cosmos/src/Json/JsonNavigator.JsonTextNavigator.cs +++ b/Microsoft.Azure.Cosmos/src/Json/JsonNavigator.JsonTextNavigator.cs @@ -57,7 +57,10 @@ public JsonTextNavigator(ReadOnlyMemory buffer) JsonTextNavigatorNode CreateRootNode() { - IJsonReader jsonTextReader = JsonReader.Create(buffer: buffer); + IJsonReader jsonTextReader = JsonReader.Create( + buffer: buffer, + jsonStringDictionary: null); + if (!(jsonTextReader is IJsonTextReaderPrivateImplementation jsonTextReaderExtensions)) { throw new InvalidOperationException($"{nameof(jsonTextReader)} needs to implement {nameof(IJsonTextReaderPrivateImplementation)}."); diff --git a/Microsoft.Azure.Cosmos/src/Json/JsonNavigator.cs b/Microsoft.Azure.Cosmos/src/Json/JsonNavigator.cs index c6e37e7427..a4473c79f8 100644 --- a/Microsoft.Azure.Cosmos/src/Json/JsonNavigator.cs +++ b/Microsoft.Azure.Cosmos/src/Json/JsonNavigator.cs @@ -32,9 +32,11 @@ protected JsonNavigator() /// Creates a JsonNavigator that can navigate a supplied buffer /// /// The buffer to navigate + /// The optional json string dictionary for binary encoding. /// A concrete JsonNavigator that can navigate the supplied buffer. public static IJsonNavigator Create( - ReadOnlyMemory buffer) + ReadOnlyMemory buffer, + IJsonStringDictionary jsonStringDictionary = null) { if (buffer.IsEmpty) { @@ -47,7 +49,7 @@ public static IJsonNavigator Create( return ((JsonSerializationFormat)firstByte) switch { // Explicitly pick from the set of supported formats - JsonSerializationFormat.Binary => new JsonBinaryNavigator(buffer), + JsonSerializationFormat.Binary => new JsonBinaryNavigator(buffer, jsonStringDictionary), // or otherwise assume text format _ => new JsonTextNavigator(buffer), diff --git a/Microsoft.Azure.Cosmos/src/Json/JsonReader.JsonBinaryReader.cs b/Microsoft.Azure.Cosmos/src/Json/JsonReader.JsonBinaryReader.cs index 04996ebd64..902a0ca7d5 100644 --- a/Microsoft.Azure.Cosmos/src/Json/JsonReader.JsonBinaryReader.cs +++ b/Microsoft.Azure.Cosmos/src/Json/JsonReader.JsonBinaryReader.cs @@ -172,6 +172,11 @@ private sealed class JsonBinaryReader : JsonReader, ITypedJsonReader /// private readonly JsonBinaryMemoryReader jsonBinaryBuffer; + /// + /// Dictionary used for user string encoding. + /// + private readonly IJsonStringDictionary jsonStringDictionary; + /// /// For binary there is no end of token marker in the actual binary, but the JsonReader interface still needs to surface ObjectEndToken and ArrayEndToken. /// To accommodate for this we have a progress stack to let us know how many bytes there are left to read for all levels of nesting. @@ -185,14 +190,16 @@ private sealed class JsonBinaryReader : JsonReader, ITypedJsonReader private int currentTokenPosition; public JsonBinaryReader( - ReadOnlyMemory buffer) - : this(buffer, indexToStartFrom: null) + ReadOnlyMemory buffer, + IJsonStringDictionary jsonStringDictionary = null) + : this(buffer, indexToStartFrom: null, jsonStringDictionary: jsonStringDictionary) { } internal JsonBinaryReader( ReadOnlyMemory rootBuffer, - int? indexToStartFrom = null) + int? indexToStartFrom = null, + IJsonStringDictionary jsonStringDictionary = null) { if (rootBuffer.IsEmpty) { @@ -225,6 +232,7 @@ internal JsonBinaryReader( // offset for the 0x80 binary type marker this.jsonBinaryBuffer = new JsonBinaryMemoryReader(readerBuffer); this.arrayAndObjectEndStack = new ArrayAndObjectEndStack(); + this.jsonStringDictionary = jsonStringDictionary; } #region IJsonReader @@ -361,7 +369,8 @@ public override UtfAnyString GetStringValue() return JsonBinaryEncoding.GetUtf8StringValue( this.rootBuffer, - this.jsonBinaryBuffer.GetBufferedRawJsonToken(this.currentTokenPosition)); + this.jsonBinaryBuffer.GetBufferedRawJsonToken(this.currentTokenPosition), + this.jsonStringDictionary); } /// @@ -377,6 +386,7 @@ public override bool TryGetBufferedStringValue(out Utf8Memory bufferedUtf8String return JsonBinaryEncoding.TryGetBufferedStringValue( this.rootBuffer, this.jsonBinaryBuffer.GetBufferedRawJsonToken(this.currentTokenPosition), + this.jsonStringDictionary, out bufferedUtf8StringValue); } @@ -539,7 +549,8 @@ public Utf8Span GetUtf8SpanValue() return JsonBinaryEncoding.GetUtf8SpanValue( this.rootBuffer, - this.jsonBinaryBuffer.GetBufferedRawJsonToken(this.currentTokenPosition)); + this.jsonBinaryBuffer.GetBufferedRawJsonToken(this.currentTokenPosition), + this.jsonStringDictionary); } #endregion diff --git a/Microsoft.Azure.Cosmos/src/Json/JsonReader.cs b/Microsoft.Azure.Cosmos/src/Json/JsonReader.cs index 07789ae9de..a61554dfad 100644 --- a/Microsoft.Azure.Cosmos/src/Json/JsonReader.cs +++ b/Microsoft.Azure.Cosmos/src/Json/JsonReader.cs @@ -44,8 +44,9 @@ protected JsonReader() /// Creates a JsonReader that can read from the supplied byte array (assumes utf-8 encoding) with format marker. /// /// The byte array (with format marker) to read from. + /// The dictionary to use for user string encoding. /// A concrete JsonReader that can read the supplied byte array. - public static IJsonReader Create(ReadOnlyMemory buffer) + public static IJsonReader Create(ReadOnlyMemory buffer, IJsonStringDictionary jsonStringDictionary = null) { if (buffer.IsEmpty) { @@ -56,7 +57,7 @@ public static IJsonReader Create(ReadOnlyMemory buffer) // Explicitly pick from the set of supported formats, or otherwise assume text format JsonSerializationFormat jsonSerializationFormat = (firstByte == (byte)JsonSerializationFormat.Binary) ? JsonSerializationFormat.Binary : JsonSerializationFormat.Text; - return JsonReader.Create(jsonSerializationFormat, buffer); + return JsonReader.Create(jsonSerializationFormat, buffer, jsonStringDictionary); } /// @@ -64,10 +65,12 @@ public static IJsonReader Create(ReadOnlyMemory buffer) /// /// The serialization format of the payload. /// The buffer to read from. + /// The optional dictionary to decode strings. /// An for the buffer, format, and dictionary. public static IJsonReader Create( JsonSerializationFormat jsonSerializationFormat, - ReadOnlyMemory buffer) + ReadOnlyMemory buffer, + IJsonStringDictionary jsonStringDictionary = null) { if (buffer.IsEmpty) { @@ -77,7 +80,7 @@ public static IJsonReader Create( // Explicitly pick from the set of supported formats, or otherwise assume text format return jsonSerializationFormat switch { - JsonSerializationFormat.Binary => new JsonBinaryReader(buffer), + JsonSerializationFormat.Binary => new JsonBinaryReader(buffer, jsonStringDictionary), JsonSerializationFormat.Text => new JsonTextReader(buffer), _ => throw new ArgumentOutOfRangeException($"Unknown {nameof(JsonSerializationFormat)}: {jsonSerializationFormat}."), }; @@ -85,7 +88,11 @@ public static IJsonReader Create( internal static IJsonReader CreateBinaryFromOffset( ReadOnlyMemory buffer, - int offset) => new JsonBinaryReader(buffer, offset); + int offset, + IJsonStringDictionary jsonStringDictionary = null) + { + return new JsonBinaryReader(buffer, offset, jsonStringDictionary); + } #region IJsonReader /// diff --git a/Microsoft.Azure.Cosmos/src/Json/JsonStringDictionary.cs b/Microsoft.Azure.Cosmos/src/Json/JsonStringDictionary.cs new file mode 100644 index 0000000000..25f9505c43 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Json/JsonStringDictionary.cs @@ -0,0 +1,181 @@ +// ------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// ------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Json +{ + using System; + using System.Collections.Generic; + using System.Text; + using Microsoft.Azure.Cosmos.Core.Collections; + using Microsoft.Azure.Cosmos.Core.Utf8; + using static Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding; + +#if INTERNAL +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member +#pragma warning disable SA1600 // Elements should be documented + public +#else + internal +#endif + sealed class JsonStringDictionary : IJsonStringDictionary, IEquatable + { + public static readonly int MaxDictionaryEncodedStrings = + TypeMarker.UserString1ByteLengthMax - TypeMarker.UserString1ByteLengthMin + ((TypeMarker.UserString2ByteLengthMax - TypeMarker.UserString2ByteLengthMin) * 256); + + private const int MaxStackAllocSize = 4 * 1024; + private static readonly IReadOnlyList EmptyUserStringList = new List(); + + private readonly List strings; + private readonly Trie utf8StringToStringId; + + private int size; + private UInt128 checksum; + + public JsonStringDictionary() + : this(EmptyUserStringList) + { + } + + public JsonStringDictionary(IReadOnlyList userStrings) + { + if (userStrings == null) + { + throw new ArgumentNullException(nameof(userStrings)); + } + + this.strings = new List(); + this.utf8StringToStringId = new Trie(); + + for (int i = 0; i < userStrings.Count; i++) + { + string userString = userStrings[i]; + this.AddString(Utf8Span.TranscodeUtf16(userString), out int stringId); + + if (stringId != i) + { + throw new ArgumentException($"Tried to add {userString} at stringId {i}, but instead it was inserted at stringId {stringId}."); + } + } + + this.SetChecksum(); + } + + public bool TryGetString(int stringId, out UtfAllString value) + { + if ((stringId < 0) || (stringId >= this.size)) + { + value = default; + return false; + } + + value = this.strings[stringId]; + return true; + } + + public bool TryGetStringId(Utf8Span value, out int stringId) + { + return this.utf8StringToStringId.TryGetValue(value.Span, out stringId); + } + + public bool Equals(JsonStringDictionary other) + { + if (object.ReferenceEquals(this, other)) + { + return true; + } + + if (other == null) + { + return false; + } + + return this.checksum == other.checksum; + } + + public bool Equals(IJsonStringDictionary other) + { + if (other == null) + { + return false; + } + + if (other is JsonStringDictionary otherDictionary) + { + return this.Equals(otherDictionary); + } + else + { + if (other.GetCount() != this.size) + { + return false; + } + + for (int i = 0; i < this.size; i++) + { + if (this.TryGetString(i, out UtfAllString userStringThis) && + this.TryGetString(i, out UtfAllString userStringOther)) + { + if (!userStringThis.Equals(userStringOther)) + { + return false; + } + } + else + { + return false; + } + } + + return true; + } + } + + public int GetCount() + { + return this.size; + } + + private void AddString(string value, out int stringId) + { + int utf8Length = Encoding.UTF8.GetByteCount(value); + Span utfString = utf8Length < JsonStringDictionary.MaxStackAllocSize ? stackalloc byte[utf8Length] : new byte[utf8Length]; + Encoding.UTF8.GetBytes(value, utfString); + + this.AddString(Utf8Span.UnsafeFromUtf8BytesNoValidation(utfString), out stringId); + } + + private void AddString(Utf8Span value, out int stringId) + { + stringId = this.size; + this.strings.Add(UtfAllString.Create(value.ToString())); + this.utf8StringToStringId.AddOrUpdate(value.Span, stringId); + this.size++; + } + + public override int GetHashCode() + { + return this.checksum.GetHashCode(); + } + + internal UInt128 GetChecksum() + { + return this.checksum; + } + + private void SetChecksum() + { + UInt128 checksum = this.GetCount(); + for (int i = 0; i < this.size; i++) + { + checksum = MurmurHash3.Hash128(this.strings[i].Utf8String.Span.Span, checksum); + } + + this.checksum = checksum; + } + } +#if INTERNAL +#pragma warning restore SA1600 // Elements should be documented +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member +#endif +} diff --git a/Microsoft.Azure.Cosmos/src/Json/JsonWriter.JsonBinaryWriter.cs b/Microsoft.Azure.Cosmos/src/Json/JsonWriter.JsonBinaryWriter.cs index ab24c03a49..77a549fb53 100644 --- a/Microsoft.Azure.Cosmos/src/Json/JsonWriter.JsonBinaryWriter.cs +++ b/Microsoft.Azure.Cosmos/src/Json/JsonWriter.JsonBinaryWriter.cs @@ -8,14 +8,9 @@ namespace Microsoft.Azure.Cosmos.Json using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; - using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - using System.Text; using Microsoft.Azure.Cosmos.Core; using Microsoft.Azure.Cosmos.Core.Utf8; - using Microsoft.Azure.Cosmos.Linq; - using Microsoft.Azure.Cosmos.Serialization.HybridRow; - using Newtonsoft.Json.Linq; using static Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding; /// @@ -280,6 +275,11 @@ private enum RawValueType : byte /// private readonly int reservationSize; + /// + /// The string dictionary used for user string encoding. + /// + private readonly IJsonStringDictionary jsonStringDictionary; + private readonly List sharedStrings; private readonly ReferenceStringDictionary sharedStringIndexes; @@ -292,6 +292,7 @@ private enum RawValueType : byte /// /// Initializes a new instance of the JsonBinaryWriter class. /// + /// The JSON string dictionary used for user string encoding. /// The initial capacity to avoid intermediary allocations. /// Determines whether to enable writing of uniform number arrays. /// Determines whether to enable writing of full-precision unsigned 64-bit integer values @@ -300,7 +301,8 @@ public JsonBinaryWriter( int initialCapacity, bool enableNumberArrays, bool enableUint64Values, - bool enableEncodedStrings = true) + bool enableEncodedStrings = true, + IJsonStringDictionary jsonStringDictionary = null) { this.enableNumberArrays = enableNumberArrays; this.enableUInt64Values = enableUint64Values; @@ -311,6 +313,7 @@ public JsonBinaryWriter( this.sharedStrings = new List(); this.sharedStringIndexes = new ReferenceStringDictionary(); this.stringReferenceOffsets = new List(); + this.jsonStringDictionary = jsonStringDictionary; // Write the serialization format as the very first byte byte binaryTypeMarker = (byte)JsonSerializationFormat.Binary; @@ -1377,6 +1380,7 @@ private void WriteFieldNameOrString(bool isFieldName, Utf8Span utf8Span) this.JsonObjectState.RegisterToken(isFieldName ? JsonTokenType.FieldName : JsonTokenType.String); if (JsonBinaryEncoding.TryGetEncodedStringTypeMarker( utf8Span, + this.JsonObjectState.CurrentTokenType == JsonTokenType.FieldName ? this.jsonStringDictionary : null, out JsonBinaryEncoding.MultiByteTypeMarker multiByteTypeMarker)) { switch (multiByteTypeMarker.Length) @@ -1610,16 +1614,18 @@ public void WriteRawJsonValue( ReadOnlyMemory rootBuffer, int valueOffset, UniformArrayInfo externalArrayInfo, - bool isFieldName) + bool isFieldName, + IJsonStringDictionary jsonStringDictionary) { - this.ForceRewriteRawJsonValue(rootBuffer, valueOffset, externalArrayInfo, isFieldName); + this.ForceRewriteRawJsonValue(rootBuffer, valueOffset, externalArrayInfo, isFieldName, jsonStringDictionary); } private void ForceRewriteRawJsonValue( ReadOnlyMemory rootBuffer, int valueOffset, UniformArrayInfo externalArrayInfo, - bool isFieldName) + bool isFieldName, + IJsonStringDictionary jsonStringDictionary) { ReadOnlyMemory rawJsonValue = rootBuffer.Slice(valueOffset); byte typeMarker = rawJsonValue.Span[0]; @@ -1669,7 +1675,7 @@ private void ForceRewriteRawJsonValue( case RawValueType.StrL1: case RawValueType.StrL2: case RawValueType.StrL4: - this.WriteRawStringValue(rawType, rawJsonValue, isFieldName); + this.WriteRawStringValue(rawType, rawJsonValue, isFieldName, this.jsonStringDictionary); break; case RawValueType.StrR1: @@ -1677,28 +1683,32 @@ private void ForceRewriteRawJsonValue( rootBuffer, JsonBinaryEncoding.GetFixedSizedValue(rawJsonValue.Slice(start: 1).Span), default, - isFieldName); + isFieldName, + jsonStringDictionary); break; case RawValueType.StrR2: this.ForceRewriteRawJsonValue( rootBuffer, JsonBinaryEncoding.GetFixedSizedValue(rawJsonValue.Slice(start: 1).Span), default, - isFieldName); + isFieldName, + jsonStringDictionary); break; case RawValueType.StrR3: this.ForceRewriteRawJsonValue( rootBuffer, JsonBinaryEncoding.GetFixedSizedValue(rawJsonValue.Slice(start: 1).Span), default, - isFieldName); + isFieldName, + jsonStringDictionary); break; case RawValueType.StrR4: this.ForceRewriteRawJsonValue( rootBuffer, JsonBinaryEncoding.GetFixedSizedValue(rawJsonValue.Slice(start: 1).Span), default, - isFieldName); + isFieldName, + jsonStringDictionary); break; case RawValueType.Arr1: @@ -1711,7 +1721,8 @@ private void ForceRewriteRawJsonValue( rootBuffer, valueOffset: valueOffset + 1, externalArrayInfo: default, - isFieldName: false); + isFieldName: false, + jsonStringDictionary: jsonStringDictionary); this.JsonObjectState.RegisterToken(JsonTokenType.EndArray); } @@ -1727,7 +1738,8 @@ private void ForceRewriteRawJsonValue( rootBuffer, valueOffset: valueOffset + 1, externalArrayInfo: default, - isFieldName: true); + isFieldName: true, + jsonStringDictionary: jsonStringDictionary); int nameLength = JsonBinaryEncoding.GetValueLength(rawJsonValue.Slice(start: 1).Span); @@ -1735,7 +1747,8 @@ private void ForceRewriteRawJsonValue( rootBuffer, valueOffset: valueOffset + 1 + nameLength, externalArrayInfo: default, - isFieldName: false); + isFieldName: false, + jsonStringDictionary: jsonStringDictionary); this.JsonObjectState.RegisterToken(JsonTokenType.EndObject); } @@ -1751,7 +1764,8 @@ private void ForceRewriteRawJsonValue( rootBuffer, arrayItem.Offset, arrayItem.ExternalArrayInfo, - isFieldName); + isFieldName, + jsonStringDictionary); } this.WriteArrayEnd(); @@ -1764,8 +1778,8 @@ private void ForceRewriteRawJsonValue( foreach (JsonBinaryEncoding.Enumerator.ObjectProperty property in JsonBinaryEncoding.Enumerator.GetObjectProperties(rootBuffer, valueOffset)) { - this.ForceRewriteRawJsonValue(rootBuffer, property.NameOffset, externalArrayInfo: default, isFieldName: true); - this.ForceRewriteRawJsonValue(rootBuffer, property.ValueOffset, externalArrayInfo: default, isFieldName: false); + this.ForceRewriteRawJsonValue(rootBuffer, property.NameOffset, externalArrayInfo: default, isFieldName: true, jsonStringDictionary: this.jsonStringDictionary); + this.ForceRewriteRawJsonValue(rootBuffer, property.ValueOffset, externalArrayInfo: default, isFieldName: false, jsonStringDictionary: this.jsonStringDictionary); } this.WriteObjectEnd(); @@ -1790,7 +1804,7 @@ private void ForceRewriteRawJsonValue( } } - private void WriteRawStringValue(RawValueType rawValueType, ReadOnlyMemory buffer, bool isFieldName) + private void WriteRawStringValue(RawValueType rawValueType, ReadOnlyMemory buffer, bool isFieldName, IJsonStringDictionary jsonStringDictionary) { Utf8Span rawStringValue; switch (rawValueType) @@ -1798,6 +1812,7 @@ private void WriteRawStringValue(RawValueType rawValueType, ReadOnlyMemory case RawValueType.StrUsr: if (!JsonBinaryEncoding.TryGetDictionaryEncodedStringValue( buffer.Span, + jsonStringDictionary, out UtfAllString value)) { throw new InvalidOperationException("Failed to get dictionary encoded string value"); @@ -1846,7 +1861,7 @@ private void WriteRawStringValue(RawValueType rawValueType, ReadOnlyMemory private void WriteRawUniformArrayItem( ReadOnlySpan rawValue, UniformArrayInfo arrayInfo) - { + { if (arrayInfo == null) throw new ArgumentNullException(nameof(arrayInfo)); switch (arrayInfo.ItemTypeMarker) diff --git a/Microsoft.Azure.Cosmos/src/Json/JsonWriter.cs b/Microsoft.Azure.Cosmos/src/Json/JsonWriter.cs index 20535f0c31..2fda753df2 100644 --- a/Microsoft.Azure.Cosmos/src/Json/JsonWriter.cs +++ b/Microsoft.Azure.Cosmos/src/Json/JsonWriter.cs @@ -49,11 +49,13 @@ protected JsonWriter() /// The JsonSerializationFormat of the writer. /// The write options the control the write behavior. /// Initial capacity to help avoid intermediary allocations. + /// The dictionary to use for user string encoding. /// A JsonWriter that can write in a particular JsonSerializationFormat public static IJsonWriter Create( JsonSerializationFormat jsonSerializationFormat, JsonWriteOptions writeOptions = JsonWriteOptions.None, - int initialCapacity = 256) + int initialCapacity = 256, + IJsonStringDictionary jsonStringDictionary = null) { return jsonSerializationFormat switch { @@ -61,7 +63,8 @@ public static IJsonWriter Create( JsonSerializationFormat.Binary => new JsonBinaryWriter( enableNumberArrays: writeOptions.HasFlag(JsonWriteOptions.EnableNumberArrays), enableUint64Values: writeOptions.HasFlag(JsonWriteOptions.EnableUInt64Values), - initialCapacity: initialCapacity), + initialCapacity: initialCapacity, + jsonStringDictionary: jsonStringDictionary), _ => throw new ArgumentException( string.Format( CultureInfo.CurrentCulture, diff --git a/Microsoft.Azure.Cosmos/src/Linq/BuiltinFunctions/BuiltinFunctionVisitor.cs b/Microsoft.Azure.Cosmos/src/Linq/BuiltinFunctions/BuiltinFunctionVisitor.cs index 3dbbedce16..dafc1d7265 100644 --- a/Microsoft.Azure.Cosmos/src/Linq/BuiltinFunctions/BuiltinFunctionVisitor.cs +++ b/Microsoft.Azure.Cosmos/src/Linq/BuiltinFunctions/BuiltinFunctionVisitor.cs @@ -1,121 +1,125 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Linq -{ - using System; - using System.Collections.Generic; - using System.Globalization; - using System.Linq.Expressions; - using Microsoft.Azure.Cosmos; - using Microsoft.Azure.Cosmos.Spatial; - using Microsoft.Azure.Cosmos.SqlObjects; - using Microsoft.Azure.Documents; - - internal abstract class BuiltinFunctionVisitor - { - public SqlScalarExpression Visit(MethodCallExpression methodCallExpression, TranslationContext context) - { - SqlScalarExpression result = this.VisitExplicit(methodCallExpression, context); - if (result != null) - { - return result; - } - - result = this.VisitImplicit(methodCallExpression, context); - if (result != null) - { - return result; - } - - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.MethodNotSupported, methodCallExpression.Method.Name)); - } - - public static SqlScalarExpression VisitBuiltinFunctionCall(MethodCallExpression methodCallExpression, TranslationContext context) - { - Type declaringType; - - // Method could be an extension method - if (methodCallExpression.Method.IsStatic && methodCallExpression.Method.IsExtensionMethod()) - { - if (methodCallExpression.Arguments.Count < 1) - { - // Extension methods should has at least 1 argument, this should never happen - // Throwing ArgumentException instead of assert - throw new ArgumentException(); - } - - declaringType = methodCallExpression.Arguments[0].Type; - - if (methodCallExpression.Method.DeclaringType.GeUnderlyingSystemType() == typeof(CosmosLinqExtensions)) - { - // CosmosLinq Extensions can be RegexMatch, DocumentId or Type check functions (IsString, IsBool, etc.) - if ((methodCallExpression.Method.Name == nameof(CosmosLinqExtensions.RegexMatch)) || - (methodCallExpression.Method.Name == nameof(CosmosLinqExtensions.FullTextContains)) || - (methodCallExpression.Method.Name == nameof(CosmosLinqExtensions.FullTextContainsAll)) || - (methodCallExpression.Method.Name == nameof(CosmosLinqExtensions.FullTextContainsAny))) - { - return StringBuiltinFunctions.Visit(methodCallExpression, context); +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Linq +{ + using System; + using System.Collections.Generic; + using System.Globalization; + using System.Linq.Expressions; + using Microsoft.Azure.Cosmos; + using Microsoft.Azure.Cosmos.Spatial; + using Microsoft.Azure.Cosmos.SqlObjects; + using Microsoft.Azure.Documents; + + internal abstract class BuiltinFunctionVisitor + { + public SqlScalarExpression Visit(MethodCallExpression methodCallExpression, TranslationContext context) + { + SqlScalarExpression result = this.VisitExplicit(methodCallExpression, context); + if (result != null) + { + return result; + } + + result = this.VisitImplicit(methodCallExpression, context); + if (result != null) + { + return result; + } + + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.MethodNotSupported, methodCallExpression.Method.Name)); + } + + public static SqlScalarExpression VisitBuiltinFunctionCall(MethodCallExpression methodCallExpression, TranslationContext context) + { + Type declaringType; + bool isExtensionMethod = methodCallExpression.Method.IsExtensionMethod(); + // Method could be an extension method + // RRF doesn't have "this" qualifier, so it's not considered an extension method by the compiler, and so needed to be checked separately + if (methodCallExpression.Method.IsStatic && + (methodCallExpression.Method.IsExtensionMethod() + || methodCallExpression.Method.Name.Equals(nameof(CosmosLinqExtensions.RRF)))) + { + if (methodCallExpression.Arguments.Count < 1) + { + // Extension methods should has at least 1 argument, this should never happen + // Throwing ArgumentException instead of assert + throw new ArgumentException(); + } + + declaringType = methodCallExpression.Arguments[0].Type; + + if (methodCallExpression.Method.DeclaringType.GeUnderlyingSystemType() == typeof(CosmosLinqExtensions)) + { + // CosmosLinq Extensions can be RegexMatch, DocumentId or Type check functions (IsString, IsBool, etc.) + switch (methodCallExpression.Method.Name) + { + case nameof(CosmosLinqExtensions.RegexMatch): + case nameof(CosmosLinqExtensions.FullTextContains): + case nameof(CosmosLinqExtensions.FullTextContainsAll): + case nameof(CosmosLinqExtensions.FullTextContainsAny): + return StringBuiltinFunctions.Visit(methodCallExpression, context); + case nameof(CosmosLinqExtensions.DocumentId): + case nameof(CosmosLinqExtensions.RRF): + case nameof(CosmosLinqExtensions.FullTextScore): + case nameof(CosmosLinqExtensions.VectorDistance): + return OtherBuiltinSystemFunctions.Visit(methodCallExpression, context); + default: + return TypeCheckFunctions.Visit(methodCallExpression, context); } - - if (methodCallExpression.Method.Name == nameof(CosmosLinqExtensions.DocumentId)) - { - return OtherBuiltinSystemFunctions.Visit(methodCallExpression, context); - } - - return TypeCheckFunctions.Visit(methodCallExpression, context); - } - } - else - { - declaringType = methodCallExpression.Method.DeclaringType; - } - - // Check order matters, some extension methods work for both strings and arrays - - // Math functions - if (declaringType == typeof(Math)) - { - return MathBuiltinFunctions.Visit(methodCallExpression, context); - } - - // ToString with String and Guid only becomes passthrough - if (methodCallExpression.Method.Name == "ToString" && - methodCallExpression.Arguments.Count == 0 && - methodCallExpression.Object != null && - ((methodCallExpression.Object.Type == typeof(string)) || - (methodCallExpression.Object.Type == typeof(Guid)))) - { - return ExpressionToSql.VisitNonSubqueryScalarExpression(methodCallExpression.Object, context); - } - - // String functions or ToString with Objects that are not strings and guids - if ((declaringType == typeof(string)) || - (methodCallExpression.Method.Name == "ToString" && - methodCallExpression.Arguments.Count == 0 && - methodCallExpression.Object != null)) - { - return StringBuiltinFunctions.Visit(methodCallExpression, context); - } - - // Array functions - if (declaringType.IsEnumerable()) - { - return ArrayBuiltinFunctions.Visit(methodCallExpression, context); - } - - // Spatial functions - if (typeof(Geometry).IsAssignableFrom(declaringType)) - { - return SpatialBuiltinFunctions.Visit(methodCallExpression, context); - } - - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.MethodNotSupported, methodCallExpression.Method.Name)); - } - - protected abstract SqlScalarExpression VisitExplicit(MethodCallExpression methodCallExpression, TranslationContext context); - - protected abstract SqlScalarExpression VisitImplicit(MethodCallExpression methodCallExpression, TranslationContext context); - } -} + } + } + else + { + declaringType = methodCallExpression.Method.DeclaringType; + } + + // Check order matters, some extension methods work for both strings and arrays + + // Math functions + if (declaringType == typeof(Math)) + { + return MathBuiltinFunctions.Visit(methodCallExpression, context); + } + + // ToString with String and Guid only becomes passthrough + if (methodCallExpression.Method.Name == "ToString" && + methodCallExpression.Arguments.Count == 0 && + methodCallExpression.Object != null && + ((methodCallExpression.Object.Type == typeof(string)) || + (methodCallExpression.Object.Type == typeof(Guid)))) + { + return ExpressionToSql.VisitNonSubqueryScalarExpression(methodCallExpression.Object, context); + } + + // String functions or ToString with Objects that are not strings and guids + if ((declaringType == typeof(string)) || + (methodCallExpression.Method.Name == "ToString" && + methodCallExpression.Arguments.Count == 0 && + methodCallExpression.Object != null)) + { + return StringBuiltinFunctions.Visit(methodCallExpression, context); + } + + // Array functions + if (declaringType.IsEnumerable()) + { + return ArrayBuiltinFunctions.Visit(methodCallExpression, context); + } + + // Spatial functions + if (typeof(Geometry).IsAssignableFrom(declaringType)) + { + return SpatialBuiltinFunctions.Visit(methodCallExpression, context); + } + + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.MethodNotSupported, methodCallExpression.Method.Name)); + } + + protected abstract SqlScalarExpression VisitExplicit(MethodCallExpression methodCallExpression, TranslationContext context); + + protected abstract SqlScalarExpression VisitImplicit(MethodCallExpression methodCallExpression, TranslationContext context); + } +} diff --git a/Microsoft.Azure.Cosmos/src/Linq/BuiltinFunctions/OtherBuiltinSystemFunctions.cs b/Microsoft.Azure.Cosmos/src/Linq/BuiltinFunctions/OtherBuiltinSystemFunctions.cs index ea748b9a74..a928f889e8 100644 --- a/Microsoft.Azure.Cosmos/src/Linq/BuiltinFunctions/OtherBuiltinSystemFunctions.cs +++ b/Microsoft.Azure.Cosmos/src/Linq/BuiltinFunctions/OtherBuiltinSystemFunctions.cs @@ -6,12 +6,163 @@ namespace Microsoft.Azure.Cosmos.Linq { using System; using System.Collections.Generic; + using System.Collections.Immutable; + using System.Collections.ObjectModel; using System.Globalization; using System.Linq.Expressions; + using System.Text.Json; + using System.Text.Json.Serialization; + using Microsoft.Azure.Cosmos.CosmosElements; using Microsoft.Azure.Cosmos.SqlObjects; internal static class OtherBuiltinSystemFunctions { + private class RRFVisit : SqlBuiltinFunctionVisitor + { + public RRFVisit() + : base("RRF", + true, + new List() + { + new Type[]{typeof(double[])} + }) + { + } + + protected override SqlScalarExpression VisitImplicit(MethodCallExpression methodCallExpression, TranslationContext context) + { + if (methodCallExpression.Arguments.Count == 1 + && methodCallExpression.Arguments[0] is NewArrayExpression argumentsExpressions) + { + // For RRF, We don't need to care about the first argument, it is the object itself and have no relevance to the computation + ReadOnlyCollection functionListExpression = argumentsExpressions.Expressions; + List arguments = new List(); + foreach (Expression argument in functionListExpression) + { + if (!(argument is MethodCallExpression functionCallExpression)) + { + throw new ArgumentException( + string.Format( + CultureInfo.CurrentCulture, + "Expressions of type {0} is not supported as an argument to CosmosLinqExtensions.RRF. Supported expressions are method calls to {1}, {2}.", + argument.Type, + nameof(CosmosLinqExtensions.FullTextScore), + nameof(CosmosLinqExtensions.VectorDistance))); + } + + if (functionCallExpression.Method.Name != nameof(CosmosLinqExtensions.FullTextScore) && + functionCallExpression.Method.Name != nameof(CosmosLinqExtensions.VectorDistance)) + { + throw new ArgumentException( + string.Format( + CultureInfo.CurrentCulture, + "Method {0} is not supported as an argument to CosmosLinqExtensions.RRF. Supported methods are {1}, {2}.", + functionCallExpression.Method.Name, + nameof(CosmosLinqExtensions.FullTextScore), + nameof(CosmosLinqExtensions.VectorDistance))); + } + + arguments.Add(ExpressionToSql.VisitNonSubqueryScalarExpression(argument, context)); + } + + return SqlFunctionCallScalarExpression.CreateBuiltin(SqlFunctionCallScalarExpression.Names.RRF, arguments.ToImmutableArray()); + } + + return null; + } + + protected override SqlScalarExpression VisitExplicit(MethodCallExpression methodCallExpression, TranslationContext context) + { + return null; + } + } + + private class FullTextScoreVisit : SqlBuiltinFunctionVisitor + { + public FullTextScoreVisit() + : base("FullTextScore", + true, + new List() + { + new Type[]{typeof(object), typeof(string[])} + }) + { + } + + protected override SqlScalarExpression VisitImplicit(MethodCallExpression methodCallExpression, TranslationContext context) + { + if (methodCallExpression.Arguments.Count == 2 + && methodCallExpression.Arguments[1] is ConstantExpression stringListArgumentExpression + && ExpressionToSql.VisitConstant(stringListArgumentExpression, context) is SqlArrayCreateScalarExpression arrayScalarExpressions) + { + List arguments = new List + { + ExpressionToSql.VisitNonSubqueryScalarExpression(methodCallExpression.Arguments[0], context) + }; + + arguments.AddRange(arrayScalarExpressions.Items); + + return SqlFunctionCallScalarExpression.CreateBuiltin(SqlFunctionCallScalarExpression.Names.FullTextScore, arguments.ToImmutableArray()); + } + + return null; + } + + protected override SqlScalarExpression VisitExplicit(MethodCallExpression methodCallExpression, TranslationContext context) + { + return null; + } + } + + private class VectorDistanceVisit : SqlBuiltinFunctionVisitor + { + public VectorDistanceVisit() + : base("VectorDistance", + true, + new List() + { + new Type[]{typeof(float[]), typeof(float[]), typeof(bool), typeof(CosmosLinqExtensions.VectorDistanceOptions)}, + new Type[]{typeof(sbyte[]), typeof(sbyte[]), typeof(bool), typeof(CosmosLinqExtensions.VectorDistanceOptions)}, + new Type[]{typeof(byte[]), typeof(byte[]), typeof(bool), typeof(CosmosLinqExtensions.VectorDistanceOptions)}, + }) + { + } + + protected override SqlScalarExpression VisitImplicit(MethodCallExpression methodCallExpression, TranslationContext context) + { + if (methodCallExpression.Arguments.Count != 4) throw new ArgumentException(); + + List arguments = new List + { + ExpressionToSql.VisitNonSubqueryScalarExpression(methodCallExpression.Arguments[0], context), + ExpressionToSql.VisitNonSubqueryScalarExpression(methodCallExpression.Arguments[1], context), + ExpressionToSql.VisitNonSubqueryScalarExpression(methodCallExpression.Arguments[2], context) + }; + + if (methodCallExpression.Arguments[3] is ConstantExpression optionExpression && optionExpression.Value != null) + { + JsonSerializerOptions options = new JsonSerializerOptions + { + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + }; + options.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.CamelCase)); + + string serializedConstant = JsonSerializer.Serialize( + optionExpression.Value, + options); + + arguments.Add(CosmosElement.Parse(serializedConstant).Accept(CosmosElementToSqlScalarExpressionVisitor.Singleton)); + } + + return SqlFunctionCallScalarExpression.CreateBuiltin(SqlFunctionCallScalarExpression.Names.VectorDistance, arguments.ToImmutableArray()); + } + + protected override SqlScalarExpression VisitExplicit(MethodCallExpression methodCallExpression, TranslationContext context) + { + return null; + } + } + private static Dictionary FunctionsDefinitions { get; set; } static OtherBuiltinSystemFunctions() @@ -24,7 +175,10 @@ static OtherBuiltinSystemFunctions() argumentLists: new List() { new Type[]{typeof(object)}, - }) + }), + [nameof(CosmosLinqExtensions.RRF)] = new RRFVisit(), + [nameof(CosmosLinqExtensions.FullTextScore)] = new FullTextScoreVisit(), + [nameof(CosmosLinqExtensions.VectorDistance)] = new VectorDistanceVisit(), }; } diff --git a/Microsoft.Azure.Cosmos/src/Linq/CosmosLinqExtensions.cs b/Microsoft.Azure.Cosmos/src/Linq/CosmosLinqExtensions.cs index 6b84c04198..56f05c9faa 100644 --- a/Microsoft.Azure.Cosmos/src/Linq/CosmosLinqExtensions.cs +++ b/Microsoft.Azure.Cosmos/src/Linq/CosmosLinqExtensions.cs @@ -1,246 +1,343 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Linq -{ - using System; - using System.Collections.Generic; - using System.Diagnostics; - using System.Linq; - using System.Linq.Expressions; - using System.Reflection; - using System.Threading; - using System.Threading.Tasks; - using Microsoft.Azure.Cosmos.Diagnostics; - using Microsoft.Azure.Cosmos.Tracing; - - /// - /// This class provides extension methods for cosmos LINQ code. - /// - public static class CosmosLinqExtensions +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Linq +{ + using System; + using System.Collections.Generic; + using System.Diagnostics; + using System.Linq; + using System.Linq.Expressions; + using System.Reflection; + using System.Text.Json.Serialization; + using System.Threading; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos.Diagnostics; + using Microsoft.Azure.Cosmos.Tracing; + + /// + /// This class provides extension methods for cosmos LINQ code. + /// + public static class CosmosLinqExtensions { - /// - /// Returns the integer identifier corresponding to a specific item within a physical partition. - /// This method is to be used in LINQ expressions only and will be evaluated on server. - /// There's no implementation provided in the client library. - /// - /// The root object - /// Returns the integer identifier corresponding to a specific item within a physical partition. - /// - /// - /// root.DocumentId()); - /// ]]> - /// - /// - public static int DocumentId(this object obj) - { - throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); - } - - /// - /// Returns a Boolean value indicating if the type of the specified expression is an array. - /// This method is to be used in LINQ expressions only and will be evaluated on server. - /// There's no implementation provided in the client library. - /// - /// - /// Returns true if the type of the specified expression is an array; otherwise, false. - /// - /// - /// document.Names.IsArray()); - /// ]]> - /// - /// - public static bool IsArray(this object obj) - { - throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); - } - - /// - /// Returns a Boolean value indicating if the type of the specified expression is a boolean. - /// This method is to be used in LINQ expressions only and will be evaluated on server. - /// There's no implementation provided in the client library. - /// - /// - /// Returns true if the type of the specified expression is a boolean; otherwise, false. - /// - /// - /// document.IsRegistered.IsBool()); - /// ]]> - /// - /// - public static bool IsBool(this object obj) - { - throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); - } - - /// - /// Determines if a certain property is defined or not. - /// This method is to be used in LINQ expressions only and will be evaluated on server. - /// There's no implementation provided in the client library. - /// - /// - /// Returns true if this property is defined otherwise returns false. - /// - /// - /// document.Name.IsDefined()); - /// ]]> - /// - /// - public static bool IsDefined(this object obj) - { - throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); - } - - /// - /// Determines if a certain property is null or not. - /// This method is to be used in LINQ expressions only and will be evaluated on server. - /// There's no implementation provided in the client library. - /// - /// - /// Returns true if this property is null otherwise returns false. - /// - /// - /// document.Name.IsNull()); - /// ]]> - /// - /// - public static bool IsNull(this object obj) - { - throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); - } - - /// - /// Returns a Boolean value indicating if the type of the specified expression is a number. - /// This method is to be used in LINQ expressions only and will be evaluated on server. - /// There's no implementation provided in the client library. - /// - /// - /// Returns true if the type of the specified expression is a number; otherwise, false. - /// - /// - /// document.Age.IsNumber()); - /// ]]> - /// - /// - public static bool IsNumber(this object obj) - { - throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); - } - - /// - /// Returns a Boolean value indicating if the type of the specified expression is an object. - /// This method is to be used in LINQ expressions only and will be evaluated on server. - /// There's no implementation provided in the client library. - /// - /// - /// Returns true if the type of the specified expression is an object; otherwise, false. - /// - /// - /// document.Address.IsObject()); - /// ]]> - /// - /// - public static bool IsObject(this object obj) - { - throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); - } - - /// - /// Determines if a certain property is of primitive JSON type. - /// This method is to be used in LINQ expressions only and will be evaluated on server. - /// There's no implementation provided in the client library. - /// - /// - /// Returns true if this property is null otherwise returns false. - /// - /// Primitive JSON types (Double, String, Boolean and Null) - /// - /// - /// - /// document.Name.IsPrimitive()); - /// ]]> - /// - /// - public static bool IsPrimitive(this object obj) - { - throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); - } - - /// - /// Returns a Boolean value indicating if the type of the specified expression is a string. - /// This method is to be used in LINQ expressions only and will be evaluated on server. - /// There's no implementation provided in the client library. - /// - /// - /// Returns true if the type of the specified expression is a string; otherwise, false. - /// - /// - /// document.Name.IsString()); - /// ]]> - /// - /// - public static bool IsString(this object obj) - { - throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); - } - - /// - /// Returns a Boolean value indicating if the specified expression matches the supplied regex pattern. - /// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/regexmatch. - /// This method is to be used in LINQ expressions only and will be evaluated on server. - /// There's no implementation provided in the client library. - /// - /// - /// A string expression with a regular expression defined to use when searching. - /// Returns true if the string matches the regex expressions; otherwise, false. - /// - /// - /// document.Name.RegexMatch()); - /// ]]> - /// - /// - public static bool RegexMatch(this object obj, string regularExpression) - { - throw new NotImplementedException(ClientResources.ExtensionMethodNotImplemented); - } - - /// - /// Returns a Boolean value indicating if the specified expression matches the supplied regex pattern. - /// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/regexmatch. - /// This method is to be used in LINQ expressions only and will be evaluated on server. - /// There's no implementation provided in the client library. - /// - /// - /// A string expression with a regular expression defined to use when searching. - /// An optional string expression with the selected modifiers to use with the regular expression. - /// Returns true if the string matches the regex expressions; otherwise, false. - /// - /// - /// document.Name.RegexMatch(, )); - /// ]]> - /// - /// - public static bool RegexMatch(this object obj, string regularExpression, string searchModifier) - { - throw new NotImplementedException(ClientResources.ExtensionMethodNotImplemented); + /// + /// Object representing the options for vector distance calculation. All field are optional. if a field is not specified, the default value will be used. + /// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/vectordistance. + /// + public sealed class VectorDistanceOptions + { + /// + /// The metric used to compute distance/similarity. Valid values are "cosine", "dotproduct", "euclidean". + /// If not specified, the default value is what is defined in the container policy + /// + [JsonPropertyName("distanceFunction")] + public DistanceFunction? DistanceFunction { get; set; } + + /// + /// The data type of the vectors. float32, int8, uint8 values. Default value is float32. + /// + [JsonPropertyName("dataType")] + public VectorDataType? DataType { get; set; } + + /// + /// An integer specifying the size of the search list when conducting a vector search on the DiskANN index. + /// Increasing this may improve accuracy at the expense of RU cost and latency. Min=1, Default=10, Max=100. + /// + [JsonPropertyName("searchListSizeMultiplier")] + public int? SearchListSizeMultiplier { get; set; } + } + + /// + /// Returns the integer identifier corresponding to a specific item within a physical partition. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// The root object + /// Returns the integer identifier corresponding to a specific item within a physical partition. + /// + /// + /// root.DocumentId()); + /// ]]> + /// + /// + public static int DocumentId(this object obj) + { + throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); + } + + /// + /// Returns a Boolean value indicating if the type of the specified expression is an array. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// + /// Returns true if the type of the specified expression is an array; otherwise, false. + /// + /// + /// document.Names.IsArray()); + /// ]]> + /// + /// + public static bool IsArray(this object obj) + { + throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); + } + + /// + /// Returns a Boolean value indicating if the type of the specified expression is a boolean. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// + /// Returns true if the type of the specified expression is a boolean; otherwise, false. + /// + /// + /// document.IsRegistered.IsBool()); + /// ]]> + /// + /// + public static bool IsBool(this object obj) + { + throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); + } + + /// + /// Determines if a certain property is defined or not. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// + /// Returns true if this property is defined otherwise returns false. + /// + /// + /// document.Name.IsDefined()); + /// ]]> + /// + /// + public static bool IsDefined(this object obj) + { + throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); + } + + /// + /// Determines if a certain property is null or not. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// + /// Returns true if this property is null otherwise returns false. + /// + /// + /// document.Name.IsNull()); + /// ]]> + /// + /// + public static bool IsNull(this object obj) + { + throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); + } + + /// + /// Returns a Boolean value indicating if the type of the specified expression is a number. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// + /// Returns true if the type of the specified expression is a number; otherwise, false. + /// + /// + /// document.Age.IsNumber()); + /// ]]> + /// + /// + public static bool IsNumber(this object obj) + { + throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); + } + + /// + /// Returns a Boolean value indicating if the type of the specified expression is an object. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// + /// Returns true if the type of the specified expression is an object; otherwise, false. + /// + /// + /// document.Address.IsObject()); + /// ]]> + /// + /// + public static bool IsObject(this object obj) + { + throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); + } + + /// + /// Determines if a certain property is of primitive JSON type. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// + /// Returns true if this property is null otherwise returns false. + /// + /// Primitive JSON types (Double, String, Boolean and Null) + /// + /// + /// + /// document.Name.IsPrimitive()); + /// ]]> + /// + /// + public static bool IsPrimitive(this object obj) + { + throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); + } + + /// + /// Returns a Boolean value indicating if the type of the specified expression is a string. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// + /// Returns true if the type of the specified expression is a string; otherwise, false. + /// + /// + /// document.Name.IsString()); + /// ]]> + /// + /// + public static bool IsString(this object obj) + { + throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); + } + + /// + /// Returns a Boolean value indicating if the specified expression matches the supplied regex pattern. + /// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/regexmatch. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// + /// A string expression with a regular expression defined to use when searching. + /// Returns true if the string matches the regex expressions; otherwise, false. + /// + /// + /// document.Name.RegexMatch()); + /// ]]> + /// + /// + public static bool RegexMatch(this object obj, string regularExpression) + { + throw new NotImplementedException(ClientResources.ExtensionMethodNotImplemented); + } + + /// + /// Returns a Boolean value indicating if the specified expression matches the supplied regex pattern. + /// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/regexmatch. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// + /// A string expression with a regular expression defined to use when searching. + /// An optional string expression with the selected modifiers to use with the regular expression. + /// Returns true if the string matches the regex expressions; otherwise, false. + /// + /// + /// document.Name.RegexMatch(, )); + /// ]]> + /// + /// + public static bool RegexMatch(this object obj, string regularExpression, string searchModifier) + { + throw new NotImplementedException(ClientResources.ExtensionMethodNotImplemented); + } + + /// + /// Returns the similarity score between two specified vectors. + /// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/vectordistance. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// The first vector. + /// The second vector. + /// A boolean specifying how the computed value is used in an ORDER BY expression. If true, then brute force is used. A value of false uses any index defined on the vector property, if it exists. + /// An JSON formatted object literal used to specify options for the vector distance calculation. + /// Returns the similarity score between two specified vectors. + /// + /// + /// document.vector1.VectorDistance(, true, new VectorDistanceOptions() { DistanceFunction = DistanceFunction.Cosine, DataType = VectorDataType.Float32})); + /// ]]> + /// + /// + public static double VectorDistance(this float[] vector1, float[] vector2, bool isBruteForce, VectorDistanceOptions options) + { + throw new NotImplementedException(ClientResources.ExtensionMethodNotImplemented); + } + + /// + /// Returns the similarity score between two specified vectors. + /// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/vectordistance. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// The first vector. + /// The second vector. + /// A boolean specifying how the computed value is used in an ORDER BY expression. If true, then brute force is used. A value of false uses any index defined on the vector property, if it exists. + /// An JSON formatted object literal used to specify options for the vector distance calculation. + /// Returns the similarity score between two specified vectors. + /// + /// + /// document.vector1.VectorDistance(, true, new VectorDistanceOptions() { DistanceFunction = DistanceFunction.Cosine, DataType = VectorDataType.Int8})); + /// ]]> + /// + /// + public static double VectorDistance(this byte[] vector1, byte[] vector2, bool isBruteForce, VectorDistanceOptions options) + { + throw new NotImplementedException(ClientResources.ExtensionMethodNotImplemented); + } + + /// + /// Returns the similarity score between two specified vectors. + /// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/vectordistance. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// The first vector. + /// The second vector. + /// A boolean specifying how the computed value is used in an ORDER BY expression. If true, then brute force is used. A value of false uses any index defined on the vector property, if it exists. + /// An JSON formatted object literal used to specify options for the vector distance calculation. + /// Returns the similarity score between two specified vectors. + /// + /// + /// document.vector1.VectorDistance(, true, new VectorDistanceOptions() { DistanceFunction = DistanceFunction.Cosine, DataType = VectorDataType.Uint8})); + /// ]]> + /// + /// + public static double VectorDistance(this sbyte[] vector1, sbyte[] vector2, bool isBruteForce, VectorDistanceOptions options) + { + throw new NotImplementedException(ClientResources.ExtensionMethodNotImplemented); } /// /// Returns a boolean indicating whether the keyword string expression is contained in a specified property path. - /// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/fulltextcontains. - /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/fulltextcontains. + /// This method is to be used in LINQ expressions only and will be evaluated on server. /// There's no implementation provided in the client library. /// /// @@ -248,8 +345,8 @@ public static bool RegexMatch(this object obj, string regularExpression, string /// Returns true if a given string is contained in the specified property of a document. /// /// - /// document.Name.FullTextContains()); + /// document.Name.FullTextContains()); /// ]]> /// /// @@ -260,8 +357,8 @@ public static bool FullTextContains(this object obj, string search) /// /// Returns a boolean indicating whether all of the provided string expressions are contained in a specified property path. - /// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/fulltextcontainsall. - /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/fulltextcontainsall. + /// This method is to be used in LINQ expressions only and will be evaluated on server. /// There's no implementation provided in the client library. /// /// @@ -269,8 +366,8 @@ public static bool FullTextContains(this object obj, string search) /// Returns true if all of the given strings are contained in the specified property of a document. /// /// - /// document.Name.FullTextContainsAll(, , , ...)); + /// document.Name.FullTextContainsAll(, , , ...)); /// ]]> /// /// @@ -281,8 +378,8 @@ public static bool FullTextContainsAll(this object obj, params string[] searches /// /// Returns a boolean indicating whether any of the provided string expressions are contained in a specified property path. - /// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/fulltextcontainsany. - /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/fulltextcontainsany. + /// This method is to be used in LINQ expressions only and will be evaluated on server. /// There's no implementation provided in the client library. /// /// @@ -290,8 +387,8 @@ public static bool FullTextContainsAll(this object obj, params string[] searches /// Returns true if any of the given strings are contained in the specified property of a document. /// /// - /// document.Name.FullTextContainsAny(, , , ...)); + /// document.Name.FullTextContainsAny(, , , ...)); /// ]]> /// /// @@ -300,650 +397,723 @@ public static bool FullTextContainsAny(this object obj, params string[] searches throw new NotImplementedException(ClientResources.ExtensionMethodNotImplemented); } - /// - /// This method generate query definition from LINQ query. - /// - /// the type of object to query. - /// the IQueryable{T} to be converted. - /// Dictionary containing parameter value and name for parameterized query - /// The queryDefinition which can be used in query execution. - /// - /// This example shows how to generate query definition from LINQ. - /// - /// - /// queryable = container.GetItemsQueryIterator(allowSynchronousQueryExecution = true) - /// .Where(t => b.id.contains("test")); - /// QueryDefinition queryDefinition = queryable.ToQueryDefinition(); - /// ]]> - /// - /// -#if PREVIEW - public -#else - internal -#endif - static QueryDefinition ToQueryDefinition(this IQueryable query, IDictionary namedParameters) - { - if (namedParameters == null) - { - throw new ArgumentException("namedParameters dictionary cannot be empty for this overload, please use ToQueryDefinition(IQueryable query) instead", nameof(namedParameters)); - } - - if (query is CosmosLinqQuery linqQuery) - { - return linqQuery.ToQueryDefinition(namedParameters); - } - - throw new ArgumentException("ToQueryDefinition is only supported on Cosmos LINQ query operations", nameof(query)); - } - - /// - /// This method generate query definition from LINQ query. - /// - /// the type of object to query. - /// the IQueryable{T} to be converted. - /// The queryDefinition which can be used in query execution. - /// - /// This example shows how to generate query definition from LINQ. - /// - /// - /// queryable = container.GetItemsQueryIterator(allowSynchronousQueryExecution = true) - /// .Where(t => b.id.contains("test")); - /// QueryDefinition queryDefinition = queryable.ToQueryDefinition(); - /// ]]> - /// - /// - public static QueryDefinition ToQueryDefinition(this IQueryable query) - { - if (query is CosmosLinqQuery linqQuery) - { - return linqQuery.ToQueryDefinition(); - - } - - throw new ArgumentException("ToQueryDefinition is only supported on Cosmos LINQ query operations", nameof(query)); - } - - /// - /// This extension method gets the FeedIterator from LINQ IQueryable to execute query asynchronously. - /// This will create the fresh new FeedIterator when called. - /// - /// the type of object to query. - /// the IQueryable{T} to be converted. - /// An iterator to go through the items. - /// - /// This example shows how to get FeedIterator from LINQ. - /// - /// - /// linqQueryable = this.Container.GetItemLinqQueryable(); - /// using (FeedIterator setIterator = linqQueryable.Where(item => (item.taskNum < 100)).ToFeedIterator() - /// ]]> - /// - /// - public static FeedIterator ToFeedIterator(this IQueryable query) - { - if (!(query is CosmosLinqQuery linqQuery)) - { - throw new ArgumentOutOfRangeException(nameof(linqQuery), "ToFeedIterator is only supported on Cosmos LINQ query operations"); - } - - return linqQuery.ToFeedIterator(); - } - - /// - /// This extension method gets the FeedIterator from LINQ IQueryable to execute query asynchronously. - /// This will create the fresh new FeedIterator when called. - /// - /// the type of object to query. - /// the IQueryable{T} to be converted. - /// An iterator to go through the items. - /// - /// This example shows how to get FeedIterator from LINQ. - /// - /// - /// linqQueryable = this.Container.GetItemLinqQueryable(); - /// using (FeedIterator setIterator = linqQueryable.Where(item => (item.taskNum < 100)).ToStreamIterator()) - /// ]]> - /// - /// - public static FeedIterator ToStreamIterator(this IQueryable query) - { - if (!(query is CosmosLinqQuery linqQuery)) - { - throw new ArgumentOutOfRangeException(nameof(linqQuery), "ToStreamFeedIterator is only supported on cosmos LINQ query operations"); - } - - return linqQuery.ToStreamIterator(); - } - - /// - /// Returns the maximum value in a generic . - /// - /// The type of the elements of source. - /// A sequence of values to determine the maximum of. - /// The cancellation token. - /// The maximum value in the sequence. - public static Task> MaxAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Max()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, TSource>(Queryable.Max), - source.Expression), - cancellationToken); - } - - /// - /// Returns the minimum value in a generic . - /// - /// The type of the elements of source. - /// A sequence of values to determine the minimum of. - /// The cancellation token. - /// The minimum value in the sequence. - public static Task> MinAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Min()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, TSource>(Queryable.Min), - source.Expression), - cancellationToken); - } - - /// - /// Computes the average of a sequence of values. - /// - /// A sequence of values to calculate the average of. - /// The cancellation token. - /// The average value in the sequence. - public static Task> AverageAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Average()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, decimal>(Queryable.Average), - source.Expression), - cancellationToken); - } - - /// - /// Computes the average of a sequence of values. - /// - /// A sequence of values to calculate the average of. - /// The cancellation token. - /// The average value in the sequence. - public static Task> AverageAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Average()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, decimal?>(Queryable.Average), - source.Expression), - cancellationToken); - } - - /// - /// Computes the average of a sequence of values. - /// - /// A sequence of values to calculate the average of. - /// The cancellation token. - /// The average value in the sequence. - public static Task> AverageAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Average()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, double>(Queryable.Average), - source.Expression), - cancellationToken); - } - - /// - /// Computes the average of a sequence of values. - /// - /// A sequence of values to calculate the average of. - /// The cancellation token. - /// The average value in the sequence. - public static Task> AverageAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Average()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, double?>(Queryable.Average), - source.Expression), - cancellationToken); - } - - /// - /// Computes the average of a sequence of values. - /// - /// A sequence of values to calculate the average of. - /// The cancellation token. - /// The average value in the sequence. - public static Task> AverageAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Average()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, float>(Queryable.Average), - source.Expression), - cancellationToken); - } - - /// - /// Computes the average of a sequence of values. - /// - /// A sequence of values to calculate the average of. - /// The cancellation token. - /// The average value in the sequence. - public static Task> AverageAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Average()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, float?>(Queryable.Average), - source.Expression), - cancellationToken); - } - - /// - /// Computes the average of a sequence of values. - /// - /// A sequence of values to calculate the average of. - /// The cancellation token. - /// The average value in the sequence. - public static Task> AverageAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Average()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, double>(Queryable.Average), - source.Expression), - cancellationToken); - } - - /// - /// Computes the average of a sequence of values. - /// - /// A sequence of values to calculate the average of. - /// The cancellation token. - /// The average value in the sequence. - public static Task> AverageAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Average()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, double?>(Queryable.Average), - source.Expression), - cancellationToken); - } - - /// - /// Computes the average of a sequence of values. - /// - /// A sequence of values to calculate the average of. - /// The cancellation token. - /// The average value in the sequence. - public static Task> AverageAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Average()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, double>(Queryable.Average), - source.Expression), - cancellationToken); - } - - /// - /// Computes the average of a sequence of values. - /// - /// A sequence of values to calculate the average of. - /// The cancellation token. - /// The average value in the sequence. - public static Task> AverageAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Average()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, double?>(Queryable.Average), - source.Expression), - cancellationToken); - } - - /// - /// Computes the sum of a sequence of values. - /// - /// A sequence of values to calculate the average of. - /// The cancellation token. - /// The average value in the sequence. - public static Task> SumAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Sum()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, decimal>(Queryable.Sum), - source.Expression), - cancellationToken); - } - - /// - /// Computes the sum of a sequence of values. - /// - /// A sequence of values to calculate the average of. - /// The cancellation token. - /// The average value in the sequence. - public static Task> SumAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Sum()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, decimal?>(Queryable.Sum), - source.Expression), - cancellationToken); - } - - /// - /// Computes the sum of a sequence of values. - /// - /// A sequence of values to calculate the average of. - /// The cancellation token. - /// The average value in the sequence. - public static Task> SumAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Sum()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, double>(Queryable.Sum), - source.Expression), - cancellationToken); - } - - /// - /// Computes the sum of a sequence of values. - /// - /// A sequence of values to calculate the average of. - /// The cancellation token. - /// The average value in the sequence. - public static Task> SumAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Sum()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, double?>(Queryable.Sum), - source.Expression), - cancellationToken); - } - - /// - /// Computes the sum of a sequence of values. - /// - /// A sequence of values to calculate the average of. - /// The cancellation token. - /// The average value in the sequence. - public static Task> SumAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Sum()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, float>(Queryable.Sum), - source.Expression), - cancellationToken); - } - - /// - /// Computes the sum of a sequence of values. - /// - /// A sequence of values to calculate the average of. - /// The cancellation token. - /// The average value in the sequence. - public static Task> SumAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Sum()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, float?>(Queryable.Sum), - source.Expression), - cancellationToken); - } - - /// - /// Computes the sum of a sequence of values. - /// - /// A sequence of values to calculate the average of. - /// The cancellation token. - /// The average value in the sequence. - public static Task> SumAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Sum()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, int>(Queryable.Sum), - source.Expression), - cancellationToken); - } - - /// - /// Computes the sum of a sequence of values. - /// - /// A sequence of values to calculate the average of. - /// The cancellation token. - /// The average value in the sequence. - public static Task> SumAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Sum()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, int?>(Queryable.Sum), - source.Expression), - cancellationToken); - } - - /// - /// Computes the sum of a sequence of values. - /// - /// A sequence of values to calculate the average of. - /// The cancellation token. - /// The average value in the sequence. - public static Task> SumAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Sum()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, long>(Queryable.Sum), - source.Expression), - cancellationToken); - } - - /// - /// Computes the sum of a sequence of values. - /// - /// A sequence of values to calculate the average of. - /// The cancellation token. - /// The average value in the sequence. - public static Task> SumAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Sum()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, long?>(Queryable.Sum), - source.Expression), - cancellationToken); - } - - /// - /// Returns the number of elements in a sequence. - /// - /// The type of the elements of source. - /// The sequence that contains the elements to be counted. - /// The cancellation token. - /// The number of elements in the input sequence. - public static Task> CountAsync( - this IQueryable source, - CancellationToken cancellationToken = default) - { - if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) - { - return ResponseHelperAsync(source.Count()); - } - - return cosmosLinqQueryProvider.ExecuteAggregateAsync( - Expression.Call( - GetMethodInfoOf, int>(Queryable.Count), - source.Expression), - cancellationToken); - } - - private static Task> ResponseHelperAsync(T value) - { - return Task.FromResult>( - new ItemResponse( - System.Net.HttpStatusCode.OK, - new Headers(), - value, - new CosmosTraceDiagnostics(NoOpTrace.Singleton), - null)); - } - - private static MethodInfo GetMethodInfoOf(Func func) - { - Debug.Assert(func != null); - return func.GetMethodInfo(); - } - } -} + /// + /// Returns a BM25 score value that can only be used in an ORDER BY RANK function to sort results from highest relevancy to lowest relevancy. + /// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/fulltextscore. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// + /// A nonempty array of string literals. + /// Returns a BM25 score value that can only be used in an ORDER BY RANK clause. + /// + /// + /// document.Name.FullTextScore([], [keyword2])); + /// ]]> + /// + /// + public static double FullTextScore(this TSource obj, params string[] terms) + { + throw new NotImplementedException(ClientResources.ExtensionMethodNotImplemented); + } + + /// + /// This optional ORDER BY RANK clause sorts scoring functions by their rank. It's used specifically for scoring functions like VectorDistance, FullTextScore, and RRF. + /// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/order-by-rank. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// A sequence of values to order. + /// A scoring function. + /// Returns the sequence with the elements ordered according to the rank of the scoring functions. + /// + /// + /// document.Name.FullTextScore()); + /// ]]> + /// + /// + public static IOrderedQueryable OrderByRank(this IQueryable source, Expression> scoreFunction) + { + if (!(source is CosmosLinqQuery)) + { + throw new ArgumentException("OrderByRank is only supported on Cosmos LINQ query operations"); + } + + return (IOrderedQueryable)source.Provider.CreateQuery( + Expression.Call( + null, + typeof(CosmosLinqExtensions).GetMethod("OrderByRank").MakeGenericMethod(typeof(TSource), typeof(TKey)), + source.Expression, + Expression.Quote(scoreFunction))); + } + + /// + /// This system function is used to combine two or more scores provided by other scoring functions. + /// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/rrf. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// the scoring functions to combine. Valid functions are FullTextScore and VectorDistance + /// Returns the the combined scores of the scoring functions. + /// + /// + /// document.RRF(document.Name.FullTextScore(), document.Address.FullTextScore())); + /// ]]> + /// + /// + public static double RRF(params double[] scoringFunctions) + { + // The reason for not defining "this" keyword is because this causes undesirable serialization when call Expression.ToString() on this method + throw new NotImplementedException(ClientResources.ExtensionMethodNotImplemented); + } + + /// + /// This method generate query definition from LINQ query. + /// + /// the type of object to query. + /// the IQueryable{T} to be converted. + /// Dictionary containing parameter value and name for parameterized query + /// The queryDefinition which can be used in query execution. + /// + /// This example shows how to generate query definition from LINQ. + /// + /// + /// queryable = container.GetItemsQueryIterator(allowSynchronousQueryExecution = true) + /// .Where(t => b.id.contains("test")); + /// QueryDefinition queryDefinition = queryable.ToQueryDefinition(); + /// ]]> + /// + /// +#if PREVIEW + public +#else + internal +#endif + static QueryDefinition ToQueryDefinition(this IQueryable query, IDictionary namedParameters) + { + if (namedParameters == null) + { + throw new ArgumentException("namedParameters dictionary cannot be empty for this overload, please use ToQueryDefinition(IQueryable query) instead", nameof(namedParameters)); + } + + if (query is CosmosLinqQuery linqQuery) + { + return linqQuery.ToQueryDefinition(namedParameters); + } + + throw new ArgumentException("ToQueryDefinition is only supported on Cosmos LINQ query operations", nameof(query)); + } + + /// + /// This method generate query definition from LINQ query. + /// + /// the type of object to query. + /// the IQueryable{T} to be converted. + /// The queryDefinition which can be used in query execution. + /// + /// This example shows how to generate query definition from LINQ. + /// + /// + /// queryable = container.GetItemsQueryIterator(allowSynchronousQueryExecution = true) + /// .Where(t => b.id.contains("test")); + /// QueryDefinition queryDefinition = queryable.ToQueryDefinition(); + /// ]]> + /// + /// + public static QueryDefinition ToQueryDefinition(this IQueryable query) + { + if (query is CosmosLinqQuery linqQuery) + { + return linqQuery.ToQueryDefinition(); + + } + + throw new ArgumentException("ToQueryDefinition is only supported on Cosmos LINQ query operations", nameof(query)); + } + + /// + /// This extension method gets the FeedIterator from LINQ IQueryable to execute query asynchronously. + /// This will create the fresh new FeedIterator when called. + /// + /// the type of object to query. + /// the IQueryable{T} to be converted. + /// An iterator to go through the items. + /// + /// This example shows how to get FeedIterator from LINQ. + /// + /// + /// linqQueryable = this.Container.GetItemLinqQueryable(); + /// using (FeedIterator setIterator = linqQueryable.Where(item => (item.taskNum < 100)).ToFeedIterator() + /// ]]> + /// + /// + public static FeedIterator ToFeedIterator(this IQueryable query) + { + if (!(query is CosmosLinqQuery linqQuery)) + { + throw new ArgumentOutOfRangeException(nameof(linqQuery), "ToFeedIterator is only supported on Cosmos LINQ query operations"); + } + + return linqQuery.ToFeedIterator(); + } + + /// + /// This extension method gets the FeedIterator from LINQ IQueryable to execute query asynchronously. + /// This will create the fresh new FeedIterator when called. + /// + /// the type of object to query. + /// the IQueryable{T} to be converted. + /// An iterator to go through the items. + /// + /// This example shows how to get FeedIterator from LINQ. + /// + /// + /// linqQueryable = this.Container.GetItemLinqQueryable(); + /// using (FeedIterator setIterator = linqQueryable.Where(item => (item.taskNum < 100)).ToStreamIterator()) + /// ]]> + /// + /// + public static FeedIterator ToStreamIterator(this IQueryable query) + { + if (!(query is CosmosLinqQuery linqQuery)) + { + throw new ArgumentOutOfRangeException(nameof(linqQuery), "ToStreamFeedIterator is only supported on cosmos LINQ query operations"); + } + + return linqQuery.ToStreamIterator(); + } + + /// + /// Returns the maximum value in a generic . + /// + /// The type of the elements of source. + /// A sequence of values to determine the maximum of. + /// The cancellation token. + /// The maximum value in the sequence. + public static Task> MaxAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Max()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, TSource>(Queryable.Max), + source.Expression), + cancellationToken); + } + + /// + /// Returns the minimum value in a generic . + /// + /// The type of the elements of source. + /// A sequence of values to determine the minimum of. + /// The cancellation token. + /// The minimum value in the sequence. + public static Task> MinAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Min()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, TSource>(Queryable.Min), + source.Expression), + cancellationToken); + } + + /// + /// Computes the average of a sequence of values. + /// + /// A sequence of values to calculate the average of. + /// The cancellation token. + /// The average value in the sequence. + public static Task> AverageAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Average()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, decimal>(Queryable.Average), + source.Expression), + cancellationToken); + } + + /// + /// Computes the average of a sequence of values. + /// + /// A sequence of values to calculate the average of. + /// The cancellation token. + /// The average value in the sequence. + public static Task> AverageAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Average()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, decimal?>(Queryable.Average), + source.Expression), + cancellationToken); + } + + /// + /// Computes the average of a sequence of values. + /// + /// A sequence of values to calculate the average of. + /// The cancellation token. + /// The average value in the sequence. + public static Task> AverageAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Average()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, double>(Queryable.Average), + source.Expression), + cancellationToken); + } + + /// + /// Computes the average of a sequence of values. + /// + /// A sequence of values to calculate the average of. + /// The cancellation token. + /// The average value in the sequence. + public static Task> AverageAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Average()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, double?>(Queryable.Average), + source.Expression), + cancellationToken); + } + + /// + /// Computes the average of a sequence of values. + /// + /// A sequence of values to calculate the average of. + /// The cancellation token. + /// The average value in the sequence. + public static Task> AverageAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Average()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, float>(Queryable.Average), + source.Expression), + cancellationToken); + } + + /// + /// Computes the average of a sequence of values. + /// + /// A sequence of values to calculate the average of. + /// The cancellation token. + /// The average value in the sequence. + public static Task> AverageAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Average()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, float?>(Queryable.Average), + source.Expression), + cancellationToken); + } + + /// + /// Computes the average of a sequence of values. + /// + /// A sequence of values to calculate the average of. + /// The cancellation token. + /// The average value in the sequence. + public static Task> AverageAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Average()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, double>(Queryable.Average), + source.Expression), + cancellationToken); + } + + /// + /// Computes the average of a sequence of values. + /// + /// A sequence of values to calculate the average of. + /// The cancellation token. + /// The average value in the sequence. + public static Task> AverageAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Average()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, double?>(Queryable.Average), + source.Expression), + cancellationToken); + } + + /// + /// Computes the average of a sequence of values. + /// + /// A sequence of values to calculate the average of. + /// The cancellation token. + /// The average value in the sequence. + public static Task> AverageAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Average()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, double>(Queryable.Average), + source.Expression), + cancellationToken); + } + + /// + /// Computes the average of a sequence of values. + /// + /// A sequence of values to calculate the average of. + /// The cancellation token. + /// The average value in the sequence. + public static Task> AverageAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Average()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, double?>(Queryable.Average), + source.Expression), + cancellationToken); + } + + /// + /// Computes the sum of a sequence of values. + /// + /// A sequence of values to calculate the average of. + /// The cancellation token. + /// The average value in the sequence. + public static Task> SumAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Sum()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, decimal>(Queryable.Sum), + source.Expression), + cancellationToken); + } + + /// + /// Computes the sum of a sequence of values. + /// + /// A sequence of values to calculate the average of. + /// The cancellation token. + /// The average value in the sequence. + public static Task> SumAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Sum()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, decimal?>(Queryable.Sum), + source.Expression), + cancellationToken); + } + + /// + /// Computes the sum of a sequence of values. + /// + /// A sequence of values to calculate the average of. + /// The cancellation token. + /// The average value in the sequence. + public static Task> SumAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Sum()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, double>(Queryable.Sum), + source.Expression), + cancellationToken); + } + + /// + /// Computes the sum of a sequence of values. + /// + /// A sequence of values to calculate the average of. + /// The cancellation token. + /// The average value in the sequence. + public static Task> SumAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Sum()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, double?>(Queryable.Sum), + source.Expression), + cancellationToken); + } + + /// + /// Computes the sum of a sequence of values. + /// + /// A sequence of values to calculate the average of. + /// The cancellation token. + /// The average value in the sequence. + public static Task> SumAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Sum()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, float>(Queryable.Sum), + source.Expression), + cancellationToken); + } + + /// + /// Computes the sum of a sequence of values. + /// + /// A sequence of values to calculate the average of. + /// The cancellation token. + /// The average value in the sequence. + public static Task> SumAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Sum()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, float?>(Queryable.Sum), + source.Expression), + cancellationToken); + } + + /// + /// Computes the sum of a sequence of values. + /// + /// A sequence of values to calculate the average of. + /// The cancellation token. + /// The average value in the sequence. + public static Task> SumAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Sum()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, int>(Queryable.Sum), + source.Expression), + cancellationToken); + } + + /// + /// Computes the sum of a sequence of values. + /// + /// A sequence of values to calculate the average of. + /// The cancellation token. + /// The average value in the sequence. + public static Task> SumAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Sum()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, int?>(Queryable.Sum), + source.Expression), + cancellationToken); + } + + /// + /// Computes the sum of a sequence of values. + /// + /// A sequence of values to calculate the average of. + /// The cancellation token. + /// The average value in the sequence. + public static Task> SumAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Sum()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, long>(Queryable.Sum), + source.Expression), + cancellationToken); + } + + /// + /// Computes the sum of a sequence of values. + /// + /// A sequence of values to calculate the average of. + /// The cancellation token. + /// The average value in the sequence. + public static Task> SumAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Sum()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, long?>(Queryable.Sum), + source.Expression), + cancellationToken); + } + + /// + /// Returns the number of elements in a sequence. + /// + /// The type of the elements of source. + /// The sequence that contains the elements to be counted. + /// The cancellation token. + /// The number of elements in the input sequence. + public static Task> CountAsync( + this IQueryable source, + CancellationToken cancellationToken = default) + { + if (!(source.Provider is CosmosLinqQueryProvider cosmosLinqQueryProvider)) + { + return ResponseHelperAsync(source.Count()); + } + + return cosmosLinqQueryProvider.ExecuteAggregateAsync( + Expression.Call( + GetMethodInfoOf, int>(Queryable.Count), + source.Expression), + cancellationToken); + } + + private static Task> ResponseHelperAsync(T value) + { + return Task.FromResult>( + new ItemResponse( + System.Net.HttpStatusCode.OK, + new Headers(), + value, + new CosmosTraceDiagnostics(NoOpTrace.Singleton), + null)); + } + + private static MethodInfo GetMethodInfoOf(Func func) + { + Debug.Assert(func != null); + return func.GetMethodInfo(); + } + } +} diff --git a/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs b/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs index bf68408710..66ad64f8ed 100644 --- a/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs +++ b/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs @@ -1,1792 +1,1802 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Linq -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.Collections.Immutable; - using System.Collections.ObjectModel; - using System.Data.Common; - using System.Diagnostics; - using System.Globalization; - using System.Linq; - using System.Linq.Expressions; - using System.Reflection; - using System.Text.RegularExpressions; +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ +namespace Microsoft.Azure.Cosmos.Linq +{ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Collections.Immutable; + using System.Collections.ObjectModel; + using System.Data.Common; + using System.Diagnostics; + using System.Globalization; + using System.Linq; + using System.Linq.Expressions; + using System.Reflection; + using System.Text.RegularExpressions; using Microsoft.Azure.Cosmos.CosmosElements; using Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql; - using Microsoft.Azure.Cosmos.Serialization.HybridRow; - using Microsoft.Azure.Cosmos.Serializer; - using Microsoft.Azure.Cosmos.Spatial; - using Microsoft.Azure.Cosmos.SqlObjects; - using Microsoft.Azure.Documents; - using static Microsoft.Azure.Cosmos.Linq.FromParameterBindings; - - // ReSharper disable UnusedParameter.Local - - ////////////////////////////////////////////////////////////////////// - // - // data.SelectMany(x => x.fields.SelectMany(y => y.fields.Select(z => f(x,y,z))) - // expression tree: - // SelectMany - lambda - Selectmany - lambda - Select - lambda - f(x,y,z) - // | | | | | | - // data x .- fields y .- fields z - // | | - // x y - // parameter bound_to - // x data - // y x.fields - // z y.fields - // - // data.Where(x => f(x)).Select(y => g(y)) - // expression tree: - // Select - lambda - g(y) - // | | - // | y - // Where - lambda - f(x) - // | | - // data x - // - // parameter bound_to - // x data - // y Where - - /// - /// Core Linq to DocDBSQL translator. - /// - internal static class ExpressionToSql - { - public static class LinqMethods - { - public const string Any = "Any"; - public const string Average = "Average"; - public const string Count = "Count"; - public const string Distinct = "Distinct"; - public const string First = "First"; - public const string FirstOrDefault = "FirstOrDefault"; - public const string Max = "Max"; - public const string Min = "Min"; - public const string GroupBy = "GroupBy"; - public const string OrderBy = "OrderBy"; - public const string OrderByDescending = "OrderByDescending"; - public const string Select = "Select"; - public const string SelectMany = "SelectMany"; - public const string Single = "Single"; - public const string SingleOrDefault = "SingleOrDefault"; - public const string Skip = "Skip"; - public const string Sum = "Sum"; - public const string ThenBy = "ThenBy"; - public const string ThenByDescending = "ThenByDescending"; - public const string Take = "Take"; - public const string Where = "Where"; - } - - private static readonly string SqlRoot = "root"; - private static readonly string DefaultParameterName = "v"; - private static readonly bool usePropertyRef = false; - - /// - /// Toplevel entry point. - /// - /// An Expression representing a Query on a IDocumentQuery object. - /// Optional dictionary for parameter name and value - /// Optional serializer options. - /// Indicates the client operation that needs to be performed on the results of SqlQuery. - /// The corresponding SQL query. - public static SqlQuery TranslateQuery( - Expression inputExpression, - IDictionary parameters, - CosmosLinqSerializerOptionsInternal linqSerializerOptions, - out ScalarOperationKind clientOperation) - { - TranslationContext context = new TranslationContext(linqSerializerOptions, parameters); - ExpressionToSql.Translate(inputExpression, context); // ignore result here - - QueryUnderConstruction query = context.CurrentQuery; - query = query.FlattenAsPossible(); - SqlQuery result = query.GetSqlQuery(); - clientOperation = context.ClientOperation; - - return result; - } - - /// - /// Translate an expression into a query. - /// Query is constructed as a side-effect in context.CurrentQuery. - /// - /// Expression to translate. - /// Context for translation. - private static Collection Translate(Expression inputExpression, TranslationContext context) - { - Debug.Assert(context != null, "Translation Context should not be null"); - - if (inputExpression == null) - { - throw new ArgumentNullException("inputExpression"); - } - - Collection collection; - switch (inputExpression.NodeType) - { - case ExpressionType.Call: - MethodCallExpression methodCallExpression = (MethodCallExpression)inputExpression; - bool shouldConvertToScalarAnyCollection = (context.PeekMethod() == null) && methodCallExpression.Method.Name.Equals(LinqMethods.Any); - collection = ExpressionToSql.VisitMethodCall(methodCallExpression, context); - if (shouldConvertToScalarAnyCollection) collection = ExpressionToSql.ConvertToScalarAnyCollection(context); - - break; - - case ExpressionType.Constant: - collection = ExpressionToSql.TranslateInput((ConstantExpression)inputExpression, context); - break; - - case ExpressionType.MemberAccess: - collection = ExpressionToSql.VisitMemberAccessCollectionExpression(inputExpression, context, ExpressionToSql.GetBindingParameterName(context)); - break; - - case ExpressionType.Parameter: - SqlScalarExpression scalar = ExpressionToSql.VisitNonSubqueryScalarExpression(inputExpression, context); - collection = ExpressionToSql.ConvertToCollection(scalar); - break; - - default: - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.ExpressionTypeIsNotSupported, inputExpression.NodeType)); - } - return collection; - } - - private static Collection TranslateInput(ConstantExpression inputExpression, TranslationContext context) - { - if (!typeof(IDocumentQuery).IsAssignableFrom(inputExpression.Type)) - { - throw new DocumentQueryException(ClientResources.InputIsNotIDocumentQuery); - } - - // ExpressionToSql is the query input value: a IDocumentQuery - if (!(inputExpression.Value is IDocumentQuery input)) - { - throw new DocumentQueryException(ClientResources.InputIsNotIDocumentQuery); - } - - context.CurrentQuery = new QueryUnderConstruction(context.GetGenFreshParameterFunc()); - Type elemType = TypeSystem.GetElementType(inputExpression.Type); - context.SetInputParameter(elemType, ParameterSubstitution.InputParameterName); // ignore result - - // First outer collection - Collection result = new Collection(ExpressionToSql.SqlRoot); - return result; - } - - /// - /// Get a parameter name to be binded to the collection from the next lambda. - /// It's merely for readability purpose. If that is not possible, use a default - /// parameter name. - /// - /// The translation context - /// A parameter name - private static string GetBindingParameterName(TranslationContext context) - { - MethodCallExpression peekMethod = context.PeekMethod(); - - // The parameter name is the top method's parameter if applicable - string parameterName = null; - if (peekMethod.Arguments.Count > 1) - { - if (peekMethod.Arguments[1] is LambdaExpression lambda && lambda.Parameters.Count > 0) - { - parameterName = lambda.Parameters[0].Name; - } - } - - parameterName ??= ExpressionToSql.DefaultParameterName; - - return parameterName; - } - - #region VISITOR - - /// - /// Visitor which produces a SqlScalarExpression. - /// - /// Expression to visit. - /// Context information. - /// The translation as a ScalarExpression. - internal static SqlScalarExpression VisitNonSubqueryScalarExpression(Expression inputExpression, TranslationContext context) - { - if (inputExpression == null) - { - return null; - } - - switch (inputExpression.NodeType) - { - case ExpressionType.Negate: - case ExpressionType.NegateChecked: - case ExpressionType.Not: - case ExpressionType.Convert: - case ExpressionType.ConvertChecked: - case ExpressionType.ArrayLength: - case ExpressionType.Quote: - case ExpressionType.TypeAs: - return ExpressionToSql.VisitUnary((UnaryExpression)inputExpression, context); - case ExpressionType.Add: - case ExpressionType.AddChecked: - case ExpressionType.Subtract: - case ExpressionType.SubtractChecked: - case ExpressionType.Multiply: - case ExpressionType.MultiplyChecked: - case ExpressionType.Divide: - case ExpressionType.Modulo: - case ExpressionType.And: - case ExpressionType.AndAlso: - case ExpressionType.Or: - case ExpressionType.OrElse: - case ExpressionType.LessThan: - case ExpressionType.LessThanOrEqual: - case ExpressionType.GreaterThan: - case ExpressionType.GreaterThanOrEqual: - case ExpressionType.Equal: - case ExpressionType.NotEqual: - case ExpressionType.Coalesce: - case ExpressionType.ArrayIndex: - case ExpressionType.RightShift: - case ExpressionType.LeftShift: - case ExpressionType.ExclusiveOr: - return ExpressionToSql.VisitBinary((BinaryExpression)inputExpression, context); - case ExpressionType.TypeIs: - return ExpressionToSql.VisitTypeIs((TypeBinaryExpression)inputExpression, context); - case ExpressionType.Conditional: - return ExpressionToSql.VisitConditional((ConditionalExpression)inputExpression, context); - case ExpressionType.Constant: - return ExpressionToSql.VisitConstant((ConstantExpression)inputExpression, context); - case ExpressionType.Parameter: - return ExpressionToSql.VisitParameter((ParameterExpression)inputExpression, context); - case ExpressionType.MemberAccess: - return ExpressionToSql.VisitMemberAccess((MemberExpression)inputExpression, context); - case ExpressionType.New: - return ExpressionToSql.VisitNew((NewExpression)inputExpression, context); - case ExpressionType.NewArrayInit: - case ExpressionType.NewArrayBounds: - return ExpressionToSql.VisitNewArray((NewArrayExpression)inputExpression, context); - case ExpressionType.Invoke: - return ExpressionToSql.VisitInvocation((InvocationExpression)inputExpression, context); - case ExpressionType.MemberInit: - return ExpressionToSql.VisitMemberInit((MemberInitExpression)inputExpression, context); - case ExpressionType.ListInit: - return ExpressionToSql.VisitListInit((ListInitExpression)inputExpression, context); - case ExpressionType.Call: - return ExpressionToSql.VisitMethodCallScalar((MethodCallExpression)inputExpression, context); - default: - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.ExpressionTypeIsNotSupported, inputExpression.NodeType)); - } - } - - private static SqlScalarExpression VisitMethodCallScalar(MethodCallExpression methodCallExpression, TranslationContext context) - { - // Check if it is a UDF method call - if (methodCallExpression.Method.Equals(typeof(CosmosLinq).GetMethod("InvokeUserDefinedFunction"))) - { - string udfName = ((ConstantExpression)methodCallExpression.Arguments[0]).Value as string; - if (string.IsNullOrEmpty(udfName)) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.UdfNameIsNullOrEmpty)); - } - - SqlIdentifier methodName = SqlIdentifier.Create(udfName); - List arguments = new List(); - - if (methodCallExpression.Arguments.Count == 2) - { - // We have two cases here, if the udf was expecting only one parameter and this parameter is an array - // then the second argument will be an expression of this array. - // else we will have a NewArrayExpression of the udf arguments - if (methodCallExpression.Arguments[1] is NewArrayExpression newArrayExpression) - { - ReadOnlyCollection argumentsExpressions = newArrayExpression.Expressions; - foreach (Expression argument in argumentsExpressions) - { - arguments.Add(ExpressionToSql.VisitScalarExpression(argument, context)); - } - } - else if (methodCallExpression.Arguments[1].NodeType == ExpressionType.Constant && - methodCallExpression.Arguments[1].Type == typeof(object[])) - { - object[] argumentsExpressions = (object[])((ConstantExpression)methodCallExpression.Arguments[1]).Value; - foreach (object argument in argumentsExpressions) - { - arguments.Add(ExpressionToSql.VisitConstant(Expression.Constant(argument), context)); - } - } - else - { - arguments.Add(ExpressionToSql.VisitScalarExpression(methodCallExpression.Arguments[1], context)); - } - } - - return SqlFunctionCallScalarExpression.Create(methodName, true, arguments.ToImmutableArray()); - } - else - { - return BuiltinFunctionVisitor.VisitBuiltinFunctionCall(methodCallExpression, context); - } - } - - private static SqlObjectProperty VisitBinding(MemberBinding binding, TranslationContext context) - { - switch (binding.BindingType) - { - case MemberBindingType.Assignment: - return ExpressionToSql.VisitMemberAssignment((MemberAssignment)binding, context); - case MemberBindingType.MemberBinding: - return ExpressionToSql.VisitMemberMemberBinding((MemberMemberBinding)binding, context); - case MemberBindingType.ListBinding: - default: - return ExpressionToSql.VisitMemberListBinding((MemberListBinding)binding, context); - } - } - - private static SqlUnaryScalarOperatorKind GetUnaryOperatorKind(ExpressionType type) - { - switch (type) - { - case ExpressionType.UnaryPlus: - return SqlUnaryScalarOperatorKind.Plus; - case ExpressionType.Negate: - return SqlUnaryScalarOperatorKind.Minus; - case ExpressionType.OnesComplement: - return SqlUnaryScalarOperatorKind.BitwiseNot; - case ExpressionType.Not: - return SqlUnaryScalarOperatorKind.Not; - default: - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.UnaryOperatorNotSupported, type)); - } - } - - private static SqlScalarExpression VisitUnary(UnaryExpression inputExpression, TranslationContext context) - { - SqlScalarExpression operand = ExpressionToSql.VisitScalarExpression(inputExpression.Operand, context); - - // handle NOT IN - if (operand is SqlInScalarExpression sqlInScalarExpression && inputExpression.NodeType == ExpressionType.Not) - { - SqlInScalarExpression inExpression = sqlInScalarExpression; - return SqlInScalarExpression.Create(inExpression.Needle, true, inExpression.Haystack); - } - - if (inputExpression.NodeType == ExpressionType.Quote) - { - return operand; - } - - if (inputExpression.NodeType == ExpressionType.Convert) - { - return operand; - } - - SqlUnaryScalarOperatorKind op = GetUnaryOperatorKind(inputExpression.NodeType); - return SqlUnaryScalarExpression.Create(op, operand); - } - - private static SqlBinaryScalarOperatorKind GetBinaryOperatorKind(ExpressionType expressionType, Type resultType) - { - switch (expressionType) - { - case ExpressionType.Add: - { - if (resultType == typeof(string)) - { - return SqlBinaryScalarOperatorKind.StringConcat; - } - return SqlBinaryScalarOperatorKind.Add; - } - case ExpressionType.AndAlso: - return SqlBinaryScalarOperatorKind.And; - case ExpressionType.And: - return SqlBinaryScalarOperatorKind.BitwiseAnd; - case ExpressionType.Or: - return SqlBinaryScalarOperatorKind.BitwiseOr; - case ExpressionType.ExclusiveOr: - return SqlBinaryScalarOperatorKind.BitwiseXor; - case ExpressionType.Divide: - return SqlBinaryScalarOperatorKind.Divide; - case ExpressionType.Equal: - return SqlBinaryScalarOperatorKind.Equal; - case ExpressionType.GreaterThan: - return SqlBinaryScalarOperatorKind.GreaterThan; - case ExpressionType.GreaterThanOrEqual: - return SqlBinaryScalarOperatorKind.GreaterThanOrEqual; - case ExpressionType.LessThan: - return SqlBinaryScalarOperatorKind.LessThan; - case ExpressionType.LessThanOrEqual: - return SqlBinaryScalarOperatorKind.LessThanOrEqual; - case ExpressionType.Modulo: - return SqlBinaryScalarOperatorKind.Modulo; - case ExpressionType.Multiply: - return SqlBinaryScalarOperatorKind.Multiply; - case ExpressionType.NotEqual: - return SqlBinaryScalarOperatorKind.NotEqual; - case ExpressionType.OrElse: - return SqlBinaryScalarOperatorKind.Or; - case ExpressionType.Subtract: - return SqlBinaryScalarOperatorKind.Subtract; - case ExpressionType.Coalesce: - return SqlBinaryScalarOperatorKind.Coalesce; - default: - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.BinaryOperatorNotSupported, expressionType)); - } - } - - private static SqlScalarExpression VisitBinary(BinaryExpression inputExpression, TranslationContext context) - { - // Speical case for string.CompareTo - // if any of the left or right expression is MethodCallExpression - // the other expression should only be constant (integer) - MethodCallExpression methodCallExpression = null; - ConstantExpression constantExpression = null; - - bool reverseNodeType = false; - if (inputExpression.Left.NodeType == ExpressionType.Call && inputExpression.Right.NodeType == ExpressionType.Constant) - { - methodCallExpression = (MethodCallExpression)inputExpression.Left; - constantExpression = (ConstantExpression)inputExpression.Right; - } - else if (inputExpression.Right.NodeType == ExpressionType.Call && inputExpression.Left.NodeType == ExpressionType.Constant) - { - methodCallExpression = (MethodCallExpression)inputExpression.Right; - constantExpression = (ConstantExpression)inputExpression.Left; - reverseNodeType = true; - } - - if (methodCallExpression != null && constantExpression != null) - { - if (TryMatchStringCompareTo(methodCallExpression, constantExpression, inputExpression.NodeType)) - { - return ExpressionToSql.VisitStringCompareTo(methodCallExpression, inputExpression.NodeType, reverseNodeType, context); - } - - if (TryMatchStringCompare(methodCallExpression, constantExpression, inputExpression.NodeType)) - { - return ExpressionToSql.VisitStringCompare(methodCallExpression, inputExpression.NodeType, reverseNodeType, context); - } - } - - SqlScalarExpression left = ExpressionToSql.VisitScalarExpression(inputExpression.Left, context); - SqlScalarExpression right = ExpressionToSql.VisitScalarExpression(inputExpression.Right, context); - - if (inputExpression.NodeType == ExpressionType.ArrayIndex) - { - SqlMemberIndexerScalarExpression result = SqlMemberIndexerScalarExpression.Create(left, right); - return result; - } - - SqlBinaryScalarOperatorKind op = GetBinaryOperatorKind(inputExpression.NodeType, inputExpression.Type); - - if (left is SqlMemberIndexerScalarExpression && right is SqlLiteralScalarExpression literalScalarExpression) - { - right = ExpressionToSql.ApplyCustomConverters(inputExpression.Left, literalScalarExpression, context); - } - else if (right is SqlMemberIndexerScalarExpression && left is SqlLiteralScalarExpression sqlLiteralScalarExpression) - { - left = ExpressionToSql.ApplyCustomConverters(inputExpression.Right, sqlLiteralScalarExpression, context); - } - - return SqlBinaryScalarExpression.Create(op, left, right); - } - - private static SqlScalarExpression ApplyCustomConverters(Expression left, SqlLiteralScalarExpression right, TranslationContext context) - { - MemberExpression memberExpression; - if (left is UnaryExpression unaryExpression) - { - memberExpression = unaryExpression.Operand as MemberExpression; - } - else - { - memberExpression = left as MemberExpression; - } - - if (memberExpression != null && - right.Literal is not SqlNullLiteral) - { - Type memberType = memberExpression.Type; - if (memberType.IsNullable()) - { - memberType = memberType.NullableUnderlyingType(); - } - - bool requiresCustomSerialization = context.CosmosLinqSerializer.RequiresCustomSerialization(memberExpression, memberType); - if (requiresCustomSerialization) - { - object value = default(object); - // Enum - if (memberType.IsEnum()) - { - try - { - Number64 number64 = ((SqlNumberLiteral)right.Literal).Value; - if (number64.IsDouble) - { - value = Enum.ToObject(memberType, Number64.ToDouble(number64)); - } - else - { - value = Enum.ToObject(memberType, Number64.ToLong(number64)); - } - } - catch - { - value = ((SqlStringLiteral)right.Literal).Value; - } - - } - // DateTime - else if (memberType == typeof(DateTime)) - { - SqlStringLiteral serializedDateTime = (SqlStringLiteral)right.Literal; - value = DateTime.Parse(serializedDateTime.Value, provider: null, DateTimeStyles.RoundtripKind); - } - - if (value != default(object)) - { - string serializedValue = context.CosmosLinqSerializer.Serialize(value, memberExpression, memberType); - return CosmosElement.Parse(serializedValue).Accept(CosmosElementToSqlScalarExpressionVisitor.Singleton); - } - } - } - - return right; - } - - private static bool TryMatchStringCompareTo(MethodCallExpression left, ConstantExpression right, ExpressionType compareOperator) - { - if (left.Method.Equals(typeof(string).GetMethod("CompareTo", new Type[] { typeof(string) })) && left.Arguments.Count == 1) - { - // operator can only be =, >, >=, <, <= - switch (compareOperator) - { - case ExpressionType.Equal: - case ExpressionType.GreaterThan: - case ExpressionType.GreaterThanOrEqual: - case ExpressionType.LessThan: - case ExpressionType.LessThanOrEqual: - break; - default: - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.StringCompareToInvalidOperator)); - } - - // the constant value should be zero, otherwise we can't determine how to translate the expression - // it could be either integer or nullable integer - if (!(right.Type == typeof(int) && (int)right.Value == 0) && - !(right.Type == typeof(int?) && ((int?)right.Value).HasValue && ((int?)right.Value).Value == 0)) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.StringCompareToInvalidConstant)); - } - - return true; - } - - return false; - } - - private static SqlScalarExpression VisitStringCompareTo( - MethodCallExpression left, - ExpressionType compareOperator, - bool reverseNodeType, - TranslationContext context) - { - if (reverseNodeType) - { - compareOperator = ReverseExpressionTypeForStrings(compareOperator, ClientResources.StringCompareToInvalidOperator); - } - - SqlBinaryScalarOperatorKind op = GetBinaryOperatorKind(compareOperator, null); - - SqlScalarExpression leftExpression = ExpressionToSql.VisitNonSubqueryScalarExpression(left.Object, context); - SqlScalarExpression rightExpression = ExpressionToSql.VisitNonSubqueryScalarExpression(left.Arguments[0], context); - - return SqlBinaryScalarExpression.Create(op, leftExpression, rightExpression); - } - - private static ExpressionType ReverseExpressionTypeForStrings(ExpressionType compareOperator, string errorMessage) - { - switch (compareOperator) - { - case ExpressionType.Equal: - // do nothing - break; - case ExpressionType.GreaterThan: - compareOperator = ExpressionType.LessThan; - break; - case ExpressionType.GreaterThanOrEqual: - compareOperator = ExpressionType.LessThanOrEqual; - break; - case ExpressionType.LessThan: - compareOperator = ExpressionType.GreaterThan; - break; - case ExpressionType.LessThanOrEqual: - compareOperator = ExpressionType.GreaterThanOrEqual; - break; - default: - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, errorMessage)); - } - - return compareOperator; - } - - private static bool TryMatchStringCompare(MethodCallExpression left, ConstantExpression right, ExpressionType compareOperator) - { - if (left.Method.Equals(typeof(string).GetMethod("Compare", new Type[] { typeof(string), typeof(string) })) && left.Arguments.Count == 2) - { - // operator can only be =, >, >=, <, <= - switch (compareOperator) - { - case ExpressionType.Equal: - case ExpressionType.GreaterThan: - case ExpressionType.GreaterThanOrEqual: - case ExpressionType.LessThan: - case ExpressionType.LessThanOrEqual: - break; - default: - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.StringCompareInvalidOperator)); - } - - // the constant value should be zero, otherwise we can't determine how to translate the expression - // it could be either integer or nullable integer - if (!(right.Type == typeof(int) && (int)right.Value == 0) && - !(right.Type == typeof(int?) && ((int?)right.Value).HasValue && ((int?)right.Value).Value == 0)) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.StringCompareInvalidConstant)); - } - - return true; - } - - return false; - } - - private static SqlScalarExpression VisitStringCompare( - MethodCallExpression left, - ExpressionType compareOperator, - bool reverseNodeType, - TranslationContext context) - { - if (reverseNodeType) - { - compareOperator = ReverseExpressionTypeForStrings(compareOperator, ClientResources.StringCompareInvalidOperator); - } - - SqlBinaryScalarOperatorKind op = GetBinaryOperatorKind(compareOperator, null); - - SqlScalarExpression leftExpression = ExpressionToSql.VisitNonSubqueryScalarExpression(left.Arguments[0], context); - SqlScalarExpression rightExpression = ExpressionToSql.VisitNonSubqueryScalarExpression(left.Arguments[1], context); - - return SqlBinaryScalarExpression.Create(op, leftExpression, rightExpression); - } - - private static SqlScalarExpression VisitTypeIs(TypeBinaryExpression inputExpression, TranslationContext context) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.ExpressionTypeIsNotSupported, inputExpression.NodeType)); - } - - public static SqlScalarExpression VisitConstant(ConstantExpression inputExpression, TranslationContext context) - { - if (inputExpression.Value == null) - { - return SqlLiteralScalarExpression.SqlNullLiteralScalarExpression; - } - - if (inputExpression.Type.IsNullable()) - { - return VisitConstant(Expression.Constant(inputExpression.Value, Nullable.GetUnderlyingType(inputExpression.Type)), context); - } - - if (context.Parameters != null && context.Parameters.TryGetValue(inputExpression.Value, out string paramName)) - { - SqlParameter sqlParameter = SqlParameter.Create(paramName); - return SqlParameterRefScalarExpression.Create(sqlParameter); - } - - Type constantType = inputExpression.Value.GetType(); - if (constantType.IsValueType) - { - if (inputExpression.Value is bool boolValue) - { - SqlBooleanLiteral literal = SqlBooleanLiteral.Create(boolValue); - return SqlLiteralScalarExpression.Create(literal); - } - - if (ExpressionToSql.TryGetSqlNumberLiteral(inputExpression.Value, out SqlNumberLiteral numberLiteral)) - { - return SqlLiteralScalarExpression.Create(numberLiteral); - } - - if (inputExpression.Value is Guid guidValue) - { - SqlStringLiteral literal = SqlStringLiteral.Create(guidValue.ToString()); - return SqlLiteralScalarExpression.Create(literal); - } - } - - if (inputExpression.Value is string stringValue) - { - SqlStringLiteral literal = SqlStringLiteral.Create(stringValue); - return SqlLiteralScalarExpression.Create(literal); - } - - if (typeof(Geometry).IsAssignableFrom(constantType)) - { - return GeometrySqlExpressionFactory.Construct(inputExpression); - } - - if (inputExpression.Value is IEnumerable enumerable) - { - List arrayItems = new List(); - - foreach (object item in enumerable) - { - arrayItems.Add(VisitConstant(Expression.Constant(item), context)); - } - - return SqlArrayCreateScalarExpression.Create(arrayItems.ToImmutableArray()); - } - - string serializedConstant = context.CosmosLinqSerializer.SerializeScalarExpression(inputExpression); - - return CosmosElement.Parse(serializedConstant).Accept(CosmosElementToSqlScalarExpressionVisitor.Singleton); - } - - private static SqlScalarExpression VisitConditional(ConditionalExpression inputExpression, TranslationContext context) - { - SqlScalarExpression conditionExpression = ExpressionToSql.VisitScalarExpression(inputExpression.Test, context); - SqlScalarExpression firstExpression = ExpressionToSql.VisitScalarExpression(inputExpression.IfTrue, context); - SqlScalarExpression secondExpression = ExpressionToSql.VisitScalarExpression(inputExpression.IfFalse, context); - - return SqlConditionalScalarExpression.Create(conditionExpression, firstExpression, secondExpression); - } - - private static SqlScalarExpression VisitParameter(ParameterExpression inputExpression, TranslationContext context) - { - Expression subst = context.LookupSubstitution(inputExpression); - if (subst != null) - { - return ExpressionToSql.VisitNonSubqueryScalarExpression(subst, context); - } - - string name = inputExpression.Name; - SqlIdentifier id = SqlIdentifier.Create(name); - return SqlPropertyRefScalarExpression.Create(null, id); - } - - private static SqlScalarExpression VisitMemberAccess(MemberExpression inputExpression, TranslationContext context) - { - SqlScalarExpression memberExpression = ExpressionToSql.VisitScalarExpression(inputExpression.Expression, context); - string memberName = inputExpression.Member.GetMemberName(context); - - // If the resulting memberName is null, then the indexer should be on the root of the object. - if (memberName == null) - { - return memberExpression; - } - - // if expression is nullable - if (inputExpression.Expression.Type.IsNullable()) - { - MemberNames memberNames = context.MemberNames; - - // ignore .Value - if (memberName == memberNames.Value) - { - return memberExpression; - } - - // convert .HasValue to IS_DEFINED expression - if (memberName == memberNames.HasValue) - { - return SqlFunctionCallScalarExpression.CreateBuiltin("IS_DEFINED", memberExpression); - } - } - - if (usePropertyRef) - { - SqlIdentifier propertyIdentifier = SqlIdentifier.Create(memberName); - SqlPropertyRefScalarExpression propertyRefExpression = SqlPropertyRefScalarExpression.Create(memberExpression, propertyIdentifier); - return propertyRefExpression; - } - else - { - SqlScalarExpression indexExpression = SqlLiteralScalarExpression.Create(SqlStringLiteral.Create(memberName)); - SqlMemberIndexerScalarExpression memberIndexerExpression = SqlMemberIndexerScalarExpression.Create(memberExpression, indexExpression); - return memberIndexerExpression; - } - } - - private static SqlScalarExpression[] VisitExpressionList(ReadOnlyCollection inputExpressionList, TranslationContext context) - { - SqlScalarExpression[] result = new SqlScalarExpression[inputExpressionList.Count]; - for (int i = 0; i < inputExpressionList.Count; i++) - { - SqlScalarExpression p = ExpressionToSql.VisitScalarExpression(inputExpressionList[i], context); - result[i] = p; - } - - return result; - } - - private static SqlObjectProperty VisitMemberAssignment(MemberAssignment inputExpression, TranslationContext context) - { - SqlScalarExpression assign = ExpressionToSql.VisitScalarExpression(inputExpression.Expression, context); - string memberName = inputExpression.Member.GetMemberName(context); - SqlPropertyName propName = SqlPropertyName.Create(memberName); - SqlObjectProperty prop = SqlObjectProperty.Create(propName, assign); - return prop; - } - - private static SqlObjectProperty VisitMemberMemberBinding(MemberMemberBinding inputExpression, TranslationContext context) - { - throw new DocumentQueryException(ClientResources.MemberBindingNotSupported); - } - - private static SqlObjectProperty VisitMemberListBinding(MemberListBinding inputExpression, TranslationContext context) - { - throw new DocumentQueryException(ClientResources.MemberBindingNotSupported); - } - - private static SqlObjectProperty[] VisitBindingList(ReadOnlyCollection inputExpressionList, TranslationContext context) - { - SqlObjectProperty[] list = new SqlObjectProperty[inputExpressionList.Count]; - for (int i = 0; i < inputExpressionList.Count; i++) - { - SqlObjectProperty b = ExpressionToSql.VisitBinding(inputExpressionList[i], context); - list[i] = b; - } - - return list; - } - - private static SqlObjectProperty[] CreateInitializers(ReadOnlyCollection arguments, ReadOnlyCollection members, TranslationContext context) - { - if (arguments.Count != members.Count) - { - throw new InvalidOperationException("Expected same number of arguments as members"); - } - - SqlObjectProperty[] result = new SqlObjectProperty[arguments.Count]; - for (int i = 0; i < arguments.Count; i++) - { - Expression arg = arguments[i]; - MemberInfo member = members[i]; - SqlScalarExpression value = ExpressionToSql.VisitScalarExpression(arg, context); - - string memberName = member.GetMemberName(context); - SqlPropertyName propName = SqlPropertyName.Create(memberName); - SqlObjectProperty prop = SqlObjectProperty.Create(propName, value); - result[i] = prop; - } - - return result; - } - - private static SqlSelectItem[] CreateSelectItems(ReadOnlyCollection arguments, ReadOnlyCollection members, TranslationContext context) - { - if (arguments.Count != members.Count) - { - throw new InvalidOperationException("Expected same number of arguments as members"); - } - - SqlSelectItem[] result = new SqlSelectItem[arguments.Count]; - for (int i = 0; i < arguments.Count; i++) - { - Expression arg = arguments[i]; - MemberInfo member = members[i]; - SqlScalarExpression selectExpression = ExpressionToSql.VisitScalarExpression(arg, context); - - string memberName = member.GetMemberName(context); - SqlIdentifier alias = SqlIdentifier.Create(memberName); - SqlSelectItem prop = SqlSelectItem.Create(selectExpression, alias); - result[i] = prop; - } - - return result; - } - - private static SqlScalarExpression VisitNew(NewExpression inputExpression, TranslationContext context) - { - if (typeof(Geometry).IsAssignableFrom(inputExpression.Type)) - { - return GeometrySqlExpressionFactory.Construct(inputExpression); - } - - if (inputExpression.Arguments.Count > 0) - { - if (inputExpression.Members == null) - { - throw new DocumentQueryException(ClientResources.ConstructorInvocationNotSupported); - } - - SqlObjectProperty[] propertyBindings = ExpressionToSql.CreateInitializers(inputExpression.Arguments, inputExpression.Members, context); - SqlObjectCreateScalarExpression create = SqlObjectCreateScalarExpression.Create(propertyBindings); - return create; - } - else - { - // no need to return anything; the initializer will generate the complete code - return null; - } - } - - private static SqlScalarExpression VisitMemberInit(MemberInitExpression inputExpression, TranslationContext context) - { - ExpressionToSql.VisitNew(inputExpression.NewExpression, context); // Return value is ignored - SqlObjectProperty[] propertyBindings = ExpressionToSql.VisitBindingList(inputExpression.Bindings, context); - SqlObjectCreateScalarExpression create = SqlObjectCreateScalarExpression.Create(propertyBindings); - return create; - } - - private static SqlScalarExpression VisitListInit(ListInitExpression inputExpression, TranslationContext context) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.ExpressionTypeIsNotSupported, inputExpression.NodeType)); - } - - private static SqlScalarExpression VisitNewArray(NewArrayExpression inputExpression, TranslationContext context) - { - SqlScalarExpression[] exprs = ExpressionToSql.VisitExpressionList(inputExpression.Expressions, context); - if (inputExpression.NodeType == ExpressionType.NewArrayInit) - { - SqlArrayCreateScalarExpression array = SqlArrayCreateScalarExpression.Create(exprs); - return array; - } - else - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.ExpressionTypeIsNotSupported, inputExpression.NodeType)); - } - } - - private static SqlScalarExpression VisitInvocation(InvocationExpression inputExpression, TranslationContext context) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.ExpressionTypeIsNotSupported, inputExpression.NodeType)); - } - - #endregion VISITOR - - #region Scalar and CollectionScalar Visitors - - private static Collection ConvertToCollection(SqlScalarExpression scalar) - { - if (usePropertyRef) - { - SqlPropertyRefScalarExpression propertyRefExpression = scalar as SqlPropertyRefScalarExpression; - if (propertyRefExpression == null) - { - throw new DocumentQueryException(ClientResources.PathExpressionsOnly); - } - - SqlInputPathCollection path = ConvertPropertyRefToPath(propertyRefExpression); - Collection result = new Collection(path); - return result; - } - else - { - SqlMemberIndexerScalarExpression memberIndexerExpression = scalar as SqlMemberIndexerScalarExpression; - if (memberIndexerExpression == null) - { - SqlPropertyRefScalarExpression propertyRefExpression = scalar as SqlPropertyRefScalarExpression; - if (propertyRefExpression == null) - { - throw new DocumentQueryException(ClientResources.PathExpressionsOnly); - } - - SqlInputPathCollection path = ConvertPropertyRefToPath(propertyRefExpression); - Collection result = new Collection(path); - return result; - } - else - { - SqlInputPathCollection path = ConvertMemberIndexerToPath(memberIndexerExpression); - Collection result = new Collection(path); - return result; - } - } - } - - /// - /// Convert the context's current query to a scalar Any collection - /// by wrapping it as following: SELECT VALUE COUNT(v0) > 0 FROM (current query) AS v0. - /// This is used in cases where LINQ expression ends with Any() which is a boolean scalar. - /// Normally Any would translate to SELECT VALUE EXISTS() subquery. However that wouldn't work - /// for these cases because it would result in a boolean value for each row instead of - /// one single "aggregated" boolean value. - /// - /// The translation context - /// The scalar Any collection - private static Collection ConvertToScalarAnyCollection(TranslationContext context) - { - SqlQuery query = context.CurrentQuery.FlattenAsPossible().GetSqlQuery(); - SqlCollection subqueryCollection = SqlSubqueryCollection.Create(query); - - ParameterExpression parameterExpression = context.GenerateFreshParameter(typeof(object), ExpressionToSql.DefaultParameterName); - Binding binding = new Binding(parameterExpression, subqueryCollection, isInCollection: false, isInputParameter: true); - - context.CurrentQuery = new QueryUnderConstruction(context.GetGenFreshParameterFunc()); - context.CurrentQuery.AddBinding(binding); - - SqlSelectSpec selectSpec = SqlSelectValueSpec.Create( - SqlBinaryScalarExpression.Create( - SqlBinaryScalarOperatorKind.GreaterThan, - SqlFunctionCallScalarExpression.CreateBuiltin( - SqlFunctionCallScalarExpression.Names.Count, - SqlPropertyRefScalarExpression.Create(null, SqlIdentifier.Create(parameterExpression.Name))), - SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(0)))); - SqlSelectClause selectClause = SqlSelectClause.Create(selectSpec); - context.CurrentQuery.AddSelectClause(selectClause); - - return new Collection(LinqMethods.Any); - } - - private static SqlScalarExpression VisitNonSubqueryScalarExpression(Expression expression, ReadOnlyCollection parameters, TranslationContext context) - { - foreach (ParameterExpression par in parameters) - { - context.PushParameter(par, context.CurrentSubqueryBinding.ShouldBeOnNewQuery); - } - - SqlScalarExpression scalarExpression = ExpressionToSql.VisitNonSubqueryScalarExpression(expression, context); - - foreach (ParameterExpression par in parameters) - { - context.PopParameter(); - } - - return scalarExpression; - } - - private static SqlScalarExpression VisitNonSubqueryScalarLambda(LambdaExpression lambdaExpression, TranslationContext context) - { - ReadOnlyCollection parameters = lambdaExpression.Parameters; - if (parameters.Count != 1) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, lambdaExpression.Body, 1, parameters.Count)); - } - - return ExpressionToSql.VisitNonSubqueryScalarExpression(lambdaExpression.Body, parameters, context); - } - - private static Collection VisitCollectionExpression(Expression expression, ReadOnlyCollection parameters, TranslationContext context) - { - foreach (ParameterExpression par in parameters) - { - context.PushParameter(par, context.CurrentSubqueryBinding.ShouldBeOnNewQuery); - } - - Collection collection = ExpressionToSql.VisitCollectionExpression(expression, context, parameters.Count > 0 ? parameters.First().Name : ExpressionToSql.DefaultParameterName); - - foreach (ParameterExpression par in parameters) - { - context.PopParameter(); - } - - return collection; - } - - private static Collection VisitCollectionExpression(Expression expression, TranslationContext context, string parameterName) - { - Collection result; - switch (expression.NodeType) - { - case ExpressionType.Call: - result = ExpressionToSql.Translate(expression, context); - break; - - case ExpressionType.MemberAccess: - result = ExpressionToSql.VisitMemberAccessCollectionExpression(expression, context, parameterName); - break; - - default: - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.ExpressionTypeIsNotSupported, expression.NodeType)); - } - - return result; - } - - /// - /// Visit a lambda which is supposed to return a collection. - /// - /// LambdaExpression with a result which is a collection. - /// The translation context. - /// The collection computed by the lambda. - private static Collection VisitCollectionLambda(LambdaExpression lambdaExpression, TranslationContext context) - { - ReadOnlyCollection parameters = lambdaExpression.Parameters; - if (parameters.Count != 1) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, lambdaExpression.Body, 1, parameters.Count)); - } - - return ExpressionToSql.VisitCollectionExpression(lambdaExpression.Body, lambdaExpression.Parameters, context); - } - - /// - /// Visit an expression, usually a MemberAccess, then trigger parameter binding for that expression. - /// - /// The input expression - /// The current translation context - /// Parameter name is merely for readability - private static Collection VisitMemberAccessCollectionExpression(Expression inputExpression, TranslationContext context, string parameterName) - { - SqlScalarExpression body = ExpressionToSql.VisitNonSubqueryScalarExpression(inputExpression, context); - Type type = inputExpression.Type; - - Collection collection = ExpressionToSql.ConvertToCollection(body); - context.PushCollection(collection); - ParameterExpression parameter = context.GenerateFreshParameter(type, parameterName); - context.PushParameter(parameter, context.CurrentSubqueryBinding.ShouldBeOnNewQuery); - context.PopParameter(); - context.PopCollection(); - - return new Collection(parameter.Name); - } - - /// - /// Visit a method call, construct the corresponding query in context.CurrentQuery. - /// At ExpressionToSql point only LINQ method calls are allowed. - /// These methods are static extension methods of IQueryable or IEnumerable. - /// - /// Method to translate. - /// Query translation context. - private static Collection VisitMethodCall(MethodCallExpression inputExpression, TranslationContext context) - { - context.PushMethod(inputExpression); - - Type declaringType = inputExpression.Method.DeclaringType; - if ((declaringType != typeof(Queryable) && declaringType != typeof(Enumerable)) - || !inputExpression.Method.IsStatic) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.OnlyLINQMethodsAreSupported, inputExpression.Method.Name)); - } - - Type returnType = inputExpression.Method.ReturnType; - Type returnElementType = TypeSystem.GetElementType(returnType); - - if (inputExpression.Object != null) - { - throw new DocumentQueryException(ClientResources.ExpectedMethodCallsMethods); - } - - Expression inputCollection = inputExpression.Arguments[0]; // all these methods are static extension methods, so argument[0] is the collection - - Type inputElementType = TypeSystem.GetElementType(inputCollection.Type); - Collection collection = ExpressionToSql.Translate(inputCollection, context); - - context.PushCollection(collection); - - Collection result = new Collection(inputExpression.Method.Name); - bool shouldBeOnNewQuery = context.CurrentQuery.ShouldBeOnNewQuery(inputExpression.Method.Name, inputExpression.Arguments.Count); - context.PushSubqueryBinding(shouldBeOnNewQuery); - - if (context.LastExpressionIsGroupBy) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, "Group By cannot be followed by other methods")); - } - - switch (inputExpression.Method.Name) - { - case LinqMethods.Any: - { - result = new Collection(string.Empty); - - if (inputExpression.Arguments.Count == 2) - { - // Any is translated to an SELECT VALUE EXISTS() where Any operation itself is treated as a Where. - SqlWhereClause where = ExpressionToSql.VisitWhere(inputExpression.Arguments, context); - context.CurrentQuery = context.CurrentQuery.AddWhereClause(where, context); - } - break; - } - case LinqMethods.Average: - { - SqlSelectClause select = ExpressionToSql.VisitAggregateFunction(inputExpression.Arguments, context, SqlFunctionCallScalarExpression.Names.Avg); - context.CurrentQuery = context.CurrentQuery.AddSelectClause(select, context); - break; - } - case LinqMethods.Count: - { - SqlSelectClause select = ExpressionToSql.VisitCount(inputExpression.Arguments, context); - context.CurrentQuery = context.CurrentQuery.AddSelectClause(select, context); - break; - } - case LinqMethods.Distinct: - { - SqlSelectClause select = ExpressionToSql.VisitDistinct(inputExpression.Arguments, context); - context.CurrentQuery = context.CurrentQuery.AddSelectClause(select, context); - break; - } - case LinqMethods.FirstOrDefault: - { - if (inputExpression.Arguments.Count == 1) - { - // TOP is not allowed when OFFSET ... LIMIT is present. - if (!context.CurrentQuery.HasOffsetSpec()) - { - SqlNumberLiteral sqlNumberLiteral = SqlNumberLiteral.Create(1); - SqlTopSpec topSpec = SqlTopSpec.Create(sqlNumberLiteral); - context.CurrentQuery = context.CurrentQuery.AddTopSpec(topSpec); - } - - context.SetClientOperation(ScalarOperationKind.FirstOrDefault); - } - else - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, inputExpression.Method.Name, 0, inputExpression.Arguments.Count - 1)); - } - - break; - } - case LinqMethods.Max: - { - SqlSelectClause select = ExpressionToSql.VisitAggregateFunction(inputExpression.Arguments, context, SqlFunctionCallScalarExpression.Names.Max); - context.CurrentQuery = context.CurrentQuery.AddSelectClause(select, context); - break; - } - case LinqMethods.Min: - { - SqlSelectClause select = ExpressionToSql.VisitAggregateFunction(inputExpression.Arguments, context, SqlFunctionCallScalarExpression.Names.Min); - context.CurrentQuery = context.CurrentQuery.AddSelectClause(select, context); - break; - } - case LinqMethods.GroupBy: - { - context.CurrentQuery = context.PackageCurrentQueryIfNeccessary(); - result = ExpressionToSql.VisitGroupBy(returnElementType, inputExpression.Arguments, context); - context.LastExpressionIsGroupBy = true; - break; - } - case LinqMethods.OrderBy: - { - SqlOrderByClause orderBy = ExpressionToSql.VisitOrderBy(inputExpression.Arguments, false, context); - context.CurrentQuery = context.CurrentQuery.AddOrderByClause(orderBy, context); - break; - } - case LinqMethods.OrderByDescending: - { - SqlOrderByClause orderBy = ExpressionToSql.VisitOrderBy(inputExpression.Arguments, true, context); - context.CurrentQuery = context.CurrentQuery.AddOrderByClause(orderBy, context); - break; - } - case LinqMethods.Select: - { - SqlSelectClause select = ExpressionToSql.VisitSelect(inputExpression.Arguments, context); - context.CurrentQuery = context.CurrentQuery.AddSelectClause(select, context); - break; - } - case LinqMethods.SelectMany: - { - context.CurrentQuery = context.PackageCurrentQueryIfNeccessary(); - result = ExpressionToSql.VisitSelectMany(inputExpression.Arguments, context); - break; - } - case LinqMethods.Skip: - { - SqlOffsetSpec offsetSpec = ExpressionToSql.VisitSkip(inputExpression.Arguments, context); - context.CurrentQuery = context.CurrentQuery.AddOffsetSpec(offsetSpec, context); - break; - } - case LinqMethods.Sum: - { - SqlSelectClause select = ExpressionToSql.VisitAggregateFunction(inputExpression.Arguments, context, SqlFunctionCallScalarExpression.Names.Sum); - context.CurrentQuery = context.CurrentQuery.AddSelectClause(select, context); - break; - } - case LinqMethods.Take: - { - if (context.CurrentQuery.HasOffsetSpec()) - { - SqlLimitSpec limitSpec = ExpressionToSql.VisitTakeLimit(inputExpression.Arguments, context); - context.CurrentQuery = context.CurrentQuery.AddLimitSpec(limitSpec, context); - } - else - { - SqlTopSpec topSpec = ExpressionToSql.VisitTakeTop(inputExpression.Arguments, context); - context.CurrentQuery = context.CurrentQuery.AddTopSpec(topSpec); - } - break; - } - case LinqMethods.ThenBy: - { - SqlOrderByClause thenBy = ExpressionToSql.VisitOrderBy(inputExpression.Arguments, false, context); - context.CurrentQuery = context.CurrentQuery.UpdateOrderByClause(thenBy, context); - break; - } - case LinqMethods.ThenByDescending: - { - SqlOrderByClause thenBy = ExpressionToSql.VisitOrderBy(inputExpression.Arguments, true, context); - context.CurrentQuery = context.CurrentQuery.UpdateOrderByClause(thenBy, context); - break; - } - case LinqMethods.Where: - { - SqlWhereClause where = ExpressionToSql.VisitWhere(inputExpression.Arguments, context); - context.CurrentQuery = context.CurrentQuery.AddWhereClause(where, context); - break; - } - default: - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.MethodNotSupported, inputExpression.Method.Name)); - } - - context.PopSubqueryBinding(); - context.PopCollection(); - context.PopMethod(); - return result; - } - - /// - /// Visit a method call, construct the corresponding query and return the select clause for the aggregate function. - /// At ExpressionToSql point only LINQ method calls are allowed. - /// These methods are static extension methods of IQueryable or IEnumerable. - /// - /// Method to translate. - /// Query translation context. - private static SqlSelectClause VisitGroupByAggregateMethodCall(MethodCallExpression inputExpression, TranslationContext context) - { - context.PushMethod(inputExpression); - - Type declaringType = inputExpression.Method.DeclaringType; - if ((declaringType != typeof(Queryable) && declaringType != typeof(Enumerable)) - || !inputExpression.Method.IsStatic) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.OnlyLINQMethodsAreSupported, inputExpression.Method.Name)); - } - - if (inputExpression.Object != null) - { - throw new DocumentQueryException(ClientResources.ExpectedMethodCallsMethods); - } - - if (context.LastExpressionIsGroupBy) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, "Group By cannot be followed by other methods")); - } - - SqlSelectClause select; - switch (inputExpression.Method.Name) - { - case LinqMethods.Average: - { - select = ExpressionToSql.VisitAggregateFunction(inputExpression.Arguments, context, SqlFunctionCallScalarExpression.Names.Avg); - break; - } - case LinqMethods.Count: - { - select = ExpressionToSql.VisitCount(inputExpression.Arguments, context); - break; - } - case LinqMethods.Max: - { - select = ExpressionToSql.VisitAggregateFunction(inputExpression.Arguments, context, SqlFunctionCallScalarExpression.Names.Max); - break; - } - case LinqMethods.Min: - { - select = ExpressionToSql.VisitAggregateFunction(inputExpression.Arguments, context, SqlFunctionCallScalarExpression.Names.Min); - break; - } - case LinqMethods.Sum: - { - select = ExpressionToSql.VisitAggregateFunction(inputExpression.Arguments, context, SqlFunctionCallScalarExpression.Names.Sum); - break; - } - default: - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.MethodNotSupported, inputExpression.Method.Name)); - } - - context.PopMethod(); - return select; - } - - /// - /// Determine if an expression should be translated to a subquery. - /// This only applies to expression that is inside a lamda. - /// - /// The input expression - /// The expression object kind of the expression - /// True if the method is either Min, Max, or Avg - /// True if subquery is needed, otherwise false - private static bool IsSubqueryScalarExpression(Expression expression, out SubqueryKind? expressionObjKind, out bool isMinMaxAvgMethod) - { - if (!(expression is MethodCallExpression methodCallExpression)) - { - expressionObjKind = null; - isMinMaxAvgMethod = false; - return false; - } - - string methodName = methodCallExpression.Method.Name; - bool isSubqueryExpression; - - isMinMaxAvgMethod = false; - - switch (methodName) - { - case LinqMethods.Min: - case LinqMethods.Max: - case LinqMethods.Average: - isMinMaxAvgMethod = true; - isSubqueryExpression = true; - expressionObjKind = SubqueryKind.SubqueryScalarExpression; - break; - - case LinqMethods.Sum: - isSubqueryExpression = true; - expressionObjKind = SubqueryKind.SubqueryScalarExpression; - break; - - case LinqMethods.Count: - if (methodCallExpression.Arguments.Count > 1) - { - isSubqueryExpression = true; - expressionObjKind = SubqueryKind.SubqueryScalarExpression; - } - else - { - SubqueryKind? objKind; - bool isMinMaxAvg; - isSubqueryExpression = ExpressionToSql.IsSubqueryScalarExpression( - methodCallExpression.Arguments[0] as MethodCallExpression, - out objKind, out isMinMaxAvg); - - if (isSubqueryExpression) - { - isSubqueryExpression = true; - expressionObjKind = SubqueryKind.SubqueryScalarExpression; - } - else - { - isSubqueryExpression = false; - expressionObjKind = null; - } - } - break; - - case LinqMethods.Any: - isSubqueryExpression = true; - expressionObjKind = SubqueryKind.ExistsScalarExpression; - break; - - case LinqMethods.Select: - case LinqMethods.SelectMany: - case LinqMethods.Where: - case LinqMethods.OrderBy: - case LinqMethods.OrderByDescending: - case LinqMethods.ThenBy: - case LinqMethods.ThenByDescending: - case LinqMethods.Skip: - case LinqMethods.Take: - case LinqMethods.Distinct: - case LinqMethods.GroupBy: - isSubqueryExpression = true; - expressionObjKind = SubqueryKind.ArrayScalarExpression; - break; - - default: - isSubqueryExpression = false; - expressionObjKind = null; - break; - } - - return isSubqueryExpression; - } - - /// - /// Visit an lambda expression which is in side a lambda and translate it to a scalar expression or a subquery scalar expression. - /// See the other overload of this method for more details. - /// - /// The input lambda expression - /// The translation context - /// A scalar expression representing the input expression - private static SqlScalarExpression VisitScalarExpression(LambdaExpression lambda, TranslationContext context) - { - return ExpressionToSql.VisitScalarExpression( - lambda.Body, - lambda.Parameters, - context); - } - - /// - /// Visit an lambda expression which is inside a lambda and translate it to a scalar expression or a collection scalar expression. - /// If it is a collection scalar expression, e.g. should be translated to subquery such as SELECT VALUE ARRAY, SELECT VALUE EXISTS, - /// SELECT VALUE [aggregate], the subquery will be aliased to a new binding for the FROM clause. E.g. consider - /// Select(family => family.Children.Select(child => child.Grade)). Since the inner Select corresponds to a subquery, this method would - /// create a new binding of v0 to the subquery SELECT VALUE ARRAY(), and the inner expression will be just SELECT v0. - /// - /// The input expression - /// The translation context - /// A scalar expression representing the input expression - internal static SqlScalarExpression VisitScalarExpression(Expression expression, TranslationContext context) - { - return ExpressionToSql.VisitScalarExpression( - expression, - new ReadOnlyCollection(Array.Empty()), - context); - } - - internal static bool TryGetSqlNumberLiteral(object value, out SqlNumberLiteral sqlNumberLiteral) - { - sqlNumberLiteral = default(SqlNumberLiteral); - if (value is byte byteValue) - { - sqlNumberLiteral = SqlNumberLiteral.Create(byteValue); - } - else if (value is sbyte sbyteValue) - { - sqlNumberLiteral = SqlNumberLiteral.Create(sbyteValue); - } - else if (value is decimal decimalValue) - { - if ((decimalValue >= long.MinValue) && (decimalValue <= long.MaxValue) && (decimalValue % 1 == 0)) - { - sqlNumberLiteral = SqlNumberLiteral.Create(Convert.ToInt64(decimalValue)); - } - else - { - sqlNumberLiteral = SqlNumberLiteral.Create(Convert.ToDouble(decimalValue)); - } - } - else if (value is double doubleValue) - { - sqlNumberLiteral = SqlNumberLiteral.Create(doubleValue); - } - else if (value is float floatVlaue) - { - sqlNumberLiteral = SqlNumberLiteral.Create(floatVlaue); - } - else if (value is int intValue) - { - sqlNumberLiteral = SqlNumberLiteral.Create(intValue); - } - else if (value is uint uintValue) - { - sqlNumberLiteral = SqlNumberLiteral.Create(uintValue); - } - else if (value is long longValue) - { - sqlNumberLiteral = SqlNumberLiteral.Create(longValue); - } - else if (value is ulong ulongValue) - { - if (ulongValue <= long.MaxValue) - { - sqlNumberLiteral = SqlNumberLiteral.Create(Convert.ToInt64(ulongValue)); - } - else - { - sqlNumberLiteral = SqlNumberLiteral.Create(Convert.ToDouble(ulongValue)); - } - } - else if (value is short shortValue) - { - sqlNumberLiteral = SqlNumberLiteral.Create(shortValue); - } - else if (value is ushort ushortValue) - { - sqlNumberLiteral = SqlNumberLiteral.Create(ushortValue); - } - - return sqlNumberLiteral != default(SqlNumberLiteral); - } - - /// - /// Visit an lambda expression which is in side a lambda and translate it to a scalar expression or a collection scalar expression. - /// See the other overload of this method for more details. - /// - private static SqlScalarExpression VisitScalarExpression(Expression expression, - ReadOnlyCollection parameters, - TranslationContext context) - { - SubqueryKind? expressionObjKind; - bool isMinMaxAvgMethod; - bool shouldUseSubquery = ExpressionToSql.IsSubqueryScalarExpression(expression, out expressionObjKind, out isMinMaxAvgMethod); - - SqlScalarExpression sqlScalarExpression; - if (!shouldUseSubquery) - { - sqlScalarExpression = ExpressionToSql.VisitNonSubqueryScalarExpression(expression, parameters, context); - } - else - { - SqlQuery query = ExpressionToSql.CreateSubquery(expression, parameters, context); - - ParameterExpression parameterExpression = context.GenerateFreshParameter(typeof(object), ExpressionToSql.DefaultParameterName); - SqlCollection subqueryCollection = ExpressionToSql.CreateSubquerySqlCollection( - query, - isMinMaxAvgMethod ? SubqueryKind.ArrayScalarExpression : expressionObjKind.Value); - - Binding newBinding = new Binding(parameterExpression, subqueryCollection, - isInCollection: false, isInputParameter: context.IsInMainBranchSelect()); - - context.CurrentSubqueryBinding.NewBindings.Add(newBinding); - - if (isMinMaxAvgMethod) - { - sqlScalarExpression = SqlMemberIndexerScalarExpression.Create( - SqlPropertyRefScalarExpression.Create(null, SqlIdentifier.Create(parameterExpression.Name)), - SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(0))); - } - else - { - sqlScalarExpression = SqlPropertyRefScalarExpression.Create(null, SqlIdentifier.Create(parameterExpression.Name)); - } - } - - return sqlScalarExpression; - } - - /// - /// Create a subquery SQL collection object for a SQL query - /// - /// The SQL query object - /// The subquery type - private static SqlCollection CreateSubquerySqlCollection(SqlQuery query, SubqueryKind subqueryType) - { - SqlCollection subqueryCollection; - switch (subqueryType) - { - case SubqueryKind.ArrayScalarExpression: - SqlArrayScalarExpression arrayScalarExpression = SqlArrayScalarExpression.Create(query); - query = SqlQuery.Create( - SqlSelectClause.Create(SqlSelectValueSpec.Create(arrayScalarExpression)), - fromClause: null, whereClause: null, groupByClause: null, orderByClause: null, offsetLimitClause: null); - break; - - case SubqueryKind.ExistsScalarExpression: - SqlExistsScalarExpression existsScalarExpression = SqlExistsScalarExpression.Create(query); - query = SqlQuery.Create( - SqlSelectClause.Create(SqlSelectValueSpec.Create(existsScalarExpression)), - fromClause: null, whereClause: null, groupByClause: null, orderByClause: null, offsetLimitClause: null); - break; - - case SubqueryKind.SubqueryScalarExpression: - // No need to wrap query as in ArrayScalarExpression, or ExistsScalarExpression - break; - - default: - throw new DocumentQueryException($"Unsupported subquery type {subqueryType}"); - } - - subqueryCollection = SqlSubqueryCollection.Create(query); - return subqueryCollection; - } - - /// - /// Create a subquery from a subquery scalar expression. - /// By visiting the collection expression, this builds a new QueryUnderConstruction on top of the current one - /// and then translate it to a SQL query while keeping the current QueryUnderConstruction in tact. - /// - /// The subquery scalar expression - /// The list of parameters of the expression - /// The translation context - /// A query corresponding to the collection expression - /// The QueryUnderConstruction remains unchanged after this. - private static SqlQuery CreateSubquery(Expression expression, ReadOnlyCollection parameters, TranslationContext context) - { - bool shouldBeOnNewQuery = context.CurrentSubqueryBinding.ShouldBeOnNewQuery; - - QueryUnderConstruction queryBeforeVisit = context.CurrentQuery; - QueryUnderConstruction packagedQuery = new QueryUnderConstruction(context.GetGenFreshParameterFunc(), context.CurrentQuery); - packagedQuery.FromParameters.SetInputParameter(typeof(object), context.CurrentQuery.GetInputParameterInContext(shouldBeOnNewQuery).Name, context.InScope); - context.CurrentQuery = packagedQuery; - - if (shouldBeOnNewQuery) context.CurrentSubqueryBinding.ShouldBeOnNewQuery = false; - - Collection collection = ExpressionToSql.VisitCollectionExpression(expression, parameters, context); - - QueryUnderConstruction subquery = context.CurrentQuery.GetSubquery(queryBeforeVisit); - context.CurrentSubqueryBinding.ShouldBeOnNewQuery = shouldBeOnNewQuery; - context.CurrentQuery = queryBeforeVisit; - - SqlQuery sqlSubquery = subquery.FlattenAsPossible().GetSqlQuery(); - return sqlSubquery; - } - - #endregion Scalar and CollectionScalar Visitors - - #region LINQ Specific Visitors - - private static SqlWhereClause VisitWhere(ReadOnlyCollection arguments, TranslationContext context) - { - if (arguments.Count != 2) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, LinqMethods.Where, 2, arguments.Count)); - } - - LambdaExpression function = Utilities.GetLambda(arguments[1]); - SqlScalarExpression sqlfunc = ExpressionToSql.VisitScalarExpression(function, context); - SqlWhereClause where = SqlWhereClause.Create(sqlfunc); - return where; - } - - private static SqlSelectClause VisitSelect(ReadOnlyCollection arguments, TranslationContext context) - { - if (arguments.Count != 2) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, LinqMethods.Select, 2, arguments.Count)); - } - - LambdaExpression lambda = Utilities.GetLambda(arguments[1]); - - SqlScalarExpression sqlfunc = ExpressionToSql.VisitScalarExpression(lambda, context); - SqlSelectSpec sqlSpec = SqlSelectValueSpec.Create(sqlfunc); - SqlSelectClause select = SqlSelectClause.Create(sqlSpec, null); - return select; - } - - private static Collection VisitSelectMany(ReadOnlyCollection arguments, TranslationContext context) - { - if (arguments.Count != 2) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, LinqMethods.SelectMany, 2, arguments.Count)); - } - - LambdaExpression lambda = Utilities.GetLambda(arguments[1]); - - // If there is Distinct, Take or OrderBy the lambda then it needs to be in a subquery. - bool requireLocalExecution = false; - - for (MethodCallExpression methodCall = lambda.Body as MethodCallExpression; - methodCall != null; - methodCall = methodCall.Arguments[0] as MethodCallExpression) - { - string methodName = methodCall.Method.Name; - requireLocalExecution |= methodName.Equals(LinqMethods.Distinct) || methodName.Equals(LinqMethods.Take) || methodName.Equals(LinqMethods.OrderBy) || methodName.Equals(LinqMethods.OrderByDescending); - } - - Collection collection; - if (!requireLocalExecution) - { - collection = ExpressionToSql.VisitCollectionLambda(lambda, context); - } - else - { - collection = new Collection(string.Empty); - Binding binding; - SqlQuery query = ExpressionToSql.CreateSubquery(lambda.Body, lambda.Parameters, context); - SqlCollection subqueryCollection = SqlSubqueryCollection.Create(query); - ParameterExpression parameterExpression = context.GenerateFreshParameter(typeof(object), ExpressionToSql.DefaultParameterName); - binding = new Binding(parameterExpression, subqueryCollection, isInCollection: false, isInputParameter: true); - context.CurrentQuery.FromParameters.Add(binding); - } - - return collection; - } - - private static Collection VisitGroupBy(Type returnElementType, ReadOnlyCollection arguments, TranslationContext context) - { - if (arguments.Count != 3) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, LinqMethods.GroupBy, 3, arguments.Count)); - } - - // Key Selector handling - // First argument is input, second is key selector and third is value selector + using Microsoft.Azure.Cosmos.Serialization.HybridRow; + using Microsoft.Azure.Cosmos.Serializer; + using Microsoft.Azure.Cosmos.Spatial; + using Microsoft.Azure.Cosmos.SqlObjects; + using Microsoft.Azure.Documents; + using static Microsoft.Azure.Cosmos.Linq.FromParameterBindings; + + // ReSharper disable UnusedParameter.Local + + ////////////////////////////////////////////////////////////////////// + // + // data.SelectMany(x => x.fields.SelectMany(y => y.fields.Select(z => f(x,y,z))) + // expression tree: + // SelectMany - lambda - Selectmany - lambda - Select - lambda - f(x,y,z) + // | | | | | | + // data x .- fields y .- fields z + // | | + // x y + // parameter bound_to + // x data + // y x.fields + // z y.fields + // + // data.Where(x => f(x)).Select(y => g(y)) + // expression tree: + // Select - lambda - g(y) + // | | + // | y + // Where - lambda - f(x) + // | | + // data x + // + // parameter bound_to + // x data + // y Where + + /// + /// Core Linq to DocDBSQL translator. + /// + internal static class ExpressionToSql + { + public static class LinqMethods + { + public const string Any = "Any"; + public const string Average = "Average"; + public const string Count = "Count"; + public const string Distinct = "Distinct"; + public const string First = "First"; + public const string FirstOrDefault = "FirstOrDefault"; + public const string Max = "Max"; + public const string Min = "Min"; + public const string GroupBy = "GroupBy"; + public const string OrderBy = "OrderBy"; + public const string OrderByDescending = "OrderByDescending"; + public const string Select = "Select"; + public const string SelectMany = "SelectMany"; + public const string Single = "Single"; + public const string SingleOrDefault = "SingleOrDefault"; + public const string Skip = "Skip"; + public const string Sum = "Sum"; + public const string ThenBy = "ThenBy"; + public const string ThenByDescending = "ThenByDescending"; + public const string Take = "Take"; + public const string Where = "Where"; + } + + private static readonly string SqlRoot = "root"; + private static readonly string DefaultParameterName = "v"; + private static readonly bool usePropertyRef = false; + + /// + /// Toplevel entry point. + /// + /// An Expression representing a Query on a IDocumentQuery object. + /// Optional dictionary for parameter name and value + /// Optional serializer options. + /// Indicates the client operation that needs to be performed on the results of SqlQuery. + /// The corresponding SQL query. + public static SqlQuery TranslateQuery( + Expression inputExpression, + IDictionary parameters, + CosmosLinqSerializerOptionsInternal linqSerializerOptions, + out ScalarOperationKind clientOperation) + { + TranslationContext context = new TranslationContext(linqSerializerOptions, parameters); + ExpressionToSql.Translate(inputExpression, context); // ignore result here + + QueryUnderConstruction query = context.CurrentQuery; + query = query.FlattenAsPossible(); + SqlQuery result = query.GetSqlQuery(); + clientOperation = context.ClientOperation; + + return result; + } + + /// + /// Translate an expression into a query. + /// Query is constructed as a side-effect in context.CurrentQuery. + /// + /// Expression to translate. + /// Context for translation. + private static Collection Translate(Expression inputExpression, TranslationContext context) + { + Debug.Assert(context != null, "Translation Context should not be null"); + + if (inputExpression == null) + { + throw new ArgumentNullException("inputExpression"); + } + + Collection collection; + switch (inputExpression.NodeType) + { + case ExpressionType.Call: + MethodCallExpression methodCallExpression = (MethodCallExpression)inputExpression; + bool shouldConvertToScalarAnyCollection = (context.PeekMethod() == null) && methodCallExpression.Method.Name.Equals(LinqMethods.Any); + collection = ExpressionToSql.VisitMethodCall(methodCallExpression, context); + if (shouldConvertToScalarAnyCollection) collection = ExpressionToSql.ConvertToScalarAnyCollection(context); + + break; + + case ExpressionType.Constant: + collection = ExpressionToSql.TranslateInput((ConstantExpression)inputExpression, context); + break; + + case ExpressionType.MemberAccess: + collection = ExpressionToSql.VisitMemberAccessCollectionExpression(inputExpression, context, ExpressionToSql.GetBindingParameterName(context)); + break; + + case ExpressionType.Parameter: + SqlScalarExpression scalar = ExpressionToSql.VisitNonSubqueryScalarExpression(inputExpression, context); + collection = ExpressionToSql.ConvertToCollection(scalar); + break; + + default: + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.ExpressionTypeIsNotSupported, inputExpression.NodeType)); + } + return collection; + } + + private static Collection TranslateInput(ConstantExpression inputExpression, TranslationContext context) + { + if (!typeof(IDocumentQuery).IsAssignableFrom(inputExpression.Type)) + { + throw new DocumentQueryException(ClientResources.InputIsNotIDocumentQuery); + } + + // ExpressionToSql is the query input value: a IDocumentQuery + if (!(inputExpression.Value is IDocumentQuery input)) + { + throw new DocumentQueryException(ClientResources.InputIsNotIDocumentQuery); + } + + context.CurrentQuery = new QueryUnderConstruction(context.GetGenFreshParameterFunc()); + Type elemType = TypeSystem.GetElementType(inputExpression.Type); + context.SetInputParameter(elemType, ParameterSubstitution.InputParameterName); // ignore result + + // First outer collection + Collection result = new Collection(ExpressionToSql.SqlRoot); + return result; + } + + /// + /// Get a parameter name to be binded to the collection from the next lambda. + /// It's merely for readability purpose. If that is not possible, use a default + /// parameter name. + /// + /// The translation context + /// A parameter name + private static string GetBindingParameterName(TranslationContext context) + { + MethodCallExpression peekMethod = context.PeekMethod(); + + // The parameter name is the top method's parameter if applicable + string parameterName = null; + if (peekMethod.Arguments.Count > 1) + { + if (peekMethod.Arguments[1] is LambdaExpression lambda && lambda.Parameters.Count > 0) + { + parameterName = lambda.Parameters[0].Name; + } + } + + parameterName ??= ExpressionToSql.DefaultParameterName; + + return parameterName; + } + + #region VISITOR + + /// + /// Visitor which produces a SqlScalarExpression. + /// + /// Expression to visit. + /// Context information. + /// The translation as a ScalarExpression. + internal static SqlScalarExpression VisitNonSubqueryScalarExpression(Expression inputExpression, TranslationContext context) + { + if (inputExpression == null) + { + return null; + } + + switch (inputExpression.NodeType) + { + case ExpressionType.Negate: + case ExpressionType.NegateChecked: + case ExpressionType.Not: + case ExpressionType.Convert: + case ExpressionType.ConvertChecked: + case ExpressionType.ArrayLength: + case ExpressionType.Quote: + case ExpressionType.TypeAs: + return ExpressionToSql.VisitUnary((UnaryExpression)inputExpression, context); + case ExpressionType.Add: + case ExpressionType.AddChecked: + case ExpressionType.Subtract: + case ExpressionType.SubtractChecked: + case ExpressionType.Multiply: + case ExpressionType.MultiplyChecked: + case ExpressionType.Divide: + case ExpressionType.Modulo: + case ExpressionType.And: + case ExpressionType.AndAlso: + case ExpressionType.Or: + case ExpressionType.OrElse: + case ExpressionType.LessThan: + case ExpressionType.LessThanOrEqual: + case ExpressionType.GreaterThan: + case ExpressionType.GreaterThanOrEqual: + case ExpressionType.Equal: + case ExpressionType.NotEqual: + case ExpressionType.Coalesce: + case ExpressionType.ArrayIndex: + case ExpressionType.RightShift: + case ExpressionType.LeftShift: + case ExpressionType.ExclusiveOr: + return ExpressionToSql.VisitBinary((BinaryExpression)inputExpression, context); + case ExpressionType.TypeIs: + return ExpressionToSql.VisitTypeIs((TypeBinaryExpression)inputExpression, context); + case ExpressionType.Conditional: + return ExpressionToSql.VisitConditional((ConditionalExpression)inputExpression, context); + case ExpressionType.Constant: + return ExpressionToSql.VisitConstant((ConstantExpression)inputExpression, context); + case ExpressionType.Parameter: + return ExpressionToSql.VisitParameter((ParameterExpression)inputExpression, context); + case ExpressionType.MemberAccess: + return ExpressionToSql.VisitMemberAccess((MemberExpression)inputExpression, context); + case ExpressionType.New: + return ExpressionToSql.VisitNew((NewExpression)inputExpression, context); + case ExpressionType.NewArrayInit: + case ExpressionType.NewArrayBounds: + return ExpressionToSql.VisitNewArray((NewArrayExpression)inputExpression, context); + case ExpressionType.Invoke: + return ExpressionToSql.VisitInvocation((InvocationExpression)inputExpression, context); + case ExpressionType.MemberInit: + return ExpressionToSql.VisitMemberInit((MemberInitExpression)inputExpression, context); + case ExpressionType.ListInit: + return ExpressionToSql.VisitListInit((ListInitExpression)inputExpression, context); + case ExpressionType.Call: + return ExpressionToSql.VisitMethodCallScalar((MethodCallExpression)inputExpression, context); + default: + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.ExpressionTypeIsNotSupported, inputExpression.NodeType)); + } + } + + private static SqlScalarExpression VisitMethodCallScalar(MethodCallExpression methodCallExpression, TranslationContext context) + { + // Check if it is a UDF method call + if (methodCallExpression.Method.Equals(typeof(CosmosLinq).GetMethod("InvokeUserDefinedFunction"))) + { + string udfName = ((ConstantExpression)methodCallExpression.Arguments[0]).Value as string; + if (string.IsNullOrEmpty(udfName)) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.UdfNameIsNullOrEmpty)); + } + + SqlIdentifier methodName = SqlIdentifier.Create(udfName); + List arguments = new List(); + + if (methodCallExpression.Arguments.Count == 2) + { + // We have two cases here, if the udf was expecting only one parameter and this parameter is an array + // then the second argument will be an expression of this array. + // else we will have a NewArrayExpression of the udf arguments + if (methodCallExpression.Arguments[1] is NewArrayExpression newArrayExpression) + { + ReadOnlyCollection argumentsExpressions = newArrayExpression.Expressions; + foreach (Expression argument in argumentsExpressions) + { + arguments.Add(ExpressionToSql.VisitScalarExpression(argument, context)); + } + } + else if (methodCallExpression.Arguments[1].NodeType == ExpressionType.Constant && + methodCallExpression.Arguments[1].Type == typeof(object[])) + { + object[] argumentsExpressions = (object[])((ConstantExpression)methodCallExpression.Arguments[1]).Value; + foreach (object argument in argumentsExpressions) + { + arguments.Add(ExpressionToSql.VisitConstant(Expression.Constant(argument), context)); + } + } + else + { + arguments.Add(ExpressionToSql.VisitScalarExpression(methodCallExpression.Arguments[1], context)); + } + } + + return SqlFunctionCallScalarExpression.Create(methodName, true, arguments.ToImmutableArray()); + } + else + { + return BuiltinFunctionVisitor.VisitBuiltinFunctionCall(methodCallExpression, context); + } + } + + private static SqlObjectProperty VisitBinding(MemberBinding binding, TranslationContext context) + { + switch (binding.BindingType) + { + case MemberBindingType.Assignment: + return ExpressionToSql.VisitMemberAssignment((MemberAssignment)binding, context); + case MemberBindingType.MemberBinding: + return ExpressionToSql.VisitMemberMemberBinding((MemberMemberBinding)binding, context); + case MemberBindingType.ListBinding: + default: + return ExpressionToSql.VisitMemberListBinding((MemberListBinding)binding, context); + } + } + + private static SqlUnaryScalarOperatorKind GetUnaryOperatorKind(ExpressionType type) + { + switch (type) + { + case ExpressionType.UnaryPlus: + return SqlUnaryScalarOperatorKind.Plus; + case ExpressionType.Negate: + return SqlUnaryScalarOperatorKind.Minus; + case ExpressionType.OnesComplement: + return SqlUnaryScalarOperatorKind.BitwiseNot; + case ExpressionType.Not: + return SqlUnaryScalarOperatorKind.Not; + default: + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.UnaryOperatorNotSupported, type)); + } + } + + private static SqlScalarExpression VisitUnary(UnaryExpression inputExpression, TranslationContext context) + { + SqlScalarExpression operand = ExpressionToSql.VisitScalarExpression(inputExpression.Operand, context); + + // handle NOT IN + if (operand is SqlInScalarExpression sqlInScalarExpression && inputExpression.NodeType == ExpressionType.Not) + { + SqlInScalarExpression inExpression = sqlInScalarExpression; + return SqlInScalarExpression.Create(inExpression.Needle, true, inExpression.Haystack); + } + + if (inputExpression.NodeType == ExpressionType.Quote) + { + return operand; + } + + if (inputExpression.NodeType == ExpressionType.Convert) + { + return operand; + } + + SqlUnaryScalarOperatorKind op = GetUnaryOperatorKind(inputExpression.NodeType); + return SqlUnaryScalarExpression.Create(op, operand); + } + + private static SqlBinaryScalarOperatorKind GetBinaryOperatorKind(ExpressionType expressionType, Type resultType) + { + switch (expressionType) + { + case ExpressionType.Add: + { + if (resultType == typeof(string)) + { + return SqlBinaryScalarOperatorKind.StringConcat; + } + return SqlBinaryScalarOperatorKind.Add; + } + case ExpressionType.AndAlso: + return SqlBinaryScalarOperatorKind.And; + case ExpressionType.And: + return SqlBinaryScalarOperatorKind.BitwiseAnd; + case ExpressionType.Or: + return SqlBinaryScalarOperatorKind.BitwiseOr; + case ExpressionType.ExclusiveOr: + return SqlBinaryScalarOperatorKind.BitwiseXor; + case ExpressionType.Divide: + return SqlBinaryScalarOperatorKind.Divide; + case ExpressionType.Equal: + return SqlBinaryScalarOperatorKind.Equal; + case ExpressionType.GreaterThan: + return SqlBinaryScalarOperatorKind.GreaterThan; + case ExpressionType.GreaterThanOrEqual: + return SqlBinaryScalarOperatorKind.GreaterThanOrEqual; + case ExpressionType.LessThan: + return SqlBinaryScalarOperatorKind.LessThan; + case ExpressionType.LessThanOrEqual: + return SqlBinaryScalarOperatorKind.LessThanOrEqual; + case ExpressionType.Modulo: + return SqlBinaryScalarOperatorKind.Modulo; + case ExpressionType.Multiply: + return SqlBinaryScalarOperatorKind.Multiply; + case ExpressionType.NotEqual: + return SqlBinaryScalarOperatorKind.NotEqual; + case ExpressionType.OrElse: + return SqlBinaryScalarOperatorKind.Or; + case ExpressionType.Subtract: + return SqlBinaryScalarOperatorKind.Subtract; + case ExpressionType.Coalesce: + return SqlBinaryScalarOperatorKind.Coalesce; + default: + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.BinaryOperatorNotSupported, expressionType)); + } + } + + private static SqlScalarExpression VisitBinary(BinaryExpression inputExpression, TranslationContext context) + { + // Speical case for string.CompareTo + // if any of the left or right expression is MethodCallExpression + // the other expression should only be constant (integer) + MethodCallExpression methodCallExpression = null; + ConstantExpression constantExpression = null; + + bool reverseNodeType = false; + if (inputExpression.Left.NodeType == ExpressionType.Call && inputExpression.Right.NodeType == ExpressionType.Constant) + { + methodCallExpression = (MethodCallExpression)inputExpression.Left; + constantExpression = (ConstantExpression)inputExpression.Right; + } + else if (inputExpression.Right.NodeType == ExpressionType.Call && inputExpression.Left.NodeType == ExpressionType.Constant) + { + methodCallExpression = (MethodCallExpression)inputExpression.Right; + constantExpression = (ConstantExpression)inputExpression.Left; + reverseNodeType = true; + } + + if (methodCallExpression != null && constantExpression != null) + { + if (TryMatchStringCompareTo(methodCallExpression, constantExpression, inputExpression.NodeType)) + { + return ExpressionToSql.VisitStringCompareTo(methodCallExpression, inputExpression.NodeType, reverseNodeType, context); + } + + if (TryMatchStringCompare(methodCallExpression, constantExpression, inputExpression.NodeType)) + { + return ExpressionToSql.VisitStringCompare(methodCallExpression, inputExpression.NodeType, reverseNodeType, context); + } + } + + SqlScalarExpression left = ExpressionToSql.VisitScalarExpression(inputExpression.Left, context); + SqlScalarExpression right = ExpressionToSql.VisitScalarExpression(inputExpression.Right, context); + + if (inputExpression.NodeType == ExpressionType.ArrayIndex) + { + SqlMemberIndexerScalarExpression result = SqlMemberIndexerScalarExpression.Create(left, right); + return result; + } + + SqlBinaryScalarOperatorKind op = GetBinaryOperatorKind(inputExpression.NodeType, inputExpression.Type); + + if (left is SqlMemberIndexerScalarExpression && right is SqlLiteralScalarExpression literalScalarExpression) + { + right = ExpressionToSql.ApplyCustomConverters(inputExpression.Left, literalScalarExpression, context); + } + else if (right is SqlMemberIndexerScalarExpression && left is SqlLiteralScalarExpression sqlLiteralScalarExpression) + { + left = ExpressionToSql.ApplyCustomConverters(inputExpression.Right, sqlLiteralScalarExpression, context); + } + + return SqlBinaryScalarExpression.Create(op, left, right); + } + + private static SqlScalarExpression ApplyCustomConverters(Expression left, SqlLiteralScalarExpression right, TranslationContext context) + { + MemberExpression memberExpression; + if (left is UnaryExpression unaryExpression) + { + memberExpression = unaryExpression.Operand as MemberExpression; + } + else + { + memberExpression = left as MemberExpression; + } + + if (memberExpression != null && + right.Literal is not SqlNullLiteral) + { + Type memberType = memberExpression.Type; + if (memberType.IsNullable()) + { + memberType = memberType.NullableUnderlyingType(); + } + + bool requiresCustomSerialization = context.CosmosLinqSerializer.RequiresCustomSerialization(memberExpression, memberType); + if (requiresCustomSerialization) + { + object value = default(object); + // Enum + if (memberType.IsEnum()) + { + try + { + Number64 number64 = ((SqlNumberLiteral)right.Literal).Value; + if (number64.IsDouble) + { + value = Enum.ToObject(memberType, Number64.ToDouble(number64)); + } + else + { + value = Enum.ToObject(memberType, Number64.ToLong(number64)); + } + } + catch + { + value = ((SqlStringLiteral)right.Literal).Value; + } + + } + // DateTime + else if (memberType == typeof(DateTime)) + { + SqlStringLiteral serializedDateTime = (SqlStringLiteral)right.Literal; + value = DateTime.Parse(serializedDateTime.Value, provider: null, DateTimeStyles.RoundtripKind); + } + + if (value != default(object)) + { + string serializedValue = context.CosmosLinqSerializer.Serialize(value, memberExpression, memberType); + return CosmosElement.Parse(serializedValue).Accept(CosmosElementToSqlScalarExpressionVisitor.Singleton); + } + } + } + + return right; + } + + private static bool TryMatchStringCompareTo(MethodCallExpression left, ConstantExpression right, ExpressionType compareOperator) + { + if (left.Method.Equals(typeof(string).GetMethod("CompareTo", new Type[] { typeof(string) })) && left.Arguments.Count == 1) + { + // operator can only be =, >, >=, <, <= + switch (compareOperator) + { + case ExpressionType.Equal: + case ExpressionType.GreaterThan: + case ExpressionType.GreaterThanOrEqual: + case ExpressionType.LessThan: + case ExpressionType.LessThanOrEqual: + break; + default: + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.StringCompareToInvalidOperator)); + } + + // the constant value should be zero, otherwise we can't determine how to translate the expression + // it could be either integer or nullable integer + if (!(right.Type == typeof(int) && (int)right.Value == 0) && + !(right.Type == typeof(int?) && ((int?)right.Value).HasValue && ((int?)right.Value).Value == 0)) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.StringCompareToInvalidConstant)); + } + + return true; + } + + return false; + } + + private static SqlScalarExpression VisitStringCompareTo( + MethodCallExpression left, + ExpressionType compareOperator, + bool reverseNodeType, + TranslationContext context) + { + if (reverseNodeType) + { + compareOperator = ReverseExpressionTypeForStrings(compareOperator, ClientResources.StringCompareToInvalidOperator); + } + + SqlBinaryScalarOperatorKind op = GetBinaryOperatorKind(compareOperator, null); + + SqlScalarExpression leftExpression = ExpressionToSql.VisitNonSubqueryScalarExpression(left.Object, context); + SqlScalarExpression rightExpression = ExpressionToSql.VisitNonSubqueryScalarExpression(left.Arguments[0], context); + + return SqlBinaryScalarExpression.Create(op, leftExpression, rightExpression); + } + + private static ExpressionType ReverseExpressionTypeForStrings(ExpressionType compareOperator, string errorMessage) + { + switch (compareOperator) + { + case ExpressionType.Equal: + // do nothing + break; + case ExpressionType.GreaterThan: + compareOperator = ExpressionType.LessThan; + break; + case ExpressionType.GreaterThanOrEqual: + compareOperator = ExpressionType.LessThanOrEqual; + break; + case ExpressionType.LessThan: + compareOperator = ExpressionType.GreaterThan; + break; + case ExpressionType.LessThanOrEqual: + compareOperator = ExpressionType.GreaterThanOrEqual; + break; + default: + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, errorMessage)); + } + + return compareOperator; + } + + private static bool TryMatchStringCompare(MethodCallExpression left, ConstantExpression right, ExpressionType compareOperator) + { + if (left.Method.Equals(typeof(string).GetMethod("Compare", new Type[] { typeof(string), typeof(string) })) && left.Arguments.Count == 2) + { + // operator can only be =, >, >=, <, <= + switch (compareOperator) + { + case ExpressionType.Equal: + case ExpressionType.GreaterThan: + case ExpressionType.GreaterThanOrEqual: + case ExpressionType.LessThan: + case ExpressionType.LessThanOrEqual: + break; + default: + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.StringCompareInvalidOperator)); + } + + // the constant value should be zero, otherwise we can't determine how to translate the expression + // it could be either integer or nullable integer + if (!(right.Type == typeof(int) && (int)right.Value == 0) && + !(right.Type == typeof(int?) && ((int?)right.Value).HasValue && ((int?)right.Value).Value == 0)) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.StringCompareInvalidConstant)); + } + + return true; + } + + return false; + } + + private static SqlScalarExpression VisitStringCompare( + MethodCallExpression left, + ExpressionType compareOperator, + bool reverseNodeType, + TranslationContext context) + { + if (reverseNodeType) + { + compareOperator = ReverseExpressionTypeForStrings(compareOperator, ClientResources.StringCompareInvalidOperator); + } + + SqlBinaryScalarOperatorKind op = GetBinaryOperatorKind(compareOperator, null); + + SqlScalarExpression leftExpression = ExpressionToSql.VisitNonSubqueryScalarExpression(left.Arguments[0], context); + SqlScalarExpression rightExpression = ExpressionToSql.VisitNonSubqueryScalarExpression(left.Arguments[1], context); + + return SqlBinaryScalarExpression.Create(op, leftExpression, rightExpression); + } + + private static SqlScalarExpression VisitTypeIs(TypeBinaryExpression inputExpression, TranslationContext context) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.ExpressionTypeIsNotSupported, inputExpression.NodeType)); + } + + public static SqlScalarExpression VisitConstant(ConstantExpression inputExpression, TranslationContext context) + { + if (inputExpression.Value == null) + { + return SqlLiteralScalarExpression.SqlNullLiteralScalarExpression; + } + + if (inputExpression.Type.IsNullable()) + { + return VisitConstant(Expression.Constant(inputExpression.Value, Nullable.GetUnderlyingType(inputExpression.Type)), context); + } + + if (context.Parameters != null && context.Parameters.TryGetValue(inputExpression.Value, out string paramName)) + { + SqlParameter sqlParameter = SqlParameter.Create(paramName); + return SqlParameterRefScalarExpression.Create(sqlParameter); + } + + Type constantType = inputExpression.Value.GetType(); + if (constantType.IsValueType) + { + if (inputExpression.Value is bool boolValue) + { + SqlBooleanLiteral literal = SqlBooleanLiteral.Create(boolValue); + return SqlLiteralScalarExpression.Create(literal); + } + + if (ExpressionToSql.TryGetSqlNumberLiteral(inputExpression.Value, out SqlNumberLiteral numberLiteral)) + { + return SqlLiteralScalarExpression.Create(numberLiteral); + } + + if (inputExpression.Value is Guid guidValue) + { + SqlStringLiteral literal = SqlStringLiteral.Create(guidValue.ToString()); + return SqlLiteralScalarExpression.Create(literal); + } + } + + if (inputExpression.Value is string stringValue) + { + SqlStringLiteral literal = SqlStringLiteral.Create(stringValue); + return SqlLiteralScalarExpression.Create(literal); + } + + if (typeof(Geometry).IsAssignableFrom(constantType)) + { + return GeometrySqlExpressionFactory.Construct(inputExpression); + } + + if (inputExpression.Value is IEnumerable enumerable) + { + List arrayItems = new List(); + + foreach (object item in enumerable) + { + arrayItems.Add(VisitConstant(Expression.Constant(item), context)); + } + + return SqlArrayCreateScalarExpression.Create(arrayItems.ToImmutableArray()); + } + + string serializedConstant = context.CosmosLinqSerializer.SerializeScalarExpression(inputExpression); + + return CosmosElement.Parse(serializedConstant).Accept(CosmosElementToSqlScalarExpressionVisitor.Singleton); + } + + private static SqlScalarExpression VisitConditional(ConditionalExpression inputExpression, TranslationContext context) + { + SqlScalarExpression conditionExpression = ExpressionToSql.VisitScalarExpression(inputExpression.Test, context); + SqlScalarExpression firstExpression = ExpressionToSql.VisitScalarExpression(inputExpression.IfTrue, context); + SqlScalarExpression secondExpression = ExpressionToSql.VisitScalarExpression(inputExpression.IfFalse, context); + + return SqlConditionalScalarExpression.Create(conditionExpression, firstExpression, secondExpression); + } + + private static SqlScalarExpression VisitParameter(ParameterExpression inputExpression, TranslationContext context) + { + Expression subst = context.LookupSubstitution(inputExpression); + if (subst != null) + { + return ExpressionToSql.VisitNonSubqueryScalarExpression(subst, context); + } + + string name = inputExpression.Name; + SqlIdentifier id = SqlIdentifier.Create(name); + return SqlPropertyRefScalarExpression.Create(null, id); + } + + private static SqlScalarExpression VisitMemberAccess(MemberExpression inputExpression, TranslationContext context) + { + SqlScalarExpression memberExpression = ExpressionToSql.VisitScalarExpression(inputExpression.Expression, context); + string memberName = inputExpression.Member.GetMemberName(context); + + // If the resulting memberName is null, then the indexer should be on the root of the object. + if (memberName == null) + { + return memberExpression; + } + + // if expression is nullable + if (inputExpression.Expression.Type.IsNullable()) + { + MemberNames memberNames = context.MemberNames; + + // ignore .Value + if (memberName == memberNames.Value) + { + return memberExpression; + } + + // convert .HasValue to IS_DEFINED expression + if (memberName == memberNames.HasValue) + { + return SqlFunctionCallScalarExpression.CreateBuiltin("IS_DEFINED", memberExpression); + } + } + + if (usePropertyRef) + { + SqlIdentifier propertyIdentifier = SqlIdentifier.Create(memberName); + SqlPropertyRefScalarExpression propertyRefExpression = SqlPropertyRefScalarExpression.Create(memberExpression, propertyIdentifier); + return propertyRefExpression; + } + else + { + SqlScalarExpression indexExpression = SqlLiteralScalarExpression.Create(SqlStringLiteral.Create(memberName)); + SqlMemberIndexerScalarExpression memberIndexerExpression = SqlMemberIndexerScalarExpression.Create(memberExpression, indexExpression); + return memberIndexerExpression; + } + } + + private static SqlScalarExpression[] VisitExpressionList(ReadOnlyCollection inputExpressionList, TranslationContext context) + { + SqlScalarExpression[] result = new SqlScalarExpression[inputExpressionList.Count]; + for (int i = 0; i < inputExpressionList.Count; i++) + { + SqlScalarExpression p = ExpressionToSql.VisitScalarExpression(inputExpressionList[i], context); + result[i] = p; + } + + return result; + } + + private static SqlObjectProperty VisitMemberAssignment(MemberAssignment inputExpression, TranslationContext context) + { + SqlScalarExpression assign = ExpressionToSql.VisitScalarExpression(inputExpression.Expression, context); + string memberName = inputExpression.Member.GetMemberName(context); + SqlPropertyName propName = SqlPropertyName.Create(memberName); + SqlObjectProperty prop = SqlObjectProperty.Create(propName, assign); + return prop; + } + + private static SqlObjectProperty VisitMemberMemberBinding(MemberMemberBinding inputExpression, TranslationContext context) + { + throw new DocumentQueryException(ClientResources.MemberBindingNotSupported); + } + + private static SqlObjectProperty VisitMemberListBinding(MemberListBinding inputExpression, TranslationContext context) + { + throw new DocumentQueryException(ClientResources.MemberBindingNotSupported); + } + + private static SqlObjectProperty[] VisitBindingList(ReadOnlyCollection inputExpressionList, TranslationContext context) + { + SqlObjectProperty[] list = new SqlObjectProperty[inputExpressionList.Count]; + for (int i = 0; i < inputExpressionList.Count; i++) + { + SqlObjectProperty b = ExpressionToSql.VisitBinding(inputExpressionList[i], context); + list[i] = b; + } + + return list; + } + + private static SqlObjectProperty[] CreateInitializers(ReadOnlyCollection arguments, ReadOnlyCollection members, TranslationContext context) + { + if (arguments.Count != members.Count) + { + throw new InvalidOperationException("Expected same number of arguments as members"); + } + + SqlObjectProperty[] result = new SqlObjectProperty[arguments.Count]; + for (int i = 0; i < arguments.Count; i++) + { + Expression arg = arguments[i]; + MemberInfo member = members[i]; + SqlScalarExpression value = ExpressionToSql.VisitScalarExpression(arg, context); + + string memberName = member.GetMemberName(context); + SqlPropertyName propName = SqlPropertyName.Create(memberName); + SqlObjectProperty prop = SqlObjectProperty.Create(propName, value); + result[i] = prop; + } + + return result; + } + + private static SqlSelectItem[] CreateSelectItems(ReadOnlyCollection arguments, ReadOnlyCollection members, TranslationContext context) + { + if (arguments.Count != members.Count) + { + throw new InvalidOperationException("Expected same number of arguments as members"); + } + + SqlSelectItem[] result = new SqlSelectItem[arguments.Count]; + for (int i = 0; i < arguments.Count; i++) + { + Expression arg = arguments[i]; + MemberInfo member = members[i]; + SqlScalarExpression selectExpression = ExpressionToSql.VisitScalarExpression(arg, context); + + string memberName = member.GetMemberName(context); + SqlIdentifier alias = SqlIdentifier.Create(memberName); + SqlSelectItem prop = SqlSelectItem.Create(selectExpression, alias); + result[i] = prop; + } + + return result; + } + + private static SqlScalarExpression VisitNew(NewExpression inputExpression, TranslationContext context) + { + if (typeof(Geometry).IsAssignableFrom(inputExpression.Type)) + { + return GeometrySqlExpressionFactory.Construct(inputExpression); + } + + if (inputExpression.Arguments.Count > 0) + { + if (inputExpression.Members == null) + { + throw new DocumentQueryException(ClientResources.ConstructorInvocationNotSupported); + } + + SqlObjectProperty[] propertyBindings = ExpressionToSql.CreateInitializers(inputExpression.Arguments, inputExpression.Members, context); + SqlObjectCreateScalarExpression create = SqlObjectCreateScalarExpression.Create(propertyBindings); + return create; + } + else + { + // no need to return anything; the initializer will generate the complete code + return null; + } + } + + private static SqlScalarExpression VisitMemberInit(MemberInitExpression inputExpression, TranslationContext context) + { + ExpressionToSql.VisitNew(inputExpression.NewExpression, context); // Return value is ignored + SqlObjectProperty[] propertyBindings = ExpressionToSql.VisitBindingList(inputExpression.Bindings, context); + SqlObjectCreateScalarExpression create = SqlObjectCreateScalarExpression.Create(propertyBindings); + return create; + } + + private static SqlScalarExpression VisitListInit(ListInitExpression inputExpression, TranslationContext context) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.ExpressionTypeIsNotSupported, inputExpression.NodeType)); + } + + private static SqlScalarExpression VisitNewArray(NewArrayExpression inputExpression, TranslationContext context) + { + SqlScalarExpression[] exprs = ExpressionToSql.VisitExpressionList(inputExpression.Expressions, context); + if (inputExpression.NodeType == ExpressionType.NewArrayInit) + { + SqlArrayCreateScalarExpression array = SqlArrayCreateScalarExpression.Create(exprs); + return array; + } + else + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.ExpressionTypeIsNotSupported, inputExpression.NodeType)); + } + } + + private static SqlScalarExpression VisitInvocation(InvocationExpression inputExpression, TranslationContext context) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.ExpressionTypeIsNotSupported, inputExpression.NodeType)); + } + + #endregion VISITOR + + #region Scalar and CollectionScalar Visitors + + private static Collection ConvertToCollection(SqlScalarExpression scalar) + { + if (usePropertyRef) + { + SqlPropertyRefScalarExpression propertyRefExpression = scalar as SqlPropertyRefScalarExpression; + if (propertyRefExpression == null) + { + throw new DocumentQueryException(ClientResources.PathExpressionsOnly); + } + + SqlInputPathCollection path = ConvertPropertyRefToPath(propertyRefExpression); + Collection result = new Collection(path); + return result; + } + else + { + SqlMemberIndexerScalarExpression memberIndexerExpression = scalar as SqlMemberIndexerScalarExpression; + if (memberIndexerExpression == null) + { + SqlPropertyRefScalarExpression propertyRefExpression = scalar as SqlPropertyRefScalarExpression; + if (propertyRefExpression == null) + { + throw new DocumentQueryException(ClientResources.PathExpressionsOnly); + } + + SqlInputPathCollection path = ConvertPropertyRefToPath(propertyRefExpression); + Collection result = new Collection(path); + return result; + } + else + { + SqlInputPathCollection path = ConvertMemberIndexerToPath(memberIndexerExpression); + Collection result = new Collection(path); + return result; + } + } + } + + /// + /// Convert the context's current query to a scalar Any collection + /// by wrapping it as following: SELECT VALUE COUNT(v0) > 0 FROM (current query) AS v0. + /// This is used in cases where LINQ expression ends with Any() which is a boolean scalar. + /// Normally Any would translate to SELECT VALUE EXISTS() subquery. However that wouldn't work + /// for these cases because it would result in a boolean value for each row instead of + /// one single "aggregated" boolean value. + /// + /// The translation context + /// The scalar Any collection + private static Collection ConvertToScalarAnyCollection(TranslationContext context) + { + SqlQuery query = context.CurrentQuery.FlattenAsPossible().GetSqlQuery(); + SqlCollection subqueryCollection = SqlSubqueryCollection.Create(query); + + ParameterExpression parameterExpression = context.GenerateFreshParameter(typeof(object), ExpressionToSql.DefaultParameterName); + Binding binding = new Binding(parameterExpression, subqueryCollection, isInCollection: false, isInputParameter: true); + + context.CurrentQuery = new QueryUnderConstruction(context.GetGenFreshParameterFunc()); + context.CurrentQuery.AddBinding(binding); + + SqlSelectSpec selectSpec = SqlSelectValueSpec.Create( + SqlBinaryScalarExpression.Create( + SqlBinaryScalarOperatorKind.GreaterThan, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Names.Count, + SqlPropertyRefScalarExpression.Create(null, SqlIdentifier.Create(parameterExpression.Name))), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(0)))); + SqlSelectClause selectClause = SqlSelectClause.Create(selectSpec); + context.CurrentQuery.AddSelectClause(selectClause); + + return new Collection(LinqMethods.Any); + } + + private static SqlScalarExpression VisitNonSubqueryScalarExpression(Expression expression, ReadOnlyCollection parameters, TranslationContext context) + { + foreach (ParameterExpression par in parameters) + { + context.PushParameter(par, context.CurrentSubqueryBinding.ShouldBeOnNewQuery); + } + + SqlScalarExpression scalarExpression = ExpressionToSql.VisitNonSubqueryScalarExpression(expression, context); + + foreach (ParameterExpression par in parameters) + { + context.PopParameter(); + } + + return scalarExpression; + } + + private static SqlScalarExpression VisitNonSubqueryScalarLambda(LambdaExpression lambdaExpression, TranslationContext context) + { + ReadOnlyCollection parameters = lambdaExpression.Parameters; + if (parameters.Count != 1) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, lambdaExpression.Body, 1, parameters.Count)); + } + + return ExpressionToSql.VisitNonSubqueryScalarExpression(lambdaExpression.Body, parameters, context); + } + + private static Collection VisitCollectionExpression(Expression expression, ReadOnlyCollection parameters, TranslationContext context) + { + foreach (ParameterExpression par in parameters) + { + context.PushParameter(par, context.CurrentSubqueryBinding.ShouldBeOnNewQuery); + } + + Collection collection = ExpressionToSql.VisitCollectionExpression(expression, context, parameters.Count > 0 ? parameters.First().Name : ExpressionToSql.DefaultParameterName); + + foreach (ParameterExpression par in parameters) + { + context.PopParameter(); + } + + return collection; + } + + private static Collection VisitCollectionExpression(Expression expression, TranslationContext context, string parameterName) + { + Collection result; + switch (expression.NodeType) + { + case ExpressionType.Call: + result = ExpressionToSql.Translate(expression, context); + break; + + case ExpressionType.MemberAccess: + result = ExpressionToSql.VisitMemberAccessCollectionExpression(expression, context, parameterName); + break; + + default: + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.ExpressionTypeIsNotSupported, expression.NodeType)); + } + + return result; + } + + /// + /// Visit a lambda which is supposed to return a collection. + /// + /// LambdaExpression with a result which is a collection. + /// The translation context. + /// The collection computed by the lambda. + private static Collection VisitCollectionLambda(LambdaExpression lambdaExpression, TranslationContext context) + { + ReadOnlyCollection parameters = lambdaExpression.Parameters; + if (parameters.Count != 1) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, lambdaExpression.Body, 1, parameters.Count)); + } + + return ExpressionToSql.VisitCollectionExpression(lambdaExpression.Body, lambdaExpression.Parameters, context); + } + + /// + /// Visit an expression, usually a MemberAccess, then trigger parameter binding for that expression. + /// + /// The input expression + /// The current translation context + /// Parameter name is merely for readability + private static Collection VisitMemberAccessCollectionExpression(Expression inputExpression, TranslationContext context, string parameterName) + { + SqlScalarExpression body = ExpressionToSql.VisitNonSubqueryScalarExpression(inputExpression, context); + Type type = inputExpression.Type; + + Collection collection = ExpressionToSql.ConvertToCollection(body); + context.PushCollection(collection); + ParameterExpression parameter = context.GenerateFreshParameter(type, parameterName); + context.PushParameter(parameter, context.CurrentSubqueryBinding.ShouldBeOnNewQuery); + context.PopParameter(); + context.PopCollection(); + + return new Collection(parameter.Name); + } + + /// + /// Visit a method call, construct the corresponding query in context.CurrentQuery. + /// At ExpressionToSql point only LINQ method calls are allowed. + /// These methods are static extension methods of IQueryable or IEnumerable. + /// + /// Method to translate. + /// Query translation context. + private static Collection VisitMethodCall(MethodCallExpression inputExpression, TranslationContext context) + { + context.PushMethod(inputExpression); + + Type declaringType = inputExpression.Method.DeclaringType; + + if ((declaringType != typeof(Queryable) + && declaringType != typeof(Enumerable) /*LINQ Methods*/ + && declaringType != typeof(CosmosLinqExtensions) /*OrderByRank*/) + || !inputExpression.Method.IsStatic /*Other extansion method*/) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.OnlyLINQMethodsAreSupported, inputExpression.Method.Name)); + } + + Type returnType = inputExpression.Method.ReturnType; + Type returnElementType = TypeSystem.GetElementType(returnType); + + if (inputExpression.Object != null) + { + throw new DocumentQueryException(ClientResources.ExpectedMethodCallsMethods); + } + + Expression inputCollection = inputExpression.Arguments[0]; // all these methods are static extension methods, so argument[0] is the collection + + Type inputElementType = TypeSystem.GetElementType(inputCollection.Type); + Collection collection = ExpressionToSql.Translate(inputCollection, context); + + context.PushCollection(collection); + + Collection result = new Collection(inputExpression.Method.Name); + bool shouldBeOnNewQuery = context.CurrentQuery.ShouldBeOnNewQuery(inputExpression.Method.Name, inputExpression.Arguments.Count); + context.PushSubqueryBinding(shouldBeOnNewQuery); + + if (context.LastExpressionIsGroupBy) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, "Group By cannot be followed by other methods")); + } + + switch (inputExpression.Method.Name) + { + case LinqMethods.Any: + { + result = new Collection(string.Empty); + + if (inputExpression.Arguments.Count == 2) + { + // Any is translated to an SELECT VALUE EXISTS() where Any operation itself is treated as a Where. + SqlWhereClause where = ExpressionToSql.VisitWhere(inputExpression.Arguments, context); + context.CurrentQuery = context.CurrentQuery.AddWhereClause(where, context); + } + break; + } + case LinqMethods.Average: + { + SqlSelectClause select = ExpressionToSql.VisitAggregateFunction(inputExpression.Arguments, context, SqlFunctionCallScalarExpression.Names.Avg); + context.CurrentQuery = context.CurrentQuery.AddSelectClause(select, context); + break; + } + case LinqMethods.Count: + { + SqlSelectClause select = ExpressionToSql.VisitCount(inputExpression.Arguments, context); + context.CurrentQuery = context.CurrentQuery.AddSelectClause(select, context); + break; + } + case LinqMethods.Distinct: + { + SqlSelectClause select = ExpressionToSql.VisitDistinct(inputExpression.Arguments, context); + context.CurrentQuery = context.CurrentQuery.AddSelectClause(select, context); + break; + } + case LinqMethods.FirstOrDefault: + { + if (inputExpression.Arguments.Count == 1) + { + // TOP is not allowed when OFFSET ... LIMIT is present. + if (!context.CurrentQuery.HasOffsetSpec()) + { + SqlNumberLiteral sqlNumberLiteral = SqlNumberLiteral.Create(1); + SqlTopSpec topSpec = SqlTopSpec.Create(sqlNumberLiteral); + context.CurrentQuery = context.CurrentQuery.AddTopSpec(topSpec); + } + + context.SetClientOperation(ScalarOperationKind.FirstOrDefault); + } + else + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, inputExpression.Method.Name, 0, inputExpression.Arguments.Count - 1)); + } + + break; + } + case LinqMethods.Max: + { + SqlSelectClause select = ExpressionToSql.VisitAggregateFunction(inputExpression.Arguments, context, SqlFunctionCallScalarExpression.Names.Max); + context.CurrentQuery = context.CurrentQuery.AddSelectClause(select, context); + break; + } + case LinqMethods.Min: + { + SqlSelectClause select = ExpressionToSql.VisitAggregateFunction(inputExpression.Arguments, context, SqlFunctionCallScalarExpression.Names.Min); + context.CurrentQuery = context.CurrentQuery.AddSelectClause(select, context); + break; + } + case LinqMethods.GroupBy: + { + context.CurrentQuery = context.PackageCurrentQueryIfNeccessary(); + result = ExpressionToSql.VisitGroupBy(returnElementType, inputExpression.Arguments, context); + context.LastExpressionIsGroupBy = true; + break; + } + case LinqMethods.OrderBy: + { + SqlOrderByClause orderBy = ExpressionToSql.VisitOrderBy(inputExpression.Arguments, false, context); + context.CurrentQuery = context.CurrentQuery.AddOrderByClause(orderBy, context); + break; + } + case LinqMethods.OrderByDescending: + { + SqlOrderByClause orderBy = ExpressionToSql.VisitOrderBy(inputExpression.Arguments, true, context); + context.CurrentQuery = context.CurrentQuery.AddOrderByClause(orderBy, context); + break; + } + case nameof(CosmosLinqExtensions.OrderByRank): + { + SqlOrderByClause orderBy = ExpressionToSql.VisitOrderByRank(inputExpression.Arguments, context); + context.CurrentQuery = context.CurrentQuery.AddOrderByClause(orderBy, context); + break; + } + case LinqMethods.Select: + { + SqlSelectClause select = ExpressionToSql.VisitSelect(inputExpression.Arguments, context); + context.CurrentQuery = context.CurrentQuery.AddSelectClause(select, context); + break; + } + case LinqMethods.SelectMany: + { + context.CurrentQuery = context.PackageCurrentQueryIfNeccessary(); + result = ExpressionToSql.VisitSelectMany(inputExpression.Arguments, context); + break; + } + case LinqMethods.Skip: + { + SqlOffsetSpec offsetSpec = ExpressionToSql.VisitSkip(inputExpression.Arguments, context); + context.CurrentQuery = context.CurrentQuery.AddOffsetSpec(offsetSpec, context); + break; + } + case LinqMethods.Sum: + { + SqlSelectClause select = ExpressionToSql.VisitAggregateFunction(inputExpression.Arguments, context, SqlFunctionCallScalarExpression.Names.Sum); + context.CurrentQuery = context.CurrentQuery.AddSelectClause(select, context); + break; + } + case LinqMethods.Take: + { + if (context.CurrentQuery.HasOffsetSpec()) + { + SqlLimitSpec limitSpec = ExpressionToSql.VisitTakeLimit(inputExpression.Arguments, context); + context.CurrentQuery = context.CurrentQuery.AddLimitSpec(limitSpec, context); + } + else + { + SqlTopSpec topSpec = ExpressionToSql.VisitTakeTop(inputExpression.Arguments, context); + context.CurrentQuery = context.CurrentQuery.AddTopSpec(topSpec); + } + break; + } + case LinqMethods.ThenBy: + { + SqlOrderByClause thenBy = ExpressionToSql.VisitOrderBy(inputExpression.Arguments, false, context); + context.CurrentQuery = context.CurrentQuery.UpdateOrderByClause(thenBy, context); + break; + } + case LinqMethods.ThenByDescending: + { + SqlOrderByClause thenBy = ExpressionToSql.VisitOrderBy(inputExpression.Arguments, true, context); + context.CurrentQuery = context.CurrentQuery.UpdateOrderByClause(thenBy, context); + break; + } + case LinqMethods.Where: + { + SqlWhereClause where = ExpressionToSql.VisitWhere(inputExpression.Arguments, context); + context.CurrentQuery = context.CurrentQuery.AddWhereClause(where, context); + break; + } + default: + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.MethodNotSupported, inputExpression.Method.Name)); + } + + context.PopSubqueryBinding(); + context.PopCollection(); + context.PopMethod(); + return result; + } + + /// + /// Visit a method call, construct the corresponding query and return the select clause for the aggregate function. + /// At ExpressionToSql point only LINQ method calls are allowed. + /// These methods are static extension methods of IQueryable or IEnumerable. + /// + /// Method to translate. + /// Query translation context. + private static SqlSelectClause VisitGroupByAggregateMethodCall(MethodCallExpression inputExpression, TranslationContext context) + { + context.PushMethod(inputExpression); + + Type declaringType = inputExpression.Method.DeclaringType; + if ((declaringType != typeof(Queryable) && declaringType != typeof(Enumerable)) + || !inputExpression.Method.IsStatic) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.OnlyLINQMethodsAreSupported, inputExpression.Method.Name)); + } + + if (inputExpression.Object != null) + { + throw new DocumentQueryException(ClientResources.ExpectedMethodCallsMethods); + } + + if (context.LastExpressionIsGroupBy) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, "Group By cannot be followed by other methods")); + } + + SqlSelectClause select; + switch (inputExpression.Method.Name) + { + case LinqMethods.Average: + { + select = ExpressionToSql.VisitAggregateFunction(inputExpression.Arguments, context, SqlFunctionCallScalarExpression.Names.Avg); + break; + } + case LinqMethods.Count: + { + select = ExpressionToSql.VisitCount(inputExpression.Arguments, context); + break; + } + case LinqMethods.Max: + { + select = ExpressionToSql.VisitAggregateFunction(inputExpression.Arguments, context, SqlFunctionCallScalarExpression.Names.Max); + break; + } + case LinqMethods.Min: + { + select = ExpressionToSql.VisitAggregateFunction(inputExpression.Arguments, context, SqlFunctionCallScalarExpression.Names.Min); + break; + } + case LinqMethods.Sum: + { + select = ExpressionToSql.VisitAggregateFunction(inputExpression.Arguments, context, SqlFunctionCallScalarExpression.Names.Sum); + break; + } + default: + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.MethodNotSupported, inputExpression.Method.Name)); + } + + context.PopMethod(); + return select; + } + + /// + /// Determine if an expression should be translated to a subquery. + /// This only applies to expression that is inside a lamda. + /// + /// The input expression + /// The expression object kind of the expression + /// True if the method is either Min, Max, or Avg + /// True if subquery is needed, otherwise false + private static bool IsSubqueryScalarExpression(Expression expression, out SubqueryKind? expressionObjKind, out bool isMinMaxAvgMethod) + { + if (!(expression is MethodCallExpression methodCallExpression)) + { + expressionObjKind = null; + isMinMaxAvgMethod = false; + return false; + } + + string methodName = methodCallExpression.Method.Name; + bool isSubqueryExpression; + + isMinMaxAvgMethod = false; + + switch (methodName) + { + case LinqMethods.Min: + case LinqMethods.Max: + case LinqMethods.Average: + isMinMaxAvgMethod = true; + isSubqueryExpression = true; + expressionObjKind = SubqueryKind.SubqueryScalarExpression; + break; + + case LinqMethods.Sum: + isSubqueryExpression = true; + expressionObjKind = SubqueryKind.SubqueryScalarExpression; + break; + + case LinqMethods.Count: + if (methodCallExpression.Arguments.Count > 1) + { + isSubqueryExpression = true; + expressionObjKind = SubqueryKind.SubqueryScalarExpression; + } + else + { + SubqueryKind? objKind; + bool isMinMaxAvg; + isSubqueryExpression = ExpressionToSql.IsSubqueryScalarExpression( + methodCallExpression.Arguments[0] as MethodCallExpression, + out objKind, out isMinMaxAvg); + + if (isSubqueryExpression) + { + isSubqueryExpression = true; + expressionObjKind = SubqueryKind.SubqueryScalarExpression; + } + else + { + isSubqueryExpression = false; + expressionObjKind = null; + } + } + break; + + case LinqMethods.Any: + isSubqueryExpression = true; + expressionObjKind = SubqueryKind.ExistsScalarExpression; + break; + + case LinqMethods.Select: + case LinqMethods.SelectMany: + case LinqMethods.Where: + case LinqMethods.OrderBy: + case LinqMethods.OrderByDescending: + case nameof(CosmosLinqExtensions.OrderByRank): + case LinqMethods.ThenBy: + case LinqMethods.ThenByDescending: + case LinqMethods.Skip: + case LinqMethods.Take: + case LinqMethods.Distinct: + case LinqMethods.GroupBy: + isSubqueryExpression = true; + expressionObjKind = SubqueryKind.ArrayScalarExpression; + break; + + default: + isSubqueryExpression = false; + expressionObjKind = null; + break; + } + + return isSubqueryExpression; + } + + /// + /// Visit an lambda expression which is in side a lambda and translate it to a scalar expression or a subquery scalar expression. + /// See the other overload of this method for more details. + /// + /// The input lambda expression + /// The translation context + /// A scalar expression representing the input expression + private static SqlScalarExpression VisitScalarExpression(LambdaExpression lambda, TranslationContext context) + { + return ExpressionToSql.VisitScalarExpression( + lambda.Body, + lambda.Parameters, + context); + } + + /// + /// Visit an lambda expression which is inside a lambda and translate it to a scalar expression or a collection scalar expression. + /// If it is a collection scalar expression, e.g. should be translated to subquery such as SELECT VALUE ARRAY, SELECT VALUE EXISTS, + /// SELECT VALUE [aggregate], the subquery will be aliased to a new binding for the FROM clause. E.g. consider + /// Select(family => family.Children.Select(child => child.Grade)). Since the inner Select corresponds to a subquery, this method would + /// create a new binding of v0 to the subquery SELECT VALUE ARRAY(), and the inner expression will be just SELECT v0. + /// + /// The input expression + /// The translation context + /// A scalar expression representing the input expression + internal static SqlScalarExpression VisitScalarExpression(Expression expression, TranslationContext context) + { + return ExpressionToSql.VisitScalarExpression( + expression, + new ReadOnlyCollection(Array.Empty()), + context); + } + + internal static bool TryGetSqlNumberLiteral(object value, out SqlNumberLiteral sqlNumberLiteral) + { + sqlNumberLiteral = default(SqlNumberLiteral); + if (value is byte byteValue) + { + sqlNumberLiteral = SqlNumberLiteral.Create(byteValue); + } + else if (value is sbyte sbyteValue) + { + sqlNumberLiteral = SqlNumberLiteral.Create(sbyteValue); + } + else if (value is decimal decimalValue) + { + if ((decimalValue >= long.MinValue) && (decimalValue <= long.MaxValue) && (decimalValue % 1 == 0)) + { + sqlNumberLiteral = SqlNumberLiteral.Create(Convert.ToInt64(decimalValue)); + } + else + { + sqlNumberLiteral = SqlNumberLiteral.Create(Convert.ToDouble(decimalValue)); + } + } + else if (value is double doubleValue) + { + sqlNumberLiteral = SqlNumberLiteral.Create(doubleValue); + } + else if (value is float floatVlaue) + { + sqlNumberLiteral = SqlNumberLiteral.Create(floatVlaue); + } + else if (value is int intValue) + { + sqlNumberLiteral = SqlNumberLiteral.Create(intValue); + } + else if (value is uint uintValue) + { + sqlNumberLiteral = SqlNumberLiteral.Create(uintValue); + } + else if (value is long longValue) + { + sqlNumberLiteral = SqlNumberLiteral.Create(longValue); + } + else if (value is ulong ulongValue) + { + if (ulongValue <= long.MaxValue) + { + sqlNumberLiteral = SqlNumberLiteral.Create(Convert.ToInt64(ulongValue)); + } + else + { + sqlNumberLiteral = SqlNumberLiteral.Create(Convert.ToDouble(ulongValue)); + } + } + else if (value is short shortValue) + { + sqlNumberLiteral = SqlNumberLiteral.Create(shortValue); + } + else if (value is ushort ushortValue) + { + sqlNumberLiteral = SqlNumberLiteral.Create(ushortValue); + } + + return sqlNumberLiteral != default(SqlNumberLiteral); + } + + /// + /// Visit an lambda expression which is in side a lambda and translate it to a scalar expression or a collection scalar expression. + /// See the other overload of this method for more details. + /// + private static SqlScalarExpression VisitScalarExpression(Expression expression, + ReadOnlyCollection parameters, + TranslationContext context) + { + SubqueryKind? expressionObjKind; + bool isMinMaxAvgMethod; + bool shouldUseSubquery = ExpressionToSql.IsSubqueryScalarExpression(expression, out expressionObjKind, out isMinMaxAvgMethod); + + SqlScalarExpression sqlScalarExpression; + if (!shouldUseSubquery) + { + sqlScalarExpression = ExpressionToSql.VisitNonSubqueryScalarExpression(expression, parameters, context); + } + else + { + SqlQuery query = ExpressionToSql.CreateSubquery(expression, parameters, context); + + ParameterExpression parameterExpression = context.GenerateFreshParameter(typeof(object), ExpressionToSql.DefaultParameterName); + SqlCollection subqueryCollection = ExpressionToSql.CreateSubquerySqlCollection( + query, + isMinMaxAvgMethod ? SubqueryKind.ArrayScalarExpression : expressionObjKind.Value); + + Binding newBinding = new Binding(parameterExpression, subqueryCollection, + isInCollection: false, isInputParameter: context.IsInMainBranchSelect()); + + context.CurrentSubqueryBinding.NewBindings.Add(newBinding); + + if (isMinMaxAvgMethod) + { + sqlScalarExpression = SqlMemberIndexerScalarExpression.Create( + SqlPropertyRefScalarExpression.Create(null, SqlIdentifier.Create(parameterExpression.Name)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(0))); + } + else + { + sqlScalarExpression = SqlPropertyRefScalarExpression.Create(null, SqlIdentifier.Create(parameterExpression.Name)); + } + } + + return sqlScalarExpression; + } + + /// + /// Create a subquery SQL collection object for a SQL query + /// + /// The SQL query object + /// The subquery type + private static SqlCollection CreateSubquerySqlCollection(SqlQuery query, SubqueryKind subqueryType) + { + SqlCollection subqueryCollection; + switch (subqueryType) + { + case SubqueryKind.ArrayScalarExpression: + SqlArrayScalarExpression arrayScalarExpression = SqlArrayScalarExpression.Create(query); + query = SqlQuery.Create( + SqlSelectClause.Create(SqlSelectValueSpec.Create(arrayScalarExpression)), + fromClause: null, whereClause: null, groupByClause: null, orderByClause: null, offsetLimitClause: null); + break; + + case SubqueryKind.ExistsScalarExpression: + SqlExistsScalarExpression existsScalarExpression = SqlExistsScalarExpression.Create(query); + query = SqlQuery.Create( + SqlSelectClause.Create(SqlSelectValueSpec.Create(existsScalarExpression)), + fromClause: null, whereClause: null, groupByClause: null, orderByClause: null, offsetLimitClause: null); + break; + + case SubqueryKind.SubqueryScalarExpression: + // No need to wrap query as in ArrayScalarExpression, or ExistsScalarExpression + break; + + default: + throw new DocumentQueryException($"Unsupported subquery type {subqueryType}"); + } + + subqueryCollection = SqlSubqueryCollection.Create(query); + return subqueryCollection; + } + + /// + /// Create a subquery from a subquery scalar expression. + /// By visiting the collection expression, this builds a new QueryUnderConstruction on top of the current one + /// and then translate it to a SQL query while keeping the current QueryUnderConstruction in tact. + /// + /// The subquery scalar expression + /// The list of parameters of the expression + /// The translation context + /// A query corresponding to the collection expression + /// The QueryUnderConstruction remains unchanged after this. + private static SqlQuery CreateSubquery(Expression expression, ReadOnlyCollection parameters, TranslationContext context) + { + bool shouldBeOnNewQuery = context.CurrentSubqueryBinding.ShouldBeOnNewQuery; + + QueryUnderConstruction queryBeforeVisit = context.CurrentQuery; + QueryUnderConstruction packagedQuery = new QueryUnderConstruction(context.GetGenFreshParameterFunc(), context.CurrentQuery); + packagedQuery.FromParameters.SetInputParameter(typeof(object), context.CurrentQuery.GetInputParameterInContext(shouldBeOnNewQuery).Name, context.InScope); + context.CurrentQuery = packagedQuery; + + if (shouldBeOnNewQuery) context.CurrentSubqueryBinding.ShouldBeOnNewQuery = false; + + Collection collection = ExpressionToSql.VisitCollectionExpression(expression, parameters, context); + + QueryUnderConstruction subquery = context.CurrentQuery.GetSubquery(queryBeforeVisit); + context.CurrentSubqueryBinding.ShouldBeOnNewQuery = shouldBeOnNewQuery; + context.CurrentQuery = queryBeforeVisit; + + SqlQuery sqlSubquery = subquery.FlattenAsPossible().GetSqlQuery(); + return sqlSubquery; + } + + #endregion Scalar and CollectionScalar Visitors + + #region LINQ Specific Visitors + + private static SqlWhereClause VisitWhere(ReadOnlyCollection arguments, TranslationContext context) + { + if (arguments.Count != 2) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, LinqMethods.Where, 2, arguments.Count)); + } + + LambdaExpression function = Utilities.GetLambda(arguments[1]); + SqlScalarExpression sqlfunc = ExpressionToSql.VisitScalarExpression(function, context); + SqlWhereClause where = SqlWhereClause.Create(sqlfunc); + return where; + } + + private static SqlSelectClause VisitSelect(ReadOnlyCollection arguments, TranslationContext context) + { + if (arguments.Count != 2) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, LinqMethods.Select, 2, arguments.Count)); + } + + LambdaExpression lambda = Utilities.GetLambda(arguments[1]); + + SqlScalarExpression sqlfunc = ExpressionToSql.VisitScalarExpression(lambda, context); + SqlSelectSpec sqlSpec = SqlSelectValueSpec.Create(sqlfunc); + SqlSelectClause select = SqlSelectClause.Create(sqlSpec, null); + return select; + } + + private static Collection VisitSelectMany(ReadOnlyCollection arguments, TranslationContext context) + { + if (arguments.Count != 2) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, LinqMethods.SelectMany, 2, arguments.Count)); + } + + LambdaExpression lambda = Utilities.GetLambda(arguments[1]); + + // If there is Distinct, Take or OrderBy the lambda then it needs to be in a subquery. + bool requireLocalExecution = false; + + for (MethodCallExpression methodCall = lambda.Body as MethodCallExpression; + methodCall != null; + methodCall = methodCall.Arguments[0] as MethodCallExpression) + { + string methodName = methodCall.Method.Name; + requireLocalExecution |= methodName.Equals(LinqMethods.Distinct) || methodName.Equals(LinqMethods.Take) || methodName.Equals(LinqMethods.OrderBy) || methodName.Equals(LinqMethods.OrderByDescending); + } + + Collection collection; + if (!requireLocalExecution) + { + collection = ExpressionToSql.VisitCollectionLambda(lambda, context); + } + else + { + collection = new Collection(string.Empty); + Binding binding; + SqlQuery query = ExpressionToSql.CreateSubquery(lambda.Body, lambda.Parameters, context); + SqlCollection subqueryCollection = SqlSubqueryCollection.Create(query); + ParameterExpression parameterExpression = context.GenerateFreshParameter(typeof(object), ExpressionToSql.DefaultParameterName); + binding = new Binding(parameterExpression, subqueryCollection, isInCollection: false, isInputParameter: true); + context.CurrentQuery.FromParameters.Add(binding); + } + + return collection; + } + + private static Collection VisitGroupBy(Type returnElementType, ReadOnlyCollection arguments, TranslationContext context) + { + if (arguments.Count != 3) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, LinqMethods.GroupBy, 3, arguments.Count)); + } + + // Key Selector handling + // First argument is input, second is key selector and third is value selector LambdaExpression keySelectorLambda = Utilities.GetLambda(arguments[1]); Collection collection = new Collection("Group By"); @@ -1794,7 +1804,7 @@ private static Collection VisitGroupBy(Type returnElementType, ReadOnlyCollectio SqlGroupByClause groupby; ParameterExpression parameterExpression; - switch (keySelectorLambda.Body.NodeType) + switch (keySelectorLambda.Body.NodeType) { case ExpressionType.Parameter: case ExpressionType.Call: @@ -1862,10 +1872,10 @@ private static Collection VisitGroupBy(Type returnElementType, ReadOnlyCollectio // Value Selector Handingling // Translate the body of the value selector lambda - Expression valueSelectorExpression = Utilities.GetLambda(arguments[2]).Body; - - // The value selector function needs to be either a MethodCall or an AnonymousType - switch (valueSelectorExpression.NodeType) + Expression valueSelectorExpression = Utilities.GetLambda(arguments[2]).Body; + + // The value selector function needs to be either a MethodCall or an AnonymousType + switch (valueSelectorExpression.NodeType) { case ExpressionType.MemberAccess: { @@ -1888,7 +1898,7 @@ private static Collection VisitGroupBy(Type returnElementType, ReadOnlyCollectio } } break; - } + } case ExpressionType.Constant: { ConstantExpression constantExpression = (ConstantExpression)valueSelectorExpression; @@ -1916,7 +1926,7 @@ private static Collection VisitGroupBy(Type returnElementType, ReadOnlyCollectio SqlSelectClause select = ExpressionToSql.VisitGroupByAggregateMethodCall(methodCallExpression, context); context.CurrentQuery = context.CurrentQuery.AddSelectClause(select, context); break; - } + } case ExpressionType.New: { // Add select item clause at the end of this method @@ -1991,19 +2001,19 @@ private static Collection VisitGroupBy(Type returnElementType, ReadOnlyCollectio throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.ExpressionTypeIsNotSupported, arg.NodeType)); } } - - SqlSelectListSpec sqlSpec = SqlSelectListSpec.Create(selectItems); - SqlSelectClause select = SqlSelectClause.Create(sqlSpec, null); + + SqlSelectListSpec sqlSpec = SqlSelectListSpec.Create(selectItems); + SqlSelectClause select = SqlSelectClause.Create(sqlSpec, null); context.CurrentQuery = context.CurrentQuery.AddSelectClause(select, context); - + break; - } - default: - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.ExpressionTypeIsNotSupported, valueSelectorExpression.NodeType)); + } + default: + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.ExpressionTypeIsNotSupported, valueSelectorExpression.NodeType)); } // Pop the correct number of items off the parameter stack - switch (keySelectorLambda.Body.NodeType) + switch (keySelectorLambda.Body.NodeType) { case ExpressionType.Parameter: case ExpressionType.Call: @@ -2028,352 +2038,370 @@ private static Collection VisitGroupBy(Type returnElementType, ReadOnlyCollectio break; } - return collection; - } - - private static SqlOrderByClause VisitOrderBy(ReadOnlyCollection arguments, bool isDescending, TranslationContext context) - { - if (arguments.Count != 2) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, LinqMethods.OrderBy, 2, arguments.Count)); - } - - LambdaExpression lambda = Utilities.GetLambda(arguments[1]); - SqlScalarExpression sqlfunc = ExpressionToSql.VisitScalarExpression(lambda, context); - SqlOrderByItem orderByItem = SqlOrderByItem.Create(sqlfunc, isDescending); - SqlOrderByClause orderby = SqlOrderByClause.Create(new SqlOrderByItem[] { orderByItem }); - return orderby; - } - - private static bool TryGetTopSkipTakeLiteral( - SqlScalarExpression scalarExpression, - TranslationContext context, - out SqlNumberLiteral literal) - { - literal = default(SqlNumberLiteral); - - if (scalarExpression is SqlLiteralScalarExpression literalScalarExpression) - { - if (literalScalarExpression.Literal is SqlNumberLiteral numberLiteral) - { - // After a member access in SelectMany's lambda, if there is only Top/Skip/Take then - // it is necessary to trigger the binding because Skip is just a spec with no binding on its own. - // This can be done by pushing and popping a temporary parameter. E.g. In SelectMany(f => f.Children.Skip(1)), - // it's necessary to consider Skip as Skip(x => x, 1) to bind x to f.Children. Similarly for Top and Limit. - ParameterExpression parameter = context.GenerateFreshParameter(typeof(object), ExpressionToSql.DefaultParameterName); - context.PushParameter(parameter, context.CurrentSubqueryBinding.ShouldBeOnNewQuery); - context.PopParameter(); - - literal = numberLiteral; - } - } - - return (literal != default(SqlNumberLiteral)) && (literal.Value >= 0); - } - - private static bool TryGetTopSkipTakeParameter( - SqlScalarExpression scalarExpression, - TranslationContext context, - out SqlParameter sqlParameter) - { - sqlParameter = default(SqlParameter); - SqlParameterRefScalarExpression parameterRefScalarExpression = scalarExpression as SqlParameterRefScalarExpression; - if (parameterRefScalarExpression != null) - { - sqlParameter = parameterRefScalarExpression.Parameter; - } - - return (sqlParameter != default(SqlParameter)) && !string.IsNullOrEmpty(sqlParameter.Name); - } - - private static SqlOffsetSpec VisitSkip(ReadOnlyCollection arguments, TranslationContext context) - { - if (arguments.Count != 2) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, LinqMethods.Skip, 2, arguments.Count)); - } - - Expression expression = arguments[1]; - if (expression == null) - { - throw new ArgumentNullException(nameof(expression)); - } - - SqlScalarExpression scalarExpression = ExpressionToSql.VisitScalarExpression(expression, context); - SqlNumberLiteral offsetNumberLiteral; - SqlParameter sqlParameter; - SqlOffsetSpec offsetSpec; - - // skipExpression must be number literal - if (TryGetTopSkipTakeLiteral(scalarExpression, context, out offsetNumberLiteral)) - { - offsetSpec = SqlOffsetSpec.Create(offsetNumberLiteral); - } - else if (TryGetTopSkipTakeParameter(scalarExpression, context, out sqlParameter)) - { - offsetSpec = SqlOffsetSpec.Create(sqlParameter); - } - else - { - // .Skip() has only one overload that takes int - // so we really should always get a number (integer) literal here - // the below throw serves as assert - throw new ArgumentException(ClientResources.InvalidSkipValue); - } - - return offsetSpec; - } - - private static SqlLimitSpec VisitTakeLimit(ReadOnlyCollection arguments, TranslationContext context) - { - if (arguments.Count != 2) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, LinqMethods.Take, 2, arguments.Count)); - } - - Expression expression = arguments[1]; - if (expression == null) - { - throw new ArgumentNullException(nameof(expression)); - } - - SqlScalarExpression scalarExpression = ExpressionToSql.VisitScalarExpression(expression, context); - SqlNumberLiteral takeNumberLiteral; - SqlParameter sqlParameter; - SqlLimitSpec limitSpec; - - // takeExpression must be number literal - if (TryGetTopSkipTakeLiteral(scalarExpression, context, out takeNumberLiteral)) - { - limitSpec = SqlLimitSpec.Create(takeNumberLiteral); - } - else if (TryGetTopSkipTakeParameter(scalarExpression, context, out sqlParameter)) - { - limitSpec = SqlLimitSpec.Create(sqlParameter); - } - else - { - // .Take() has only one overload that takes int - // so we really should always get a number (integer) literal here - // the below throw serves as assert - throw new ArgumentException(ClientResources.InvalidTakeValue); - } - - return limitSpec; - } - - private static SqlTopSpec VisitTakeTop(ReadOnlyCollection arguments, TranslationContext context) - { - if (arguments.Count != 2) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, LinqMethods.Take, 2, arguments.Count)); - } - - Expression expression = arguments[1]; - if (expression == null) - { - throw new ArgumentNullException(nameof(expression)); - } - - SqlScalarExpression scalarExpression = ExpressionToSql.VisitScalarExpression(expression, context); - SqlNumberLiteral takeNumberLiteral; - SqlParameter sqlParameter; - SqlTopSpec topSpec; - - // takeExpression must be number literal - if (TryGetTopSkipTakeLiteral(scalarExpression, context, out takeNumberLiteral)) - { - topSpec = SqlTopSpec.Create(takeNumberLiteral); - } - else if (TryGetTopSkipTakeParameter(scalarExpression, context, out sqlParameter)) - { - topSpec = SqlTopSpec.Create(sqlParameter); - } - else - { - // .Take() has only one overload that takes int - // so we really should always get a number (integer) literal here - // the below throw serves as assert - throw new ArgumentException(ClientResources.InvalidTakeValue); - } - - return topSpec; - } - - private static SqlSelectClause VisitAggregateFunction( - ReadOnlyCollection arguments, - TranslationContext context, - string aggregateFunctionName) - { - SqlScalarExpression aggregateExpression; - if (arguments.Count == 1) - { - // Need to trigger parameter binding for cases where an aggregate function immediately follows a member access. - ParameterExpression parameter = context.GenerateFreshParameter(typeof(object), ExpressionToSql.DefaultParameterName); - context.PushParameter(parameter, context.CurrentSubqueryBinding.ShouldBeOnNewQuery); - - // If there is a groupby, since there is no argument to the aggregate, we consider it to be invoked on the source collection, and not the group by keys - aggregateExpression = ExpressionToSql.VisitParameter(parameter, context); - context.PopParameter(); - } - else if (arguments.Count == 2) - { - LambdaExpression lambda = Utilities.GetLambda(arguments[1]); - + return collection; + } + + private static SqlOrderByClause VisitOrderBy(ReadOnlyCollection arguments, bool isDescending, TranslationContext context) + { + if (arguments.Count != 2) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, LinqMethods.OrderBy, 2, arguments.Count)); + } + + LambdaExpression lambda = Utilities.GetLambda(arguments[1]); + SqlScalarExpression sqlfunc = ExpressionToSql.VisitScalarExpression(lambda, context); + + // Order By VectorDistance is a special case, since there is no ordering required. + bool isVectorDistance = (sqlfunc is SqlFunctionCallScalarExpression functionCall) && (functionCall.Name.Value == SqlFunctionCallScalarExpression.Names.VectorDistance); + + SqlOrderByItem orderByItem = SqlOrderByItem.Create(sqlfunc, isVectorDistance ? null : isDescending); + SqlOrderByClause orderby = SqlOrderByClause.Create(new SqlOrderByItem[] { orderByItem }); + return orderby; + } + + private static SqlOrderByClause VisitOrderByRank(ReadOnlyCollection arguments, TranslationContext context) + { + if (arguments.Count != 2) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, LinqMethods.OrderBy, 2, arguments.Count)); + } + LambdaExpression lambda = Utilities.GetLambda(arguments[1]); + SqlScalarExpression sqlfunc = ExpressionToSql.VisitScalarExpression(lambda, context); + SqlOrderByItem scoreFuncOrderByItem = SqlOrderByItem.Create(sqlfunc, isDescending: null); + SqlOrderByClause orderby = SqlOrderByClause.Create(rank: true, new SqlOrderByItem[] { scoreFuncOrderByItem }); + + return orderby; + } + + private static bool TryGetTopSkipTakeLiteral( + SqlScalarExpression scalarExpression, + TranslationContext context, + out SqlNumberLiteral literal) + { + literal = default(SqlNumberLiteral); + + if (scalarExpression is SqlLiteralScalarExpression literalScalarExpression) + { + if (literalScalarExpression.Literal is SqlNumberLiteral numberLiteral) + { + // After a member access in SelectMany's lambda, if there is only Top/Skip/Take then + // it is necessary to trigger the binding because Skip is just a spec with no binding on its own. + // This can be done by pushing and popping a temporary parameter. E.g. In SelectMany(f => f.Children.Skip(1)), + // it's necessary to consider Skip as Skip(x => x, 1) to bind x to f.Children. Similarly for Top and Limit. + ParameterExpression parameter = context.GenerateFreshParameter(typeof(object), ExpressionToSql.DefaultParameterName); + context.PushParameter(parameter, context.CurrentSubqueryBinding.ShouldBeOnNewQuery); + context.PopParameter(); + + literal = numberLiteral; + } + } + + return (literal != default(SqlNumberLiteral)) && (literal.Value >= 0); + } + + private static bool TryGetTopSkipTakeParameter( + SqlScalarExpression scalarExpression, + TranslationContext context, + out SqlParameter sqlParameter) + { + sqlParameter = default(SqlParameter); + SqlParameterRefScalarExpression parameterRefScalarExpression = scalarExpression as SqlParameterRefScalarExpression; + if (parameterRefScalarExpression != null) + { + sqlParameter = parameterRefScalarExpression.Parameter; + } + + return (sqlParameter != default(SqlParameter)) && !string.IsNullOrEmpty(sqlParameter.Name); + } + + private static SqlOffsetSpec VisitSkip(ReadOnlyCollection arguments, TranslationContext context) + { + if (arguments.Count != 2) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, LinqMethods.Skip, 2, arguments.Count)); + } + + Expression expression = arguments[1]; + if (expression == null) + { + throw new ArgumentNullException(nameof(expression)); + } + + SqlScalarExpression scalarExpression = ExpressionToSql.VisitScalarExpression(expression, context); + SqlNumberLiteral offsetNumberLiteral; + SqlParameter sqlParameter; + SqlOffsetSpec offsetSpec; + + // skipExpression must be number literal + if (TryGetTopSkipTakeLiteral(scalarExpression, context, out offsetNumberLiteral)) + { + offsetSpec = SqlOffsetSpec.Create(offsetNumberLiteral); + } + else if (TryGetTopSkipTakeParameter(scalarExpression, context, out sqlParameter)) + { + offsetSpec = SqlOffsetSpec.Create(sqlParameter); + } + else + { + // .Skip() has only one overload that takes int + // so we really should always get a number (integer) literal here + // the below throw serves as assert + throw new ArgumentException(ClientResources.InvalidSkipValue); + } + + return offsetSpec; + } + + private static SqlLimitSpec VisitTakeLimit(ReadOnlyCollection arguments, TranslationContext context) + { + if (arguments.Count != 2) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, LinqMethods.Take, 2, arguments.Count)); + } + + Expression expression = arguments[1]; + if (expression == null) + { + throw new ArgumentNullException(nameof(expression)); + } + + SqlScalarExpression scalarExpression = ExpressionToSql.VisitScalarExpression(expression, context); + SqlNumberLiteral takeNumberLiteral; + SqlParameter sqlParameter; + SqlLimitSpec limitSpec; + + // takeExpression must be number literal + if (TryGetTopSkipTakeLiteral(scalarExpression, context, out takeNumberLiteral)) + { + limitSpec = SqlLimitSpec.Create(takeNumberLiteral); + } + else if (TryGetTopSkipTakeParameter(scalarExpression, context, out sqlParameter)) + { + limitSpec = SqlLimitSpec.Create(sqlParameter); + } + else + { + // .Take() has only one overload that takes int + // so we really should always get a number (integer) literal here + // the below throw serves as assert + throw new ArgumentException(ClientResources.InvalidTakeValue); + } + + return limitSpec; + } + + private static SqlTopSpec VisitTakeTop(ReadOnlyCollection arguments, TranslationContext context) + { + if (arguments.Count != 2) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, LinqMethods.Take, 2, arguments.Count)); + } + + Expression expression = arguments[1]; + if (expression == null) + { + throw new ArgumentNullException(nameof(expression)); + } + + SqlScalarExpression scalarExpression = ExpressionToSql.VisitScalarExpression(expression, context); + SqlNumberLiteral takeNumberLiteral; + SqlParameter sqlParameter; + SqlTopSpec topSpec; + + // takeExpression must be number literal + if (TryGetTopSkipTakeLiteral(scalarExpression, context, out takeNumberLiteral)) + { + topSpec = SqlTopSpec.Create(takeNumberLiteral); + } + else if (TryGetTopSkipTakeParameter(scalarExpression, context, out sqlParameter)) + { + topSpec = SqlTopSpec.Create(sqlParameter); + } + else + { + // .Take() has only one overload that takes int + // so we really should always get a number (integer) literal here + // the below throw serves as assert + throw new ArgumentException(ClientResources.InvalidTakeValue); + } + + return topSpec; + } + + private static SqlSelectClause VisitAggregateFunction( + ReadOnlyCollection arguments, + TranslationContext context, + string aggregateFunctionName) + { + SqlScalarExpression aggregateExpression; + if (arguments.Count == 1) + { + // Need to trigger parameter binding for cases where an aggregate function immediately follows a member access. + ParameterExpression parameter = context.GenerateFreshParameter(typeof(object), ExpressionToSql.DefaultParameterName); + context.PushParameter(parameter, context.CurrentSubqueryBinding.ShouldBeOnNewQuery); + + // If there is a groupby, since there is no argument to the aggregate, we consider it to be invoked on the source collection, and not the group by keys + aggregateExpression = ExpressionToSql.VisitParameter(parameter, context); + context.PopParameter(); + } + else if (arguments.Count == 2) + { + LambdaExpression lambda = Utilities.GetLambda(arguments[1]); + aggregateExpression = context.CurrentQuery.GroupByParameter != null ? ExpressionToSql.VisitNonSubqueryScalarLambda(lambda, context) - : ExpressionToSql.VisitScalarExpression(lambda, context); - } - else - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, aggregateFunctionName, 2, arguments.Count)); - } - - SqlFunctionCallScalarExpression aggregateFunctionCall; - aggregateFunctionCall = SqlFunctionCallScalarExpression.CreateBuiltin(aggregateFunctionName, aggregateExpression); - - SqlSelectSpec selectSpec = SqlSelectValueSpec.Create(aggregateFunctionCall); - SqlSelectClause selectClause = SqlSelectClause.Create(selectSpec, null); - return selectClause; - } - - private static SqlSelectClause VisitDistinct( - ReadOnlyCollection arguments, - TranslationContext context) - { - string functionName = LinqMethods.Distinct; - if (arguments.Count != 1) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, functionName, 1, arguments.Count)); - } - - // We consider Distinct as Distinct(v0 => v0) - // It's necessary to visit this identity method to replace the parameters names - ParameterExpression parameter = context.GenerateFreshParameter(typeof(object), ExpressionToSql.DefaultParameterName); - LambdaExpression identityLambda = Expression.Lambda(parameter, parameter); - SqlScalarExpression sqlfunc = ExpressionToSql.VisitNonSubqueryScalarLambda(identityLambda, context); - SqlSelectSpec sqlSpec = SqlSelectValueSpec.Create(sqlfunc); - SqlSelectClause select = SqlSelectClause.Create(sqlSpec, topSpec: null, hasDistinct: true); - return select; - } - - private static SqlSelectClause VisitCount( - ReadOnlyCollection arguments, - TranslationContext context) - { - SqlScalarExpression countExpression; - countExpression = SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create((Number64)1)); - - if (arguments.Count == 2) - { - SqlWhereClause whereClause = ExpressionToSql.VisitWhere(arguments, context); - context.CurrentQuery = context.CurrentQuery.AddWhereClause(whereClause, context); - } - else if (arguments.Count != 1) - { - throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, LinqMethods.Count, 2, arguments.Count)); - } - - SqlSelectSpec selectSpec = SqlSelectValueSpec.Create(SqlFunctionCallScalarExpression.CreateBuiltin(SqlFunctionCallScalarExpression.Names.Count, countExpression)); - SqlSelectClause selectClause = SqlSelectClause.Create(selectSpec, null); - return selectClause; - } - - /// - /// Property references that refer to array-valued properties are converted to collection references. - /// - /// Property reference object. - /// An inputPathCollection which contains the same property path as the propRef. - private static SqlInputPathCollection ConvertPropertyRefToPath(SqlPropertyRefScalarExpression propRef) - { - List identifiers = new List(); - while (true) - { - identifiers.Add(propRef.Identifier); - SqlScalarExpression parent = propRef.Member; - if (parent == null) - { - break; - } - - if (parent is SqlPropertyRefScalarExpression) - { - propRef = parent as SqlPropertyRefScalarExpression; - } - else - { - throw new DocumentQueryException(ClientResources.NotSupported); - } - } - - if (identifiers.Count == 0) - { - throw new DocumentQueryException(ClientResources.NotSupported); - } - - SqlPathExpression path = null; - for (int i = identifiers.Count - 2; i >= 0; i--) - { - SqlIdentifier identifer = identifiers[i]; - path = SqlIdentifierPathExpression.Create(path, identifer); - } - - SqlIdentifier last = identifiers[identifiers.Count - 1]; - SqlInputPathCollection result = SqlInputPathCollection.Create(last, path); - return result; - } - - private static SqlInputPathCollection ConvertMemberIndexerToPath(SqlMemberIndexerScalarExpression memberIndexerExpression) - { - // root.Children.Age ==> root["Children"]["Age"] - List literals = new List(); - while (true) - { - literals.Add((SqlStringLiteral)((SqlLiteralScalarExpression)memberIndexerExpression.Indexer).Literal); - SqlScalarExpression parent = memberIndexerExpression.Member; - if (parent == null) - { - break; + : ExpressionToSql.VisitScalarExpression(lambda, context); + } + else + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, aggregateFunctionName, 2, arguments.Count)); + } + + SqlFunctionCallScalarExpression aggregateFunctionCall; + aggregateFunctionCall = SqlFunctionCallScalarExpression.CreateBuiltin(aggregateFunctionName, aggregateExpression); + + SqlSelectSpec selectSpec = SqlSelectValueSpec.Create(aggregateFunctionCall); + SqlSelectClause selectClause = SqlSelectClause.Create(selectSpec, null); + return selectClause; + } + + private static SqlSelectClause VisitDistinct( + ReadOnlyCollection arguments, + TranslationContext context) + { + string functionName = LinqMethods.Distinct; + if (arguments.Count != 1) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, functionName, 1, arguments.Count)); + } + + // We consider Distinct as Distinct(v0 => v0) + // It's necessary to visit this identity method to replace the parameters names + ParameterExpression parameter = context.GenerateFreshParameter(typeof(object), ExpressionToSql.DefaultParameterName); + LambdaExpression identityLambda = Expression.Lambda(parameter, parameter); + SqlScalarExpression sqlfunc = ExpressionToSql.VisitNonSubqueryScalarLambda(identityLambda, context); + SqlSelectSpec sqlSpec = SqlSelectValueSpec.Create(sqlfunc); + SqlSelectClause select = SqlSelectClause.Create(sqlSpec, topSpec: null, hasDistinct: true); + return select; + } + + private static SqlSelectClause VisitCount( + ReadOnlyCollection arguments, + TranslationContext context) + { + SqlScalarExpression countExpression; + countExpression = SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create((Number64)1)); + + if (arguments.Count == 2) + { + SqlWhereClause whereClause = ExpressionToSql.VisitWhere(arguments, context); + context.CurrentQuery = context.CurrentQuery.AddWhereClause(whereClause, context); + } + else if (arguments.Count != 1) + { + throw new DocumentQueryException(string.Format(CultureInfo.CurrentCulture, ClientResources.InvalidArgumentsCount, LinqMethods.Count, 2, arguments.Count)); + } + + SqlSelectSpec selectSpec = SqlSelectValueSpec.Create(SqlFunctionCallScalarExpression.CreateBuiltin(SqlFunctionCallScalarExpression.Names.Count, countExpression)); + SqlSelectClause selectClause = SqlSelectClause.Create(selectSpec, null); + return selectClause; + } + + /// + /// Property references that refer to array-valued properties are converted to collection references. + /// + /// Property reference object. + /// An inputPathCollection which contains the same property path as the propRef. + private static SqlInputPathCollection ConvertPropertyRefToPath(SqlPropertyRefScalarExpression propRef) + { + List identifiers = new List(); + while (true) + { + identifiers.Add(propRef.Identifier); + SqlScalarExpression parent = propRef.Member; + if (parent == null) + { + break; + } + + if (parent is SqlPropertyRefScalarExpression) + { + propRef = parent as SqlPropertyRefScalarExpression; } - - if (parent is SqlPropertyRefScalarExpression sqlPropertyRefScalarExpression) - { - literals.Add(SqlStringLiteral.Create(sqlPropertyRefScalarExpression.Identifier.Value)); - break; - } - - if (parent is SqlMemberIndexerScalarExpression) - { - memberIndexerExpression = parent as SqlMemberIndexerScalarExpression; - } - else - { - throw new DocumentQueryException(ClientResources.NotSupported); - } - } - - if (literals.Count == 0) - { - throw new ArgumentException("memberIndexerExpression"); - } - - SqlPathExpression path = null; - for (int i = literals.Count - 2; i >= 0; i--) - { - path = SqlStringPathExpression.Create(path, literals[i]); - } - - SqlInputPathCollection result = SqlInputPathCollection.Create(SqlIdentifier.Create(literals[literals.Count - 1].Value), path); - return result; - } - - #endregion LINQ Specific Visitors - - private enum SubqueryKind - { - ArrayScalarExpression, - ExistsScalarExpression, - SubqueryScalarExpression, - } - } -} + else + { + throw new DocumentQueryException(ClientResources.NotSupported); + } + } + + if (identifiers.Count == 0) + { + throw new DocumentQueryException(ClientResources.NotSupported); + } + + SqlPathExpression path = null; + for (int i = identifiers.Count - 2; i >= 0; i--) + { + SqlIdentifier identifer = identifiers[i]; + path = SqlIdentifierPathExpression.Create(path, identifer); + } + + SqlIdentifier last = identifiers[identifiers.Count - 1]; + SqlInputPathCollection result = SqlInputPathCollection.Create(last, path); + return result; + } + + private static SqlInputPathCollection ConvertMemberIndexerToPath(SqlMemberIndexerScalarExpression memberIndexerExpression) + { + // root.Children.Age ==> root["Children"]["Age"] + List literals = new List(); + while (true) + { + literals.Add((SqlStringLiteral)((SqlLiteralScalarExpression)memberIndexerExpression.Indexer).Literal); + SqlScalarExpression parent = memberIndexerExpression.Member; + if (parent == null) + { + break; + } + + if (parent is SqlPropertyRefScalarExpression sqlPropertyRefScalarExpression) + { + literals.Add(SqlStringLiteral.Create(sqlPropertyRefScalarExpression.Identifier.Value)); + break; + } + + if (parent is SqlMemberIndexerScalarExpression) + { + memberIndexerExpression = parent as SqlMemberIndexerScalarExpression; + } + else + { + throw new DocumentQueryException(ClientResources.NotSupported); + } + } + + if (literals.Count == 0) + { + throw new ArgumentException("memberIndexerExpression"); + } + + SqlPathExpression path = null; + for (int i = literals.Count - 2; i >= 0; i--) + { + path = SqlStringPathExpression.Create(path, literals[i]); + } + + SqlInputPathCollection result = SqlInputPathCollection.Create(SqlIdentifier.Create(literals[literals.Count - 1].Value), path); + return result; + } + + #endregion LINQ Specific Visitors + + private enum SubqueryKind + { + ArrayScalarExpression, + ExistsScalarExpression, + SubqueryScalarExpression, + } + } +} diff --git a/Microsoft.Azure.Cosmos/src/Linq/QueryUnderConstruction.cs b/Microsoft.Azure.Cosmos/src/Linq/QueryUnderConstruction.cs index a5cfb4784a..fbb8d27872 100644 --- a/Microsoft.Azure.Cosmos/src/Linq/QueryUnderConstruction.cs +++ b/Microsoft.Azure.Cosmos/src/Linq/QueryUnderConstruction.cs @@ -458,7 +458,7 @@ private SqlOrderByClause Substitute(SqlSelectSpec spec, SqlIdentifier inputParam SqlScalarExpression substituted = SqlExpressionManipulation.Substitute(replaced, inputParam, orderByClause.OrderByItems[i].Expression); substitutedItems[i] = SqlOrderByItem.Create(substituted, orderByClause.OrderByItems[i].IsDescending); } - SqlOrderByClause result = SqlOrderByClause.Create(substitutedItems); + SqlOrderByClause result = SqlOrderByClause.Create(orderByClause.Rank, substitutedItems); return result; } @@ -550,17 +550,21 @@ public bool ShouldBeOnNewQuery(string methodName, int argumentCount) case LinqMethods.Where: // Where expression parameter needs to be substituted if necessary so // It is not needed in Select distinct because the Select distinct would have the necessary parameter name adjustment. - case LinqMethods.Any: + case LinqMethods.Any: + case nameof(CosmosLinqExtensions.OrderByRank): case LinqMethods.OrderBy: case LinqMethods.OrderByDescending: case LinqMethods.ThenBy: case LinqMethods.ThenByDescending: case LinqMethods.Distinct: - // New query is needed when there is already a Take or a non-distinct Select + // New query is needed when there is already a Take or a non-distinct Select + // Or when an Order By Rank is added to a query with an Order By clause (and vice versa) shouldPackage = (this.topSpec != null) || (this.offsetSpec != null) || (this.selectClause != null && !this.selectClause.HasDistinct) || - (this.groupByClause != null); + (this.groupByClause != null) || + (this.orderByClause != null && (methodName == nameof(CosmosLinqExtensions.OrderByRank))) || + (this.orderByClause != null && (this.orderByClause.Rank == true) && (methodName == LinqMethods.OrderBy)); break; case LinqMethods.GroupBy: @@ -648,7 +652,7 @@ public QueryUnderConstruction UpdateOrderByClause(SqlOrderByClause thenBy, Trans { List items = new List(context.CurrentQuery.orderByClause.OrderByItems); items.AddRange(thenBy.OrderByItems); - context.CurrentQuery.orderByClause = SqlOrderByClause.Create(items.ToImmutableArray()); + context.CurrentQuery.orderByClause = SqlOrderByClause.Create(context.CurrentQuery.orderByClause.Rank, items.ToImmutableArray()); foreach (Binding binding in context.CurrentSubqueryBinding.TakeBindings()) context.CurrentQuery.AddBinding(binding); diff --git a/Microsoft.Azure.Cosmos/src/Linq/TranslationContext.cs b/Microsoft.Azure.Cosmos/src/Linq/TranslationContext.cs index 606ade1d84..69cc505bcb 100644 --- a/Microsoft.Azure.Cosmos/src/Linq/TranslationContext.cs +++ b/Microsoft.Azure.Cosmos/src/Linq/TranslationContext.cs @@ -57,27 +57,37 @@ internal sealed class TranslationContext /// If the FROM clause uses a parameter name, it will be substituted for the parameter used in /// the lambda expressions for the WHERE and SELECT clauses. /// +#pragma warning disable IDE0044 // Add readonly modifier private ParameterSubstitution substitutions; +#pragma warning restore IDE0044 // Add readonly modifier /// /// We are currently visiting these methods. /// +#pragma warning disable IDE0044 // Add readonly modifier private List methodStack; +#pragma warning restore IDE0044 // Add readonly modifier /// /// Stack of parameters from lambdas currently in scope. /// +#pragma warning disable IDE0044 // Add readonly modifier private List lambdaParametersStack; +#pragma warning restore IDE0044 // Add readonly modifier /// /// Stack of collection-valued inputs. /// +#pragma warning disable IDE0044 // Add readonly modifier private List collectionStack; +#pragma warning restore IDE0044 // Add readonly modifier /// /// The stack of subquery binding information. /// +#pragma warning disable IDE0044 // Add readonly modifier private Stack subqueryBindingStack; +#pragma warning restore IDE0044 // Add readonly modifier private static readonly ICosmosLinqSerializerInternal DefaultLinqSerializer = new DefaultCosmosLinqSerializer(new CosmosLinqSerializerOptions().PropertyNamingPolicy); @@ -376,7 +386,9 @@ internal sealed class ParameterSubstitution // This class is used to rename parameters, so that the Linq program above generates // the correct SQL program above (modulo alpha-renaming). +#pragma warning disable IDE0044 // Add readonly modifier private Dictionary substitutionTable; +#pragma warning restore IDE0044 // Add readonly modifier public ParameterSubstitution() { @@ -485,7 +497,9 @@ public Binding(ParameterExpression parameter, SqlCollection collection, bool isI /// The list of parameter definitions. This will generate a FROM clause of the shape: /// FROM ParameterDefinitions[0] JOIN ParameterDefinitions[1] ... ParameterDefinitions[n] /// +#pragma warning disable IDE0044 // Add readonly modifier private List ParameterDefinitions; +#pragma warning restore IDE0044 // Add readonly modifier /// /// Create empty parameter bindings. diff --git a/Microsoft.Azure.Cosmos/src/Linq/Utilities.cs b/Microsoft.Azure.Cosmos/src/Linq/Utilities.cs index ca39671f74..92fa33d418 100644 --- a/Microsoft.Azure.Cosmos/src/Linq/Utilities.cs +++ b/Microsoft.Azure.Cosmos/src/Linq/Utilities.cs @@ -66,7 +66,9 @@ public static ParameterExpression NewParameter(string prefix, Type type, HashSet internal abstract class ExpressionSimplifier { +#pragma warning disable IDE0044 // Add readonly modifier private static ConcurrentDictionary cached = new ConcurrentDictionary(); +#pragma warning restore IDE0044 // Add readonly modifier public abstract object EvalBoxed(Expression expr); public static object Evaluate(Expression expr) diff --git a/Microsoft.Azure.Cosmos/src/MediaStream.cs b/Microsoft.Azure.Cosmos/src/MediaStream.cs index 281d3ff4f2..4c0c3e8272 100644 --- a/Microsoft.Azure.Cosmos/src/MediaStream.cs +++ b/Microsoft.Azure.Cosmos/src/MediaStream.cs @@ -12,8 +12,12 @@ namespace Microsoft.Azure.Cosmos internal sealed class MediaStream : Stream { +#pragma warning disable IDE0044 // Add readonly modifier private HttpResponseMessage responseMessage; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private Stream contentStream; +#pragma warning restore IDE0044 // Add readonly modifier private bool isDisposed; public MediaStream(HttpResponseMessage responseMessage, Stream contentStream) diff --git a/Microsoft.Azure.Cosmos/src/MetadataRequestThrottleRetryPolicy.cs b/Microsoft.Azure.Cosmos/src/MetadataRequestThrottleRetryPolicy.cs index 928d2f2e87..204bcbd830 100644 --- a/Microsoft.Azure.Cosmos/src/MetadataRequestThrottleRetryPolicy.cs +++ b/Microsoft.Azure.Cosmos/src/MetadataRequestThrottleRetryPolicy.cs @@ -23,9 +23,9 @@ internal sealed class MetadataRequestThrottleRetryPolicy : IDocumentClientRetryP private const int DefaultMaxWaitTimeInSeconds = 60; /// - /// A constant integer defining the default maximum retry count on service unavailable. + /// A constant integer defining the default maximum retry count on unavailable endpoint. /// - private const int DefaultMaxServiceUnavailableRetryCount = 1; + private const int DefaultMaxUnavailableEndpointRetryCount = 1; /// /// An instance of . @@ -38,9 +38,9 @@ internal sealed class MetadataRequestThrottleRetryPolicy : IDocumentClientRetryP private readonly IDocumentClientRetryPolicy throttlingRetryPolicy; /// - /// An integer defining the maximum retry count on service unavailable. + /// An integer defining the maximum retry count on unavailable endpoint. /// - private readonly int maxServiceUnavailableRetryCount; + private readonly int maxUnavailableEndpointRetryCount; /// /// An instance of containing the location endpoint where the partition key @@ -49,9 +49,9 @@ internal sealed class MetadataRequestThrottleRetryPolicy : IDocumentClientRetryP private MetadataRetryContext retryContext; /// - /// An integer capturing the current retry count on service unavailable. + /// An integer capturing the current retry count on unavailable endpoint. /// - private int serviceUnavailableRetryCount; + private int unavailableEndpointRetryCount; /// /// The constructor to initialize an instance of . @@ -66,8 +66,8 @@ public MetadataRequestThrottleRetryPolicy( int maxRetryWaitTimeInSeconds = DefaultMaxWaitTimeInSeconds) { this.globalEndpointManager = endpointManager; - this.maxServiceUnavailableRetryCount = Math.Max( - MetadataRequestThrottleRetryPolicy.DefaultMaxServiceUnavailableRetryCount, + this.maxUnavailableEndpointRetryCount = Math.Max( + MetadataRequestThrottleRetryPolicy.DefaultMaxUnavailableEndpointRetryCount, this.globalEndpointManager.PreferredLocationCount); this.throttlingRetryPolicy = new ResourceThrottleRetryPolicy( @@ -91,11 +91,43 @@ public Task ShouldRetryAsync( Exception exception, CancellationToken cancellationToken) { - if (exception is CosmosException cosmosException - && cosmosException.StatusCode == HttpStatusCode.ServiceUnavailable - && cosmosException.Headers.SubStatusCode == SubStatusCodes.TransportGenerated503) + if (exception is CosmosException cosmosException) { - if (this.IncrementRetryIndexOnServiceUnavailableForMetadataRead()) + return this.ShouldRetryInternalAsync( + cosmosException.StatusCode, + (SubStatusCodes)cosmosException.SubStatusCode, + exception, + cancellationToken); + } + + if (exception is DocumentClientException clientException) + { + return this.ShouldRetryInternalAsync( + clientException.StatusCode, + clientException.GetSubStatus(), + exception, cancellationToken); + } + + return this.throttlingRetryPolicy.ShouldRetryAsync(exception, cancellationToken); + } + + private Task ShouldRetryInternalAsync( + HttpStatusCode? statusCode, + SubStatusCodes subStatus, + Exception exception, + CancellationToken cancellationToken) + { + if (statusCode == null) + { + return this.throttlingRetryPolicy.ShouldRetryAsync(exception, cancellationToken); + } + + if (statusCode == HttpStatusCode.ServiceUnavailable + || statusCode == HttpStatusCode.InternalServerError + || (statusCode == HttpStatusCode.Gone && subStatus == SubStatusCodes.LeaseNotFound) + || (statusCode == HttpStatusCode.Forbidden && subStatus == SubStatusCodes.DatabaseAccountNotFound)) + { + if (this.IncrementRetryIndexOnUnavailableEndpointForMetadataRead()) { return Task.FromResult(ShouldRetryResult.RetryAfter(TimeSpan.Zero)); } @@ -114,16 +146,36 @@ public Task ShouldRetryAsync( ResponseMessage cosmosResponseMessage, CancellationToken cancellationToken) { - if (cosmosResponseMessage?.StatusCode == HttpStatusCode.ServiceUnavailable - && cosmosResponseMessage?.Headers?.SubStatusCode == SubStatusCodes.TransportGenerated503) + return this.ShouldRetryInternalAsync( + cosmosResponseMessage.StatusCode, + (SubStatusCodes)Convert.ToInt32(cosmosResponseMessage.Headers[WFConstants.BackendHeaders.SubStatus]), + cosmosResponseMessage, + cancellationToken); + } + + private Task ShouldRetryInternalAsync( + HttpStatusCode? statusCode, + SubStatusCodes subStatus, + ResponseMessage responseMessage, + CancellationToken cancellationToken) + { + if (statusCode == null) + { + return this.throttlingRetryPolicy.ShouldRetryAsync(responseMessage, cancellationToken); + } + + if (statusCode == HttpStatusCode.ServiceUnavailable + || statusCode == HttpStatusCode.InternalServerError + || (statusCode == HttpStatusCode.Gone && subStatus == SubStatusCodes.LeaseNotFound) + || (statusCode == HttpStatusCode.Forbidden && subStatus == SubStatusCodes.DatabaseAccountNotFound)) { - if (this.IncrementRetryIndexOnServiceUnavailableForMetadataRead()) + if (this.IncrementRetryIndexOnUnavailableEndpointForMetadataRead()) { return Task.FromResult(ShouldRetryResult.RetryAfter(TimeSpan.Zero)); } } - return this.throttlingRetryPolicy.ShouldRetryAsync(cosmosResponseMessage, cancellationToken); + return this.throttlingRetryPolicy.ShouldRetryAsync(responseMessage, cancellationToken); } /// @@ -146,23 +198,23 @@ public void OnBeforeSendRequest(DocumentServiceRequest request) } /// - /// Increments the location index when a service unavailable exception ocurrs, for any future read requests. + /// Increments the location index when a unavailable endpoint exception ocurrs, for any future read requests. /// /// A boolean flag indicating if the operation was successful. - private bool IncrementRetryIndexOnServiceUnavailableForMetadataRead() + private bool IncrementRetryIndexOnUnavailableEndpointForMetadataRead() { - if (this.serviceUnavailableRetryCount++ >= this.maxServiceUnavailableRetryCount) + if (this.unavailableEndpointRetryCount++ >= this.maxUnavailableEndpointRetryCount) { - DefaultTrace.TraceWarning("MetadataRequestThrottleRetryPolicy: Retry count: {0} has exceeded the maximum permitted retry count on service unavailable: {1}.", this.serviceUnavailableRetryCount, this.maxServiceUnavailableRetryCount); + DefaultTrace.TraceWarning("MetadataRequestThrottleRetryPolicy: Retry count: {0} has exceeded the maximum permitted retry count on unavailable endpoint: {1}.", this.unavailableEndpointRetryCount, this.maxUnavailableEndpointRetryCount); return false; } // Retrying on second PreferredLocations. // RetryCount is used as zero-based index. - DefaultTrace.TraceWarning("MetadataRequestThrottleRetryPolicy: Incrementing the metadata retry location index to: {0}.", this.serviceUnavailableRetryCount); + DefaultTrace.TraceWarning("MetadataRequestThrottleRetryPolicy: Incrementing the metadata retry location index to: {0}.", this.unavailableEndpointRetryCount); this.retryContext = new MetadataRetryContext() { - RetryLocationIndex = this.serviceUnavailableRetryCount, + RetryLocationIndex = this.unavailableEndpointRetryCount, RetryRequestOnPreferredLocations = true, }; diff --git a/Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj b/Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj index 3bfded2acc..f78f739066 100644 --- a/Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj +++ b/Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj @@ -1,199 +1,198 @@ - - - - Microsoft Corporation - Microsoft(R) Azure Cosmos - This client library enables client applications to connect to Azure Cosmos DB via the NoSQL API. Azure Cosmos DB is a globally distributed, multi-model database service. For more information, refer to http://azure.microsoft.com/services/cosmos-db/. - © Microsoft Corporation. All rights reserved. - en-US - $([System.DateTime]::Now.ToString(yyyyMMdd)) - $(ClientOfficialVersion) - $(ClientPreviewVersion) - $(ClientPreviewSuffixVersion) - nightly-$(CurrentDate) - $(VersionSuffix)-nightly-$(CurrentDate) - $(ClientVersion) - $(ClientVersion)-$(VersionSuffix) - $(ClientVersion) - Microsoft - netstandard2.0 - true - true - Microsoft.Azure.Cosmos.Client - Microsoft Azure Cosmos DB Client library - Microsoft.Azure.Cosmos - microsoft;azure;cosmos;cosmosdb;documentdb;docdb;nosql;azureofficial;dotnetcore;netcore;netstandard - The change log for this SDK is made available at https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/changelog.md at the time of release. - https://github.com/Azure/azure-cosmos-dotnet-v3 - true - http://go.microsoft.com/fwlink/?LinkID=288890 - Icon.png - true - true - false - true - AnyCPU - External - Product - portable - false - false - Microsoft.Azure.Cosmos - NU5125 - true - $(LangVersion) - LICENSE - - - - - - - - - - - - - - - - - - - - - - - - - - Never - - - Never - - - - - - True - True - JsonBinaryEncoding.SystemStrings.tt - - - - - - True - True - ClientResources.resx - - - True - True - CosmosNumberCodeGenerator.tt - - - True - True - JsonBinaryEncoding.SystemStrings.tt - - - True - True - SystemStrings.tt - + + + + Microsoft Corporation + Microsoft(R) Azure Cosmos + This client library enables client applications to connect to Azure Cosmos DB via the NoSQL API. Azure Cosmos DB is a globally distributed, multi-model database service. For more information, refer to http://azure.microsoft.com/services/cosmos-db/. + © Microsoft Corporation. All rights reserved. + en-US + $([System.DateTime]::Now.ToString(yyyyMMdd)) + $(ClientOfficialVersion) + $(ClientPreviewVersion) + $(ClientPreviewSuffixVersion) + nightly-$(CurrentDate) + $(VersionSuffix)-nightly-$(CurrentDate) + $(ClientVersion) + $(ClientVersion)-$(VersionSuffix) + $(ClientVersion) + Microsoft + netstandard2.0 + true + true + Microsoft.Azure.Cosmos.Client + Microsoft Azure Cosmos DB Client library + Microsoft.Azure.Cosmos + microsoft;azure;cosmos;cosmosdb;documentdb;docdb;nosql;azureofficial;dotnetcore;netcore;netstandard + The change log for this SDK is made available at https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/changelog.md at the time of release. + https://github.com/Azure/azure-cosmos-dotnet-v3 + true + http://go.microsoft.com/fwlink/?LinkID=288890 + Icon.png + true + true + false + true + AnyCPU + External + Product + portable + false + false + Microsoft.Azure.Cosmos + NU5125 + true + $(LangVersion) + MIT + + + + + + + + + + + + + + + + + + + + + + Never + + + Never + + + + + + True + True + JsonBinaryEncoding.SystemStrings.tt + + + + + + True + True + ClientResources.resx + + + True + True + CosmosNumberCodeGenerator.tt + + + True + True + JsonBinaryEncoding.SystemStrings.tt + + + True + True + SystemStrings.tt + True True Resources.resx - - - - - ResXFileCodeGenerator - ClientResources.Designer.cs - + + + + + ResXFileCodeGenerator + ClientResources.Designer.cs + ResXFileCodeGenerator Resources.Designer.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PreserveNewest - - - PreserveNewest - - - - - - TextTemplatingFileGenerator - CosmosNumberCodeGenerator.cs - - - TextTemplatingFileGenerator - JsonBinaryEncoding.SystemStrings.cs - - - - - - - - - true - true - ..\..\35MSSharedLib1024.snk - - - - $(DefineConstants);SignAssembly - $(DefineConstants);DelaySignKeys - $(DefineConstants);DOCDBCLIENT;COSMOSCLIENT;NETSTANDARD20 - CS0472 - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + + + + TextTemplatingFileGenerator + CosmosNumberCodeGenerator.cs + + + TextTemplatingFileGenerator + JsonBinaryEncoding.SystemStrings.cs + + + + + + + + + true + true + ..\..\35MSSharedLib1024.snk + + + + $(DefineConstants);SignAssembly + $(DefineConstants);DelaySignKeys + $(DefineConstants);DOCDBCLIENT;COSMOSCLIENT;NETSTANDARD20 + + + diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ExceptionToCosmosException.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ExceptionToCosmosException.cs index 5ee4eca609..71a6a980a5 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ExceptionToCosmosException.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ExceptionToCosmosException.cs @@ -88,6 +88,7 @@ private static bool TryCreateFromExceptionWithStackTrace( if (innerException is not CosmosException && innerException is not Documents.DocumentClientException) { +#pragma warning disable CDX1002 // DontUseExceptionStackTrace cosmosException = CosmosExceptionFactory.Create( cosmosException.StatusCode, cosmosException.Message, @@ -96,6 +97,7 @@ private static bool TryCreateFromExceptionWithStackTrace( cosmosException.Trace, cosmosException.Error, cosmosException.InnerException); +#pragma warning restore CDX1002 // DontUseExceptionStackTrace } return true; @@ -114,13 +116,15 @@ public override CosmosException Visit(MalformedContinuationTokenException malfor Headers headers = new Headers() { SubStatusCode = Documents.SubStatusCodes.MalformedContinuationToken - }; + }; +#pragma warning disable CDX1002 // DontUseExceptionStackTrace return CosmosExceptionFactory.CreateBadRequestException( message: malformedContinuationTokenException.Message, headers: headers, stackTrace: malformedContinuationTokenException.StackTrace, innerException: malformedContinuationTokenException, trace: trace); +#pragma warning restore CDX1002 // DontUseExceptionStackTrace } public override CosmosException Visit(UnexpectedQueryPartitionProviderException unexpectedQueryPartitionProviderException, ITrace trace) @@ -134,12 +138,14 @@ public override CosmosException Visit(UnexpectedQueryPartitionProviderException public override CosmosException Visit(ExpectedQueryPartitionProviderException expectedQueryPartitionProviderException, ITrace trace) { +#pragma warning disable CDX1002 // DontUseExceptionStackTrace return CosmosExceptionFactory.CreateBadRequestException( message: expectedQueryPartitionProviderException.Message, headers: new Headers(), stackTrace: expectedQueryPartitionProviderException.StackTrace, innerException: expectedQueryPartitionProviderException, trace: trace); +#pragma warning restore CDX1002 // DontUseExceptionStackTrace } } @@ -155,6 +161,7 @@ internal override CosmosException Visit( MalformedChangeFeedContinuationTokenException malformedChangeFeedContinuationTokenException, ITrace trace) { +#pragma warning disable CDX1002 // DontUseExceptionStackTrace return CosmosExceptionFactory.CreateBadRequestException( message: malformedChangeFeedContinuationTokenException.Message, headers: new Headers() @@ -164,6 +171,7 @@ internal override CosmosException Visit( stackTrace: malformedChangeFeedContinuationTokenException.StackTrace, innerException: malformedChangeFeedContinuationTokenException, trace: trace); +#pragma warning restore CDX1002 // DontUseExceptionStackTrace } } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/Monads/ExceptionWithStackTraceException.cs b/Microsoft.Azure.Cosmos/src/Query/Core/Monads/ExceptionWithStackTraceException.cs index bd5adc1b01..a8410d0ab5 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/Monads/ExceptionWithStackTraceException.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/Monads/ExceptionWithStackTraceException.cs @@ -33,7 +33,9 @@ public ExceptionWithStackTraceException( { if (stackTrace == null) { +#pragma warning disable IDE0016 // Use 'throw' expression throw new ArgumentNullException(nameof(stackTrace)); +#pragma warning restore IDE0016 // Use 'throw' expression } this.stackTrace = stackTrace; @@ -59,16 +61,20 @@ public override string ToString() if (this.InnerException != null) { +#pragma warning disable CDX1003 // DontUseExceptionToString s = s + " ---> " + this.InnerException.ToString() + Environment.NewLine + " " + EndOfInnerExceptionString; +#pragma warning restore CDX1003 // DontUseExceptionToString } +#pragma warning disable CDX1002 // DontUseExceptionStackTrace s += Environment.NewLine + this.StackTrace; +#pragma warning restore CDX1002 // DontUseExceptionStackTrace return s; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/Monads/TryCatch{TResult}.cs b/Microsoft.Azure.Cosmos/src/Query/Core/Monads/TryCatch{TResult}.cs index 38d0f4d1fc..ac3cb77682 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/Monads/TryCatch{TResult}.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/Monads/TryCatch{TResult}.cs @@ -244,11 +244,13 @@ public static TryCatch FromException(Exception exception) { // Skipping a stack frame, since we don't want this method showing up in the stack trace. StackTrace stackTrace = new StackTrace(skipFrames: 1); +#pragma warning disable CDX1000 // DontConvertExceptionToObject return new TryCatch( new ExceptionWithStackTraceException( message: $"{nameof(TryCatch)} resulted in an exception.", innerException: exception, stackTrace: stackTrace)); +#pragma warning restore CDX1000 // DontConvertExceptionToObject } public static bool ConvertToTryGet(TryCatch tryCatch, out T result) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/Parser/CstToAstVisitor.cs b/Microsoft.Azure.Cosmos/src/Query/Core/Parser/CstToAstVisitor.cs index fd92b233a8..220b10591c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/Parser/CstToAstVisitor.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/Parser/CstToAstVisitor.cs @@ -355,15 +355,27 @@ public override SqlObject VisitGroup_by_clause([NotNull] sqlParser.Group_by_clau public override SqlObject VisitOrder_by_clause([NotNull] sqlParser.Order_by_clauseContext context) { Contract.Requires(context != null); - - List orderByItems = new List(); - foreach (sqlParser.Order_by_itemContext orderByItemContext in context.order_by_items().order_by_item()) - { - SqlOrderByItem orderByItem = (SqlOrderByItem)this.VisitOrder_by_item(orderByItemContext); - orderByItems.Add(orderByItem); - } - - return SqlOrderByClause.Create(orderByItems.ToImmutableArray()); + + bool rank = context.K_RANK() != null; + List orderByItems = new List(); + if (rank) + { + foreach (sqlParser.Score_expression_order_by_itemContext scoreOrderByItemContext in context.score_expression_order_by_items().score_expression_order_by_item()) + { + SqlOrderByItem orderByItem = (SqlOrderByItem)this.VisitScore_expression_order_by_item(scoreOrderByItemContext); + orderByItems.Add(orderByItem); + } + } + else + { + foreach (sqlParser.Order_by_itemContext orderByItemContext in context.order_by_items().order_by_item()) + { + SqlOrderByItem orderByItem = (SqlOrderByItem)this.VisitOrder_by_item(orderByItemContext); + orderByItems.Add(orderByItem); + } + } + + return SqlOrderByClause.Create(rank, orderByItems.ToImmutableArray()); } public override SqlObject VisitOrder_by_item([NotNull] sqlParser.Order_by_itemContext context) @@ -388,6 +400,31 @@ public override SqlObject VisitOrder_by_item([NotNull] sqlParser.Order_by_itemCo } } + return SqlOrderByItem.Create(expression, isDescending); + } + + public override SqlObject VisitScore_expression_order_by_item([NotNull] sqlParser.Score_expression_order_by_itemContext context) + { + Contract.Requires(context != null); + + SqlFunctionCallScalarExpression expression = (SqlFunctionCallScalarExpression)this.Visit(context.function_call_scalar_expression()); + bool? isDescending = null; + if (context.sort_order() != null) + { + if (context.sort_order().K_ASC() != null) + { + isDescending = false; + } + else if (context.sort_order().K_DESC() != null) + { + isDescending = true; + } + else + { + throw new ArgumentOutOfRangeException($"Unknown sort order : {context.sort_order()}."); + } + } + return SqlOrderByItem.Create(expression, isDescending); } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/Parser/IsqlListener.cs b/Microsoft.Azure.Cosmos/src/Query/Core/Parser/IsqlListener.cs index 9cde50fb6b..13686b1986 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/Parser/IsqlListener.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/Parser/IsqlListener.cs @@ -268,6 +268,26 @@ internal interface IsqlListener : IParseTreeListener { /// The parse tree. void ExitOrder_by_clause([NotNull] sqlParser.Order_by_clauseContext context); /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterScore_expression_order_by_items([NotNull] sqlParser.Score_expression_order_by_itemsContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitScore_expression_order_by_items([NotNull] sqlParser.Score_expression_order_by_itemsContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterScore_expression_order_by_item([NotNull] sqlParser.Score_expression_order_by_itemContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitScore_expression_order_by_item([NotNull] sqlParser.Score_expression_order_by_itemContext context); + /// /// Enter a parse tree produced by . /// /// The parse tree. diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/Parser/IsqlVisitor.cs b/Microsoft.Azure.Cosmos/src/Query/Core/Parser/IsqlVisitor.cs index b9bea8ca1d..3c756bbbe2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/Parser/IsqlVisitor.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/Parser/IsqlVisitor.cs @@ -172,6 +172,18 @@ internal interface IsqlVisitor : IParseTreeVisitor { /// The visitor result. Result VisitOrder_by_clause([NotNull] sqlParser.Order_by_clauseContext context); /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitScore_expression_order_by_items([NotNull] sqlParser.Score_expression_order_by_itemsContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitScore_expression_order_by_item([NotNull] sqlParser.Score_expression_order_by_itemContext context); + /// /// Visit a parse tree produced by . /// /// The parse tree. diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/Parser/sql.g4 b/Microsoft.Azure.Cosmos/src/Query/Core/Parser/sql.g4 index 2b0002a8ab..d87a99cf27 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/Parser/sql.g4 +++ b/Microsoft.Azure.Cosmos/src/Query/Core/Parser/sql.g4 @@ -58,9 +58,17 @@ group_by_clause : K_GROUP K_BY scalar_expression_list ; /*--------------------------------------------------------------------------------*/ /* ORDER BY */ /*--------------------------------------------------------------------------------*/ -order_by_clause : K_ORDER K_BY order_by_items ; +order_by_clause + : K_ORDER K_BY order_by_items + | K_ORDER K_BY K_RANK score_expression_order_by_items + ; + +score_expression_order_by_items : score_expression_order_by_item (',' score_expression_order_by_item)* ; +score_expression_order_by_item : function_call_scalar_expression sort_order? ; + order_by_items : order_by_item (',' order_by_item)* ; order_by_item : scalar_expression sort_order? ; + sort_order : K_ASC | K_DESC @@ -227,6 +235,7 @@ K_NULL : 'null'; K_OFFSET : O F F S E T; K_OR : O R; K_ORDER : O R D E R; +K_RANK : R A N K; K_RIGHT : R I G H T; K_SELECT : S E L E C T; K_TOP : T O P; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/Parser/sqlBaseListener.cs b/Microsoft.Azure.Cosmos/src/Query/Core/Parser/sqlBaseListener.cs index 62f2873d72..5779650c51 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/Parser/sqlBaseListener.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/Parser/sqlBaseListener.cs @@ -316,6 +316,30 @@ public virtual void EnterOrder_by_clause([NotNull] sqlParser.Order_by_clauseCont /// The parse tree. public virtual void ExitOrder_by_clause([NotNull] sqlParser.Order_by_clauseContext context) { } /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterScore_expression_order_by_items([NotNull] sqlParser.Score_expression_order_by_itemsContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitScore_expression_order_by_items([NotNull] sqlParser.Score_expression_order_by_itemsContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterScore_expression_order_by_item([NotNull] sqlParser.Score_expression_order_by_itemContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitScore_expression_order_by_item([NotNull] sqlParser.Score_expression_order_by_itemContext context) { } + /// /// Enter a parse tree produced by . /// The default implementation does nothing. /// diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/Parser/sqlBaseVisitor.cs b/Microsoft.Azure.Cosmos/src/Query/Core/Parser/sqlBaseVisitor.cs index 4594f5fc79..e32fe76ea5 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/Parser/sqlBaseVisitor.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/Parser/sqlBaseVisitor.cs @@ -262,6 +262,26 @@ internal partial class sqlBaseVisitor : AbstractParseTreeVisitor /// The visitor result. public virtual Result VisitOrder_by_clause([NotNull] sqlParser.Order_by_clauseContext context) { return VisitChildren(context); } /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitScore_expression_order_by_items([NotNull] sqlParser.Score_expression_order_by_itemsContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitScore_expression_order_by_item([NotNull] sqlParser.Score_expression_order_by_itemContext context) { return VisitChildren(context); } + /// /// Visit a parse tree produced by . /// /// The default implementation returns the result of calling diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/Parser/sqlLexer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/Parser/sqlLexer.cs index 88888fea5d..b5fac862c1 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/Parser/sqlLexer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/Parser/sqlLexer.cs @@ -39,9 +39,9 @@ public const int K_ASC=32, K_BETWEEN=33, K_BY=34, K_DESC=35, K_DISTINCT=36, K_ESCAPE=37, K_EXISTS=38, K_FIRST=39, K_FALSE=40, K_FROM=41, K_GROUP=42, K_IN=43, K_JOIN=44, K_LAST=45, K_LEFT=46, K_LIKE=47, K_LIMIT=48, K_NOT=49, K_NULL=50, K_OFFSET=51, - K_OR=52, K_ORDER=53, K_RIGHT=54, K_SELECT=55, K_TOP=56, K_TRUE=57, K_UDF=58, - K_UNDEFINED=59, K_VALUE=60, K_WHERE=61, WS=62, NUMERIC_LITERAL=63, STRING_LITERAL=64, - LEX_IDENTIFIER=65, PARAMETER=66; + K_OR=52, K_ORDER=53, K_RANK=54, K_RIGHT=55, K_SELECT=56, K_TOP=57, K_TRUE=58, + K_UDF=59, K_UNDEFINED=60, K_VALUE=61, K_WHERE=62, WS=63, NUMERIC_LITERAL=64, + STRING_LITERAL=65, LEX_IDENTIFIER=66, PARAMETER=67; public static string[] channelNames = { "DEFAULT_TOKEN_CHANNEL", "HIDDEN" }; @@ -57,9 +57,9 @@ public const int "T__25", "T__26", "K_ALL", "K_AND", "K_ARRAY", "K_AS", "K_ASC", "K_BETWEEN", "K_BY", "K_DESC", "K_DISTINCT", "K_ESCAPE", "K_EXISTS", "K_FIRST", "K_FALSE", "K_FROM", "K_GROUP", "K_IN", "K_JOIN", "K_LAST", "K_LEFT", "K_LIKE", "K_LIMIT", - "K_NOT", "K_NULL", "K_OFFSET", "K_OR", "K_ORDER", "K_RIGHT", "K_SELECT", - "K_TOP", "K_TRUE", "K_UDF", "K_UNDEFINED", "K_VALUE", "K_WHERE", "WS", - "NUMERIC_LITERAL", "STRING_LITERAL", "ESC", "UNICODE", "HEX", "SAFECODEPOINTWITHSINGLEQUOTATION", + "K_NOT", "K_NULL", "K_OFFSET", "K_OR", "K_ORDER", "K_RANK", "K_RIGHT", + "K_SELECT", "K_TOP", "K_TRUE", "K_UDF", "K_UNDEFINED", "K_VALUE", "K_WHERE", + "WS", "NUMERIC_LITERAL", "STRING_LITERAL", "ESC", "UNICODE", "HEX", "SAFECODEPOINTWITHSINGLEQUOTATION", "SAFECODEPOINTWITHDOUBLEQUOTATION", "LEX_IDENTIFIER", "PARAMETER", "DIGIT", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" @@ -81,7 +81,7 @@ public sqlLexer(ICharStream input, TextWriter output, TextWriter errorOutput) "'&'", "'^'", "'|'", "'||'", "'~'", "'{'", "'}'", null, null, null, null, null, null, null, null, null, null, null, null, "'false'", null, null, null, null, null, null, null, null, null, "'null'", null, null, null, - null, null, null, "'true'", "'udf'", "'undefined'" + null, null, null, null, "'true'", "'udf'", "'undefined'" }; private static readonly string[] _SymbolicNames = { null, null, null, null, null, null, null, null, null, null, null, null, @@ -90,8 +90,8 @@ public sqlLexer(ICharStream input, TextWriter output, TextWriter errorOutput) "K_BETWEEN", "K_BY", "K_DESC", "K_DISTINCT", "K_ESCAPE", "K_EXISTS", "K_FIRST", "K_FALSE", "K_FROM", "K_GROUP", "K_IN", "K_JOIN", "K_LAST", "K_LEFT", "K_LIKE", "K_LIMIT", "K_NOT", "K_NULL", "K_OFFSET", "K_OR", "K_ORDER", - "K_RIGHT", "K_SELECT", "K_TOP", "K_TRUE", "K_UDF", "K_UNDEFINED", "K_VALUE", - "K_WHERE", "WS", "NUMERIC_LITERAL", "STRING_LITERAL", "LEX_IDENTIFIER", + "K_RANK", "K_RIGHT", "K_SELECT", "K_TOP", "K_TRUE", "K_UDF", "K_UNDEFINED", + "K_VALUE", "K_WHERE", "WS", "NUMERIC_LITERAL", "STRING_LITERAL", "LEX_IDENTIFIER", "PARAMETER" }; public static readonly IVocabulary DefaultVocabulary = new Vocabulary(_LiteralNames, _SymbolicNames); @@ -123,7 +123,7 @@ static sqlLexer() { } private static char[] _serializedATN = { '\x3', '\x608B', '\xA72A', '\x8133', '\xB9ED', '\x417C', '\x3BE7', '\x7786', - '\x5964', '\x2', '\x44', '\x25D', '\b', '\x1', '\x4', '\x2', '\t', '\x2', + '\x5964', '\x2', '\x45', '\x264', '\b', '\x1', '\x4', '\x2', '\t', '\x2', '\x4', '\x3', '\t', '\x3', '\x4', '\x4', '\t', '\x4', '\x4', '\x5', '\t', '\x5', '\x4', '\x6', '\t', '\x6', '\x4', '\a', '\t', '\a', '\x4', '\b', '\t', '\b', '\x4', '\t', '\t', '\t', '\x4', '\n', '\t', '\n', '\x4', '\v', @@ -157,84 +157,87 @@ static sqlLexer() { 'X', '\x4', 'Y', '\t', 'Y', '\x4', 'Z', '\t', 'Z', '\x4', '[', '\t', '[', '\x4', '\\', '\t', '\\', '\x4', ']', '\t', ']', '\x4', '^', '\t', '^', '\x4', '_', '\t', '_', '\x4', '`', '\t', '`', '\x4', '\x61', '\t', '\x61', - '\x4', '\x62', '\t', '\x62', '\x4', '\x63', '\t', '\x63', '\x3', '\x2', - '\x3', '\x2', '\x3', '\x3', '\x3', '\x3', '\x3', '\x4', '\x3', '\x4', - '\x3', '\x5', '\x3', '\x5', '\x3', '\x6', '\x3', '\x6', '\x3', '\a', '\x3', - '\a', '\x3', '\b', '\x3', '\b', '\x3', '\t', '\x3', '\t', '\x3', '\n', - '\x3', '\n', '\x3', '\v', '\x3', '\v', '\x3', '\v', '\x3', '\f', '\x3', - '\f', '\x3', '\r', '\x3', '\r', '\x3', '\xE', '\x3', '\xE', '\x3', '\xF', - '\x3', '\xF', '\x3', '\x10', '\x3', '\x10', '\x3', '\x11', '\x3', '\x11', - '\x3', '\x12', '\x3', '\x12', '\x3', '\x12', '\x3', '\x13', '\x3', '\x13', - '\x3', '\x13', '\x3', '\x14', '\x3', '\x14', '\x3', '\x15', '\x3', '\x15', - '\x3', '\x15', '\x3', '\x16', '\x3', '\x16', '\x3', '\x17', '\x3', '\x17', - '\x3', '\x18', '\x3', '\x18', '\x3', '\x19', '\x3', '\x19', '\x3', '\x19', - '\x3', '\x1A', '\x3', '\x1A', '\x3', '\x1B', '\x3', '\x1B', '\x3', '\x1C', - '\x3', '\x1C', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', - '\x3', '\x1E', '\x3', '\x1E', '\x3', '\x1E', '\x3', '\x1E', '\x3', '\x1F', - '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', - '\x3', ' ', '\x3', ' ', '\x3', ' ', '\x3', '!', '\x3', '!', '\x3', '!', - '\x3', '!', '\x3', '\"', '\x3', '\"', '\x3', '\"', '\x3', '\"', '\x3', - '\"', '\x3', '\"', '\x3', '\"', '\x3', '\"', '\x3', '#', '\x3', '#', '\x3', - '#', '\x3', '$', '\x3', '$', '\x3', '$', '\x3', '$', '\x3', '$', '\x3', + '\x4', '\x62', '\t', '\x62', '\x4', '\x63', '\t', '\x63', '\x4', '\x64', + '\t', '\x64', '\x3', '\x2', '\x3', '\x2', '\x3', '\x3', '\x3', '\x3', + '\x3', '\x4', '\x3', '\x4', '\x3', '\x5', '\x3', '\x5', '\x3', '\x6', + '\x3', '\x6', '\x3', '\a', '\x3', '\a', '\x3', '\b', '\x3', '\b', '\x3', + '\t', '\x3', '\t', '\x3', '\n', '\x3', '\n', '\x3', '\v', '\x3', '\v', + '\x3', '\v', '\x3', '\f', '\x3', '\f', '\x3', '\r', '\x3', '\r', '\x3', + '\xE', '\x3', '\xE', '\x3', '\xF', '\x3', '\xF', '\x3', '\x10', '\x3', + '\x10', '\x3', '\x11', '\x3', '\x11', '\x3', '\x12', '\x3', '\x12', '\x3', + '\x12', '\x3', '\x13', '\x3', '\x13', '\x3', '\x13', '\x3', '\x14', '\x3', + '\x14', '\x3', '\x15', '\x3', '\x15', '\x3', '\x15', '\x3', '\x16', '\x3', + '\x16', '\x3', '\x17', '\x3', '\x17', '\x3', '\x18', '\x3', '\x18', '\x3', + '\x19', '\x3', '\x19', '\x3', '\x19', '\x3', '\x1A', '\x3', '\x1A', '\x3', + '\x1B', '\x3', '\x1B', '\x3', '\x1C', '\x3', '\x1C', '\x3', '\x1D', '\x3', + '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1E', '\x3', '\x1E', '\x3', + '\x1E', '\x3', '\x1E', '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\x3', + '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\x3', ' ', '\x3', ' ', '\x3', ' ', + '\x3', '!', '\x3', '!', '\x3', '!', '\x3', '!', '\x3', '\"', '\x3', '\"', + '\x3', '\"', '\x3', '\"', '\x3', '\"', '\x3', '\"', '\x3', '\"', '\x3', + '\"', '\x3', '#', '\x3', '#', '\x3', '#', '\x3', '$', '\x3', '$', '\x3', + '$', '\x3', '$', '\x3', '$', '\x3', '%', '\x3', '%', '\x3', '%', '\x3', '%', '\x3', '%', '\x3', '%', '\x3', '%', '\x3', '%', '\x3', '%', '\x3', - '%', '\x3', '%', '\x3', '%', '\x3', '&', '\x3', '&', '\x3', '&', '\x3', - '&', '\x3', '&', '\x3', '&', '\x3', '&', '\x3', '\'', '\x3', '\'', '\x3', - '\'', '\x3', '\'', '\x3', '\'', '\x3', '\'', '\x3', '\'', '\x3', '(', - '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', ')', - '\x3', ')', '\x3', ')', '\x3', ')', '\x3', ')', '\x3', ')', '\x3', '*', - '\x3', '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', '+', '\x3', '+', - '\x3', '+', '\x3', '+', '\x3', '+', '\x3', '+', '\x3', ',', '\x3', ',', - '\x3', ',', '\x3', '-', '\x3', '-', '\x3', '-', '\x3', '-', '\x3', '-', - '\x3', '.', '\x3', '.', '\x3', '.', '\x3', '.', '\x3', '.', '\x3', '/', - '\x3', '/', '\x3', '/', '\x3', '/', '\x3', '/', '\x3', '\x30', '\x3', - '\x30', '\x3', '\x30', '\x3', '\x30', '\x3', '\x30', '\x3', '\x31', '\x3', - '\x31', '\x3', '\x31', '\x3', '\x31', '\x3', '\x31', '\x3', '\x31', '\x3', - '\x32', '\x3', '\x32', '\x3', '\x32', '\x3', '\x32', '\x3', '\x33', '\x3', - '\x33', '\x3', '\x33', '\x3', '\x33', '\x3', '\x33', '\x3', '\x34', '\x3', - '\x34', '\x3', '\x34', '\x3', '\x34', '\x3', '\x34', '\x3', '\x34', '\x3', - '\x34', '\x3', '\x35', '\x3', '\x35', '\x3', '\x35', '\x3', '\x36', '\x3', - '\x36', '\x3', '\x36', '\x3', '\x36', '\x3', '\x36', '\x3', '\x36', '\x3', - '\x37', '\x3', '\x37', '\x3', '\x37', '\x3', '\x37', '\x3', '\x37', '\x3', - '\x37', '\x3', '\x38', '\x3', '\x38', '\x3', '\x38', '\x3', '\x38', '\x3', - '\x38', '\x3', '\x38', '\x3', '\x38', '\x3', '\x39', '\x3', '\x39', '\x3', - '\x39', '\x3', '\x39', '\x3', ':', '\x3', ':', '\x3', ':', '\x3', ':', - '\x3', ':', '\x3', ';', '\x3', ';', '\x3', ';', '\x3', ';', '\x3', '<', - '\x3', '<', '\x3', '<', '\x3', '<', '\x3', '<', '\x3', '<', '\x3', '<', - '\x3', '<', '\x3', '<', '\x3', '<', '\x3', '=', '\x3', '=', '\x3', '=', - '\x3', '=', '\x3', '=', '\x3', '=', '\x3', '>', '\x3', '>', '\x3', '>', - '\x3', '>', '\x3', '>', '\x3', '>', '\x3', '?', '\x6', '?', '\x1BD', '\n', - '?', '\r', '?', '\xE', '?', '\x1BE', '\x3', '?', '\x3', '?', '\x3', '@', - '\x5', '@', '\x1C4', '\n', '@', '\x3', '@', '\x6', '@', '\x1C7', '\n', - '@', '\r', '@', '\xE', '@', '\x1C8', '\x3', '@', '\x3', '@', '\a', '@', - '\x1CD', '\n', '@', '\f', '@', '\xE', '@', '\x1D0', '\v', '@', '\x5', - '@', '\x1D2', '\n', '@', '\x3', '@', '\x3', '@', '\x5', '@', '\x1D6', - '\n', '@', '\x3', '@', '\x6', '@', '\x1D9', '\n', '@', '\r', '@', '\xE', - '@', '\x1DA', '\x5', '@', '\x1DD', '\n', '@', '\x3', '@', '\x5', '@', - '\x1E0', '\n', '@', '\x3', '@', '\x3', '@', '\x6', '@', '\x1E4', '\n', - '@', '\r', '@', '\xE', '@', '\x1E5', '\x3', '@', '\x3', '@', '\x5', '@', - '\x1EA', '\n', '@', '\x3', '@', '\x6', '@', '\x1ED', '\n', '@', '\r', - '@', '\xE', '@', '\x1EE', '\x5', '@', '\x1F1', '\n', '@', '\x5', '@', - '\x1F3', '\n', '@', '\x3', '\x41', '\x3', '\x41', '\x3', '\x41', '\a', - '\x41', '\x1F8', '\n', '\x41', '\f', '\x41', '\xE', '\x41', '\x1FB', '\v', - '\x41', '\x3', '\x41', '\x3', '\x41', '\x3', '\x41', '\x3', '\x41', '\a', - '\x41', '\x201', '\n', '\x41', '\f', '\x41', '\xE', '\x41', '\x204', '\v', - '\x41', '\x3', '\x41', '\x5', '\x41', '\x207', '\n', '\x41', '\x3', '\x42', - '\x3', '\x42', '\x3', '\x42', '\x5', '\x42', '\x20C', '\n', '\x42', '\x3', - '\x43', '\x3', '\x43', '\x3', '\x43', '\x3', '\x43', '\x3', '\x43', '\x3', - '\x43', '\x3', '\x44', '\x3', '\x44', '\x3', '\x45', '\x3', '\x45', '\x3', - '\x46', '\x3', '\x46', '\x3', 'G', '\x3', 'G', '\x3', 'G', '\x3', 'G', - '\a', 'G', '\x21E', '\n', 'G', '\f', 'G', '\xE', 'G', '\x221', '\v', 'G', - '\x5', 'G', '\x223', '\n', 'G', '\x3', 'H', '\x3', 'H', '\x3', 'H', '\x3', - 'I', '\x3', 'I', '\x3', 'J', '\x3', 'J', '\x3', 'K', '\x3', 'K', '\x3', - 'L', '\x3', 'L', '\x3', 'M', '\x3', 'M', '\x3', 'N', '\x3', 'N', '\x3', - 'O', '\x3', 'O', '\x3', 'P', '\x3', 'P', '\x3', 'Q', '\x3', 'Q', '\x3', - 'R', '\x3', 'R', '\x3', 'S', '\x3', 'S', '\x3', 'T', '\x3', 'T', '\x3', - 'U', '\x3', 'U', '\x3', 'V', '\x3', 'V', '\x3', 'W', '\x3', 'W', '\x3', - 'X', '\x3', 'X', '\x3', 'Y', '\x3', 'Y', '\x3', 'Z', '\x3', 'Z', '\x3', - '[', '\x3', '[', '\x3', '\\', '\x3', '\\', '\x3', ']', '\x3', ']', '\x3', - '^', '\x3', '^', '\x3', '_', '\x3', '_', '\x3', '`', '\x3', '`', '\x3', - '\x61', '\x3', '\x61', '\x3', '\x62', '\x3', '\x62', '\x3', '\x63', '\x3', - '\x63', '\x2', '\x2', '\x64', '\x3', '\x3', '\x5', '\x4', '\a', '\x5', + '&', '\x3', '&', '\x3', '&', '\x3', '&', '\x3', '&', '\x3', '&', '\x3', + '&', '\x3', '\'', '\x3', '\'', '\x3', '\'', '\x3', '\'', '\x3', '\'', + '\x3', '\'', '\x3', '\'', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', + '\x3', '(', '\x3', '(', '\x3', ')', '\x3', ')', '\x3', ')', '\x3', ')', + '\x3', ')', '\x3', ')', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', '*', + '\x3', '*', '\x3', '+', '\x3', '+', '\x3', '+', '\x3', '+', '\x3', '+', + '\x3', '+', '\x3', ',', '\x3', ',', '\x3', ',', '\x3', '-', '\x3', '-', + '\x3', '-', '\x3', '-', '\x3', '-', '\x3', '.', '\x3', '.', '\x3', '.', + '\x3', '.', '\x3', '.', '\x3', '/', '\x3', '/', '\x3', '/', '\x3', '/', + '\x3', '/', '\x3', '\x30', '\x3', '\x30', '\x3', '\x30', '\x3', '\x30', + '\x3', '\x30', '\x3', '\x31', '\x3', '\x31', '\x3', '\x31', '\x3', '\x31', + '\x3', '\x31', '\x3', '\x31', '\x3', '\x32', '\x3', '\x32', '\x3', '\x32', + '\x3', '\x32', '\x3', '\x33', '\x3', '\x33', '\x3', '\x33', '\x3', '\x33', + '\x3', '\x33', '\x3', '\x34', '\x3', '\x34', '\x3', '\x34', '\x3', '\x34', + '\x3', '\x34', '\x3', '\x34', '\x3', '\x34', '\x3', '\x35', '\x3', '\x35', + '\x3', '\x35', '\x3', '\x36', '\x3', '\x36', '\x3', '\x36', '\x3', '\x36', + '\x3', '\x36', '\x3', '\x36', '\x3', '\x37', '\x3', '\x37', '\x3', '\x37', + '\x3', '\x37', '\x3', '\x37', '\x3', '\x38', '\x3', '\x38', '\x3', '\x38', + '\x3', '\x38', '\x3', '\x38', '\x3', '\x38', '\x3', '\x39', '\x3', '\x39', + '\x3', '\x39', '\x3', '\x39', '\x3', '\x39', '\x3', '\x39', '\x3', '\x39', + '\x3', ':', '\x3', ':', '\x3', ':', '\x3', ':', '\x3', ';', '\x3', ';', + '\x3', ';', '\x3', ';', '\x3', ';', '\x3', '<', '\x3', '<', '\x3', '<', + '\x3', '<', '\x3', '=', '\x3', '=', '\x3', '=', '\x3', '=', '\x3', '=', + '\x3', '=', '\x3', '=', '\x3', '=', '\x3', '=', '\x3', '=', '\x3', '>', + '\x3', '>', '\x3', '>', '\x3', '>', '\x3', '>', '\x3', '>', '\x3', '?', + '\x3', '?', '\x3', '?', '\x3', '?', '\x3', '?', '\x3', '?', '\x3', '@', + '\x6', '@', '\x1C4', '\n', '@', '\r', '@', '\xE', '@', '\x1C5', '\x3', + '@', '\x3', '@', '\x3', '\x41', '\x5', '\x41', '\x1CB', '\n', '\x41', + '\x3', '\x41', '\x6', '\x41', '\x1CE', '\n', '\x41', '\r', '\x41', '\xE', + '\x41', '\x1CF', '\x3', '\x41', '\x3', '\x41', '\a', '\x41', '\x1D4', + '\n', '\x41', '\f', '\x41', '\xE', '\x41', '\x1D7', '\v', '\x41', '\x5', + '\x41', '\x1D9', '\n', '\x41', '\x3', '\x41', '\x3', '\x41', '\x5', '\x41', + '\x1DD', '\n', '\x41', '\x3', '\x41', '\x6', '\x41', '\x1E0', '\n', '\x41', + '\r', '\x41', '\xE', '\x41', '\x1E1', '\x5', '\x41', '\x1E4', '\n', '\x41', + '\x3', '\x41', '\x5', '\x41', '\x1E7', '\n', '\x41', '\x3', '\x41', '\x3', + '\x41', '\x6', '\x41', '\x1EB', '\n', '\x41', '\r', '\x41', '\xE', '\x41', + '\x1EC', '\x3', '\x41', '\x3', '\x41', '\x5', '\x41', '\x1F1', '\n', '\x41', + '\x3', '\x41', '\x6', '\x41', '\x1F4', '\n', '\x41', '\r', '\x41', '\xE', + '\x41', '\x1F5', '\x5', '\x41', '\x1F8', '\n', '\x41', '\x5', '\x41', + '\x1FA', '\n', '\x41', '\x3', '\x42', '\x3', '\x42', '\x3', '\x42', '\a', + '\x42', '\x1FF', '\n', '\x42', '\f', '\x42', '\xE', '\x42', '\x202', '\v', + '\x42', '\x3', '\x42', '\x3', '\x42', '\x3', '\x42', '\x3', '\x42', '\a', + '\x42', '\x208', '\n', '\x42', '\f', '\x42', '\xE', '\x42', '\x20B', '\v', + '\x42', '\x3', '\x42', '\x5', '\x42', '\x20E', '\n', '\x42', '\x3', '\x43', + '\x3', '\x43', '\x3', '\x43', '\x5', '\x43', '\x213', '\n', '\x43', '\x3', + '\x44', '\x3', '\x44', '\x3', '\x44', '\x3', '\x44', '\x3', '\x44', '\x3', + '\x44', '\x3', '\x45', '\x3', '\x45', '\x3', '\x46', '\x3', '\x46', '\x3', + 'G', '\x3', 'G', '\x3', 'H', '\x3', 'H', '\x3', 'H', '\x3', 'H', '\a', + 'H', '\x225', '\n', 'H', '\f', 'H', '\xE', 'H', '\x228', '\v', 'H', '\x5', + 'H', '\x22A', '\n', 'H', '\x3', 'I', '\x3', 'I', '\x3', 'I', '\x3', 'J', + '\x3', 'J', '\x3', 'K', '\x3', 'K', '\x3', 'L', '\x3', 'L', '\x3', 'M', + '\x3', 'M', '\x3', 'N', '\x3', 'N', '\x3', 'O', '\x3', 'O', '\x3', 'P', + '\x3', 'P', '\x3', 'Q', '\x3', 'Q', '\x3', 'R', '\x3', 'R', '\x3', 'S', + '\x3', 'S', '\x3', 'T', '\x3', 'T', '\x3', 'U', '\x3', 'U', '\x3', 'V', + '\x3', 'V', '\x3', 'W', '\x3', 'W', '\x3', 'X', '\x3', 'X', '\x3', 'Y', + '\x3', 'Y', '\x3', 'Z', '\x3', 'Z', '\x3', '[', '\x3', '[', '\x3', '\\', + '\x3', '\\', '\x3', ']', '\x3', ']', '\x3', '^', '\x3', '^', '\x3', '_', + '\x3', '_', '\x3', '`', '\x3', '`', '\x3', '\x61', '\x3', '\x61', '\x3', + '\x62', '\x3', '\x62', '\x3', '\x63', '\x3', '\x63', '\x3', '\x64', '\x3', + '\x64', '\x2', '\x2', '\x65', '\x3', '\x3', '\x5', '\x4', '\a', '\x5', '\t', '\x6', '\v', '\a', '\r', '\b', '\xF', '\t', '\x11', '\n', '\x13', '\v', '\x15', '\f', '\x17', '\r', '\x19', '\xE', '\x1B', '\xF', '\x1D', '\x10', '\x1F', '\x11', '!', '\x12', '#', '\x13', '%', '\x14', '\'', '\x15', @@ -245,393 +248,397 @@ static sqlLexer() { '-', 'Y', '.', '[', '/', ']', '\x30', '_', '\x31', '\x61', '\x32', '\x63', '\x33', '\x65', '\x34', 'g', '\x35', 'i', '\x36', 'k', '\x37', 'm', '\x38', 'o', '\x39', 'q', ':', 's', ';', 'u', '<', 'w', '=', 'y', '>', '{', '?', - '}', '@', '\x7F', '\x41', '\x81', '\x42', '\x83', '\x2', '\x85', '\x2', - '\x87', '\x2', '\x89', '\x2', '\x8B', '\x2', '\x8D', '\x43', '\x8F', '\x44', - '\x91', '\x2', '\x93', '\x2', '\x95', '\x2', '\x97', '\x2', '\x99', '\x2', + '}', '@', '\x7F', '\x41', '\x81', '\x42', '\x83', '\x43', '\x85', '\x2', + '\x87', '\x2', '\x89', '\x2', '\x8B', '\x2', '\x8D', '\x2', '\x8F', '\x44', + '\x91', '\x45', '\x93', '\x2', '\x95', '\x2', '\x97', '\x2', '\x99', '\x2', '\x9B', '\x2', '\x9D', '\x2', '\x9F', '\x2', '\xA1', '\x2', '\xA3', '\x2', '\xA5', '\x2', '\xA7', '\x2', '\xA9', '\x2', '\xAB', '\x2', '\xAD', '\x2', '\xAF', '\x2', '\xB1', '\x2', '\xB3', '\x2', '\xB5', '\x2', '\xB7', '\x2', '\xB9', '\x2', '\xBB', '\x2', '\xBD', '\x2', '\xBF', '\x2', '\xC1', '\x2', - '\xC3', '\x2', '\xC5', '\x2', '\x3', '\x2', '$', '\x5', '\x2', '\v', '\f', - '\xF', '\xF', '\"', '\"', '\x4', '\x2', '-', '-', '/', '/', '\n', '\x2', - '$', '$', '\x31', '\x31', '^', '^', '\x64', '\x64', 'h', 'h', 'p', 'p', - 't', 't', 'v', 'v', '\x5', '\x2', '\x32', ';', '\x43', 'H', '\x63', 'h', - '\x5', '\x2', '\x2', '!', ')', ')', '^', '^', '\x5', '\x2', '\x2', '!', - '$', '$', '^', '^', '\x5', '\x2', '\x43', '\\', '\x61', '\x61', '\x63', - '|', '\x3', '\x2', '\x32', ';', '\x4', '\x2', '\x43', '\x43', '\x63', - '\x63', '\x4', '\x2', '\x44', '\x44', '\x64', '\x64', '\x4', '\x2', '\x45', - '\x45', '\x65', '\x65', '\x4', '\x2', '\x46', '\x46', '\x66', '\x66', - '\x4', '\x2', 'G', 'G', 'g', 'g', '\x4', '\x2', 'H', 'H', 'h', 'h', '\x4', - '\x2', 'I', 'I', 'i', 'i', '\x4', '\x2', 'J', 'J', 'j', 'j', '\x4', '\x2', - 'K', 'K', 'k', 'k', '\x4', '\x2', 'L', 'L', 'l', 'l', '\x4', '\x2', 'M', - 'M', 'm', 'm', '\x4', '\x2', 'N', 'N', 'n', 'n', '\x4', '\x2', 'O', 'O', - 'o', 'o', '\x4', '\x2', 'P', 'P', 'p', 'p', '\x4', '\x2', 'Q', 'Q', 'q', - 'q', '\x4', '\x2', 'R', 'R', 'r', 'r', '\x4', '\x2', 'S', 'S', 's', 's', - '\x4', '\x2', 'T', 'T', 't', 't', '\x4', '\x2', 'U', 'U', 'u', 'u', '\x4', - '\x2', 'V', 'V', 'v', 'v', '\x4', '\x2', 'W', 'W', 'w', 'w', '\x4', '\x2', - 'X', 'X', 'x', 'x', '\x4', '\x2', 'Y', 'Y', 'y', 'y', '\x4', '\x2', 'Z', - 'Z', 'z', 'z', '\x4', '\x2', '[', '[', '{', '{', '\x4', '\x2', '\\', '\\', - '|', '|', '\x2', '\x253', '\x2', '\x3', '\x3', '\x2', '\x2', '\x2', '\x2', - '\x5', '\x3', '\x2', '\x2', '\x2', '\x2', '\a', '\x3', '\x2', '\x2', '\x2', - '\x2', '\t', '\x3', '\x2', '\x2', '\x2', '\x2', '\v', '\x3', '\x2', '\x2', - '\x2', '\x2', '\r', '\x3', '\x2', '\x2', '\x2', '\x2', '\xF', '\x3', '\x2', - '\x2', '\x2', '\x2', '\x11', '\x3', '\x2', '\x2', '\x2', '\x2', '\x13', - '\x3', '\x2', '\x2', '\x2', '\x2', '\x15', '\x3', '\x2', '\x2', '\x2', - '\x2', '\x17', '\x3', '\x2', '\x2', '\x2', '\x2', '\x19', '\x3', '\x2', - '\x2', '\x2', '\x2', '\x1B', '\x3', '\x2', '\x2', '\x2', '\x2', '\x1D', - '\x3', '\x2', '\x2', '\x2', '\x2', '\x1F', '\x3', '\x2', '\x2', '\x2', - '\x2', '!', '\x3', '\x2', '\x2', '\x2', '\x2', '#', '\x3', '\x2', '\x2', - '\x2', '\x2', '%', '\x3', '\x2', '\x2', '\x2', '\x2', '\'', '\x3', '\x2', - '\x2', '\x2', '\x2', ')', '\x3', '\x2', '\x2', '\x2', '\x2', '+', '\x3', - '\x2', '\x2', '\x2', '\x2', '-', '\x3', '\x2', '\x2', '\x2', '\x2', '/', - '\x3', '\x2', '\x2', '\x2', '\x2', '\x31', '\x3', '\x2', '\x2', '\x2', - '\x2', '\x33', '\x3', '\x2', '\x2', '\x2', '\x2', '\x35', '\x3', '\x2', - '\x2', '\x2', '\x2', '\x37', '\x3', '\x2', '\x2', '\x2', '\x2', '\x39', - '\x3', '\x2', '\x2', '\x2', '\x2', ';', '\x3', '\x2', '\x2', '\x2', '\x2', - '=', '\x3', '\x2', '\x2', '\x2', '\x2', '?', '\x3', '\x2', '\x2', '\x2', - '\x2', '\x41', '\x3', '\x2', '\x2', '\x2', '\x2', '\x43', '\x3', '\x2', - '\x2', '\x2', '\x2', '\x45', '\x3', '\x2', '\x2', '\x2', '\x2', 'G', '\x3', - '\x2', '\x2', '\x2', '\x2', 'I', '\x3', '\x2', '\x2', '\x2', '\x2', 'K', - '\x3', '\x2', '\x2', '\x2', '\x2', 'M', '\x3', '\x2', '\x2', '\x2', '\x2', - 'O', '\x3', '\x2', '\x2', '\x2', '\x2', 'Q', '\x3', '\x2', '\x2', '\x2', - '\x2', 'S', '\x3', '\x2', '\x2', '\x2', '\x2', 'U', '\x3', '\x2', '\x2', - '\x2', '\x2', 'W', '\x3', '\x2', '\x2', '\x2', '\x2', 'Y', '\x3', '\x2', - '\x2', '\x2', '\x2', '[', '\x3', '\x2', '\x2', '\x2', '\x2', ']', '\x3', - '\x2', '\x2', '\x2', '\x2', '_', '\x3', '\x2', '\x2', '\x2', '\x2', '\x61', - '\x3', '\x2', '\x2', '\x2', '\x2', '\x63', '\x3', '\x2', '\x2', '\x2', - '\x2', '\x65', '\x3', '\x2', '\x2', '\x2', '\x2', 'g', '\x3', '\x2', '\x2', - '\x2', '\x2', 'i', '\x3', '\x2', '\x2', '\x2', '\x2', 'k', '\x3', '\x2', - '\x2', '\x2', '\x2', 'm', '\x3', '\x2', '\x2', '\x2', '\x2', 'o', '\x3', - '\x2', '\x2', '\x2', '\x2', 'q', '\x3', '\x2', '\x2', '\x2', '\x2', 's', - '\x3', '\x2', '\x2', '\x2', '\x2', 'u', '\x3', '\x2', '\x2', '\x2', '\x2', - 'w', '\x3', '\x2', '\x2', '\x2', '\x2', 'y', '\x3', '\x2', '\x2', '\x2', - '\x2', '{', '\x3', '\x2', '\x2', '\x2', '\x2', '}', '\x3', '\x2', '\x2', - '\x2', '\x2', '\x7F', '\x3', '\x2', '\x2', '\x2', '\x2', '\x81', '\x3', - '\x2', '\x2', '\x2', '\x2', '\x8D', '\x3', '\x2', '\x2', '\x2', '\x2', - '\x8F', '\x3', '\x2', '\x2', '\x2', '\x3', '\xC7', '\x3', '\x2', '\x2', - '\x2', '\x5', '\xC9', '\x3', '\x2', '\x2', '\x2', '\a', '\xCB', '\x3', - '\x2', '\x2', '\x2', '\t', '\xCD', '\x3', '\x2', '\x2', '\x2', '\v', '\xCF', - '\x3', '\x2', '\x2', '\x2', '\r', '\xD1', '\x3', '\x2', '\x2', '\x2', - '\xF', '\xD3', '\x3', '\x2', '\x2', '\x2', '\x11', '\xD5', '\x3', '\x2', - '\x2', '\x2', '\x13', '\xD7', '\x3', '\x2', '\x2', '\x2', '\x15', '\xD9', - '\x3', '\x2', '\x2', '\x2', '\x17', '\xDC', '\x3', '\x2', '\x2', '\x2', - '\x19', '\xDE', '\x3', '\x2', '\x2', '\x2', '\x1B', '\xE0', '\x3', '\x2', - '\x2', '\x2', '\x1D', '\xE2', '\x3', '\x2', '\x2', '\x2', '\x1F', '\xE4', - '\x3', '\x2', '\x2', '\x2', '!', '\xE6', '\x3', '\x2', '\x2', '\x2', '#', - '\xE8', '\x3', '\x2', '\x2', '\x2', '%', '\xEB', '\x3', '\x2', '\x2', - '\x2', '\'', '\xEE', '\x3', '\x2', '\x2', '\x2', ')', '\xF0', '\x3', '\x2', - '\x2', '\x2', '+', '\xF3', '\x3', '\x2', '\x2', '\x2', '-', '\xF5', '\x3', - '\x2', '\x2', '\x2', '/', '\xF7', '\x3', '\x2', '\x2', '\x2', '\x31', - '\xF9', '\x3', '\x2', '\x2', '\x2', '\x33', '\xFC', '\x3', '\x2', '\x2', - '\x2', '\x35', '\xFE', '\x3', '\x2', '\x2', '\x2', '\x37', '\x100', '\x3', - '\x2', '\x2', '\x2', '\x39', '\x102', '\x3', '\x2', '\x2', '\x2', ';', - '\x106', '\x3', '\x2', '\x2', '\x2', '=', '\x10A', '\x3', '\x2', '\x2', - '\x2', '?', '\x110', '\x3', '\x2', '\x2', '\x2', '\x41', '\x113', '\x3', - '\x2', '\x2', '\x2', '\x43', '\x117', '\x3', '\x2', '\x2', '\x2', '\x45', - '\x11F', '\x3', '\x2', '\x2', '\x2', 'G', '\x122', '\x3', '\x2', '\x2', - '\x2', 'I', '\x127', '\x3', '\x2', '\x2', '\x2', 'K', '\x130', '\x3', - '\x2', '\x2', '\x2', 'M', '\x137', '\x3', '\x2', '\x2', '\x2', 'O', '\x13E', - '\x3', '\x2', '\x2', '\x2', 'Q', '\x144', '\x3', '\x2', '\x2', '\x2', - 'S', '\x14A', '\x3', '\x2', '\x2', '\x2', 'U', '\x14F', '\x3', '\x2', - '\x2', '\x2', 'W', '\x155', '\x3', '\x2', '\x2', '\x2', 'Y', '\x158', - '\x3', '\x2', '\x2', '\x2', '[', '\x15D', '\x3', '\x2', '\x2', '\x2', - ']', '\x162', '\x3', '\x2', '\x2', '\x2', '_', '\x167', '\x3', '\x2', - '\x2', '\x2', '\x61', '\x16C', '\x3', '\x2', '\x2', '\x2', '\x63', '\x172', - '\x3', '\x2', '\x2', '\x2', '\x65', '\x176', '\x3', '\x2', '\x2', '\x2', - 'g', '\x17B', '\x3', '\x2', '\x2', '\x2', 'i', '\x182', '\x3', '\x2', - '\x2', '\x2', 'k', '\x185', '\x3', '\x2', '\x2', '\x2', 'm', '\x18B', - '\x3', '\x2', '\x2', '\x2', 'o', '\x191', '\x3', '\x2', '\x2', '\x2', - 'q', '\x198', '\x3', '\x2', '\x2', '\x2', 's', '\x19C', '\x3', '\x2', - '\x2', '\x2', 'u', '\x1A1', '\x3', '\x2', '\x2', '\x2', 'w', '\x1A5', - '\x3', '\x2', '\x2', '\x2', 'y', '\x1AF', '\x3', '\x2', '\x2', '\x2', - '{', '\x1B5', '\x3', '\x2', '\x2', '\x2', '}', '\x1BC', '\x3', '\x2', - '\x2', '\x2', '\x7F', '\x1F2', '\x3', '\x2', '\x2', '\x2', '\x81', '\x206', - '\x3', '\x2', '\x2', '\x2', '\x83', '\x208', '\x3', '\x2', '\x2', '\x2', - '\x85', '\x20D', '\x3', '\x2', '\x2', '\x2', '\x87', '\x213', '\x3', '\x2', - '\x2', '\x2', '\x89', '\x215', '\x3', '\x2', '\x2', '\x2', '\x8B', '\x217', - '\x3', '\x2', '\x2', '\x2', '\x8D', '\x222', '\x3', '\x2', '\x2', '\x2', - '\x8F', '\x224', '\x3', '\x2', '\x2', '\x2', '\x91', '\x227', '\x3', '\x2', - '\x2', '\x2', '\x93', '\x229', '\x3', '\x2', '\x2', '\x2', '\x95', '\x22B', - '\x3', '\x2', '\x2', '\x2', '\x97', '\x22D', '\x3', '\x2', '\x2', '\x2', - '\x99', '\x22F', '\x3', '\x2', '\x2', '\x2', '\x9B', '\x231', '\x3', '\x2', - '\x2', '\x2', '\x9D', '\x233', '\x3', '\x2', '\x2', '\x2', '\x9F', '\x235', - '\x3', '\x2', '\x2', '\x2', '\xA1', '\x237', '\x3', '\x2', '\x2', '\x2', - '\xA3', '\x239', '\x3', '\x2', '\x2', '\x2', '\xA5', '\x23B', '\x3', '\x2', - '\x2', '\x2', '\xA7', '\x23D', '\x3', '\x2', '\x2', '\x2', '\xA9', '\x23F', - '\x3', '\x2', '\x2', '\x2', '\xAB', '\x241', '\x3', '\x2', '\x2', '\x2', - '\xAD', '\x243', '\x3', '\x2', '\x2', '\x2', '\xAF', '\x245', '\x3', '\x2', - '\x2', '\x2', '\xB1', '\x247', '\x3', '\x2', '\x2', '\x2', '\xB3', '\x249', - '\x3', '\x2', '\x2', '\x2', '\xB5', '\x24B', '\x3', '\x2', '\x2', '\x2', - '\xB7', '\x24D', '\x3', '\x2', '\x2', '\x2', '\xB9', '\x24F', '\x3', '\x2', - '\x2', '\x2', '\xBB', '\x251', '\x3', '\x2', '\x2', '\x2', '\xBD', '\x253', - '\x3', '\x2', '\x2', '\x2', '\xBF', '\x255', '\x3', '\x2', '\x2', '\x2', - '\xC1', '\x257', '\x3', '\x2', '\x2', '\x2', '\xC3', '\x259', '\x3', '\x2', - '\x2', '\x2', '\xC5', '\x25B', '\x3', '\x2', '\x2', '\x2', '\xC7', '\xC8', - '\a', ',', '\x2', '\x2', '\xC8', '\x4', '\x3', '\x2', '\x2', '\x2', '\xC9', - '\xCA', '\a', '.', '\x2', '\x2', '\xCA', '\x6', '\x3', '\x2', '\x2', '\x2', - '\xCB', '\xCC', '\a', '*', '\x2', '\x2', '\xCC', '\b', '\x3', '\x2', '\x2', - '\x2', '\xCD', '\xCE', '\a', '+', '\x2', '\x2', '\xCE', '\n', '\x3', '\x2', - '\x2', '\x2', '\xCF', '\xD0', '\a', '\x30', '\x2', '\x2', '\xD0', '\f', - '\x3', '\x2', '\x2', '\x2', '\xD1', '\xD2', '\a', ']', '\x2', '\x2', '\xD2', - '\xE', '\x3', '\x2', '\x2', '\x2', '\xD3', '\xD4', '\a', '_', '\x2', '\x2', - '\xD4', '\x10', '\x3', '\x2', '\x2', '\x2', '\xD5', '\xD6', '\a', '\x41', - '\x2', '\x2', '\xD6', '\x12', '\x3', '\x2', '\x2', '\x2', '\xD7', '\xD8', - '\a', '<', '\x2', '\x2', '\xD8', '\x14', '\x3', '\x2', '\x2', '\x2', '\xD9', - '\xDA', '\a', '\x41', '\x2', '\x2', '\xDA', '\xDB', '\a', '\x41', '\x2', - '\x2', '\xDB', '\x16', '\x3', '\x2', '\x2', '\x2', '\xDC', '\xDD', '\a', - '\x31', '\x2', '\x2', '\xDD', '\x18', '\x3', '\x2', '\x2', '\x2', '\xDE', - '\xDF', '\a', '\'', '\x2', '\x2', '\xDF', '\x1A', '\x3', '\x2', '\x2', - '\x2', '\xE0', '\xE1', '\a', '-', '\x2', '\x2', '\xE1', '\x1C', '\x3', - '\x2', '\x2', '\x2', '\xE2', '\xE3', '\a', '/', '\x2', '\x2', '\xE3', - '\x1E', '\x3', '\x2', '\x2', '\x2', '\xE4', '\xE5', '\a', '>', '\x2', - '\x2', '\xE5', ' ', '\x3', '\x2', '\x2', '\x2', '\xE6', '\xE7', '\a', - '@', '\x2', '\x2', '\xE7', '\"', '\x3', '\x2', '\x2', '\x2', '\xE8', '\xE9', - '\a', '@', '\x2', '\x2', '\xE9', '\xEA', '\a', '?', '\x2', '\x2', '\xEA', - '$', '\x3', '\x2', '\x2', '\x2', '\xEB', '\xEC', '\a', '>', '\x2', '\x2', - '\xEC', '\xED', '\a', '?', '\x2', '\x2', '\xED', '&', '\x3', '\x2', '\x2', - '\x2', '\xEE', '\xEF', '\a', '?', '\x2', '\x2', '\xEF', '(', '\x3', '\x2', - '\x2', '\x2', '\xF0', '\xF1', '\a', '#', '\x2', '\x2', '\xF1', '\xF2', - '\a', '?', '\x2', '\x2', '\xF2', '*', '\x3', '\x2', '\x2', '\x2', '\xF3', - '\xF4', '\a', '(', '\x2', '\x2', '\xF4', ',', '\x3', '\x2', '\x2', '\x2', - '\xF5', '\xF6', '\a', '`', '\x2', '\x2', '\xF6', '.', '\x3', '\x2', '\x2', - '\x2', '\xF7', '\xF8', '\a', '~', '\x2', '\x2', '\xF8', '\x30', '\x3', - '\x2', '\x2', '\x2', '\xF9', '\xFA', '\a', '~', '\x2', '\x2', '\xFA', - '\xFB', '\a', '~', '\x2', '\x2', '\xFB', '\x32', '\x3', '\x2', '\x2', - '\x2', '\xFC', '\xFD', '\a', '\x80', '\x2', '\x2', '\xFD', '\x34', '\x3', - '\x2', '\x2', '\x2', '\xFE', '\xFF', '\a', '}', '\x2', '\x2', '\xFF', - '\x36', '\x3', '\x2', '\x2', '\x2', '\x100', '\x101', '\a', '\x7F', '\x2', - '\x2', '\x101', '\x38', '\x3', '\x2', '\x2', '\x2', '\x102', '\x103', - '\x5', '\x93', 'J', '\x2', '\x103', '\x104', '\x5', '\xA9', 'U', '\x2', - '\x104', '\x105', '\x5', '\xA9', 'U', '\x2', '\x105', ':', '\x3', '\x2', - '\x2', '\x2', '\x106', '\x107', '\x5', '\x93', 'J', '\x2', '\x107', '\x108', - '\x5', '\xAD', 'W', '\x2', '\x108', '\x109', '\x5', '\x99', 'M', '\x2', - '\x109', '<', '\x3', '\x2', '\x2', '\x2', '\x10A', '\x10B', '\x5', '\x93', - 'J', '\x2', '\x10B', '\x10C', '\x5', '\xB5', '[', '\x2', '\x10C', '\x10D', - '\x5', '\xB5', '[', '\x2', '\x10D', '\x10E', '\x5', '\x93', 'J', '\x2', - '\x10E', '\x10F', '\x5', '\xC3', '\x62', '\x2', '\x10F', '>', '\x3', '\x2', - '\x2', '\x2', '\x110', '\x111', '\x5', '\x93', 'J', '\x2', '\x111', '\x112', - '\x5', '\xB7', '\\', '\x2', '\x112', '@', '\x3', '\x2', '\x2', '\x2', - '\x113', '\x114', '\x5', '\x93', 'J', '\x2', '\x114', '\x115', '\x5', - '\xB7', '\\', '\x2', '\x115', '\x116', '\x5', '\x97', 'L', '\x2', '\x116', - '\x42', '\x3', '\x2', '\x2', '\x2', '\x117', '\x118', '\x5', '\x95', 'K', - '\x2', '\x118', '\x119', '\x5', '\x9B', 'N', '\x2', '\x119', '\x11A', - '\x5', '\xB9', ']', '\x2', '\x11A', '\x11B', '\x5', '\xBF', '`', '\x2', - '\x11B', '\x11C', '\x5', '\x9B', 'N', '\x2', '\x11C', '\x11D', '\x5', - '\x9B', 'N', '\x2', '\x11D', '\x11E', '\x5', '\xAD', 'W', '\x2', '\x11E', - '\x44', '\x3', '\x2', '\x2', '\x2', '\x11F', '\x120', '\x5', '\x95', 'K', - '\x2', '\x120', '\x121', '\x5', '\xC3', '\x62', '\x2', '\x121', '\x46', - '\x3', '\x2', '\x2', '\x2', '\x122', '\x123', '\x5', '\x99', 'M', '\x2', - '\x123', '\x124', '\x5', '\x9B', 'N', '\x2', '\x124', '\x125', '\x5', - '\xB7', '\\', '\x2', '\x125', '\x126', '\x5', '\x97', 'L', '\x2', '\x126', - 'H', '\x3', '\x2', '\x2', '\x2', '\x127', '\x128', '\x5', '\x99', 'M', - '\x2', '\x128', '\x129', '\x5', '\xA3', 'R', '\x2', '\x129', '\x12A', - '\x5', '\xB7', '\\', '\x2', '\x12A', '\x12B', '\x5', '\xB9', ']', '\x2', - '\x12B', '\x12C', '\x5', '\xA3', 'R', '\x2', '\x12C', '\x12D', '\x5', - '\xAD', 'W', '\x2', '\x12D', '\x12E', '\x5', '\x97', 'L', '\x2', '\x12E', - '\x12F', '\x5', '\xB9', ']', '\x2', '\x12F', 'J', '\x3', '\x2', '\x2', - '\x2', '\x130', '\x131', '\x5', '\x9B', 'N', '\x2', '\x131', '\x132', - '\x5', '\xB7', '\\', '\x2', '\x132', '\x133', '\x5', '\x97', 'L', '\x2', - '\x133', '\x134', '\x5', '\x93', 'J', '\x2', '\x134', '\x135', '\x5', - '\xB1', 'Y', '\x2', '\x135', '\x136', '\x5', '\x9B', 'N', '\x2', '\x136', - 'L', '\x3', '\x2', '\x2', '\x2', '\x137', '\x138', '\x5', '\x9B', 'N', - '\x2', '\x138', '\x139', '\x5', '\xC1', '\x61', '\x2', '\x139', '\x13A', - '\x5', '\xA3', 'R', '\x2', '\x13A', '\x13B', '\x5', '\xB7', '\\', '\x2', - '\x13B', '\x13C', '\x5', '\xB9', ']', '\x2', '\x13C', '\x13D', '\x5', - '\xB7', '\\', '\x2', '\x13D', 'N', '\x3', '\x2', '\x2', '\x2', '\x13E', - '\x13F', '\x5', '\x9D', 'O', '\x2', '\x13F', '\x140', '\x5', '\xA3', 'R', - '\x2', '\x140', '\x141', '\x5', '\xB5', '[', '\x2', '\x141', '\x142', - '\x5', '\xB7', '\\', '\x2', '\x142', '\x143', '\x5', '\xB9', ']', '\x2', - '\x143', 'P', '\x3', '\x2', '\x2', '\x2', '\x144', '\x145', '\a', 'h', - '\x2', '\x2', '\x145', '\x146', '\a', '\x63', '\x2', '\x2', '\x146', '\x147', - '\a', 'n', '\x2', '\x2', '\x147', '\x148', '\a', 'u', '\x2', '\x2', '\x148', - '\x149', '\a', 'g', '\x2', '\x2', '\x149', 'R', '\x3', '\x2', '\x2', '\x2', - '\x14A', '\x14B', '\x5', '\x9D', 'O', '\x2', '\x14B', '\x14C', '\x5', - '\xB5', '[', '\x2', '\x14C', '\x14D', '\x5', '\xAF', 'X', '\x2', '\x14D', - '\x14E', '\x5', '\xAB', 'V', '\x2', '\x14E', 'T', '\x3', '\x2', '\x2', - '\x2', '\x14F', '\x150', '\x5', '\x9F', 'P', '\x2', '\x150', '\x151', - '\x5', '\xB5', '[', '\x2', '\x151', '\x152', '\x5', '\xAF', 'X', '\x2', - '\x152', '\x153', '\x5', '\xBB', '^', '\x2', '\x153', '\x154', '\x5', - '\xB1', 'Y', '\x2', '\x154', 'V', '\x3', '\x2', '\x2', '\x2', '\x155', - '\x156', '\x5', '\xA3', 'R', '\x2', '\x156', '\x157', '\x5', '\xAD', 'W', - '\x2', '\x157', 'X', '\x3', '\x2', '\x2', '\x2', '\x158', '\x159', '\x5', - '\xA5', 'S', '\x2', '\x159', '\x15A', '\x5', '\xAF', 'X', '\x2', '\x15A', - '\x15B', '\x5', '\xA3', 'R', '\x2', '\x15B', '\x15C', '\x5', '\xAD', 'W', - '\x2', '\x15C', 'Z', '\x3', '\x2', '\x2', '\x2', '\x15D', '\x15E', '\x5', - '\xA9', 'U', '\x2', '\x15E', '\x15F', '\x5', '\x93', 'J', '\x2', '\x15F', - '\x160', '\x5', '\xB7', '\\', '\x2', '\x160', '\x161', '\x5', '\xB9', - ']', '\x2', '\x161', '\\', '\x3', '\x2', '\x2', '\x2', '\x162', '\x163', - '\x5', '\xA9', 'U', '\x2', '\x163', '\x164', '\x5', '\x9B', 'N', '\x2', - '\x164', '\x165', '\x5', '\x9D', 'O', '\x2', '\x165', '\x166', '\x5', - '\xB9', ']', '\x2', '\x166', '^', '\x3', '\x2', '\x2', '\x2', '\x167', - '\x168', '\x5', '\xA9', 'U', '\x2', '\x168', '\x169', '\x5', '\xA3', 'R', - '\x2', '\x169', '\x16A', '\x5', '\xA7', 'T', '\x2', '\x16A', '\x16B', - '\x5', '\x9B', 'N', '\x2', '\x16B', '`', '\x3', '\x2', '\x2', '\x2', '\x16C', - '\x16D', '\x5', '\xA9', 'U', '\x2', '\x16D', '\x16E', '\x5', '\xA3', 'R', - '\x2', '\x16E', '\x16F', '\x5', '\xAB', 'V', '\x2', '\x16F', '\x170', - '\x5', '\xA3', 'R', '\x2', '\x170', '\x171', '\x5', '\xB9', ']', '\x2', - '\x171', '\x62', '\x3', '\x2', '\x2', '\x2', '\x172', '\x173', '\x5', - '\xAD', 'W', '\x2', '\x173', '\x174', '\x5', '\xAF', 'X', '\x2', '\x174', - '\x175', '\x5', '\xB9', ']', '\x2', '\x175', '\x64', '\x3', '\x2', '\x2', - '\x2', '\x176', '\x177', '\a', 'p', '\x2', '\x2', '\x177', '\x178', '\a', - 'w', '\x2', '\x2', '\x178', '\x179', '\a', 'n', '\x2', '\x2', '\x179', - '\x17A', '\a', 'n', '\x2', '\x2', '\x17A', '\x66', '\x3', '\x2', '\x2', - '\x2', '\x17B', '\x17C', '\x5', '\xAF', 'X', '\x2', '\x17C', '\x17D', - '\x5', '\x9D', 'O', '\x2', '\x17D', '\x17E', '\x5', '\x9D', 'O', '\x2', - '\x17E', '\x17F', '\x5', '\xB7', '\\', '\x2', '\x17F', '\x180', '\x5', - '\x9B', 'N', '\x2', '\x180', '\x181', '\x5', '\xB9', ']', '\x2', '\x181', - 'h', '\x3', '\x2', '\x2', '\x2', '\x182', '\x183', '\x5', '\xAF', 'X', - '\x2', '\x183', '\x184', '\x5', '\xB5', '[', '\x2', '\x184', 'j', '\x3', - '\x2', '\x2', '\x2', '\x185', '\x186', '\x5', '\xAF', 'X', '\x2', '\x186', - '\x187', '\x5', '\xB5', '[', '\x2', '\x187', '\x188', '\x5', '\x99', 'M', - '\x2', '\x188', '\x189', '\x5', '\x9B', 'N', '\x2', '\x189', '\x18A', - '\x5', '\xB5', '[', '\x2', '\x18A', 'l', '\x3', '\x2', '\x2', '\x2', '\x18B', - '\x18C', '\x5', '\xB5', '[', '\x2', '\x18C', '\x18D', '\x5', '\xA3', 'R', - '\x2', '\x18D', '\x18E', '\x5', '\x9F', 'P', '\x2', '\x18E', '\x18F', - '\x5', '\xA1', 'Q', '\x2', '\x18F', '\x190', '\x5', '\xB9', ']', '\x2', - '\x190', 'n', '\x3', '\x2', '\x2', '\x2', '\x191', '\x192', '\x5', '\xB7', - '\\', '\x2', '\x192', '\x193', '\x5', '\x9B', 'N', '\x2', '\x193', '\x194', - '\x5', '\xA9', 'U', '\x2', '\x194', '\x195', '\x5', '\x9B', 'N', '\x2', - '\x195', '\x196', '\x5', '\x97', 'L', '\x2', '\x196', '\x197', '\x5', - '\xB9', ']', '\x2', '\x197', 'p', '\x3', '\x2', '\x2', '\x2', '\x198', - '\x199', '\x5', '\xB9', ']', '\x2', '\x199', '\x19A', '\x5', '\xAF', 'X', - '\x2', '\x19A', '\x19B', '\x5', '\xB1', 'Y', '\x2', '\x19B', 'r', '\x3', - '\x2', '\x2', '\x2', '\x19C', '\x19D', '\a', 'v', '\x2', '\x2', '\x19D', - '\x19E', '\a', 't', '\x2', '\x2', '\x19E', '\x19F', '\a', 'w', '\x2', - '\x2', '\x19F', '\x1A0', '\a', 'g', '\x2', '\x2', '\x1A0', 't', '\x3', - '\x2', '\x2', '\x2', '\x1A1', '\x1A2', '\a', 'w', '\x2', '\x2', '\x1A2', - '\x1A3', '\a', '\x66', '\x2', '\x2', '\x1A3', '\x1A4', '\a', 'h', '\x2', - '\x2', '\x1A4', 'v', '\x3', '\x2', '\x2', '\x2', '\x1A5', '\x1A6', '\a', - 'w', '\x2', '\x2', '\x1A6', '\x1A7', '\a', 'p', '\x2', '\x2', '\x1A7', - '\x1A8', '\a', '\x66', '\x2', '\x2', '\x1A8', '\x1A9', '\a', 'g', '\x2', - '\x2', '\x1A9', '\x1AA', '\a', 'h', '\x2', '\x2', '\x1AA', '\x1AB', '\a', - 'k', '\x2', '\x2', '\x1AB', '\x1AC', '\a', 'p', '\x2', '\x2', '\x1AC', - '\x1AD', '\a', 'g', '\x2', '\x2', '\x1AD', '\x1AE', '\a', '\x66', '\x2', - '\x2', '\x1AE', 'x', '\x3', '\x2', '\x2', '\x2', '\x1AF', '\x1B0', '\x5', - '\xBD', '_', '\x2', '\x1B0', '\x1B1', '\x5', '\x93', 'J', '\x2', '\x1B1', - '\x1B2', '\x5', '\xA9', 'U', '\x2', '\x1B2', '\x1B3', '\x5', '\xBB', '^', - '\x2', '\x1B3', '\x1B4', '\x5', '\x9B', 'N', '\x2', '\x1B4', 'z', '\x3', - '\x2', '\x2', '\x2', '\x1B5', '\x1B6', '\x5', '\xBF', '`', '\x2', '\x1B6', - '\x1B7', '\x5', '\xA1', 'Q', '\x2', '\x1B7', '\x1B8', '\x5', '\x9B', 'N', - '\x2', '\x1B8', '\x1B9', '\x5', '\xB5', '[', '\x2', '\x1B9', '\x1BA', - '\x5', '\x9B', 'N', '\x2', '\x1BA', '|', '\x3', '\x2', '\x2', '\x2', '\x1BB', - '\x1BD', '\t', '\x2', '\x2', '\x2', '\x1BC', '\x1BB', '\x3', '\x2', '\x2', - '\x2', '\x1BD', '\x1BE', '\x3', '\x2', '\x2', '\x2', '\x1BE', '\x1BC', - '\x3', '\x2', '\x2', '\x2', '\x1BE', '\x1BF', '\x3', '\x2', '\x2', '\x2', - '\x1BF', '\x1C0', '\x3', '\x2', '\x2', '\x2', '\x1C0', '\x1C1', '\b', - '?', '\x2', '\x2', '\x1C1', '~', '\x3', '\x2', '\x2', '\x2', '\x1C2', - '\x1C4', '\t', '\x3', '\x2', '\x2', '\x1C3', '\x1C2', '\x3', '\x2', '\x2', - '\x2', '\x1C3', '\x1C4', '\x3', '\x2', '\x2', '\x2', '\x1C4', '\x1C6', - '\x3', '\x2', '\x2', '\x2', '\x1C5', '\x1C7', '\x5', '\x91', 'I', '\x2', - '\x1C6', '\x1C5', '\x3', '\x2', '\x2', '\x2', '\x1C7', '\x1C8', '\x3', - '\x2', '\x2', '\x2', '\x1C8', '\x1C6', '\x3', '\x2', '\x2', '\x2', '\x1C8', - '\x1C9', '\x3', '\x2', '\x2', '\x2', '\x1C9', '\x1D1', '\x3', '\x2', '\x2', - '\x2', '\x1CA', '\x1CE', '\a', '\x30', '\x2', '\x2', '\x1CB', '\x1CD', - '\x5', '\x91', 'I', '\x2', '\x1CC', '\x1CB', '\x3', '\x2', '\x2', '\x2', - '\x1CD', '\x1D0', '\x3', '\x2', '\x2', '\x2', '\x1CE', '\x1CC', '\x3', - '\x2', '\x2', '\x2', '\x1CE', '\x1CF', '\x3', '\x2', '\x2', '\x2', '\x1CF', - '\x1D2', '\x3', '\x2', '\x2', '\x2', '\x1D0', '\x1CE', '\x3', '\x2', '\x2', - '\x2', '\x1D1', '\x1CA', '\x3', '\x2', '\x2', '\x2', '\x1D1', '\x1D2', - '\x3', '\x2', '\x2', '\x2', '\x1D2', '\x1DC', '\x3', '\x2', '\x2', '\x2', - '\x1D3', '\x1D5', '\x5', '\x9B', 'N', '\x2', '\x1D4', '\x1D6', '\t', '\x3', - '\x2', '\x2', '\x1D5', '\x1D4', '\x3', '\x2', '\x2', '\x2', '\x1D5', '\x1D6', - '\x3', '\x2', '\x2', '\x2', '\x1D6', '\x1D8', '\x3', '\x2', '\x2', '\x2', - '\x1D7', '\x1D9', '\x5', '\x91', 'I', '\x2', '\x1D8', '\x1D7', '\x3', - '\x2', '\x2', '\x2', '\x1D9', '\x1DA', '\x3', '\x2', '\x2', '\x2', '\x1DA', - '\x1D8', '\x3', '\x2', '\x2', '\x2', '\x1DA', '\x1DB', '\x3', '\x2', '\x2', - '\x2', '\x1DB', '\x1DD', '\x3', '\x2', '\x2', '\x2', '\x1DC', '\x1D3', - '\x3', '\x2', '\x2', '\x2', '\x1DC', '\x1DD', '\x3', '\x2', '\x2', '\x2', - '\x1DD', '\x1F3', '\x3', '\x2', '\x2', '\x2', '\x1DE', '\x1E0', '\t', - '\x3', '\x2', '\x2', '\x1DF', '\x1DE', '\x3', '\x2', '\x2', '\x2', '\x1DF', - '\x1E0', '\x3', '\x2', '\x2', '\x2', '\x1E0', '\x1E1', '\x3', '\x2', '\x2', - '\x2', '\x1E1', '\x1E3', '\a', '\x30', '\x2', '\x2', '\x1E2', '\x1E4', - '\x5', '\x91', 'I', '\x2', '\x1E3', '\x1E2', '\x3', '\x2', '\x2', '\x2', - '\x1E4', '\x1E5', '\x3', '\x2', '\x2', '\x2', '\x1E5', '\x1E3', '\x3', - '\x2', '\x2', '\x2', '\x1E5', '\x1E6', '\x3', '\x2', '\x2', '\x2', '\x1E6', - '\x1F0', '\x3', '\x2', '\x2', '\x2', '\x1E7', '\x1E9', '\x5', '\x9B', - 'N', '\x2', '\x1E8', '\x1EA', '\t', '\x3', '\x2', '\x2', '\x1E9', '\x1E8', - '\x3', '\x2', '\x2', '\x2', '\x1E9', '\x1EA', '\x3', '\x2', '\x2', '\x2', - '\x1EA', '\x1EC', '\x3', '\x2', '\x2', '\x2', '\x1EB', '\x1ED', '\x5', - '\x91', 'I', '\x2', '\x1EC', '\x1EB', '\x3', '\x2', '\x2', '\x2', '\x1ED', - '\x1EE', '\x3', '\x2', '\x2', '\x2', '\x1EE', '\x1EC', '\x3', '\x2', '\x2', - '\x2', '\x1EE', '\x1EF', '\x3', '\x2', '\x2', '\x2', '\x1EF', '\x1F1', - '\x3', '\x2', '\x2', '\x2', '\x1F0', '\x1E7', '\x3', '\x2', '\x2', '\x2', - '\x1F0', '\x1F1', '\x3', '\x2', '\x2', '\x2', '\x1F1', '\x1F3', '\x3', - '\x2', '\x2', '\x2', '\x1F2', '\x1C3', '\x3', '\x2', '\x2', '\x2', '\x1F2', - '\x1DF', '\x3', '\x2', '\x2', '\x2', '\x1F3', '\x80', '\x3', '\x2', '\x2', - '\x2', '\x1F4', '\x1F9', '\a', '$', '\x2', '\x2', '\x1F5', '\x1F8', '\x5', - '\x83', '\x42', '\x2', '\x1F6', '\x1F8', '\x5', '\x8B', '\x46', '\x2', - '\x1F7', '\x1F5', '\x3', '\x2', '\x2', '\x2', '\x1F7', '\x1F6', '\x3', - '\x2', '\x2', '\x2', '\x1F8', '\x1FB', '\x3', '\x2', '\x2', '\x2', '\x1F9', - '\x1F7', '\x3', '\x2', '\x2', '\x2', '\x1F9', '\x1FA', '\x3', '\x2', '\x2', - '\x2', '\x1FA', '\x1FC', '\x3', '\x2', '\x2', '\x2', '\x1FB', '\x1F9', - '\x3', '\x2', '\x2', '\x2', '\x1FC', '\x207', '\a', '$', '\x2', '\x2', - '\x1FD', '\x202', '\a', ')', '\x2', '\x2', '\x1FE', '\x201', '\x5', '\x83', - '\x42', '\x2', '\x1FF', '\x201', '\x5', '\x89', '\x45', '\x2', '\x200', - '\x1FE', '\x3', '\x2', '\x2', '\x2', '\x200', '\x1FF', '\x3', '\x2', '\x2', - '\x2', '\x201', '\x204', '\x3', '\x2', '\x2', '\x2', '\x202', '\x200', - '\x3', '\x2', '\x2', '\x2', '\x202', '\x203', '\x3', '\x2', '\x2', '\x2', - '\x203', '\x205', '\x3', '\x2', '\x2', '\x2', '\x204', '\x202', '\x3', - '\x2', '\x2', '\x2', '\x205', '\x207', '\a', ')', '\x2', '\x2', '\x206', - '\x1F4', '\x3', '\x2', '\x2', '\x2', '\x206', '\x1FD', '\x3', '\x2', '\x2', - '\x2', '\x207', '\x82', '\x3', '\x2', '\x2', '\x2', '\x208', '\x20B', - '\a', '^', '\x2', '\x2', '\x209', '\x20C', '\t', '\x4', '\x2', '\x2', - '\x20A', '\x20C', '\x5', '\x85', '\x43', '\x2', '\x20B', '\x209', '\x3', - '\x2', '\x2', '\x2', '\x20B', '\x20A', '\x3', '\x2', '\x2', '\x2', '\x20C', - '\x84', '\x3', '\x2', '\x2', '\x2', '\x20D', '\x20E', '\a', 'w', '\x2', - '\x2', '\x20E', '\x20F', '\x5', '\x87', '\x44', '\x2', '\x20F', '\x210', - '\x5', '\x87', '\x44', '\x2', '\x210', '\x211', '\x5', '\x87', '\x44', - '\x2', '\x211', '\x212', '\x5', '\x87', '\x44', '\x2', '\x212', '\x86', - '\x3', '\x2', '\x2', '\x2', '\x213', '\x214', '\t', '\x5', '\x2', '\x2', - '\x214', '\x88', '\x3', '\x2', '\x2', '\x2', '\x215', '\x216', '\n', '\x6', - '\x2', '\x2', '\x216', '\x8A', '\x3', '\x2', '\x2', '\x2', '\x217', '\x218', - '\n', '\a', '\x2', '\x2', '\x218', '\x8C', '\x3', '\x2', '\x2', '\x2', - '\x219', '\x223', '\x3', '\x2', '\x2', '\x2', '\x21A', '\x21F', '\t', - '\b', '\x2', '\x2', '\x21B', '\x21E', '\t', '\b', '\x2', '\x2', '\x21C', - '\x21E', '\x5', '\x91', 'I', '\x2', '\x21D', '\x21B', '\x3', '\x2', '\x2', - '\x2', '\x21D', '\x21C', '\x3', '\x2', '\x2', '\x2', '\x21E', '\x221', - '\x3', '\x2', '\x2', '\x2', '\x21F', '\x21D', '\x3', '\x2', '\x2', '\x2', - '\x21F', '\x220', '\x3', '\x2', '\x2', '\x2', '\x220', '\x223', '\x3', - '\x2', '\x2', '\x2', '\x221', '\x21F', '\x3', '\x2', '\x2', '\x2', '\x222', - '\x219', '\x3', '\x2', '\x2', '\x2', '\x222', '\x21A', '\x3', '\x2', '\x2', - '\x2', '\x223', '\x8E', '\x3', '\x2', '\x2', '\x2', '\x224', '\x225', - '\a', '\x42', '\x2', '\x2', '\x225', '\x226', '\x5', '\x8D', 'G', '\x2', - '\x226', '\x90', '\x3', '\x2', '\x2', '\x2', '\x227', '\x228', '\t', '\t', - '\x2', '\x2', '\x228', '\x92', '\x3', '\x2', '\x2', '\x2', '\x229', '\x22A', - '\t', '\n', '\x2', '\x2', '\x22A', '\x94', '\x3', '\x2', '\x2', '\x2', - '\x22B', '\x22C', '\t', '\v', '\x2', '\x2', '\x22C', '\x96', '\x3', '\x2', - '\x2', '\x2', '\x22D', '\x22E', '\t', '\f', '\x2', '\x2', '\x22E', '\x98', - '\x3', '\x2', '\x2', '\x2', '\x22F', '\x230', '\t', '\r', '\x2', '\x2', - '\x230', '\x9A', '\x3', '\x2', '\x2', '\x2', '\x231', '\x232', '\t', '\xE', - '\x2', '\x2', '\x232', '\x9C', '\x3', '\x2', '\x2', '\x2', '\x233', '\x234', - '\t', '\xF', '\x2', '\x2', '\x234', '\x9E', '\x3', '\x2', '\x2', '\x2', - '\x235', '\x236', '\t', '\x10', '\x2', '\x2', '\x236', '\xA0', '\x3', - '\x2', '\x2', '\x2', '\x237', '\x238', '\t', '\x11', '\x2', '\x2', '\x238', - '\xA2', '\x3', '\x2', '\x2', '\x2', '\x239', '\x23A', '\t', '\x12', '\x2', - '\x2', '\x23A', '\xA4', '\x3', '\x2', '\x2', '\x2', '\x23B', '\x23C', - '\t', '\x13', '\x2', '\x2', '\x23C', '\xA6', '\x3', '\x2', '\x2', '\x2', - '\x23D', '\x23E', '\t', '\x14', '\x2', '\x2', '\x23E', '\xA8', '\x3', - '\x2', '\x2', '\x2', '\x23F', '\x240', '\t', '\x15', '\x2', '\x2', '\x240', - '\xAA', '\x3', '\x2', '\x2', '\x2', '\x241', '\x242', '\t', '\x16', '\x2', - '\x2', '\x242', '\xAC', '\x3', '\x2', '\x2', '\x2', '\x243', '\x244', - '\t', '\x17', '\x2', '\x2', '\x244', '\xAE', '\x3', '\x2', '\x2', '\x2', - '\x245', '\x246', '\t', '\x18', '\x2', '\x2', '\x246', '\xB0', '\x3', - '\x2', '\x2', '\x2', '\x247', '\x248', '\t', '\x19', '\x2', '\x2', '\x248', - '\xB2', '\x3', '\x2', '\x2', '\x2', '\x249', '\x24A', '\t', '\x1A', '\x2', - '\x2', '\x24A', '\xB4', '\x3', '\x2', '\x2', '\x2', '\x24B', '\x24C', - '\t', '\x1B', '\x2', '\x2', '\x24C', '\xB6', '\x3', '\x2', '\x2', '\x2', - '\x24D', '\x24E', '\t', '\x1C', '\x2', '\x2', '\x24E', '\xB8', '\x3', - '\x2', '\x2', '\x2', '\x24F', '\x250', '\t', '\x1D', '\x2', '\x2', '\x250', - '\xBA', '\x3', '\x2', '\x2', '\x2', '\x251', '\x252', '\t', '\x1E', '\x2', - '\x2', '\x252', '\xBC', '\x3', '\x2', '\x2', '\x2', '\x253', '\x254', - '\t', '\x1F', '\x2', '\x2', '\x254', '\xBE', '\x3', '\x2', '\x2', '\x2', - '\x255', '\x256', '\t', ' ', '\x2', '\x2', '\x256', '\xC0', '\x3', '\x2', - '\x2', '\x2', '\x257', '\x258', '\t', '!', '\x2', '\x2', '\x258', '\xC2', - '\x3', '\x2', '\x2', '\x2', '\x259', '\x25A', '\t', '\"', '\x2', '\x2', - '\x25A', '\xC4', '\x3', '\x2', '\x2', '\x2', '\x25B', '\x25C', '\t', '#', - '\x2', '\x2', '\x25C', '\xC6', '\x3', '\x2', '\x2', '\x2', '\x1A', '\x2', - '\x1BE', '\x1C3', '\x1C8', '\x1CE', '\x1D1', '\x1D5', '\x1DA', '\x1DC', - '\x1DF', '\x1E5', '\x1E9', '\x1EE', '\x1F0', '\x1F2', '\x1F7', '\x1F9', - '\x200', '\x202', '\x206', '\x20B', '\x21D', '\x21F', '\x222', '\x3', + '\xC3', '\x2', '\xC5', '\x2', '\xC7', '\x2', '\x3', '\x2', '$', '\x5', + '\x2', '\v', '\f', '\xF', '\xF', '\"', '\"', '\x4', '\x2', '-', '-', '/', + '/', '\n', '\x2', '$', '$', '\x31', '\x31', '^', '^', '\x64', '\x64', + 'h', 'h', 'p', 'p', 't', 't', 'v', 'v', '\x5', '\x2', '\x32', ';', '\x43', + 'H', '\x63', 'h', '\x5', '\x2', '\x2', '!', ')', ')', '^', '^', '\x5', + '\x2', '\x2', '!', '$', '$', '^', '^', '\x5', '\x2', '\x43', '\\', '\x61', + '\x61', '\x63', '|', '\x3', '\x2', '\x32', ';', '\x4', '\x2', '\x43', + '\x43', '\x63', '\x63', '\x4', '\x2', '\x44', '\x44', '\x64', '\x64', + '\x4', '\x2', '\x45', '\x45', '\x65', '\x65', '\x4', '\x2', '\x46', '\x46', + '\x66', '\x66', '\x4', '\x2', 'G', 'G', 'g', 'g', '\x4', '\x2', 'H', 'H', + 'h', 'h', '\x4', '\x2', 'I', 'I', 'i', 'i', '\x4', '\x2', 'J', 'J', 'j', + 'j', '\x4', '\x2', 'K', 'K', 'k', 'k', '\x4', '\x2', 'L', 'L', 'l', 'l', + '\x4', '\x2', 'M', 'M', 'm', 'm', '\x4', '\x2', 'N', 'N', 'n', 'n', '\x4', + '\x2', 'O', 'O', 'o', 'o', '\x4', '\x2', 'P', 'P', 'p', 'p', '\x4', '\x2', + 'Q', 'Q', 'q', 'q', '\x4', '\x2', 'R', 'R', 'r', 'r', '\x4', '\x2', 'S', + 'S', 's', 's', '\x4', '\x2', 'T', 'T', 't', 't', '\x4', '\x2', 'U', 'U', + 'u', 'u', '\x4', '\x2', 'V', 'V', 'v', 'v', '\x4', '\x2', 'W', 'W', 'w', + 'w', '\x4', '\x2', 'X', 'X', 'x', 'x', '\x4', '\x2', 'Y', 'Y', 'y', 'y', + '\x4', '\x2', 'Z', 'Z', 'z', 'z', '\x4', '\x2', '[', '[', '{', '{', '\x4', + '\x2', '\\', '\\', '|', '|', '\x2', '\x25A', '\x2', '\x3', '\x3', '\x2', + '\x2', '\x2', '\x2', '\x5', '\x3', '\x2', '\x2', '\x2', '\x2', '\a', '\x3', + '\x2', '\x2', '\x2', '\x2', '\t', '\x3', '\x2', '\x2', '\x2', '\x2', '\v', + '\x3', '\x2', '\x2', '\x2', '\x2', '\r', '\x3', '\x2', '\x2', '\x2', '\x2', + '\xF', '\x3', '\x2', '\x2', '\x2', '\x2', '\x11', '\x3', '\x2', '\x2', + '\x2', '\x2', '\x13', '\x3', '\x2', '\x2', '\x2', '\x2', '\x15', '\x3', + '\x2', '\x2', '\x2', '\x2', '\x17', '\x3', '\x2', '\x2', '\x2', '\x2', + '\x19', '\x3', '\x2', '\x2', '\x2', '\x2', '\x1B', '\x3', '\x2', '\x2', + '\x2', '\x2', '\x1D', '\x3', '\x2', '\x2', '\x2', '\x2', '\x1F', '\x3', + '\x2', '\x2', '\x2', '\x2', '!', '\x3', '\x2', '\x2', '\x2', '\x2', '#', + '\x3', '\x2', '\x2', '\x2', '\x2', '%', '\x3', '\x2', '\x2', '\x2', '\x2', + '\'', '\x3', '\x2', '\x2', '\x2', '\x2', ')', '\x3', '\x2', '\x2', '\x2', + '\x2', '+', '\x3', '\x2', '\x2', '\x2', '\x2', '-', '\x3', '\x2', '\x2', + '\x2', '\x2', '/', '\x3', '\x2', '\x2', '\x2', '\x2', '\x31', '\x3', '\x2', + '\x2', '\x2', '\x2', '\x33', '\x3', '\x2', '\x2', '\x2', '\x2', '\x35', + '\x3', '\x2', '\x2', '\x2', '\x2', '\x37', '\x3', '\x2', '\x2', '\x2', + '\x2', '\x39', '\x3', '\x2', '\x2', '\x2', '\x2', ';', '\x3', '\x2', '\x2', + '\x2', '\x2', '=', '\x3', '\x2', '\x2', '\x2', '\x2', '?', '\x3', '\x2', + '\x2', '\x2', '\x2', '\x41', '\x3', '\x2', '\x2', '\x2', '\x2', '\x43', + '\x3', '\x2', '\x2', '\x2', '\x2', '\x45', '\x3', '\x2', '\x2', '\x2', + '\x2', 'G', '\x3', '\x2', '\x2', '\x2', '\x2', 'I', '\x3', '\x2', '\x2', + '\x2', '\x2', 'K', '\x3', '\x2', '\x2', '\x2', '\x2', 'M', '\x3', '\x2', + '\x2', '\x2', '\x2', 'O', '\x3', '\x2', '\x2', '\x2', '\x2', 'Q', '\x3', + '\x2', '\x2', '\x2', '\x2', 'S', '\x3', '\x2', '\x2', '\x2', '\x2', 'U', + '\x3', '\x2', '\x2', '\x2', '\x2', 'W', '\x3', '\x2', '\x2', '\x2', '\x2', + 'Y', '\x3', '\x2', '\x2', '\x2', '\x2', '[', '\x3', '\x2', '\x2', '\x2', + '\x2', ']', '\x3', '\x2', '\x2', '\x2', '\x2', '_', '\x3', '\x2', '\x2', + '\x2', '\x2', '\x61', '\x3', '\x2', '\x2', '\x2', '\x2', '\x63', '\x3', + '\x2', '\x2', '\x2', '\x2', '\x65', '\x3', '\x2', '\x2', '\x2', '\x2', + 'g', '\x3', '\x2', '\x2', '\x2', '\x2', 'i', '\x3', '\x2', '\x2', '\x2', + '\x2', 'k', '\x3', '\x2', '\x2', '\x2', '\x2', 'm', '\x3', '\x2', '\x2', + '\x2', '\x2', 'o', '\x3', '\x2', '\x2', '\x2', '\x2', 'q', '\x3', '\x2', + '\x2', '\x2', '\x2', 's', '\x3', '\x2', '\x2', '\x2', '\x2', 'u', '\x3', + '\x2', '\x2', '\x2', '\x2', 'w', '\x3', '\x2', '\x2', '\x2', '\x2', 'y', + '\x3', '\x2', '\x2', '\x2', '\x2', '{', '\x3', '\x2', '\x2', '\x2', '\x2', + '}', '\x3', '\x2', '\x2', '\x2', '\x2', '\x7F', '\x3', '\x2', '\x2', '\x2', + '\x2', '\x81', '\x3', '\x2', '\x2', '\x2', '\x2', '\x83', '\x3', '\x2', + '\x2', '\x2', '\x2', '\x8F', '\x3', '\x2', '\x2', '\x2', '\x2', '\x91', + '\x3', '\x2', '\x2', '\x2', '\x3', '\xC9', '\x3', '\x2', '\x2', '\x2', + '\x5', '\xCB', '\x3', '\x2', '\x2', '\x2', '\a', '\xCD', '\x3', '\x2', + '\x2', '\x2', '\t', '\xCF', '\x3', '\x2', '\x2', '\x2', '\v', '\xD1', + '\x3', '\x2', '\x2', '\x2', '\r', '\xD3', '\x3', '\x2', '\x2', '\x2', + '\xF', '\xD5', '\x3', '\x2', '\x2', '\x2', '\x11', '\xD7', '\x3', '\x2', + '\x2', '\x2', '\x13', '\xD9', '\x3', '\x2', '\x2', '\x2', '\x15', '\xDB', + '\x3', '\x2', '\x2', '\x2', '\x17', '\xDE', '\x3', '\x2', '\x2', '\x2', + '\x19', '\xE0', '\x3', '\x2', '\x2', '\x2', '\x1B', '\xE2', '\x3', '\x2', + '\x2', '\x2', '\x1D', '\xE4', '\x3', '\x2', '\x2', '\x2', '\x1F', '\xE6', + '\x3', '\x2', '\x2', '\x2', '!', '\xE8', '\x3', '\x2', '\x2', '\x2', '#', + '\xEA', '\x3', '\x2', '\x2', '\x2', '%', '\xED', '\x3', '\x2', '\x2', + '\x2', '\'', '\xF0', '\x3', '\x2', '\x2', '\x2', ')', '\xF2', '\x3', '\x2', + '\x2', '\x2', '+', '\xF5', '\x3', '\x2', '\x2', '\x2', '-', '\xF7', '\x3', + '\x2', '\x2', '\x2', '/', '\xF9', '\x3', '\x2', '\x2', '\x2', '\x31', + '\xFB', '\x3', '\x2', '\x2', '\x2', '\x33', '\xFE', '\x3', '\x2', '\x2', + '\x2', '\x35', '\x100', '\x3', '\x2', '\x2', '\x2', '\x37', '\x102', '\x3', + '\x2', '\x2', '\x2', '\x39', '\x104', '\x3', '\x2', '\x2', '\x2', ';', + '\x108', '\x3', '\x2', '\x2', '\x2', '=', '\x10C', '\x3', '\x2', '\x2', + '\x2', '?', '\x112', '\x3', '\x2', '\x2', '\x2', '\x41', '\x115', '\x3', + '\x2', '\x2', '\x2', '\x43', '\x119', '\x3', '\x2', '\x2', '\x2', '\x45', + '\x121', '\x3', '\x2', '\x2', '\x2', 'G', '\x124', '\x3', '\x2', '\x2', + '\x2', 'I', '\x129', '\x3', '\x2', '\x2', '\x2', 'K', '\x132', '\x3', + '\x2', '\x2', '\x2', 'M', '\x139', '\x3', '\x2', '\x2', '\x2', 'O', '\x140', + '\x3', '\x2', '\x2', '\x2', 'Q', '\x146', '\x3', '\x2', '\x2', '\x2', + 'S', '\x14C', '\x3', '\x2', '\x2', '\x2', 'U', '\x151', '\x3', '\x2', + '\x2', '\x2', 'W', '\x157', '\x3', '\x2', '\x2', '\x2', 'Y', '\x15A', + '\x3', '\x2', '\x2', '\x2', '[', '\x15F', '\x3', '\x2', '\x2', '\x2', + ']', '\x164', '\x3', '\x2', '\x2', '\x2', '_', '\x169', '\x3', '\x2', + '\x2', '\x2', '\x61', '\x16E', '\x3', '\x2', '\x2', '\x2', '\x63', '\x174', + '\x3', '\x2', '\x2', '\x2', '\x65', '\x178', '\x3', '\x2', '\x2', '\x2', + 'g', '\x17D', '\x3', '\x2', '\x2', '\x2', 'i', '\x184', '\x3', '\x2', + '\x2', '\x2', 'k', '\x187', '\x3', '\x2', '\x2', '\x2', 'm', '\x18D', + '\x3', '\x2', '\x2', '\x2', 'o', '\x192', '\x3', '\x2', '\x2', '\x2', + 'q', '\x198', '\x3', '\x2', '\x2', '\x2', 's', '\x19F', '\x3', '\x2', + '\x2', '\x2', 'u', '\x1A3', '\x3', '\x2', '\x2', '\x2', 'w', '\x1A8', + '\x3', '\x2', '\x2', '\x2', 'y', '\x1AC', '\x3', '\x2', '\x2', '\x2', + '{', '\x1B6', '\x3', '\x2', '\x2', '\x2', '}', '\x1BC', '\x3', '\x2', + '\x2', '\x2', '\x7F', '\x1C3', '\x3', '\x2', '\x2', '\x2', '\x81', '\x1F9', + '\x3', '\x2', '\x2', '\x2', '\x83', '\x20D', '\x3', '\x2', '\x2', '\x2', + '\x85', '\x20F', '\x3', '\x2', '\x2', '\x2', '\x87', '\x214', '\x3', '\x2', + '\x2', '\x2', '\x89', '\x21A', '\x3', '\x2', '\x2', '\x2', '\x8B', '\x21C', + '\x3', '\x2', '\x2', '\x2', '\x8D', '\x21E', '\x3', '\x2', '\x2', '\x2', + '\x8F', '\x229', '\x3', '\x2', '\x2', '\x2', '\x91', '\x22B', '\x3', '\x2', + '\x2', '\x2', '\x93', '\x22E', '\x3', '\x2', '\x2', '\x2', '\x95', '\x230', + '\x3', '\x2', '\x2', '\x2', '\x97', '\x232', '\x3', '\x2', '\x2', '\x2', + '\x99', '\x234', '\x3', '\x2', '\x2', '\x2', '\x9B', '\x236', '\x3', '\x2', + '\x2', '\x2', '\x9D', '\x238', '\x3', '\x2', '\x2', '\x2', '\x9F', '\x23A', + '\x3', '\x2', '\x2', '\x2', '\xA1', '\x23C', '\x3', '\x2', '\x2', '\x2', + '\xA3', '\x23E', '\x3', '\x2', '\x2', '\x2', '\xA5', '\x240', '\x3', '\x2', + '\x2', '\x2', '\xA7', '\x242', '\x3', '\x2', '\x2', '\x2', '\xA9', '\x244', + '\x3', '\x2', '\x2', '\x2', '\xAB', '\x246', '\x3', '\x2', '\x2', '\x2', + '\xAD', '\x248', '\x3', '\x2', '\x2', '\x2', '\xAF', '\x24A', '\x3', '\x2', + '\x2', '\x2', '\xB1', '\x24C', '\x3', '\x2', '\x2', '\x2', '\xB3', '\x24E', + '\x3', '\x2', '\x2', '\x2', '\xB5', '\x250', '\x3', '\x2', '\x2', '\x2', + '\xB7', '\x252', '\x3', '\x2', '\x2', '\x2', '\xB9', '\x254', '\x3', '\x2', + '\x2', '\x2', '\xBB', '\x256', '\x3', '\x2', '\x2', '\x2', '\xBD', '\x258', + '\x3', '\x2', '\x2', '\x2', '\xBF', '\x25A', '\x3', '\x2', '\x2', '\x2', + '\xC1', '\x25C', '\x3', '\x2', '\x2', '\x2', '\xC3', '\x25E', '\x3', '\x2', + '\x2', '\x2', '\xC5', '\x260', '\x3', '\x2', '\x2', '\x2', '\xC7', '\x262', + '\x3', '\x2', '\x2', '\x2', '\xC9', '\xCA', '\a', ',', '\x2', '\x2', '\xCA', + '\x4', '\x3', '\x2', '\x2', '\x2', '\xCB', '\xCC', '\a', '.', '\x2', '\x2', + '\xCC', '\x6', '\x3', '\x2', '\x2', '\x2', '\xCD', '\xCE', '\a', '*', + '\x2', '\x2', '\xCE', '\b', '\x3', '\x2', '\x2', '\x2', '\xCF', '\xD0', + '\a', '+', '\x2', '\x2', '\xD0', '\n', '\x3', '\x2', '\x2', '\x2', '\xD1', + '\xD2', '\a', '\x30', '\x2', '\x2', '\xD2', '\f', '\x3', '\x2', '\x2', + '\x2', '\xD3', '\xD4', '\a', ']', '\x2', '\x2', '\xD4', '\xE', '\x3', + '\x2', '\x2', '\x2', '\xD5', '\xD6', '\a', '_', '\x2', '\x2', '\xD6', + '\x10', '\x3', '\x2', '\x2', '\x2', '\xD7', '\xD8', '\a', '\x41', '\x2', + '\x2', '\xD8', '\x12', '\x3', '\x2', '\x2', '\x2', '\xD9', '\xDA', '\a', + '<', '\x2', '\x2', '\xDA', '\x14', '\x3', '\x2', '\x2', '\x2', '\xDB', + '\xDC', '\a', '\x41', '\x2', '\x2', '\xDC', '\xDD', '\a', '\x41', '\x2', + '\x2', '\xDD', '\x16', '\x3', '\x2', '\x2', '\x2', '\xDE', '\xDF', '\a', + '\x31', '\x2', '\x2', '\xDF', '\x18', '\x3', '\x2', '\x2', '\x2', '\xE0', + '\xE1', '\a', '\'', '\x2', '\x2', '\xE1', '\x1A', '\x3', '\x2', '\x2', + '\x2', '\xE2', '\xE3', '\a', '-', '\x2', '\x2', '\xE3', '\x1C', '\x3', + '\x2', '\x2', '\x2', '\xE4', '\xE5', '\a', '/', '\x2', '\x2', '\xE5', + '\x1E', '\x3', '\x2', '\x2', '\x2', '\xE6', '\xE7', '\a', '>', '\x2', + '\x2', '\xE7', ' ', '\x3', '\x2', '\x2', '\x2', '\xE8', '\xE9', '\a', + '@', '\x2', '\x2', '\xE9', '\"', '\x3', '\x2', '\x2', '\x2', '\xEA', '\xEB', + '\a', '@', '\x2', '\x2', '\xEB', '\xEC', '\a', '?', '\x2', '\x2', '\xEC', + '$', '\x3', '\x2', '\x2', '\x2', '\xED', '\xEE', '\a', '>', '\x2', '\x2', + '\xEE', '\xEF', '\a', '?', '\x2', '\x2', '\xEF', '&', '\x3', '\x2', '\x2', + '\x2', '\xF0', '\xF1', '\a', '?', '\x2', '\x2', '\xF1', '(', '\x3', '\x2', + '\x2', '\x2', '\xF2', '\xF3', '\a', '#', '\x2', '\x2', '\xF3', '\xF4', + '\a', '?', '\x2', '\x2', '\xF4', '*', '\x3', '\x2', '\x2', '\x2', '\xF5', + '\xF6', '\a', '(', '\x2', '\x2', '\xF6', ',', '\x3', '\x2', '\x2', '\x2', + '\xF7', '\xF8', '\a', '`', '\x2', '\x2', '\xF8', '.', '\x3', '\x2', '\x2', + '\x2', '\xF9', '\xFA', '\a', '~', '\x2', '\x2', '\xFA', '\x30', '\x3', + '\x2', '\x2', '\x2', '\xFB', '\xFC', '\a', '~', '\x2', '\x2', '\xFC', + '\xFD', '\a', '~', '\x2', '\x2', '\xFD', '\x32', '\x3', '\x2', '\x2', + '\x2', '\xFE', '\xFF', '\a', '\x80', '\x2', '\x2', '\xFF', '\x34', '\x3', + '\x2', '\x2', '\x2', '\x100', '\x101', '\a', '}', '\x2', '\x2', '\x101', + '\x36', '\x3', '\x2', '\x2', '\x2', '\x102', '\x103', '\a', '\x7F', '\x2', + '\x2', '\x103', '\x38', '\x3', '\x2', '\x2', '\x2', '\x104', '\x105', + '\x5', '\x95', 'K', '\x2', '\x105', '\x106', '\x5', '\xAB', 'V', '\x2', + '\x106', '\x107', '\x5', '\xAB', 'V', '\x2', '\x107', ':', '\x3', '\x2', + '\x2', '\x2', '\x108', '\x109', '\x5', '\x95', 'K', '\x2', '\x109', '\x10A', + '\x5', '\xAF', 'X', '\x2', '\x10A', '\x10B', '\x5', '\x9B', 'N', '\x2', + '\x10B', '<', '\x3', '\x2', '\x2', '\x2', '\x10C', '\x10D', '\x5', '\x95', + 'K', '\x2', '\x10D', '\x10E', '\x5', '\xB7', '\\', '\x2', '\x10E', '\x10F', + '\x5', '\xB7', '\\', '\x2', '\x10F', '\x110', '\x5', '\x95', 'K', '\x2', + '\x110', '\x111', '\x5', '\xC5', '\x63', '\x2', '\x111', '>', '\x3', '\x2', + '\x2', '\x2', '\x112', '\x113', '\x5', '\x95', 'K', '\x2', '\x113', '\x114', + '\x5', '\xB9', ']', '\x2', '\x114', '@', '\x3', '\x2', '\x2', '\x2', '\x115', + '\x116', '\x5', '\x95', 'K', '\x2', '\x116', '\x117', '\x5', '\xB9', ']', + '\x2', '\x117', '\x118', '\x5', '\x99', 'M', '\x2', '\x118', '\x42', '\x3', + '\x2', '\x2', '\x2', '\x119', '\x11A', '\x5', '\x97', 'L', '\x2', '\x11A', + '\x11B', '\x5', '\x9D', 'O', '\x2', '\x11B', '\x11C', '\x5', '\xBB', '^', + '\x2', '\x11C', '\x11D', '\x5', '\xC1', '\x61', '\x2', '\x11D', '\x11E', + '\x5', '\x9D', 'O', '\x2', '\x11E', '\x11F', '\x5', '\x9D', 'O', '\x2', + '\x11F', '\x120', '\x5', '\xAF', 'X', '\x2', '\x120', '\x44', '\x3', '\x2', + '\x2', '\x2', '\x121', '\x122', '\x5', '\x97', 'L', '\x2', '\x122', '\x123', + '\x5', '\xC5', '\x63', '\x2', '\x123', '\x46', '\x3', '\x2', '\x2', '\x2', + '\x124', '\x125', '\x5', '\x9B', 'N', '\x2', '\x125', '\x126', '\x5', + '\x9D', 'O', '\x2', '\x126', '\x127', '\x5', '\xB9', ']', '\x2', '\x127', + '\x128', '\x5', '\x99', 'M', '\x2', '\x128', 'H', '\x3', '\x2', '\x2', + '\x2', '\x129', '\x12A', '\x5', '\x9B', 'N', '\x2', '\x12A', '\x12B', + '\x5', '\xA5', 'S', '\x2', '\x12B', '\x12C', '\x5', '\xB9', ']', '\x2', + '\x12C', '\x12D', '\x5', '\xBB', '^', '\x2', '\x12D', '\x12E', '\x5', + '\xA5', 'S', '\x2', '\x12E', '\x12F', '\x5', '\xAF', 'X', '\x2', '\x12F', + '\x130', '\x5', '\x99', 'M', '\x2', '\x130', '\x131', '\x5', '\xBB', '^', + '\x2', '\x131', 'J', '\x3', '\x2', '\x2', '\x2', '\x132', '\x133', '\x5', + '\x9D', 'O', '\x2', '\x133', '\x134', '\x5', '\xB9', ']', '\x2', '\x134', + '\x135', '\x5', '\x99', 'M', '\x2', '\x135', '\x136', '\x5', '\x95', 'K', + '\x2', '\x136', '\x137', '\x5', '\xB3', 'Z', '\x2', '\x137', '\x138', + '\x5', '\x9D', 'O', '\x2', '\x138', 'L', '\x3', '\x2', '\x2', '\x2', '\x139', + '\x13A', '\x5', '\x9D', 'O', '\x2', '\x13A', '\x13B', '\x5', '\xC3', '\x62', + '\x2', '\x13B', '\x13C', '\x5', '\xA5', 'S', '\x2', '\x13C', '\x13D', + '\x5', '\xB9', ']', '\x2', '\x13D', '\x13E', '\x5', '\xBB', '^', '\x2', + '\x13E', '\x13F', '\x5', '\xB9', ']', '\x2', '\x13F', 'N', '\x3', '\x2', + '\x2', '\x2', '\x140', '\x141', '\x5', '\x9F', 'P', '\x2', '\x141', '\x142', + '\x5', '\xA5', 'S', '\x2', '\x142', '\x143', '\x5', '\xB7', '\\', '\x2', + '\x143', '\x144', '\x5', '\xB9', ']', '\x2', '\x144', '\x145', '\x5', + '\xBB', '^', '\x2', '\x145', 'P', '\x3', '\x2', '\x2', '\x2', '\x146', + '\x147', '\a', 'h', '\x2', '\x2', '\x147', '\x148', '\a', '\x63', '\x2', + '\x2', '\x148', '\x149', '\a', 'n', '\x2', '\x2', '\x149', '\x14A', '\a', + 'u', '\x2', '\x2', '\x14A', '\x14B', '\a', 'g', '\x2', '\x2', '\x14B', + 'R', '\x3', '\x2', '\x2', '\x2', '\x14C', '\x14D', '\x5', '\x9F', 'P', + '\x2', '\x14D', '\x14E', '\x5', '\xB7', '\\', '\x2', '\x14E', '\x14F', + '\x5', '\xB1', 'Y', '\x2', '\x14F', '\x150', '\x5', '\xAD', 'W', '\x2', + '\x150', 'T', '\x3', '\x2', '\x2', '\x2', '\x151', '\x152', '\x5', '\xA1', + 'Q', '\x2', '\x152', '\x153', '\x5', '\xB7', '\\', '\x2', '\x153', '\x154', + '\x5', '\xB1', 'Y', '\x2', '\x154', '\x155', '\x5', '\xBD', '_', '\x2', + '\x155', '\x156', '\x5', '\xB3', 'Z', '\x2', '\x156', 'V', '\x3', '\x2', + '\x2', '\x2', '\x157', '\x158', '\x5', '\xA5', 'S', '\x2', '\x158', '\x159', + '\x5', '\xAF', 'X', '\x2', '\x159', 'X', '\x3', '\x2', '\x2', '\x2', '\x15A', + '\x15B', '\x5', '\xA7', 'T', '\x2', '\x15B', '\x15C', '\x5', '\xB1', 'Y', + '\x2', '\x15C', '\x15D', '\x5', '\xA5', 'S', '\x2', '\x15D', '\x15E', + '\x5', '\xAF', 'X', '\x2', '\x15E', 'Z', '\x3', '\x2', '\x2', '\x2', '\x15F', + '\x160', '\x5', '\xAB', 'V', '\x2', '\x160', '\x161', '\x5', '\x95', 'K', + '\x2', '\x161', '\x162', '\x5', '\xB9', ']', '\x2', '\x162', '\x163', + '\x5', '\xBB', '^', '\x2', '\x163', '\\', '\x3', '\x2', '\x2', '\x2', + '\x164', '\x165', '\x5', '\xAB', 'V', '\x2', '\x165', '\x166', '\x5', + '\x9D', 'O', '\x2', '\x166', '\x167', '\x5', '\x9F', 'P', '\x2', '\x167', + '\x168', '\x5', '\xBB', '^', '\x2', '\x168', '^', '\x3', '\x2', '\x2', + '\x2', '\x169', '\x16A', '\x5', '\xAB', 'V', '\x2', '\x16A', '\x16B', + '\x5', '\xA5', 'S', '\x2', '\x16B', '\x16C', '\x5', '\xA9', 'U', '\x2', + '\x16C', '\x16D', '\x5', '\x9D', 'O', '\x2', '\x16D', '`', '\x3', '\x2', + '\x2', '\x2', '\x16E', '\x16F', '\x5', '\xAB', 'V', '\x2', '\x16F', '\x170', + '\x5', '\xA5', 'S', '\x2', '\x170', '\x171', '\x5', '\xAD', 'W', '\x2', + '\x171', '\x172', '\x5', '\xA5', 'S', '\x2', '\x172', '\x173', '\x5', + '\xBB', '^', '\x2', '\x173', '\x62', '\x3', '\x2', '\x2', '\x2', '\x174', + '\x175', '\x5', '\xAF', 'X', '\x2', '\x175', '\x176', '\x5', '\xB1', 'Y', + '\x2', '\x176', '\x177', '\x5', '\xBB', '^', '\x2', '\x177', '\x64', '\x3', + '\x2', '\x2', '\x2', '\x178', '\x179', '\a', 'p', '\x2', '\x2', '\x179', + '\x17A', '\a', 'w', '\x2', '\x2', '\x17A', '\x17B', '\a', 'n', '\x2', + '\x2', '\x17B', '\x17C', '\a', 'n', '\x2', '\x2', '\x17C', '\x66', '\x3', + '\x2', '\x2', '\x2', '\x17D', '\x17E', '\x5', '\xB1', 'Y', '\x2', '\x17E', + '\x17F', '\x5', '\x9F', 'P', '\x2', '\x17F', '\x180', '\x5', '\x9F', 'P', + '\x2', '\x180', '\x181', '\x5', '\xB9', ']', '\x2', '\x181', '\x182', + '\x5', '\x9D', 'O', '\x2', '\x182', '\x183', '\x5', '\xBB', '^', '\x2', + '\x183', 'h', '\x3', '\x2', '\x2', '\x2', '\x184', '\x185', '\x5', '\xB1', + 'Y', '\x2', '\x185', '\x186', '\x5', '\xB7', '\\', '\x2', '\x186', 'j', + '\x3', '\x2', '\x2', '\x2', '\x187', '\x188', '\x5', '\xB1', 'Y', '\x2', + '\x188', '\x189', '\x5', '\xB7', '\\', '\x2', '\x189', '\x18A', '\x5', + '\x9B', 'N', '\x2', '\x18A', '\x18B', '\x5', '\x9D', 'O', '\x2', '\x18B', + '\x18C', '\x5', '\xB7', '\\', '\x2', '\x18C', 'l', '\x3', '\x2', '\x2', + '\x2', '\x18D', '\x18E', '\x5', '\xB7', '\\', '\x2', '\x18E', '\x18F', + '\x5', '\x95', 'K', '\x2', '\x18F', '\x190', '\x5', '\xAF', 'X', '\x2', + '\x190', '\x191', '\x5', '\xA9', 'U', '\x2', '\x191', 'n', '\x3', '\x2', + '\x2', '\x2', '\x192', '\x193', '\x5', '\xB7', '\\', '\x2', '\x193', '\x194', + '\x5', '\xA5', 'S', '\x2', '\x194', '\x195', '\x5', '\xA1', 'Q', '\x2', + '\x195', '\x196', '\x5', '\xA3', 'R', '\x2', '\x196', '\x197', '\x5', + '\xBB', '^', '\x2', '\x197', 'p', '\x3', '\x2', '\x2', '\x2', '\x198', + '\x199', '\x5', '\xB9', ']', '\x2', '\x199', '\x19A', '\x5', '\x9D', 'O', + '\x2', '\x19A', '\x19B', '\x5', '\xAB', 'V', '\x2', '\x19B', '\x19C', + '\x5', '\x9D', 'O', '\x2', '\x19C', '\x19D', '\x5', '\x99', 'M', '\x2', + '\x19D', '\x19E', '\x5', '\xBB', '^', '\x2', '\x19E', 'r', '\x3', '\x2', + '\x2', '\x2', '\x19F', '\x1A0', '\x5', '\xBB', '^', '\x2', '\x1A0', '\x1A1', + '\x5', '\xB1', 'Y', '\x2', '\x1A1', '\x1A2', '\x5', '\xB3', 'Z', '\x2', + '\x1A2', 't', '\x3', '\x2', '\x2', '\x2', '\x1A3', '\x1A4', '\a', 'v', + '\x2', '\x2', '\x1A4', '\x1A5', '\a', 't', '\x2', '\x2', '\x1A5', '\x1A6', + '\a', 'w', '\x2', '\x2', '\x1A6', '\x1A7', '\a', 'g', '\x2', '\x2', '\x1A7', + 'v', '\x3', '\x2', '\x2', '\x2', '\x1A8', '\x1A9', '\a', 'w', '\x2', '\x2', + '\x1A9', '\x1AA', '\a', '\x66', '\x2', '\x2', '\x1AA', '\x1AB', '\a', + 'h', '\x2', '\x2', '\x1AB', 'x', '\x3', '\x2', '\x2', '\x2', '\x1AC', + '\x1AD', '\a', 'w', '\x2', '\x2', '\x1AD', '\x1AE', '\a', 'p', '\x2', + '\x2', '\x1AE', '\x1AF', '\a', '\x66', '\x2', '\x2', '\x1AF', '\x1B0', + '\a', 'g', '\x2', '\x2', '\x1B0', '\x1B1', '\a', 'h', '\x2', '\x2', '\x1B1', + '\x1B2', '\a', 'k', '\x2', '\x2', '\x1B2', '\x1B3', '\a', 'p', '\x2', + '\x2', '\x1B3', '\x1B4', '\a', 'g', '\x2', '\x2', '\x1B4', '\x1B5', '\a', + '\x66', '\x2', '\x2', '\x1B5', 'z', '\x3', '\x2', '\x2', '\x2', '\x1B6', + '\x1B7', '\x5', '\xBF', '`', '\x2', '\x1B7', '\x1B8', '\x5', '\x95', 'K', + '\x2', '\x1B8', '\x1B9', '\x5', '\xAB', 'V', '\x2', '\x1B9', '\x1BA', + '\x5', '\xBD', '_', '\x2', '\x1BA', '\x1BB', '\x5', '\x9D', 'O', '\x2', + '\x1BB', '|', '\x3', '\x2', '\x2', '\x2', '\x1BC', '\x1BD', '\x5', '\xC1', + '\x61', '\x2', '\x1BD', '\x1BE', '\x5', '\xA3', 'R', '\x2', '\x1BE', '\x1BF', + '\x5', '\x9D', 'O', '\x2', '\x1BF', '\x1C0', '\x5', '\xB7', '\\', '\x2', + '\x1C0', '\x1C1', '\x5', '\x9D', 'O', '\x2', '\x1C1', '~', '\x3', '\x2', + '\x2', '\x2', '\x1C2', '\x1C4', '\t', '\x2', '\x2', '\x2', '\x1C3', '\x1C2', + '\x3', '\x2', '\x2', '\x2', '\x1C4', '\x1C5', '\x3', '\x2', '\x2', '\x2', + '\x1C5', '\x1C3', '\x3', '\x2', '\x2', '\x2', '\x1C5', '\x1C6', '\x3', + '\x2', '\x2', '\x2', '\x1C6', '\x1C7', '\x3', '\x2', '\x2', '\x2', '\x1C7', + '\x1C8', '\b', '@', '\x2', '\x2', '\x1C8', '\x80', '\x3', '\x2', '\x2', + '\x2', '\x1C9', '\x1CB', '\t', '\x3', '\x2', '\x2', '\x1CA', '\x1C9', + '\x3', '\x2', '\x2', '\x2', '\x1CA', '\x1CB', '\x3', '\x2', '\x2', '\x2', + '\x1CB', '\x1CD', '\x3', '\x2', '\x2', '\x2', '\x1CC', '\x1CE', '\x5', + '\x93', 'J', '\x2', '\x1CD', '\x1CC', '\x3', '\x2', '\x2', '\x2', '\x1CE', + '\x1CF', '\x3', '\x2', '\x2', '\x2', '\x1CF', '\x1CD', '\x3', '\x2', '\x2', + '\x2', '\x1CF', '\x1D0', '\x3', '\x2', '\x2', '\x2', '\x1D0', '\x1D8', + '\x3', '\x2', '\x2', '\x2', '\x1D1', '\x1D5', '\a', '\x30', '\x2', '\x2', + '\x1D2', '\x1D4', '\x5', '\x93', 'J', '\x2', '\x1D3', '\x1D2', '\x3', + '\x2', '\x2', '\x2', '\x1D4', '\x1D7', '\x3', '\x2', '\x2', '\x2', '\x1D5', + '\x1D3', '\x3', '\x2', '\x2', '\x2', '\x1D5', '\x1D6', '\x3', '\x2', '\x2', + '\x2', '\x1D6', '\x1D9', '\x3', '\x2', '\x2', '\x2', '\x1D7', '\x1D5', + '\x3', '\x2', '\x2', '\x2', '\x1D8', '\x1D1', '\x3', '\x2', '\x2', '\x2', + '\x1D8', '\x1D9', '\x3', '\x2', '\x2', '\x2', '\x1D9', '\x1E3', '\x3', + '\x2', '\x2', '\x2', '\x1DA', '\x1DC', '\x5', '\x9D', 'O', '\x2', '\x1DB', + '\x1DD', '\t', '\x3', '\x2', '\x2', '\x1DC', '\x1DB', '\x3', '\x2', '\x2', + '\x2', '\x1DC', '\x1DD', '\x3', '\x2', '\x2', '\x2', '\x1DD', '\x1DF', + '\x3', '\x2', '\x2', '\x2', '\x1DE', '\x1E0', '\x5', '\x93', 'J', '\x2', + '\x1DF', '\x1DE', '\x3', '\x2', '\x2', '\x2', '\x1E0', '\x1E1', '\x3', + '\x2', '\x2', '\x2', '\x1E1', '\x1DF', '\x3', '\x2', '\x2', '\x2', '\x1E1', + '\x1E2', '\x3', '\x2', '\x2', '\x2', '\x1E2', '\x1E4', '\x3', '\x2', '\x2', + '\x2', '\x1E3', '\x1DA', '\x3', '\x2', '\x2', '\x2', '\x1E3', '\x1E4', + '\x3', '\x2', '\x2', '\x2', '\x1E4', '\x1FA', '\x3', '\x2', '\x2', '\x2', + '\x1E5', '\x1E7', '\t', '\x3', '\x2', '\x2', '\x1E6', '\x1E5', '\x3', + '\x2', '\x2', '\x2', '\x1E6', '\x1E7', '\x3', '\x2', '\x2', '\x2', '\x1E7', + '\x1E8', '\x3', '\x2', '\x2', '\x2', '\x1E8', '\x1EA', '\a', '\x30', '\x2', + '\x2', '\x1E9', '\x1EB', '\x5', '\x93', 'J', '\x2', '\x1EA', '\x1E9', + '\x3', '\x2', '\x2', '\x2', '\x1EB', '\x1EC', '\x3', '\x2', '\x2', '\x2', + '\x1EC', '\x1EA', '\x3', '\x2', '\x2', '\x2', '\x1EC', '\x1ED', '\x3', + '\x2', '\x2', '\x2', '\x1ED', '\x1F7', '\x3', '\x2', '\x2', '\x2', '\x1EE', + '\x1F0', '\x5', '\x9D', 'O', '\x2', '\x1EF', '\x1F1', '\t', '\x3', '\x2', + '\x2', '\x1F0', '\x1EF', '\x3', '\x2', '\x2', '\x2', '\x1F0', '\x1F1', + '\x3', '\x2', '\x2', '\x2', '\x1F1', '\x1F3', '\x3', '\x2', '\x2', '\x2', + '\x1F2', '\x1F4', '\x5', '\x93', 'J', '\x2', '\x1F3', '\x1F2', '\x3', + '\x2', '\x2', '\x2', '\x1F4', '\x1F5', '\x3', '\x2', '\x2', '\x2', '\x1F5', + '\x1F3', '\x3', '\x2', '\x2', '\x2', '\x1F5', '\x1F6', '\x3', '\x2', '\x2', + '\x2', '\x1F6', '\x1F8', '\x3', '\x2', '\x2', '\x2', '\x1F7', '\x1EE', + '\x3', '\x2', '\x2', '\x2', '\x1F7', '\x1F8', '\x3', '\x2', '\x2', '\x2', + '\x1F8', '\x1FA', '\x3', '\x2', '\x2', '\x2', '\x1F9', '\x1CA', '\x3', + '\x2', '\x2', '\x2', '\x1F9', '\x1E6', '\x3', '\x2', '\x2', '\x2', '\x1FA', + '\x82', '\x3', '\x2', '\x2', '\x2', '\x1FB', '\x200', '\a', '$', '\x2', + '\x2', '\x1FC', '\x1FF', '\x5', '\x85', '\x43', '\x2', '\x1FD', '\x1FF', + '\x5', '\x8D', 'G', '\x2', '\x1FE', '\x1FC', '\x3', '\x2', '\x2', '\x2', + '\x1FE', '\x1FD', '\x3', '\x2', '\x2', '\x2', '\x1FF', '\x202', '\x3', + '\x2', '\x2', '\x2', '\x200', '\x1FE', '\x3', '\x2', '\x2', '\x2', '\x200', + '\x201', '\x3', '\x2', '\x2', '\x2', '\x201', '\x203', '\x3', '\x2', '\x2', + '\x2', '\x202', '\x200', '\x3', '\x2', '\x2', '\x2', '\x203', '\x20E', + '\a', '$', '\x2', '\x2', '\x204', '\x209', '\a', ')', '\x2', '\x2', '\x205', + '\x208', '\x5', '\x85', '\x43', '\x2', '\x206', '\x208', '\x5', '\x8B', + '\x46', '\x2', '\x207', '\x205', '\x3', '\x2', '\x2', '\x2', '\x207', + '\x206', '\x3', '\x2', '\x2', '\x2', '\x208', '\x20B', '\x3', '\x2', '\x2', + '\x2', '\x209', '\x207', '\x3', '\x2', '\x2', '\x2', '\x209', '\x20A', + '\x3', '\x2', '\x2', '\x2', '\x20A', '\x20C', '\x3', '\x2', '\x2', '\x2', + '\x20B', '\x209', '\x3', '\x2', '\x2', '\x2', '\x20C', '\x20E', '\a', + ')', '\x2', '\x2', '\x20D', '\x1FB', '\x3', '\x2', '\x2', '\x2', '\x20D', + '\x204', '\x3', '\x2', '\x2', '\x2', '\x20E', '\x84', '\x3', '\x2', '\x2', + '\x2', '\x20F', '\x212', '\a', '^', '\x2', '\x2', '\x210', '\x213', '\t', + '\x4', '\x2', '\x2', '\x211', '\x213', '\x5', '\x87', '\x44', '\x2', '\x212', + '\x210', '\x3', '\x2', '\x2', '\x2', '\x212', '\x211', '\x3', '\x2', '\x2', + '\x2', '\x213', '\x86', '\x3', '\x2', '\x2', '\x2', '\x214', '\x215', + '\a', 'w', '\x2', '\x2', '\x215', '\x216', '\x5', '\x89', '\x45', '\x2', + '\x216', '\x217', '\x5', '\x89', '\x45', '\x2', '\x217', '\x218', '\x5', + '\x89', '\x45', '\x2', '\x218', '\x219', '\x5', '\x89', '\x45', '\x2', + '\x219', '\x88', '\x3', '\x2', '\x2', '\x2', '\x21A', '\x21B', '\t', '\x5', + '\x2', '\x2', '\x21B', '\x8A', '\x3', '\x2', '\x2', '\x2', '\x21C', '\x21D', + '\n', '\x6', '\x2', '\x2', '\x21D', '\x8C', '\x3', '\x2', '\x2', '\x2', + '\x21E', '\x21F', '\n', '\a', '\x2', '\x2', '\x21F', '\x8E', '\x3', '\x2', + '\x2', '\x2', '\x220', '\x22A', '\x3', '\x2', '\x2', '\x2', '\x221', '\x226', + '\t', '\b', '\x2', '\x2', '\x222', '\x225', '\t', '\b', '\x2', '\x2', + '\x223', '\x225', '\x5', '\x93', 'J', '\x2', '\x224', '\x222', '\x3', + '\x2', '\x2', '\x2', '\x224', '\x223', '\x3', '\x2', '\x2', '\x2', '\x225', + '\x228', '\x3', '\x2', '\x2', '\x2', '\x226', '\x224', '\x3', '\x2', '\x2', + '\x2', '\x226', '\x227', '\x3', '\x2', '\x2', '\x2', '\x227', '\x22A', + '\x3', '\x2', '\x2', '\x2', '\x228', '\x226', '\x3', '\x2', '\x2', '\x2', + '\x229', '\x220', '\x3', '\x2', '\x2', '\x2', '\x229', '\x221', '\x3', + '\x2', '\x2', '\x2', '\x22A', '\x90', '\x3', '\x2', '\x2', '\x2', '\x22B', + '\x22C', '\a', '\x42', '\x2', '\x2', '\x22C', '\x22D', '\x5', '\x8F', + 'H', '\x2', '\x22D', '\x92', '\x3', '\x2', '\x2', '\x2', '\x22E', '\x22F', + '\t', '\t', '\x2', '\x2', '\x22F', '\x94', '\x3', '\x2', '\x2', '\x2', + '\x230', '\x231', '\t', '\n', '\x2', '\x2', '\x231', '\x96', '\x3', '\x2', + '\x2', '\x2', '\x232', '\x233', '\t', '\v', '\x2', '\x2', '\x233', '\x98', + '\x3', '\x2', '\x2', '\x2', '\x234', '\x235', '\t', '\f', '\x2', '\x2', + '\x235', '\x9A', '\x3', '\x2', '\x2', '\x2', '\x236', '\x237', '\t', '\r', + '\x2', '\x2', '\x237', '\x9C', '\x3', '\x2', '\x2', '\x2', '\x238', '\x239', + '\t', '\xE', '\x2', '\x2', '\x239', '\x9E', '\x3', '\x2', '\x2', '\x2', + '\x23A', '\x23B', '\t', '\xF', '\x2', '\x2', '\x23B', '\xA0', '\x3', '\x2', + '\x2', '\x2', '\x23C', '\x23D', '\t', '\x10', '\x2', '\x2', '\x23D', '\xA2', + '\x3', '\x2', '\x2', '\x2', '\x23E', '\x23F', '\t', '\x11', '\x2', '\x2', + '\x23F', '\xA4', '\x3', '\x2', '\x2', '\x2', '\x240', '\x241', '\t', '\x12', + '\x2', '\x2', '\x241', '\xA6', '\x3', '\x2', '\x2', '\x2', '\x242', '\x243', + '\t', '\x13', '\x2', '\x2', '\x243', '\xA8', '\x3', '\x2', '\x2', '\x2', + '\x244', '\x245', '\t', '\x14', '\x2', '\x2', '\x245', '\xAA', '\x3', + '\x2', '\x2', '\x2', '\x246', '\x247', '\t', '\x15', '\x2', '\x2', '\x247', + '\xAC', '\x3', '\x2', '\x2', '\x2', '\x248', '\x249', '\t', '\x16', '\x2', + '\x2', '\x249', '\xAE', '\x3', '\x2', '\x2', '\x2', '\x24A', '\x24B', + '\t', '\x17', '\x2', '\x2', '\x24B', '\xB0', '\x3', '\x2', '\x2', '\x2', + '\x24C', '\x24D', '\t', '\x18', '\x2', '\x2', '\x24D', '\xB2', '\x3', + '\x2', '\x2', '\x2', '\x24E', '\x24F', '\t', '\x19', '\x2', '\x2', '\x24F', + '\xB4', '\x3', '\x2', '\x2', '\x2', '\x250', '\x251', '\t', '\x1A', '\x2', + '\x2', '\x251', '\xB6', '\x3', '\x2', '\x2', '\x2', '\x252', '\x253', + '\t', '\x1B', '\x2', '\x2', '\x253', '\xB8', '\x3', '\x2', '\x2', '\x2', + '\x254', '\x255', '\t', '\x1C', '\x2', '\x2', '\x255', '\xBA', '\x3', + '\x2', '\x2', '\x2', '\x256', '\x257', '\t', '\x1D', '\x2', '\x2', '\x257', + '\xBC', '\x3', '\x2', '\x2', '\x2', '\x258', '\x259', '\t', '\x1E', '\x2', + '\x2', '\x259', '\xBE', '\x3', '\x2', '\x2', '\x2', '\x25A', '\x25B', + '\t', '\x1F', '\x2', '\x2', '\x25B', '\xC0', '\x3', '\x2', '\x2', '\x2', + '\x25C', '\x25D', '\t', ' ', '\x2', '\x2', '\x25D', '\xC2', '\x3', '\x2', + '\x2', '\x2', '\x25E', '\x25F', '\t', '!', '\x2', '\x2', '\x25F', '\xC4', + '\x3', '\x2', '\x2', '\x2', '\x260', '\x261', '\t', '\"', '\x2', '\x2', + '\x261', '\xC6', '\x3', '\x2', '\x2', '\x2', '\x262', '\x263', '\t', '#', + '\x2', '\x2', '\x263', '\xC8', '\x3', '\x2', '\x2', '\x2', '\x1A', '\x2', + '\x1C5', '\x1CA', '\x1CF', '\x1D5', '\x1D8', '\x1DC', '\x1E1', '\x1E3', + '\x1E6', '\x1EC', '\x1F0', '\x1F5', '\x1F7', '\x1F9', '\x1FE', '\x200', + '\x207', '\x209', '\x20D', '\x212', '\x224', '\x226', '\x229', '\x3', '\b', '\x2', '\x2', }; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/Parser/sqlParser.cs b/Microsoft.Azure.Cosmos/src/Query/Core/Parser/sqlParser.cs index e68b8e18f5..cfd72e04d4 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/Parser/sqlParser.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/Parser/sqlParser.cs @@ -42,32 +42,34 @@ public const int K_ASC=32, K_BETWEEN=33, K_BY=34, K_DESC=35, K_DISTINCT=36, K_ESCAPE=37, K_EXISTS=38, K_FIRST=39, K_FALSE=40, K_FROM=41, K_GROUP=42, K_IN=43, K_JOIN=44, K_LAST=45, K_LEFT=46, K_LIKE=47, K_LIMIT=48, K_NOT=49, K_NULL=50, K_OFFSET=51, - K_OR=52, K_ORDER=53, K_RIGHT=54, K_SELECT=55, K_TOP=56, K_TRUE=57, K_UDF=58, - K_UNDEFINED=59, K_VALUE=60, K_WHERE=61, WS=62, NUMERIC_LITERAL=63, STRING_LITERAL=64, - LEX_IDENTIFIER=65, PARAMETER=66; + K_OR=52, K_ORDER=53, K_RANK=54, K_RIGHT=55, K_SELECT=56, K_TOP=57, K_TRUE=58, + K_UDF=59, K_UNDEFINED=60, K_VALUE=61, K_WHERE=62, WS=63, NUMERIC_LITERAL=64, + STRING_LITERAL=65, LEX_IDENTIFIER=66, PARAMETER=67; public const int RULE_program = 0, RULE_sql_query = 1, RULE_select_clause = 2, RULE_top_spec = 3, RULE_selection = 4, RULE_select_star_spec = 5, RULE_select_value_spec = 6, RULE_select_list_spec = 7, RULE_select_item = 8, RULE_from_clause = 9, RULE_collection_expression = 10, RULE_collection = 11, RULE_path_expression = 12, RULE_where_clause = 13, RULE_group_by_clause = 14, RULE_order_by_clause = 15, - RULE_order_by_items = 16, RULE_order_by_item = 17, RULE_sort_order = 18, - RULE_offset_limit_clause = 19, RULE_offset_count = 20, RULE_limit_count = 21, - RULE_scalar_expression = 22, RULE_logical_scalar_expression = 23, RULE_in_scalar_expression = 24, - RULE_like_scalar_expression = 25, RULE_escape_expression = 26, RULE_binary_scalar_expression = 27, - RULE_multiplicative_operator = 28, RULE_additive_operator = 29, RULE_relational_operator = 30, - RULE_equality_operator = 31, RULE_bitwise_and_operator = 32, RULE_bitwise_exclusive_or_operator = 33, - RULE_bitwise_inclusive_or_operator = 34, RULE_string_concat_operator = 35, - RULE_unary_scalar_expression = 36, RULE_unary_operator = 37, RULE_primary_expression = 38, - RULE_function_call_scalar_expression = 39, RULE_scalar_expression_list = 40, - RULE_object_property_list = 41, RULE_object_property = 42, RULE_identifier = 43, - RULE_literal = 44; + RULE_score_expression_order_by_items = 16, RULE_score_expression_order_by_item = 17, + RULE_order_by_items = 18, RULE_order_by_item = 19, RULE_sort_order = 20, + RULE_offset_limit_clause = 21, RULE_offset_count = 22, RULE_limit_count = 23, + RULE_scalar_expression = 24, RULE_logical_scalar_expression = 25, RULE_in_scalar_expression = 26, + RULE_like_scalar_expression = 27, RULE_escape_expression = 28, RULE_binary_scalar_expression = 29, + RULE_multiplicative_operator = 30, RULE_additive_operator = 31, RULE_relational_operator = 32, + RULE_equality_operator = 33, RULE_bitwise_and_operator = 34, RULE_bitwise_exclusive_or_operator = 35, + RULE_bitwise_inclusive_or_operator = 36, RULE_string_concat_operator = 37, + RULE_unary_scalar_expression = 38, RULE_unary_operator = 39, RULE_primary_expression = 40, + RULE_function_call_scalar_expression = 41, RULE_scalar_expression_list = 42, + RULE_object_property_list = 43, RULE_object_property = 44, RULE_identifier = 45, + RULE_literal = 46; public static readonly string[] ruleNames = { "program", "sql_query", "select_clause", "top_spec", "selection", "select_star_spec", "select_value_spec", "select_list_spec", "select_item", "from_clause", "collection_expression", "collection", "path_expression", "where_clause", - "group_by_clause", "order_by_clause", "order_by_items", "order_by_item", - "sort_order", "offset_limit_clause", "offset_count", "limit_count", "scalar_expression", + "group_by_clause", "order_by_clause", "score_expression_order_by_items", + "score_expression_order_by_item", "order_by_items", "order_by_item", "sort_order", + "offset_limit_clause", "offset_count", "limit_count", "scalar_expression", "logical_scalar_expression", "in_scalar_expression", "like_scalar_expression", "escape_expression", "binary_scalar_expression", "multiplicative_operator", "additive_operator", "relational_operator", "equality_operator", "bitwise_and_operator", @@ -83,7 +85,7 @@ public const int "'&'", "'^'", "'|'", "'||'", "'~'", "'{'", "'}'", null, null, null, null, null, null, null, null, null, null, null, null, "'false'", null, null, null, null, null, null, null, null, null, "'null'", null, null, null, - null, null, null, "'true'", "'udf'", "'undefined'" + null, null, null, null, "'true'", "'udf'", "'undefined'" }; private static readonly string[] _SymbolicNames = { null, null, null, null, null, null, null, null, null, null, null, null, @@ -92,8 +94,8 @@ public const int "K_BETWEEN", "K_BY", "K_DESC", "K_DISTINCT", "K_ESCAPE", "K_EXISTS", "K_FIRST", "K_FALSE", "K_FROM", "K_GROUP", "K_IN", "K_JOIN", "K_LAST", "K_LEFT", "K_LIKE", "K_LIMIT", "K_NOT", "K_NULL", "K_OFFSET", "K_OR", "K_ORDER", - "K_RIGHT", "K_SELECT", "K_TOP", "K_TRUE", "K_UDF", "K_UNDEFINED", "K_VALUE", - "K_WHERE", "WS", "NUMERIC_LITERAL", "STRING_LITERAL", "LEX_IDENTIFIER", + "K_RANK", "K_RIGHT", "K_SELECT", "K_TOP", "K_TRUE", "K_UDF", "K_UNDEFINED", + "K_VALUE", "K_WHERE", "WS", "NUMERIC_LITERAL", "STRING_LITERAL", "LEX_IDENTIFIER", "PARAMETER" }; public static readonly IVocabulary DefaultVocabulary = new Vocabulary(_LiteralNames, _SymbolicNames); @@ -127,6 +129,7 @@ public sqlParser(ITokenStream input, TextWriter output, TextWriter errorOutput) { Interpreter = new ParserATNSimulator(this, _ATN, decisionToDFA, sharedContextCache); } + public partial class ProgramContext : ParserRuleContext { public Sql_queryContext sql_query() { return GetRuleContext(0); @@ -159,8 +162,8 @@ public ProgramContext program() { try { EnterOuterAlt(_localctx, 1); { - State = 90; sql_query(); - State = 91; Match(Eof); + State = 94; sql_query(); + State = 95; Match(Eof); } } catch (RecognitionException re) { @@ -221,49 +224,49 @@ public Sql_queryContext sql_query() { try { EnterOuterAlt(_localctx, 1); { - State = 93; select_clause(); - State = 95; + State = 97; select_clause(); + State = 99; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==K_FROM) { { - State = 94; from_clause(); + State = 98; from_clause(); } } - State = 98; + State = 102; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==K_WHERE) { { - State = 97; where_clause(); + State = 101; where_clause(); } } - State = 101; + State = 105; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==K_GROUP) { { - State = 100; group_by_clause(); + State = 104; group_by_clause(); } } - State = 104; + State = 108; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==K_ORDER) { { - State = 103; order_by_clause(); + State = 107; order_by_clause(); } } - State = 107; + State = 111; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==K_OFFSET) { { - State = 106; offset_limit_clause(); + State = 110; offset_limit_clause(); } } @@ -317,26 +320,26 @@ public Select_clauseContext select_clause() { try { EnterOuterAlt(_localctx, 1); { - State = 109; Match(K_SELECT); - State = 111; + State = 113; Match(K_SELECT); + State = 115; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==K_DISTINCT) { { - State = 110; Match(K_DISTINCT); + State = 114; Match(K_DISTINCT); } } - State = 114; + State = 118; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==K_TOP) { { - State = 113; top_spec(); + State = 117; top_spec(); } } - State = 116; selection(); + State = 120; selection(); } } catch (RecognitionException re) { @@ -382,8 +385,8 @@ public Top_specContext top_spec() { try { EnterOuterAlt(_localctx, 1); { - State = 118; Match(K_TOP); - State = 119; + State = 122; Match(K_TOP); + State = 123; _la = TokenStream.LA(1); if ( !(_la==NUMERIC_LITERAL || _la==PARAMETER) ) { ErrorHandler.RecoverInline(this); @@ -440,19 +443,19 @@ public SelectionContext selection() { SelectionContext _localctx = new SelectionContext(Context, State); EnterRule(_localctx, 8, RULE_selection); try { - State = 124; + State = 128; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__0: EnterOuterAlt(_localctx, 1); { - State = 121; select_star_spec(); + State = 125; select_star_spec(); } break; case K_VALUE: EnterOuterAlt(_localctx, 2); { - State = 122; select_value_spec(); + State = 126; select_value_spec(); } break; case T__2: @@ -480,7 +483,7 @@ public SelectionContext selection() { case PARAMETER: EnterOuterAlt(_localctx, 3); { - State = 123; select_list_spec(); + State = 127; select_list_spec(); } break; default: @@ -526,7 +529,7 @@ public Select_star_specContext select_star_spec() { try { EnterOuterAlt(_localctx, 1); { - State = 126; Match(T__0); + State = 130; Match(T__0); } } catch (RecognitionException re) { @@ -572,8 +575,8 @@ public Select_value_specContext select_value_spec() { try { EnterOuterAlt(_localctx, 1); { - State = 128; Match(K_VALUE); - State = 129; scalar_expression(0); + State = 132; Match(K_VALUE); + State = 133; scalar_expression(0); } } catch (RecognitionException re) { @@ -622,18 +625,18 @@ public Select_list_specContext select_list_spec() { try { EnterOuterAlt(_localctx, 1); { - State = 131; select_item(); - State = 136; + State = 135; select_item(); + State = 140; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==T__1) { { { - State = 132; Match(T__1); - State = 133; select_item(); + State = 136; Match(T__1); + State = 137; select_item(); } } - State = 138; + State = 142; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -686,14 +689,14 @@ public Select_itemContext select_item() { try { EnterOuterAlt(_localctx, 1); { - State = 139; scalar_expression(0); - State = 142; + State = 143; scalar_expression(0); + State = 146; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==K_AS) { { - State = 140; Match(K_AS); - State = 141; identifier(); + State = 144; Match(K_AS); + State = 145; identifier(); } } @@ -742,8 +745,8 @@ public From_clauseContext from_clause() { try { EnterOuterAlt(_localctx, 1); { - State = 144; Match(K_FROM); - State = 145; collection_expression(0); + State = 148; Match(K_FROM); + State = 149; collection_expression(0); } } catch (RecognitionException re) { @@ -856,7 +859,7 @@ private Collection_expressionContext collection_expression(int _p) { int _alt; EnterOuterAlt(_localctx, 1); { - State = 159; + State = 163; ErrorHandler.Sync(this); switch ( Interpreter.AdaptivePredict(TokenStream,12,Context) ) { case 1: @@ -865,22 +868,22 @@ private Collection_expressionContext collection_expression(int _p) { Context = _localctx; _prevctx = _localctx; - State = 148; collection(); - State = 153; + State = 152; collection(); + State = 157; ErrorHandler.Sync(this); switch ( Interpreter.AdaptivePredict(TokenStream,11,Context) ) { case 1: { - State = 150; + State = 154; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==K_AS) { { - State = 149; Match(K_AS); + State = 153; Match(K_AS); } } - State = 152; identifier(); + State = 156; identifier(); } break; } @@ -891,14 +894,14 @@ private Collection_expressionContext collection_expression(int _p) { _localctx = new ArrayIteratorCollectionExpressionContext(_localctx); Context = _localctx; _prevctx = _localctx; - State = 155; identifier(); - State = 156; Match(K_IN); - State = 157; collection(); + State = 159; identifier(); + State = 160; Match(K_IN); + State = 161; collection(); } break; } Context.Stop = TokenStream.LT(-1); - State = 166; + State = 170; ErrorHandler.Sync(this); _alt = Interpreter.AdaptivePredict(TokenStream,13,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { @@ -910,14 +913,14 @@ private Collection_expressionContext collection_expression(int _p) { { _localctx = new JoinCollectionExpressionContext(new Collection_expressionContext(_parentctx, _parentState)); PushNewRecursionContext(_localctx, _startState, RULE_collection_expression); - State = 161; + State = 165; if (!(Precpred(Context, 1))) throw new FailedPredicateException(this, "Precpred(Context, 1)"); - State = 162; Match(K_JOIN); - State = 163; collection_expression(2); + State = 166; Match(K_JOIN); + State = 167; collection_expression(2); } } } - State = 168; + State = 172; ErrorHandler.Sync(this); _alt = Interpreter.AdaptivePredict(TokenStream,13,Context); } @@ -993,7 +996,7 @@ public CollectionContext collection() { CollectionContext _localctx = new CollectionContext(Context, State); EnterRule(_localctx, 22, RULE_collection); try { - State = 177; + State = 181; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case K_ALL: @@ -1003,13 +1006,13 @@ public CollectionContext collection() { _localctx = new InputPathCollectionContext(_localctx); EnterOuterAlt(_localctx, 1); { - State = 169; identifier(); - State = 171; + State = 173; identifier(); + State = 175; ErrorHandler.Sync(this); switch ( Interpreter.AdaptivePredict(TokenStream,14,Context) ) { case 1: { - State = 170; path_expression(0); + State = 174; path_expression(0); } break; } @@ -1019,9 +1022,9 @@ public CollectionContext collection() { _localctx = new SubqueryCollectionContext(_localctx); EnterOuterAlt(_localctx, 2); { - State = 173; Match(T__2); - State = 174; sql_query(); - State = 175; Match(T__3); + State = 177; Match(T__2); + State = 178; sql_query(); + State = 179; Match(T__3); } break; default: @@ -1153,7 +1156,7 @@ private Path_expressionContext path_expression(int _p) { } Context.Stop = TokenStream.LT(-1); - State = 193; + State = 197; ErrorHandler.Sync(this); _alt = Interpreter.AdaptivePredict(TokenStream,17,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { @@ -1162,45 +1165,45 @@ private Path_expressionContext path_expression(int _p) { TriggerExitRuleEvent(); _prevctx = _localctx; { - State = 191; + State = 195; ErrorHandler.Sync(this); switch ( Interpreter.AdaptivePredict(TokenStream,16,Context) ) { case 1: { _localctx = new IdentifierPathExpressionContext(new Path_expressionContext(_parentctx, _parentState)); PushNewRecursionContext(_localctx, _startState, RULE_path_expression); - State = 180; + State = 184; if (!(Precpred(Context, 4))) throw new FailedPredicateException(this, "Precpred(Context, 4)"); - State = 181; Match(T__4); - State = 182; identifier(); + State = 185; Match(T__4); + State = 186; identifier(); } break; case 2: { _localctx = new NumberPathExpressionContext(new Path_expressionContext(_parentctx, _parentState)); PushNewRecursionContext(_localctx, _startState, RULE_path_expression); - State = 183; + State = 187; if (!(Precpred(Context, 3))) throw new FailedPredicateException(this, "Precpred(Context, 3)"); - State = 184; Match(T__5); - State = 185; Match(NUMERIC_LITERAL); - State = 186; Match(T__6); + State = 188; Match(T__5); + State = 189; Match(NUMERIC_LITERAL); + State = 190; Match(T__6); } break; case 3: { _localctx = new StringPathExpressionContext(new Path_expressionContext(_parentctx, _parentState)); PushNewRecursionContext(_localctx, _startState, RULE_path_expression); - State = 187; + State = 191; if (!(Precpred(Context, 2))) throw new FailedPredicateException(this, "Precpred(Context, 2)"); - State = 188; Match(T__5); - State = 189; Match(STRING_LITERAL); - State = 190; Match(T__6); + State = 192; Match(T__5); + State = 193; Match(STRING_LITERAL); + State = 194; Match(T__6); } break; } } } - State = 195; + State = 199; ErrorHandler.Sync(this); _alt = Interpreter.AdaptivePredict(TokenStream,17,Context); } @@ -1249,8 +1252,8 @@ public Where_clauseContext where_clause() { try { EnterOuterAlt(_localctx, 1); { - State = 196; Match(K_WHERE); - State = 197; scalar_expression(0); + State = 200; Match(K_WHERE); + State = 201; scalar_expression(0); } } catch (RecognitionException re) { @@ -1297,9 +1300,9 @@ public Group_by_clauseContext group_by_clause() { try { EnterOuterAlt(_localctx, 1); { - State = 199; Match(K_GROUP); - State = 200; Match(K_BY); - State = 201; scalar_expression_list(); + State = 203; Match(K_GROUP); + State = 204; Match(K_BY); + State = 205; scalar_expression_list(); } } catch (RecognitionException re) { @@ -1319,6 +1322,10 @@ public partial class Order_by_clauseContext : ParserRuleContext { public Order_by_itemsContext order_by_items() { return GetRuleContext(0); } + public ITerminalNode K_RANK() { return GetToken(sqlParser.K_RANK, 0); } + public Score_expression_order_by_itemsContext score_expression_order_by_items() { + return GetRuleContext(0); + } public Order_by_clauseContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { @@ -1343,12 +1350,148 @@ public override TResult Accept(IParseTreeVisitor visitor) { public Order_by_clauseContext order_by_clause() { Order_by_clauseContext _localctx = new Order_by_clauseContext(Context, State); EnterRule(_localctx, 30, RULE_order_by_clause); + try { + State = 214; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,18,Context) ) { + case 1: + EnterOuterAlt(_localctx, 1); + { + State = 207; Match(K_ORDER); + State = 208; Match(K_BY); + State = 209; order_by_items(); + } + break; + case 2: + EnterOuterAlt(_localctx, 2); + { + State = 210; Match(K_ORDER); + State = 211; Match(K_BY); + State = 212; Match(K_RANK); + State = 213; score_expression_order_by_items(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class Score_expression_order_by_itemsContext : ParserRuleContext { + public Score_expression_order_by_itemContext[] score_expression_order_by_item() { + return GetRuleContexts(); + } + public Score_expression_order_by_itemContext score_expression_order_by_item(int i) { + return GetRuleContext(i); + } + public Score_expression_order_by_itemsContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_score_expression_order_by_items; } } + public override void EnterRule(IParseTreeListener listener) { + IsqlListener typedListener = listener as IsqlListener; + if (typedListener != null) typedListener.EnterScore_expression_order_by_items(this); + } + public override void ExitRule(IParseTreeListener listener) { + IsqlListener typedListener = listener as IsqlListener; + if (typedListener != null) typedListener.ExitScore_expression_order_by_items(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IsqlVisitor typedVisitor = visitor as IsqlVisitor; + if (typedVisitor != null) return typedVisitor.VisitScore_expression_order_by_items(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public Score_expression_order_by_itemsContext score_expression_order_by_items() { + Score_expression_order_by_itemsContext _localctx = new Score_expression_order_by_itemsContext(Context, State); + EnterRule(_localctx, 32, RULE_score_expression_order_by_items); + int _la; try { EnterOuterAlt(_localctx, 1); { - State = 203; Match(K_ORDER); - State = 204; Match(K_BY); - State = 205; order_by_items(); + State = 216; score_expression_order_by_item(); + State = 221; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + while (_la==T__1) { + { + { + State = 217; Match(T__1); + State = 218; score_expression_order_by_item(); + } + } + State = 223; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class Score_expression_order_by_itemContext : ParserRuleContext { + public Function_call_scalar_expressionContext function_call_scalar_expression() { + return GetRuleContext(0); + } + public Sort_orderContext sort_order() { + return GetRuleContext(0); + } + public Score_expression_order_by_itemContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_score_expression_order_by_item; } } + public override void EnterRule(IParseTreeListener listener) { + IsqlListener typedListener = listener as IsqlListener; + if (typedListener != null) typedListener.EnterScore_expression_order_by_item(this); + } + public override void ExitRule(IParseTreeListener listener) { + IsqlListener typedListener = listener as IsqlListener; + if (typedListener != null) typedListener.ExitScore_expression_order_by_item(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IsqlVisitor typedVisitor = visitor as IsqlVisitor; + if (typedVisitor != null) return typedVisitor.VisitScore_expression_order_by_item(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public Score_expression_order_by_itemContext score_expression_order_by_item() { + Score_expression_order_by_itemContext _localctx = new Score_expression_order_by_itemContext(Context, State); + EnterRule(_localctx, 34, RULE_score_expression_order_by_item); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 224; function_call_scalar_expression(); + State = 226; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + if (_la==K_ASC || _la==K_DESC) { + { + State = 225; sort_order(); + } + } + } } catch (RecognitionException re) { @@ -1392,23 +1535,23 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Order_by_itemsContext order_by_items() { Order_by_itemsContext _localctx = new Order_by_itemsContext(Context, State); - EnterRule(_localctx, 32, RULE_order_by_items); + EnterRule(_localctx, 36, RULE_order_by_items); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 207; order_by_item(); - State = 212; + State = 228; order_by_item(); + State = 233; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==T__1) { { { - State = 208; Match(T__1); - State = 209; order_by_item(); + State = 229; Match(T__1); + State = 230; order_by_item(); } } - State = 214; + State = 235; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -1455,18 +1598,18 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Order_by_itemContext order_by_item() { Order_by_itemContext _localctx = new Order_by_itemContext(Context, State); - EnterRule(_localctx, 34, RULE_order_by_item); + EnterRule(_localctx, 38, RULE_order_by_item); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 215; scalar_expression(0); - State = 217; + State = 236; scalar_expression(0); + State = 238; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==K_ASC || _la==K_DESC) { { - State = 216; sort_order(); + State = 237; sort_order(); } } @@ -1509,12 +1652,12 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Sort_orderContext sort_order() { Sort_orderContext _localctx = new Sort_orderContext(Context, State); - EnterRule(_localctx, 36, RULE_sort_order); + EnterRule(_localctx, 40, RULE_sort_order); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 219; + State = 240; _la = TokenStream.LA(1); if ( !(_la==K_ASC || _la==K_DESC) ) { ErrorHandler.RecoverInline(this); @@ -1568,14 +1711,14 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Offset_limit_clauseContext offset_limit_clause() { Offset_limit_clauseContext _localctx = new Offset_limit_clauseContext(Context, State); - EnterRule(_localctx, 38, RULE_offset_limit_clause); + EnterRule(_localctx, 42, RULE_offset_limit_clause); try { EnterOuterAlt(_localctx, 1); { - State = 221; Match(K_OFFSET); - State = 222; offset_count(); - State = 223; Match(K_LIMIT); - State = 224; limit_count(); + State = 242; Match(K_OFFSET); + State = 243; offset_count(); + State = 244; Match(K_LIMIT); + State = 245; limit_count(); } } catch (RecognitionException re) { @@ -1615,12 +1758,12 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Offset_countContext offset_count() { Offset_countContext _localctx = new Offset_countContext(Context, State); - EnterRule(_localctx, 40, RULE_offset_count); + EnterRule(_localctx, 44, RULE_offset_count); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 226; + State = 247; _la = TokenStream.LA(1); if ( !(_la==NUMERIC_LITERAL || _la==PARAMETER) ) { ErrorHandler.RecoverInline(this); @@ -1668,12 +1811,12 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Limit_countContext limit_count() { Limit_countContext _localctx = new Limit_countContext(Context, State); - EnterRule(_localctx, 42, RULE_limit_count); + EnterRule(_localctx, 46, RULE_limit_count); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 228; + State = 249; _la = TokenStream.LA(1); if ( !(_la==NUMERIC_LITERAL || _la==PARAMETER) ) { ErrorHandler.RecoverInline(this); @@ -1806,23 +1949,23 @@ private Scalar_expressionContext scalar_expression(int _p) { int _parentState = State; Scalar_expressionContext _localctx = new Scalar_expressionContext(Context, _parentState); Scalar_expressionContext _prevctx = _localctx; - int _startState = 44; - EnterRecursionRule(_localctx, 44, RULE_scalar_expression, _p); + int _startState = 48; + EnterRecursionRule(_localctx, 48, RULE_scalar_expression, _p); int _la; try { int _alt; EnterOuterAlt(_localctx, 1); { - State = 241; + State = 262; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,21,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,24,Context) ) { case 1: { _localctx = new LogicalScalarExpressionContext(_localctx); Context = _localctx; _prevctx = _localctx; - State = 231; logical_scalar_expression(0); + State = 252; logical_scalar_expression(0); } break; case 2: @@ -1830,64 +1973,64 @@ private Scalar_expressionContext scalar_expression(int _p) { _localctx = new BetweenScalarExpressionContext(_localctx); Context = _localctx; _prevctx = _localctx; - State = 232; binary_scalar_expression(0); - State = 234; + State = 253; binary_scalar_expression(0); + State = 255; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==K_NOT) { { - State = 233; Match(K_NOT); + State = 254; Match(K_NOT); } } - State = 236; Match(K_BETWEEN); - State = 237; binary_scalar_expression(0); - State = 238; Match(K_AND); - State = 239; binary_scalar_expression(0); + State = 257; Match(K_BETWEEN); + State = 258; binary_scalar_expression(0); + State = 259; Match(K_AND); + State = 260; binary_scalar_expression(0); } break; } Context.Stop = TokenStream.LT(-1); - State = 254; + State = 275; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,23,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,26,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { if ( ParseListeners!=null ) TriggerExitRuleEvent(); _prevctx = _localctx; { - State = 252; + State = 273; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,22,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,25,Context) ) { case 1: { _localctx = new ConditionalScalarExpressionContext(new Scalar_expressionContext(_parentctx, _parentState)); PushNewRecursionContext(_localctx, _startState, RULE_scalar_expression); - State = 243; + State = 264; if (!(Precpred(Context, 4))) throw new FailedPredicateException(this, "Precpred(Context, 4)"); - State = 244; Match(T__7); - State = 245; scalar_expression(0); - State = 246; Match(T__8); - State = 247; scalar_expression(5); + State = 265; Match(T__7); + State = 266; scalar_expression(0); + State = 267; Match(T__8); + State = 268; scalar_expression(5); } break; case 2: { _localctx = new CoalesceScalarExpressionContext(new Scalar_expressionContext(_parentctx, _parentState)); PushNewRecursionContext(_localctx, _startState, RULE_scalar_expression); - State = 249; + State = 270; if (!(Precpred(Context, 3))) throw new FailedPredicateException(this, "Precpred(Context, 3)"); - State = 250; Match(T__9); - State = 251; scalar_expression(4); + State = 271; Match(T__9); + State = 272; scalar_expression(4); } break; } } } - State = 256; + State = 277; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,23,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,26,Context); } } } @@ -1950,70 +2093,70 @@ private Logical_scalar_expressionContext logical_scalar_expression(int _p) { int _parentState = State; Logical_scalar_expressionContext _localctx = new Logical_scalar_expressionContext(Context, _parentState); Logical_scalar_expressionContext _prevctx = _localctx; - int _startState = 46; - EnterRecursionRule(_localctx, 46, RULE_logical_scalar_expression, _p); + int _startState = 50; + EnterRecursionRule(_localctx, 50, RULE_logical_scalar_expression, _p); try { int _alt; EnterOuterAlt(_localctx, 1); { - State = 261; + State = 282; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,24,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,27,Context) ) { case 1: { - State = 258; binary_scalar_expression(0); + State = 279; binary_scalar_expression(0); } break; case 2: { - State = 259; in_scalar_expression(); + State = 280; in_scalar_expression(); } break; case 3: { - State = 260; like_scalar_expression(); + State = 281; like_scalar_expression(); } break; } Context.Stop = TokenStream.LT(-1); - State = 271; + State = 292; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,26,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,29,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { if ( ParseListeners!=null ) TriggerExitRuleEvent(); _prevctx = _localctx; { - State = 269; + State = 290; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,25,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,28,Context) ) { case 1: { _localctx = new Logical_scalar_expressionContext(_parentctx, _parentState); PushNewRecursionContext(_localctx, _startState, RULE_logical_scalar_expression); - State = 263; + State = 284; if (!(Precpred(Context, 2))) throw new FailedPredicateException(this, "Precpred(Context, 2)"); - State = 264; Match(K_AND); - State = 265; logical_scalar_expression(3); + State = 285; Match(K_AND); + State = 286; logical_scalar_expression(3); } break; case 2: { _localctx = new Logical_scalar_expressionContext(_parentctx, _parentState); PushNewRecursionContext(_localctx, _startState, RULE_logical_scalar_expression); - State = 266; + State = 287; if (!(Precpred(Context, 1))) throw new FailedPredicateException(this, "Precpred(Context, 1)"); - State = 267; Match(K_OR); - State = 268; logical_scalar_expression(2); + State = 288; Match(K_OR); + State = 289; logical_scalar_expression(2); } break; } } } - State = 273; + State = 294; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,26,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,29,Context); } } } @@ -2060,25 +2203,25 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public In_scalar_expressionContext in_scalar_expression() { In_scalar_expressionContext _localctx = new In_scalar_expressionContext(Context, State); - EnterRule(_localctx, 48, RULE_in_scalar_expression); + EnterRule(_localctx, 52, RULE_in_scalar_expression); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 274; binary_scalar_expression(0); - State = 276; + State = 295; binary_scalar_expression(0); + State = 297; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==K_NOT) { { - State = 275; Match(K_NOT); + State = 296; Match(K_NOT); } } - State = 278; Match(K_IN); - State = 279; Match(T__2); - State = 280; scalar_expression_list(); - State = 281; Match(T__3); + State = 299; Match(K_IN); + State = 300; Match(T__2); + State = 301; scalar_expression_list(); + State = 302; Match(T__3); } } catch (RecognitionException re) { @@ -2127,29 +2270,29 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Like_scalar_expressionContext like_scalar_expression() { Like_scalar_expressionContext _localctx = new Like_scalar_expressionContext(Context, State); - EnterRule(_localctx, 50, RULE_like_scalar_expression); + EnterRule(_localctx, 54, RULE_like_scalar_expression); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 283; binary_scalar_expression(0); - State = 285; + State = 304; binary_scalar_expression(0); + State = 306; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==K_NOT) { { - State = 284; Match(K_NOT); + State = 305; Match(K_NOT); } } - State = 287; Match(K_LIKE); - State = 288; binary_scalar_expression(0); - State = 290; + State = 308; Match(K_LIKE); + State = 309; binary_scalar_expression(0); + State = 311; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,29,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,32,Context) ) { case 1: { - State = 289; escape_expression(); + State = 310; escape_expression(); } break; } @@ -2192,12 +2335,12 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Escape_expressionContext escape_expression() { Escape_expressionContext _localctx = new Escape_expressionContext(Context, State); - EnterRule(_localctx, 52, RULE_escape_expression); + EnterRule(_localctx, 56, RULE_escape_expression); try { EnterOuterAlt(_localctx, 1); { - State = 292; Match(K_ESCAPE); - State = 293; Match(STRING_LITERAL); + State = 313; Match(K_ESCAPE); + State = 314; Match(STRING_LITERAL); } } catch (RecognitionException re) { @@ -2275,114 +2418,114 @@ private Binary_scalar_expressionContext binary_scalar_expression(int _p) { int _parentState = State; Binary_scalar_expressionContext _localctx = new Binary_scalar_expressionContext(Context, _parentState); Binary_scalar_expressionContext _prevctx = _localctx; - int _startState = 54; - EnterRecursionRule(_localctx, 54, RULE_binary_scalar_expression, _p); + int _startState = 58; + EnterRecursionRule(_localctx, 58, RULE_binary_scalar_expression, _p); try { int _alt; EnterOuterAlt(_localctx, 1); { { - State = 296; unary_scalar_expression(); + State = 317; unary_scalar_expression(); } Context.Stop = TokenStream.LT(-1); - State = 332; + State = 353; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,31,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,34,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { if ( ParseListeners!=null ) TriggerExitRuleEvent(); _prevctx = _localctx; { - State = 330; + State = 351; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,30,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,33,Context) ) { case 1: { _localctx = new Binary_scalar_expressionContext(_parentctx, _parentState); PushNewRecursionContext(_localctx, _startState, RULE_binary_scalar_expression); - State = 298; + State = 319; if (!(Precpred(Context, 8))) throw new FailedPredicateException(this, "Precpred(Context, 8)"); - State = 299; multiplicative_operator(); - State = 300; binary_scalar_expression(9); + State = 320; multiplicative_operator(); + State = 321; binary_scalar_expression(9); } break; case 2: { _localctx = new Binary_scalar_expressionContext(_parentctx, _parentState); PushNewRecursionContext(_localctx, _startState, RULE_binary_scalar_expression); - State = 302; + State = 323; if (!(Precpred(Context, 7))) throw new FailedPredicateException(this, "Precpred(Context, 7)"); - State = 303; additive_operator(); - State = 304; binary_scalar_expression(8); + State = 324; additive_operator(); + State = 325; binary_scalar_expression(8); } break; case 3: { _localctx = new Binary_scalar_expressionContext(_parentctx, _parentState); PushNewRecursionContext(_localctx, _startState, RULE_binary_scalar_expression); - State = 306; + State = 327; if (!(Precpred(Context, 6))) throw new FailedPredicateException(this, "Precpred(Context, 6)"); - State = 307; relational_operator(); - State = 308; binary_scalar_expression(7); + State = 328; relational_operator(); + State = 329; binary_scalar_expression(7); } break; case 4: { _localctx = new Binary_scalar_expressionContext(_parentctx, _parentState); PushNewRecursionContext(_localctx, _startState, RULE_binary_scalar_expression); - State = 310; + State = 331; if (!(Precpred(Context, 5))) throw new FailedPredicateException(this, "Precpred(Context, 5)"); - State = 311; equality_operator(); - State = 312; binary_scalar_expression(6); + State = 332; equality_operator(); + State = 333; binary_scalar_expression(6); } break; case 5: { _localctx = new Binary_scalar_expressionContext(_parentctx, _parentState); PushNewRecursionContext(_localctx, _startState, RULE_binary_scalar_expression); - State = 314; + State = 335; if (!(Precpred(Context, 4))) throw new FailedPredicateException(this, "Precpred(Context, 4)"); - State = 315; bitwise_and_operator(); - State = 316; binary_scalar_expression(5); + State = 336; bitwise_and_operator(); + State = 337; binary_scalar_expression(5); } break; case 6: { _localctx = new Binary_scalar_expressionContext(_parentctx, _parentState); PushNewRecursionContext(_localctx, _startState, RULE_binary_scalar_expression); - State = 318; + State = 339; if (!(Precpred(Context, 3))) throw new FailedPredicateException(this, "Precpred(Context, 3)"); - State = 319; bitwise_exclusive_or_operator(); - State = 320; binary_scalar_expression(4); + State = 340; bitwise_exclusive_or_operator(); + State = 341; binary_scalar_expression(4); } break; case 7: { _localctx = new Binary_scalar_expressionContext(_parentctx, _parentState); PushNewRecursionContext(_localctx, _startState, RULE_binary_scalar_expression); - State = 322; + State = 343; if (!(Precpred(Context, 2))) throw new FailedPredicateException(this, "Precpred(Context, 2)"); - State = 323; bitwise_inclusive_or_operator(); - State = 324; binary_scalar_expression(3); + State = 344; bitwise_inclusive_or_operator(); + State = 345; binary_scalar_expression(3); } break; case 8: { _localctx = new Binary_scalar_expressionContext(_parentctx, _parentState); PushNewRecursionContext(_localctx, _startState, RULE_binary_scalar_expression); - State = 326; + State = 347; if (!(Precpred(Context, 1))) throw new FailedPredicateException(this, "Precpred(Context, 1)"); - State = 327; string_concat_operator(); - State = 328; binary_scalar_expression(2); + State = 348; string_concat_operator(); + State = 349; binary_scalar_expression(2); } break; } } } - State = 334; + State = 355; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,31,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,34,Context); } } } @@ -2421,12 +2564,12 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Multiplicative_operatorContext multiplicative_operator() { Multiplicative_operatorContext _localctx = new Multiplicative_operatorContext(Context, State); - EnterRule(_localctx, 56, RULE_multiplicative_operator); + EnterRule(_localctx, 60, RULE_multiplicative_operator); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 335; + State = 356; _la = TokenStream.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__0) | (1L << T__10) | (1L << T__11))) != 0)) ) { ErrorHandler.RecoverInline(this); @@ -2472,12 +2615,12 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Additive_operatorContext additive_operator() { Additive_operatorContext _localctx = new Additive_operatorContext(Context, State); - EnterRule(_localctx, 58, RULE_additive_operator); + EnterRule(_localctx, 62, RULE_additive_operator); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 337; + State = 358; _la = TokenStream.LA(1); if ( !(_la==T__12 || _la==T__13) ) { ErrorHandler.RecoverInline(this); @@ -2523,12 +2666,12 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Relational_operatorContext relational_operator() { Relational_operatorContext _localctx = new Relational_operatorContext(Context, State); - EnterRule(_localctx, 60, RULE_relational_operator); + EnterRule(_localctx, 64, RULE_relational_operator); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 339; + State = 360; _la = TokenStream.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__14) | (1L << T__15) | (1L << T__16) | (1L << T__17))) != 0)) ) { ErrorHandler.RecoverInline(this); @@ -2574,12 +2717,12 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Equality_operatorContext equality_operator() { Equality_operatorContext _localctx = new Equality_operatorContext(Context, State); - EnterRule(_localctx, 62, RULE_equality_operator); + EnterRule(_localctx, 66, RULE_equality_operator); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 341; + State = 362; _la = TokenStream.LA(1); if ( !(_la==T__18 || _la==T__19) ) { ErrorHandler.RecoverInline(this); @@ -2625,11 +2768,11 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Bitwise_and_operatorContext bitwise_and_operator() { Bitwise_and_operatorContext _localctx = new Bitwise_and_operatorContext(Context, State); - EnterRule(_localctx, 64, RULE_bitwise_and_operator); + EnterRule(_localctx, 68, RULE_bitwise_and_operator); try { EnterOuterAlt(_localctx, 1); { - State = 343; Match(T__20); + State = 364; Match(T__20); } } catch (RecognitionException re) { @@ -2667,11 +2810,11 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Bitwise_exclusive_or_operatorContext bitwise_exclusive_or_operator() { Bitwise_exclusive_or_operatorContext _localctx = new Bitwise_exclusive_or_operatorContext(Context, State); - EnterRule(_localctx, 66, RULE_bitwise_exclusive_or_operator); + EnterRule(_localctx, 70, RULE_bitwise_exclusive_or_operator); try { EnterOuterAlt(_localctx, 1); { - State = 345; Match(T__21); + State = 366; Match(T__21); } } catch (RecognitionException re) { @@ -2709,11 +2852,11 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Bitwise_inclusive_or_operatorContext bitwise_inclusive_or_operator() { Bitwise_inclusive_or_operatorContext _localctx = new Bitwise_inclusive_or_operatorContext(Context, State); - EnterRule(_localctx, 68, RULE_bitwise_inclusive_or_operator); + EnterRule(_localctx, 72, RULE_bitwise_inclusive_or_operator); try { EnterOuterAlt(_localctx, 1); { - State = 347; Match(T__22); + State = 368; Match(T__22); } } catch (RecognitionException re) { @@ -2751,11 +2894,11 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public String_concat_operatorContext string_concat_operator() { String_concat_operatorContext _localctx = new String_concat_operatorContext(Context, State); - EnterRule(_localctx, 70, RULE_string_concat_operator); + EnterRule(_localctx, 74, RULE_string_concat_operator); try { EnterOuterAlt(_localctx, 1); { - State = 349; Match(T__23); + State = 370; Match(T__23); } } catch (RecognitionException re) { @@ -2802,9 +2945,9 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Unary_scalar_expressionContext unary_scalar_expression() { Unary_scalar_expressionContext _localctx = new Unary_scalar_expressionContext(Context, State); - EnterRule(_localctx, 72, RULE_unary_scalar_expression); + EnterRule(_localctx, 76, RULE_unary_scalar_expression); try { - State = 355; + State = 376; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__2: @@ -2828,7 +2971,7 @@ public Unary_scalar_expressionContext unary_scalar_expression() { case PARAMETER: EnterOuterAlt(_localctx, 1); { - State = 351; primary_expression(0); + State = 372; primary_expression(0); } break; case T__12: @@ -2837,8 +2980,8 @@ public Unary_scalar_expressionContext unary_scalar_expression() { case K_NOT: EnterOuterAlt(_localctx, 2); { - State = 352; unary_operator(); - State = 353; unary_scalar_expression(); + State = 373; unary_operator(); + State = 374; unary_scalar_expression(); } break; default: @@ -2881,12 +3024,12 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Unary_operatorContext unary_operator() { Unary_operatorContext _localctx = new Unary_operatorContext(Context, State); - EnterRule(_localctx, 74, RULE_unary_operator); + EnterRule(_localctx, 78, RULE_unary_operator); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 357; + State = 378; _la = TokenStream.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__12) | (1L << T__13) | (1L << T__24) | (1L << K_NOT))) != 0)) ) { ErrorHandler.RecoverInline(this); @@ -3225,23 +3368,23 @@ private Primary_expressionContext primary_expression(int _p) { int _parentState = State; Primary_expressionContext _localctx = new Primary_expressionContext(Context, _parentState); Primary_expressionContext _prevctx = _localctx; - int _startState = 76; - EnterRecursionRule(_localctx, 76, RULE_primary_expression, _p); + int _startState = 80; + EnterRecursionRule(_localctx, 80, RULE_primary_expression, _p); int _la; try { int _alt; EnterOuterAlt(_localctx, 1); { - State = 407; + State = 428; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,35,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,38,Context) ) { case 1: { _localctx = new PropertyRefScalarExpressionBaseContext(_localctx); Context = _localctx; _prevctx = _localctx; - State = 360; identifier(); + State = 381; identifier(); } break; case 2: @@ -3249,7 +3392,7 @@ private Primary_expressionContext primary_expression(int _p) { _localctx = new ParameterRefScalarExpressionContext(_localctx); Context = _localctx; _prevctx = _localctx; - State = 361; Match(PARAMETER); + State = 382; Match(PARAMETER); } break; case 3: @@ -3257,7 +3400,7 @@ private Primary_expressionContext primary_expression(int _p) { _localctx = new LiteralScalarExpressionContext(_localctx); Context = _localctx; _prevctx = _localctx; - State = 362; literal(); + State = 383; literal(); } break; case 4: @@ -3265,17 +3408,17 @@ private Primary_expressionContext primary_expression(int _p) { _localctx = new ArrayCreateScalarExpressionContext(_localctx); Context = _localctx; _prevctx = _localctx; - State = 363; Match(T__5); - State = 365; + State = 384; Match(T__5); + State = 386; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - if (((((_la - 3)) & ~0x3f) == 0 && ((1L << (_la - 3)) & ((1L << (T__2 - 3)) | (1L << (T__5 - 3)) | (1L << (T__12 - 3)) | (1L << (T__13 - 3)) | (1L << (T__24 - 3)) | (1L << (T__25 - 3)) | (1L << (K_ALL - 3)) | (1L << (K_ARRAY - 3)) | (1L << (K_EXISTS - 3)) | (1L << (K_FIRST - 3)) | (1L << (K_FALSE - 3)) | (1L << (K_LAST - 3)) | (1L << (K_LEFT - 3)) | (1L << (K_NOT - 3)) | (1L << (K_NULL - 3)) | (1L << (K_RIGHT - 3)) | (1L << (K_TRUE - 3)) | (1L << (K_UDF - 3)) | (1L << (K_UNDEFINED - 3)) | (1L << (NUMERIC_LITERAL - 3)) | (1L << (STRING_LITERAL - 3)) | (1L << (LEX_IDENTIFIER - 3)) | (1L << (PARAMETER - 3)))) != 0)) { + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__2) | (1L << T__5) | (1L << T__12) | (1L << T__13) | (1L << T__24) | (1L << T__25) | (1L << K_ALL) | (1L << K_ARRAY) | (1L << K_EXISTS) | (1L << K_FIRST) | (1L << K_FALSE) | (1L << K_LAST) | (1L << K_LEFT) | (1L << K_NOT) | (1L << K_NULL) | (1L << K_RIGHT) | (1L << K_TRUE) | (1L << K_UDF) | (1L << K_UNDEFINED))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NUMERIC_LITERAL - 64)) | (1L << (STRING_LITERAL - 64)) | (1L << (LEX_IDENTIFIER - 64)) | (1L << (PARAMETER - 64)))) != 0)) { { - State = 364; scalar_expression_list(); + State = 385; scalar_expression_list(); } } - State = 367; Match(T__6); + State = 388; Match(T__6); } break; case 5: @@ -3283,17 +3426,17 @@ private Primary_expressionContext primary_expression(int _p) { _localctx = new ObjectCreateScalarExpressionContext(_localctx); Context = _localctx; _prevctx = _localctx; - State = 368; Match(T__25); - State = 370; + State = 389; Match(T__25); + State = 391; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==STRING_LITERAL) { { - State = 369; object_property_list(); + State = 390; object_property_list(); } } - State = 372; Match(T__26); + State = 393; Match(T__26); } break; case 6: @@ -3301,9 +3444,9 @@ private Primary_expressionContext primary_expression(int _p) { _localctx = new ParenthesizedScalarExperessionContext(_localctx); Context = _localctx; _prevctx = _localctx; - State = 373; Match(T__2); - State = 374; scalar_expression(0); - State = 375; Match(T__3); + State = 394; Match(T__2); + State = 395; scalar_expression(0); + State = 396; Match(T__3); } break; case 7: @@ -3311,9 +3454,9 @@ private Primary_expressionContext primary_expression(int _p) { _localctx = new SubqueryScalarExpressionContext(_localctx); Context = _localctx; _prevctx = _localctx; - State = 377; Match(T__2); - State = 378; sql_query(); - State = 379; Match(T__3); + State = 398; Match(T__2); + State = 399; sql_query(); + State = 400; Match(T__3); } break; case 8: @@ -3321,10 +3464,10 @@ private Primary_expressionContext primary_expression(int _p) { _localctx = new ExistsScalarExpressionContext(_localctx); Context = _localctx; _prevctx = _localctx; - State = 381; Match(K_EXISTS); - State = 382; Match(T__2); - State = 383; sql_query(); - State = 384; Match(T__3); + State = 402; Match(K_EXISTS); + State = 403; Match(T__2); + State = 404; sql_query(); + State = 405; Match(T__3); } break; case 9: @@ -3332,10 +3475,10 @@ private Primary_expressionContext primary_expression(int _p) { _localctx = new ArrayScalarExpressionContext(_localctx); Context = _localctx; _prevctx = _localctx; - State = 386; Match(K_ARRAY); - State = 387; Match(T__2); - State = 388; sql_query(); - State = 389; Match(T__3); + State = 407; Match(K_ARRAY); + State = 408; Match(T__2); + State = 409; sql_query(); + State = 410; Match(T__3); } break; case 10: @@ -3343,10 +3486,10 @@ private Primary_expressionContext primary_expression(int _p) { _localctx = new AllScalarExpressionContext(_localctx); Context = _localctx; _prevctx = _localctx; - State = 391; Match(K_ALL); - State = 392; Match(T__2); - State = 393; sql_query(); - State = 394; Match(T__3); + State = 412; Match(K_ALL); + State = 413; Match(T__2); + State = 414; sql_query(); + State = 415; Match(T__3); } break; case 11: @@ -3354,10 +3497,10 @@ private Primary_expressionContext primary_expression(int _p) { _localctx = new FirstScalarExpressionContext(_localctx); Context = _localctx; _prevctx = _localctx; - State = 396; Match(K_FIRST); - State = 397; Match(T__2); - State = 398; sql_query(); - State = 399; Match(T__3); + State = 417; Match(K_FIRST); + State = 418; Match(T__2); + State = 419; sql_query(); + State = 420; Match(T__3); } break; case 12: @@ -3365,10 +3508,10 @@ private Primary_expressionContext primary_expression(int _p) { _localctx = new LastScalarExpressionContext(_localctx); Context = _localctx; _prevctx = _localctx; - State = 401; Match(K_LAST); - State = 402; Match(T__2); - State = 403; sql_query(); - State = 404; Match(T__3); + State = 422; Match(K_LAST); + State = 423; Match(T__2); + State = 424; sql_query(); + State = 425; Match(T__3); } break; case 13: @@ -3376,50 +3519,50 @@ private Primary_expressionContext primary_expression(int _p) { _localctx = new FunctionCallScalarExpressionContext(_localctx); Context = _localctx; _prevctx = _localctx; - State = 406; function_call_scalar_expression(); + State = 427; function_call_scalar_expression(); } break; } Context.Stop = TokenStream.LT(-1); - State = 419; + State = 440; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,37,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,40,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { if ( ParseListeners!=null ) TriggerExitRuleEvent(); _prevctx = _localctx; { - State = 417; + State = 438; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,36,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,39,Context) ) { case 1: { _localctx = new PropertyRefScalarExpressionRecursiveContext(new Primary_expressionContext(_parentctx, _parentState)); PushNewRecursionContext(_localctx, _startState, RULE_primary_expression); - State = 409; + State = 430; if (!(Precpred(Context, 8))) throw new FailedPredicateException(this, "Precpred(Context, 8)"); - State = 410; Match(T__4); - State = 411; identifier(); + State = 431; Match(T__4); + State = 432; identifier(); } break; case 2: { _localctx = new MemberIndexerScalarExpressionContext(new Primary_expressionContext(_parentctx, _parentState)); PushNewRecursionContext(_localctx, _startState, RULE_primary_expression); - State = 412; + State = 433; if (!(Precpred(Context, 7))) throw new FailedPredicateException(this, "Precpred(Context, 7)"); - State = 413; Match(T__5); - State = 414; scalar_expression(0); - State = 415; Match(T__6); + State = 434; Match(T__5); + State = 435; scalar_expression(0); + State = 436; Match(T__6); } break; } } } - State = 421; + State = 442; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,37,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,40,Context); } } } @@ -3467,10 +3610,10 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Function_call_scalar_expressionContext function_call_scalar_expression() { Function_call_scalar_expressionContext _localctx = new Function_call_scalar_expressionContext(Context, State); - EnterRule(_localctx, 78, RULE_function_call_scalar_expression); + EnterRule(_localctx, 82, RULE_function_call_scalar_expression); int _la; try { - State = 445; + State = 466; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case K_ALL: @@ -3480,62 +3623,62 @@ public Function_call_scalar_expressionContext function_call_scalar_expression() case LEX_IDENTIFIER: EnterOuterAlt(_localctx, 1); { - State = 424; + State = 445; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==K_UDF) { { - State = 422; Match(K_UDF); - State = 423; Match(T__4); + State = 443; Match(K_UDF); + State = 444; Match(T__4); } } - State = 426; identifier(); - State = 427; Match(T__2); - State = 429; + State = 447; identifier(); + State = 448; Match(T__2); + State = 450; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - if (((((_la - 3)) & ~0x3f) == 0 && ((1L << (_la - 3)) & ((1L << (T__2 - 3)) | (1L << (T__5 - 3)) | (1L << (T__12 - 3)) | (1L << (T__13 - 3)) | (1L << (T__24 - 3)) | (1L << (T__25 - 3)) | (1L << (K_ALL - 3)) | (1L << (K_ARRAY - 3)) | (1L << (K_EXISTS - 3)) | (1L << (K_FIRST - 3)) | (1L << (K_FALSE - 3)) | (1L << (K_LAST - 3)) | (1L << (K_LEFT - 3)) | (1L << (K_NOT - 3)) | (1L << (K_NULL - 3)) | (1L << (K_RIGHT - 3)) | (1L << (K_TRUE - 3)) | (1L << (K_UDF - 3)) | (1L << (K_UNDEFINED - 3)) | (1L << (NUMERIC_LITERAL - 3)) | (1L << (STRING_LITERAL - 3)) | (1L << (LEX_IDENTIFIER - 3)) | (1L << (PARAMETER - 3)))) != 0)) { + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__2) | (1L << T__5) | (1L << T__12) | (1L << T__13) | (1L << T__24) | (1L << T__25) | (1L << K_ALL) | (1L << K_ARRAY) | (1L << K_EXISTS) | (1L << K_FIRST) | (1L << K_FALSE) | (1L << K_LAST) | (1L << K_LEFT) | (1L << K_NOT) | (1L << K_NULL) | (1L << K_RIGHT) | (1L << K_TRUE) | (1L << K_UDF) | (1L << K_UNDEFINED))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NUMERIC_LITERAL - 64)) | (1L << (STRING_LITERAL - 64)) | (1L << (LEX_IDENTIFIER - 64)) | (1L << (PARAMETER - 64)))) != 0)) { { - State = 428; scalar_expression_list(); + State = 449; scalar_expression_list(); } } - State = 431; Match(T__3); + State = 452; Match(T__3); } break; case K_LEFT: EnterOuterAlt(_localctx, 2); { - State = 433; Match(K_LEFT); - State = 434; Match(T__2); - State = 436; + State = 454; Match(K_LEFT); + State = 455; Match(T__2); + State = 457; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - if (((((_la - 3)) & ~0x3f) == 0 && ((1L << (_la - 3)) & ((1L << (T__2 - 3)) | (1L << (T__5 - 3)) | (1L << (T__12 - 3)) | (1L << (T__13 - 3)) | (1L << (T__24 - 3)) | (1L << (T__25 - 3)) | (1L << (K_ALL - 3)) | (1L << (K_ARRAY - 3)) | (1L << (K_EXISTS - 3)) | (1L << (K_FIRST - 3)) | (1L << (K_FALSE - 3)) | (1L << (K_LAST - 3)) | (1L << (K_LEFT - 3)) | (1L << (K_NOT - 3)) | (1L << (K_NULL - 3)) | (1L << (K_RIGHT - 3)) | (1L << (K_TRUE - 3)) | (1L << (K_UDF - 3)) | (1L << (K_UNDEFINED - 3)) | (1L << (NUMERIC_LITERAL - 3)) | (1L << (STRING_LITERAL - 3)) | (1L << (LEX_IDENTIFIER - 3)) | (1L << (PARAMETER - 3)))) != 0)) { + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__2) | (1L << T__5) | (1L << T__12) | (1L << T__13) | (1L << T__24) | (1L << T__25) | (1L << K_ALL) | (1L << K_ARRAY) | (1L << K_EXISTS) | (1L << K_FIRST) | (1L << K_FALSE) | (1L << K_LAST) | (1L << K_LEFT) | (1L << K_NOT) | (1L << K_NULL) | (1L << K_RIGHT) | (1L << K_TRUE) | (1L << K_UDF) | (1L << K_UNDEFINED))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NUMERIC_LITERAL - 64)) | (1L << (STRING_LITERAL - 64)) | (1L << (LEX_IDENTIFIER - 64)) | (1L << (PARAMETER - 64)))) != 0)) { { - State = 435; scalar_expression_list(); + State = 456; scalar_expression_list(); } } - State = 438; Match(T__3); + State = 459; Match(T__3); } break; case K_RIGHT: EnterOuterAlt(_localctx, 3); { - State = 439; Match(K_RIGHT); - State = 440; Match(T__2); - State = 442; + State = 460; Match(K_RIGHT); + State = 461; Match(T__2); + State = 463; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - if (((((_la - 3)) & ~0x3f) == 0 && ((1L << (_la - 3)) & ((1L << (T__2 - 3)) | (1L << (T__5 - 3)) | (1L << (T__12 - 3)) | (1L << (T__13 - 3)) | (1L << (T__24 - 3)) | (1L << (T__25 - 3)) | (1L << (K_ALL - 3)) | (1L << (K_ARRAY - 3)) | (1L << (K_EXISTS - 3)) | (1L << (K_FIRST - 3)) | (1L << (K_FALSE - 3)) | (1L << (K_LAST - 3)) | (1L << (K_LEFT - 3)) | (1L << (K_NOT - 3)) | (1L << (K_NULL - 3)) | (1L << (K_RIGHT - 3)) | (1L << (K_TRUE - 3)) | (1L << (K_UDF - 3)) | (1L << (K_UNDEFINED - 3)) | (1L << (NUMERIC_LITERAL - 3)) | (1L << (STRING_LITERAL - 3)) | (1L << (LEX_IDENTIFIER - 3)) | (1L << (PARAMETER - 3)))) != 0)) { + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__2) | (1L << T__5) | (1L << T__12) | (1L << T__13) | (1L << T__24) | (1L << T__25) | (1L << K_ALL) | (1L << K_ARRAY) | (1L << K_EXISTS) | (1L << K_FIRST) | (1L << K_FALSE) | (1L << K_LAST) | (1L << K_LEFT) | (1L << K_NOT) | (1L << K_NULL) | (1L << K_RIGHT) | (1L << K_TRUE) | (1L << K_UDF) | (1L << K_UNDEFINED))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NUMERIC_LITERAL - 64)) | (1L << (STRING_LITERAL - 64)) | (1L << (LEX_IDENTIFIER - 64)) | (1L << (PARAMETER - 64)))) != 0)) { { - State = 441; scalar_expression_list(); + State = 462; scalar_expression_list(); } } - State = 444; Match(T__3); + State = 465; Match(T__3); } break; default: @@ -3583,23 +3726,23 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Scalar_expression_listContext scalar_expression_list() { Scalar_expression_listContext _localctx = new Scalar_expression_listContext(Context, State); - EnterRule(_localctx, 80, RULE_scalar_expression_list); + EnterRule(_localctx, 84, RULE_scalar_expression_list); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 447; scalar_expression(0); - State = 452; + State = 468; scalar_expression(0); + State = 473; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==T__1) { { { - State = 448; Match(T__1); - State = 449; scalar_expression(0); + State = 469; Match(T__1); + State = 470; scalar_expression(0); } } - State = 454; + State = 475; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -3646,23 +3789,23 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Object_property_listContext object_property_list() { Object_property_listContext _localctx = new Object_property_listContext(Context, State); - EnterRule(_localctx, 82, RULE_object_property_list); + EnterRule(_localctx, 86, RULE_object_property_list); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 455; object_property(); - State = 460; + State = 476; object_property(); + State = 481; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==T__1) { { { - State = 456; Match(T__1); - State = 457; object_property(); + State = 477; Match(T__1); + State = 478; object_property(); } } - State = 462; + State = 483; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -3707,13 +3850,13 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public Object_propertyContext object_property() { Object_propertyContext _localctx = new Object_propertyContext(Context, State); - EnterRule(_localctx, 84, RULE_object_property); + EnterRule(_localctx, 88, RULE_object_property); try { EnterOuterAlt(_localctx, 1); { - State = 463; Match(STRING_LITERAL); - State = 464; Match(T__8); - State = 465; scalar_expression(0); + State = 484; Match(STRING_LITERAL); + State = 485; Match(T__8); + State = 486; scalar_expression(0); } } catch (RecognitionException re) { @@ -3755,12 +3898,12 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public IdentifierContext identifier() { IdentifierContext _localctx = new IdentifierContext(Context, State); - EnterRule(_localctx, 86, RULE_identifier); + EnterRule(_localctx, 90, RULE_identifier); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 467; + State = 488; _la = TokenStream.LA(1); if ( !(((((_la - 28)) & ~0x3f) == 0 && ((1L << (_la - 28)) & ((1L << (K_ALL - 28)) | (1L << (K_FIRST - 28)) | (1L << (K_LAST - 28)) | (1L << (LEX_IDENTIFIER - 28)))) != 0)) ) { ErrorHandler.RecoverInline(this); @@ -3812,12 +3955,12 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public LiteralContext literal() { LiteralContext _localctx = new LiteralContext(Context, State); - EnterRule(_localctx, 88, RULE_literal); + EnterRule(_localctx, 92, RULE_literal); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 469; + State = 490; _la = TokenStream.LA(1); if ( !(((((_la - 40)) & ~0x3f) == 0 && ((1L << (_la - 40)) & ((1L << (K_FALSE - 40)) | (1L << (K_NULL - 40)) | (1L << (K_TRUE - 40)) | (1L << (K_UNDEFINED - 40)) | (1L << (NUMERIC_LITERAL - 40)) | (1L << (STRING_LITERAL - 40)))) != 0)) ) { ErrorHandler.RecoverInline(this); @@ -3843,10 +3986,10 @@ public override bool Sempred(RuleContext _localctx, int ruleIndex, int predIndex switch (ruleIndex) { case 10: return collection_expression_sempred((Collection_expressionContext)_localctx, predIndex); case 12: return path_expression_sempred((Path_expressionContext)_localctx, predIndex); - case 22: return scalar_expression_sempred((Scalar_expressionContext)_localctx, predIndex); - case 23: return logical_scalar_expression_sempred((Logical_scalar_expressionContext)_localctx, predIndex); - case 27: return binary_scalar_expression_sempred((Binary_scalar_expressionContext)_localctx, predIndex); - case 38: return primary_expression_sempred((Primary_expressionContext)_localctx, predIndex); + case 24: return scalar_expression_sempred((Scalar_expressionContext)_localctx, predIndex); + case 25: return logical_scalar_expression_sempred((Logical_scalar_expressionContext)_localctx, predIndex); + case 29: return binary_scalar_expression_sempred((Binary_scalar_expressionContext)_localctx, predIndex); + case 40: return primary_expression_sempred((Primary_expressionContext)_localctx, predIndex); } return true; } @@ -3901,7 +4044,7 @@ private bool primary_expression_sempred(Primary_expressionContext _localctx, int private static char[] _serializedATN = { '\x3', '\x608B', '\xA72A', '\x8133', '\xB9ED', '\x417C', '\x3BE7', '\x7786', - '\x5964', '\x3', '\x44', '\x1DA', '\x4', '\x2', '\t', '\x2', '\x4', '\x3', + '\x5964', '\x3', '\x45', '\x1EF', '\x4', '\x2', '\t', '\x2', '\x4', '\x3', '\t', '\x3', '\x4', '\x4', '\t', '\x4', '\x4', '\x5', '\t', '\x5', '\x4', '\x6', '\t', '\x6', '\x4', '\a', '\t', '\a', '\x4', '\b', '\t', '\b', '\x4', '\t', '\t', '\t', '\x4', '\n', '\t', '\n', '\x4', '\v', '\t', '\v', @@ -3917,393 +4060,410 @@ private bool primary_expression_sempred(Primary_expressionContext _localctx, int '#', '\t', '#', '\x4', '$', '\t', '$', '\x4', '%', '\t', '%', '\x4', '&', '\t', '&', '\x4', '\'', '\t', '\'', '\x4', '(', '\t', '(', '\x4', ')', '\t', ')', '\x4', '*', '\t', '*', '\x4', '+', '\t', '+', '\x4', ',', '\t', - ',', '\x4', '-', '\t', '-', '\x4', '.', '\t', '.', '\x3', '\x2', '\x3', - '\x2', '\x3', '\x2', '\x3', '\x3', '\x3', '\x3', '\x5', '\x3', '\x62', - '\n', '\x3', '\x3', '\x3', '\x5', '\x3', '\x65', '\n', '\x3', '\x3', '\x3', - '\x5', '\x3', 'h', '\n', '\x3', '\x3', '\x3', '\x5', '\x3', 'k', '\n', - '\x3', '\x3', '\x3', '\x5', '\x3', 'n', '\n', '\x3', '\x3', '\x4', '\x3', - '\x4', '\x5', '\x4', 'r', '\n', '\x4', '\x3', '\x4', '\x5', '\x4', 'u', - '\n', '\x4', '\x3', '\x4', '\x3', '\x4', '\x3', '\x5', '\x3', '\x5', '\x3', - '\x5', '\x3', '\x6', '\x3', '\x6', '\x3', '\x6', '\x5', '\x6', '\x7F', - '\n', '\x6', '\x3', '\a', '\x3', '\a', '\x3', '\b', '\x3', '\b', '\x3', - '\b', '\x3', '\t', '\x3', '\t', '\x3', '\t', '\a', '\t', '\x89', '\n', - '\t', '\f', '\t', '\xE', '\t', '\x8C', '\v', '\t', '\x3', '\n', '\x3', - '\n', '\x3', '\n', '\x5', '\n', '\x91', '\n', '\n', '\x3', '\v', '\x3', - '\v', '\x3', '\v', '\x3', '\f', '\x3', '\f', '\x3', '\f', '\x5', '\f', - '\x99', '\n', '\f', '\x3', '\f', '\x5', '\f', '\x9C', '\n', '\f', '\x3', - '\f', '\x3', '\f', '\x3', '\f', '\x3', '\f', '\x5', '\f', '\xA2', '\n', - '\f', '\x3', '\f', '\x3', '\f', '\x3', '\f', '\a', '\f', '\xA7', '\n', - '\f', '\f', '\f', '\xE', '\f', '\xAA', '\v', '\f', '\x3', '\r', '\x3', - '\r', '\x5', '\r', '\xAE', '\n', '\r', '\x3', '\r', '\x3', '\r', '\x3', - '\r', '\x3', '\r', '\x5', '\r', '\xB4', '\n', '\r', '\x3', '\xE', '\x3', - '\xE', '\x3', '\xE', '\x3', '\xE', '\x3', '\xE', '\x3', '\xE', '\x3', + ',', '\x4', '-', '\t', '-', '\x4', '.', '\t', '.', '\x4', '/', '\t', '/', + '\x4', '\x30', '\t', '\x30', '\x3', '\x2', '\x3', '\x2', '\x3', '\x2', + '\x3', '\x3', '\x3', '\x3', '\x5', '\x3', '\x66', '\n', '\x3', '\x3', + '\x3', '\x5', '\x3', 'i', '\n', '\x3', '\x3', '\x3', '\x5', '\x3', 'l', + '\n', '\x3', '\x3', '\x3', '\x5', '\x3', 'o', '\n', '\x3', '\x3', '\x3', + '\x5', '\x3', 'r', '\n', '\x3', '\x3', '\x4', '\x3', '\x4', '\x5', '\x4', + 'v', '\n', '\x4', '\x3', '\x4', '\x5', '\x4', 'y', '\n', '\x4', '\x3', + '\x4', '\x3', '\x4', '\x3', '\x5', '\x3', '\x5', '\x3', '\x5', '\x3', + '\x6', '\x3', '\x6', '\x3', '\x6', '\x5', '\x6', '\x83', '\n', '\x6', + '\x3', '\a', '\x3', '\a', '\x3', '\b', '\x3', '\b', '\x3', '\b', '\x3', + '\t', '\x3', '\t', '\x3', '\t', '\a', '\t', '\x8D', '\n', '\t', '\f', + '\t', '\xE', '\t', '\x90', '\v', '\t', '\x3', '\n', '\x3', '\n', '\x3', + '\n', '\x5', '\n', '\x95', '\n', '\n', '\x3', '\v', '\x3', '\v', '\x3', + '\v', '\x3', '\f', '\x3', '\f', '\x3', '\f', '\x5', '\f', '\x9D', '\n', + '\f', '\x3', '\f', '\x5', '\f', '\xA0', '\n', '\f', '\x3', '\f', '\x3', + '\f', '\x3', '\f', '\x3', '\f', '\x5', '\f', '\xA6', '\n', '\f', '\x3', + '\f', '\x3', '\f', '\x3', '\f', '\a', '\f', '\xAB', '\n', '\f', '\f', + '\f', '\xE', '\f', '\xAE', '\v', '\f', '\x3', '\r', '\x3', '\r', '\x5', + '\r', '\xB2', '\n', '\r', '\x3', '\r', '\x3', '\r', '\x3', '\r', '\x3', + '\r', '\x5', '\r', '\xB8', '\n', '\r', '\x3', '\xE', '\x3', '\xE', '\x3', '\xE', '\x3', '\xE', '\x3', '\xE', '\x3', '\xE', '\x3', '\xE', '\x3', - '\xE', '\a', '\xE', '\xC2', '\n', '\xE', '\f', '\xE', '\xE', '\xE', '\xC5', - '\v', '\xE', '\x3', '\xF', '\x3', '\xF', '\x3', '\xF', '\x3', '\x10', - '\x3', '\x10', '\x3', '\x10', '\x3', '\x10', '\x3', '\x11', '\x3', '\x11', - '\x3', '\x11', '\x3', '\x11', '\x3', '\x12', '\x3', '\x12', '\x3', '\x12', - '\a', '\x12', '\xD5', '\n', '\x12', '\f', '\x12', '\xE', '\x12', '\xD8', - '\v', '\x12', '\x3', '\x13', '\x3', '\x13', '\x5', '\x13', '\xDC', '\n', - '\x13', '\x3', '\x14', '\x3', '\x14', '\x3', '\x15', '\x3', '\x15', '\x3', - '\x15', '\x3', '\x15', '\x3', '\x15', '\x3', '\x16', '\x3', '\x16', '\x3', - '\x17', '\x3', '\x17', '\x3', '\x18', '\x3', '\x18', '\x3', '\x18', '\x3', - '\x18', '\x5', '\x18', '\xED', '\n', '\x18', '\x3', '\x18', '\x3', '\x18', - '\x3', '\x18', '\x3', '\x18', '\x3', '\x18', '\x5', '\x18', '\xF4', '\n', - '\x18', '\x3', '\x18', '\x3', '\x18', '\x3', '\x18', '\x3', '\x18', '\x3', - '\x18', '\x3', '\x18', '\x3', '\x18', '\x3', '\x18', '\x3', '\x18', '\a', - '\x18', '\xFF', '\n', '\x18', '\f', '\x18', '\xE', '\x18', '\x102', '\v', - '\x18', '\x3', '\x19', '\x3', '\x19', '\x3', '\x19', '\x3', '\x19', '\x5', - '\x19', '\x108', '\n', '\x19', '\x3', '\x19', '\x3', '\x19', '\x3', '\x19', - '\x3', '\x19', '\x3', '\x19', '\x3', '\x19', '\a', '\x19', '\x110', '\n', - '\x19', '\f', '\x19', '\xE', '\x19', '\x113', '\v', '\x19', '\x3', '\x1A', - '\x3', '\x1A', '\x5', '\x1A', '\x117', '\n', '\x1A', '\x3', '\x1A', '\x3', - '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\x3', '\x1B', '\x3', - '\x1B', '\x5', '\x1B', '\x120', '\n', '\x1B', '\x3', '\x1B', '\x3', '\x1B', - '\x3', '\x1B', '\x5', '\x1B', '\x125', '\n', '\x1B', '\x3', '\x1C', '\x3', - '\x1C', '\x3', '\x1C', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', - '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', - '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', - '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', - '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', - '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', - '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', - '\x1D', '\x3', '\x1D', '\a', '\x1D', '\x14D', '\n', '\x1D', '\f', '\x1D', - '\xE', '\x1D', '\x150', '\v', '\x1D', '\x3', '\x1E', '\x3', '\x1E', '\x3', - '\x1F', '\x3', '\x1F', '\x3', ' ', '\x3', ' ', '\x3', '!', '\x3', '!', - '\x3', '\"', '\x3', '\"', '\x3', '#', '\x3', '#', '\x3', '$', '\x3', '$', - '\x3', '%', '\x3', '%', '\x3', '&', '\x3', '&', '\x3', '&', '\x3', '&', - '\x5', '&', '\x166', '\n', '&', '\x3', '\'', '\x3', '\'', '\x3', '(', - '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', '\x5', '(', - '\x170', '\n', '(', '\x3', '(', '\x3', '(', '\x3', '(', '\x5', '(', '\x175', - '\n', '(', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', - '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', - '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', - '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', - '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', - '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', - '\x5', '(', '\x19A', '\n', '(', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', - '(', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', '\a', '(', '\x1A4', - '\n', '(', '\f', '(', '\xE', '(', '\x1A7', '\v', '(', '\x3', ')', '\x3', - ')', '\x5', ')', '\x1AB', '\n', ')', '\x3', ')', '\x3', ')', '\x3', ')', - '\x5', ')', '\x1B0', '\n', ')', '\x3', ')', '\x3', ')', '\x3', ')', '\x3', - ')', '\x3', ')', '\x5', ')', '\x1B7', '\n', ')', '\x3', ')', '\x3', ')', - '\x3', ')', '\x3', ')', '\x5', ')', '\x1BD', '\n', ')', '\x3', ')', '\x5', - ')', '\x1C0', '\n', ')', '\x3', '*', '\x3', '*', '\x3', '*', '\a', '*', - '\x1C5', '\n', '*', '\f', '*', '\xE', '*', '\x1C8', '\v', '*', '\x3', - '+', '\x3', '+', '\x3', '+', '\a', '+', '\x1CD', '\n', '+', '\f', '+', - '\xE', '+', '\x1D0', '\v', '+', '\x3', ',', '\x3', ',', '\x3', ',', '\x3', - ',', '\x3', '-', '\x3', '-', '\x3', '.', '\x3', '.', '\x3', '.', '\x2', - '\b', '\x16', '\x1A', '.', '\x30', '\x38', 'N', '/', '\x2', '\x4', '\x6', - '\b', '\n', '\f', '\xE', '\x10', '\x12', '\x14', '\x16', '\x18', '\x1A', - '\x1C', '\x1E', ' ', '\"', '$', '&', '(', '*', ',', '.', '\x30', '\x32', - '\x34', '\x36', '\x38', ':', '<', '>', '@', '\x42', '\x44', '\x46', 'H', - 'J', 'L', 'N', 'P', 'R', 'T', 'V', 'X', 'Z', '\x2', '\v', '\x4', '\x2', - '\x41', '\x41', '\x44', '\x44', '\x4', '\x2', '\"', '\"', '%', '%', '\x4', - '\x2', '\x3', '\x3', '\r', '\xE', '\x3', '\x2', '\xF', '\x10', '\x3', - '\x2', '\x11', '\x14', '\x3', '\x2', '\x15', '\x16', '\x5', '\x2', '\xF', - '\x10', '\x1B', '\x1B', '\x33', '\x33', '\x6', '\x2', '\x1E', '\x1E', - ')', ')', '/', '/', '\x43', '\x43', '\a', '\x2', '*', '*', '\x34', '\x34', - ';', ';', '=', '=', '\x41', '\x42', '\x2', '\x1EE', '\x2', '\\', '\x3', - '\x2', '\x2', '\x2', '\x4', '_', '\x3', '\x2', '\x2', '\x2', '\x6', 'o', - '\x3', '\x2', '\x2', '\x2', '\b', 'x', '\x3', '\x2', '\x2', '\x2', '\n', - '~', '\x3', '\x2', '\x2', '\x2', '\f', '\x80', '\x3', '\x2', '\x2', '\x2', - '\xE', '\x82', '\x3', '\x2', '\x2', '\x2', '\x10', '\x85', '\x3', '\x2', - '\x2', '\x2', '\x12', '\x8D', '\x3', '\x2', '\x2', '\x2', '\x14', '\x92', - '\x3', '\x2', '\x2', '\x2', '\x16', '\xA1', '\x3', '\x2', '\x2', '\x2', - '\x18', '\xB3', '\x3', '\x2', '\x2', '\x2', '\x1A', '\xB5', '\x3', '\x2', - '\x2', '\x2', '\x1C', '\xC6', '\x3', '\x2', '\x2', '\x2', '\x1E', '\xC9', - '\x3', '\x2', '\x2', '\x2', ' ', '\xCD', '\x3', '\x2', '\x2', '\x2', '\"', - '\xD1', '\x3', '\x2', '\x2', '\x2', '$', '\xD9', '\x3', '\x2', '\x2', - '\x2', '&', '\xDD', '\x3', '\x2', '\x2', '\x2', '(', '\xDF', '\x3', '\x2', - '\x2', '\x2', '*', '\xE4', '\x3', '\x2', '\x2', '\x2', ',', '\xE6', '\x3', - '\x2', '\x2', '\x2', '.', '\xF3', '\x3', '\x2', '\x2', '\x2', '\x30', - '\x107', '\x3', '\x2', '\x2', '\x2', '\x32', '\x114', '\x3', '\x2', '\x2', - '\x2', '\x34', '\x11D', '\x3', '\x2', '\x2', '\x2', '\x36', '\x126', '\x3', - '\x2', '\x2', '\x2', '\x38', '\x129', '\x3', '\x2', '\x2', '\x2', ':', - '\x151', '\x3', '\x2', '\x2', '\x2', '<', '\x153', '\x3', '\x2', '\x2', - '\x2', '>', '\x155', '\x3', '\x2', '\x2', '\x2', '@', '\x157', '\x3', - '\x2', '\x2', '\x2', '\x42', '\x159', '\x3', '\x2', '\x2', '\x2', '\x44', - '\x15B', '\x3', '\x2', '\x2', '\x2', '\x46', '\x15D', '\x3', '\x2', '\x2', - '\x2', 'H', '\x15F', '\x3', '\x2', '\x2', '\x2', 'J', '\x165', '\x3', - '\x2', '\x2', '\x2', 'L', '\x167', '\x3', '\x2', '\x2', '\x2', 'N', '\x199', - '\x3', '\x2', '\x2', '\x2', 'P', '\x1BF', '\x3', '\x2', '\x2', '\x2', - 'R', '\x1C1', '\x3', '\x2', '\x2', '\x2', 'T', '\x1C9', '\x3', '\x2', - '\x2', '\x2', 'V', '\x1D1', '\x3', '\x2', '\x2', '\x2', 'X', '\x1D5', - '\x3', '\x2', '\x2', '\x2', 'Z', '\x1D7', '\x3', '\x2', '\x2', '\x2', - '\\', ']', '\x5', '\x4', '\x3', '\x2', ']', '^', '\a', '\x2', '\x2', '\x3', - '^', '\x3', '\x3', '\x2', '\x2', '\x2', '_', '\x61', '\x5', '\x6', '\x4', - '\x2', '`', '\x62', '\x5', '\x14', '\v', '\x2', '\x61', '`', '\x3', '\x2', - '\x2', '\x2', '\x61', '\x62', '\x3', '\x2', '\x2', '\x2', '\x62', '\x64', - '\x3', '\x2', '\x2', '\x2', '\x63', '\x65', '\x5', '\x1C', '\xF', '\x2', - '\x64', '\x63', '\x3', '\x2', '\x2', '\x2', '\x64', '\x65', '\x3', '\x2', - '\x2', '\x2', '\x65', 'g', '\x3', '\x2', '\x2', '\x2', '\x66', 'h', '\x5', - '\x1E', '\x10', '\x2', 'g', '\x66', '\x3', '\x2', '\x2', '\x2', 'g', 'h', - '\x3', '\x2', '\x2', '\x2', 'h', 'j', '\x3', '\x2', '\x2', '\x2', 'i', - 'k', '\x5', ' ', '\x11', '\x2', 'j', 'i', '\x3', '\x2', '\x2', '\x2', - 'j', 'k', '\x3', '\x2', '\x2', '\x2', 'k', 'm', '\x3', '\x2', '\x2', '\x2', - 'l', 'n', '\x5', '(', '\x15', '\x2', 'm', 'l', '\x3', '\x2', '\x2', '\x2', - 'm', 'n', '\x3', '\x2', '\x2', '\x2', 'n', '\x5', '\x3', '\x2', '\x2', - '\x2', 'o', 'q', '\a', '\x39', '\x2', '\x2', 'p', 'r', '\a', '&', '\x2', + '\xE', '\x3', '\xE', '\x3', '\xE', '\x3', '\xE', '\x3', '\xE', '\a', '\xE', + '\xC6', '\n', '\xE', '\f', '\xE', '\xE', '\xE', '\xC9', '\v', '\xE', '\x3', + '\xF', '\x3', '\xF', '\x3', '\xF', '\x3', '\x10', '\x3', '\x10', '\x3', + '\x10', '\x3', '\x10', '\x3', '\x11', '\x3', '\x11', '\x3', '\x11', '\x3', + '\x11', '\x3', '\x11', '\x3', '\x11', '\x3', '\x11', '\x5', '\x11', '\xD9', + '\n', '\x11', '\x3', '\x12', '\x3', '\x12', '\x3', '\x12', '\a', '\x12', + '\xDE', '\n', '\x12', '\f', '\x12', '\xE', '\x12', '\xE1', '\v', '\x12', + '\x3', '\x13', '\x3', '\x13', '\x5', '\x13', '\xE5', '\n', '\x13', '\x3', + '\x14', '\x3', '\x14', '\x3', '\x14', '\a', '\x14', '\xEA', '\n', '\x14', + '\f', '\x14', '\xE', '\x14', '\xED', '\v', '\x14', '\x3', '\x15', '\x3', + '\x15', '\x5', '\x15', '\xF1', '\n', '\x15', '\x3', '\x16', '\x3', '\x16', + '\x3', '\x17', '\x3', '\x17', '\x3', '\x17', '\x3', '\x17', '\x3', '\x17', + '\x3', '\x18', '\x3', '\x18', '\x3', '\x19', '\x3', '\x19', '\x3', '\x1A', + '\x3', '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\x5', '\x1A', '\x102', '\n', + '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\x3', + '\x1A', '\x5', '\x1A', '\x109', '\n', '\x1A', '\x3', '\x1A', '\x3', '\x1A', + '\x3', '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\x3', '\x1A', + '\x3', '\x1A', '\x3', '\x1A', '\a', '\x1A', '\x114', '\n', '\x1A', '\f', + '\x1A', '\xE', '\x1A', '\x117', '\v', '\x1A', '\x3', '\x1B', '\x3', '\x1B', + '\x3', '\x1B', '\x3', '\x1B', '\x5', '\x1B', '\x11D', '\n', '\x1B', '\x3', + '\x1B', '\x3', '\x1B', '\x3', '\x1B', '\x3', '\x1B', '\x3', '\x1B', '\x3', + '\x1B', '\a', '\x1B', '\x125', '\n', '\x1B', '\f', '\x1B', '\xE', '\x1B', + '\x128', '\v', '\x1B', '\x3', '\x1C', '\x3', '\x1C', '\x5', '\x1C', '\x12C', + '\n', '\x1C', '\x3', '\x1C', '\x3', '\x1C', '\x3', '\x1C', '\x3', '\x1C', + '\x3', '\x1C', '\x3', '\x1D', '\x3', '\x1D', '\x5', '\x1D', '\x135', '\n', + '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x5', '\x1D', '\x13A', + '\n', '\x1D', '\x3', '\x1E', '\x3', '\x1E', '\x3', '\x1E', '\x3', '\x1F', + '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', + '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', + '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', + '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', + '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', + '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', + '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\a', '\x1F', + '\x162', '\n', '\x1F', '\f', '\x1F', '\xE', '\x1F', '\x165', '\v', '\x1F', + '\x3', ' ', '\x3', ' ', '\x3', '!', '\x3', '!', '\x3', '\"', '\x3', '\"', + '\x3', '#', '\x3', '#', '\x3', '$', '\x3', '$', '\x3', '%', '\x3', '%', + '\x3', '&', '\x3', '&', '\x3', '\'', '\x3', '\'', '\x3', '(', '\x3', '(', + '\x3', '(', '\x3', '(', '\x5', '(', '\x17B', '\n', '(', '\x3', ')', '\x3', + ')', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', + '*', '\x5', '*', '\x185', '\n', '*', '\x3', '*', '\x3', '*', '\x3', '*', + '\x5', '*', '\x18A', '\n', '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', + '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', + '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', + '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', + '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', + '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', + '*', '\x3', '*', '\x5', '*', '\x1AF', '\n', '*', '\x3', '*', '\x3', '*', + '\x3', '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', '*', + '\a', '*', '\x1B9', '\n', '*', '\f', '*', '\xE', '*', '\x1BC', '\v', '*', + '\x3', '+', '\x3', '+', '\x5', '+', '\x1C0', '\n', '+', '\x3', '+', '\x3', + '+', '\x3', '+', '\x5', '+', '\x1C5', '\n', '+', '\x3', '+', '\x3', '+', + '\x3', '+', '\x3', '+', '\x3', '+', '\x5', '+', '\x1CC', '\n', '+', '\x3', + '+', '\x3', '+', '\x3', '+', '\x3', '+', '\x5', '+', '\x1D2', '\n', '+', + '\x3', '+', '\x5', '+', '\x1D5', '\n', '+', '\x3', ',', '\x3', ',', '\x3', + ',', '\a', ',', '\x1DA', '\n', ',', '\f', ',', '\xE', ',', '\x1DD', '\v', + ',', '\x3', '-', '\x3', '-', '\x3', '-', '\a', '-', '\x1E2', '\n', '-', + '\f', '-', '\xE', '-', '\x1E5', '\v', '-', '\x3', '.', '\x3', '.', '\x3', + '.', '\x3', '.', '\x3', '/', '\x3', '/', '\x3', '\x30', '\x3', '\x30', + '\x3', '\x30', '\x2', '\b', '\x16', '\x1A', '\x32', '\x34', '<', 'R', + '\x31', '\x2', '\x4', '\x6', '\b', '\n', '\f', '\xE', '\x10', '\x12', + '\x14', '\x16', '\x18', '\x1A', '\x1C', '\x1E', ' ', '\"', '$', '&', '(', + '*', ',', '.', '\x30', '\x32', '\x34', '\x36', '\x38', ':', '<', '>', + '@', '\x42', '\x44', '\x46', 'H', 'J', 'L', 'N', 'P', 'R', 'T', 'V', 'X', + 'Z', '\\', '^', '\x2', '\v', '\x4', '\x2', '\x42', '\x42', '\x45', '\x45', + '\x4', '\x2', '\"', '\"', '%', '%', '\x4', '\x2', '\x3', '\x3', '\r', + '\xE', '\x3', '\x2', '\xF', '\x10', '\x3', '\x2', '\x11', '\x14', '\x3', + '\x2', '\x15', '\x16', '\x5', '\x2', '\xF', '\x10', '\x1B', '\x1B', '\x33', + '\x33', '\x6', '\x2', '\x1E', '\x1E', ')', ')', '/', '/', '\x44', '\x44', + '\a', '\x2', '*', '*', '\x34', '\x34', '<', '<', '>', '>', '\x42', '\x43', + '\x2', '\x204', '\x2', '`', '\x3', '\x2', '\x2', '\x2', '\x4', '\x63', + '\x3', '\x2', '\x2', '\x2', '\x6', 's', '\x3', '\x2', '\x2', '\x2', '\b', + '|', '\x3', '\x2', '\x2', '\x2', '\n', '\x82', '\x3', '\x2', '\x2', '\x2', + '\f', '\x84', '\x3', '\x2', '\x2', '\x2', '\xE', '\x86', '\x3', '\x2', + '\x2', '\x2', '\x10', '\x89', '\x3', '\x2', '\x2', '\x2', '\x12', '\x91', + '\x3', '\x2', '\x2', '\x2', '\x14', '\x96', '\x3', '\x2', '\x2', '\x2', + '\x16', '\xA5', '\x3', '\x2', '\x2', '\x2', '\x18', '\xB7', '\x3', '\x2', + '\x2', '\x2', '\x1A', '\xB9', '\x3', '\x2', '\x2', '\x2', '\x1C', '\xCA', + '\x3', '\x2', '\x2', '\x2', '\x1E', '\xCD', '\x3', '\x2', '\x2', '\x2', + ' ', '\xD8', '\x3', '\x2', '\x2', '\x2', '\"', '\xDA', '\x3', '\x2', '\x2', + '\x2', '$', '\xE2', '\x3', '\x2', '\x2', '\x2', '&', '\xE6', '\x3', '\x2', + '\x2', '\x2', '(', '\xEE', '\x3', '\x2', '\x2', '\x2', '*', '\xF2', '\x3', + '\x2', '\x2', '\x2', ',', '\xF4', '\x3', '\x2', '\x2', '\x2', '.', '\xF9', + '\x3', '\x2', '\x2', '\x2', '\x30', '\xFB', '\x3', '\x2', '\x2', '\x2', + '\x32', '\x108', '\x3', '\x2', '\x2', '\x2', '\x34', '\x11C', '\x3', '\x2', + '\x2', '\x2', '\x36', '\x129', '\x3', '\x2', '\x2', '\x2', '\x38', '\x132', + '\x3', '\x2', '\x2', '\x2', ':', '\x13B', '\x3', '\x2', '\x2', '\x2', + '<', '\x13E', '\x3', '\x2', '\x2', '\x2', '>', '\x166', '\x3', '\x2', + '\x2', '\x2', '@', '\x168', '\x3', '\x2', '\x2', '\x2', '\x42', '\x16A', + '\x3', '\x2', '\x2', '\x2', '\x44', '\x16C', '\x3', '\x2', '\x2', '\x2', + '\x46', '\x16E', '\x3', '\x2', '\x2', '\x2', 'H', '\x170', '\x3', '\x2', + '\x2', '\x2', 'J', '\x172', '\x3', '\x2', '\x2', '\x2', 'L', '\x174', + '\x3', '\x2', '\x2', '\x2', 'N', '\x17A', '\x3', '\x2', '\x2', '\x2', + 'P', '\x17C', '\x3', '\x2', '\x2', '\x2', 'R', '\x1AE', '\x3', '\x2', + '\x2', '\x2', 'T', '\x1D4', '\x3', '\x2', '\x2', '\x2', 'V', '\x1D6', + '\x3', '\x2', '\x2', '\x2', 'X', '\x1DE', '\x3', '\x2', '\x2', '\x2', + 'Z', '\x1E6', '\x3', '\x2', '\x2', '\x2', '\\', '\x1EA', '\x3', '\x2', + '\x2', '\x2', '^', '\x1EC', '\x3', '\x2', '\x2', '\x2', '`', '\x61', '\x5', + '\x4', '\x3', '\x2', '\x61', '\x62', '\a', '\x2', '\x2', '\x3', '\x62', + '\x3', '\x3', '\x2', '\x2', '\x2', '\x63', '\x65', '\x5', '\x6', '\x4', + '\x2', '\x64', '\x66', '\x5', '\x14', '\v', '\x2', '\x65', '\x64', '\x3', + '\x2', '\x2', '\x2', '\x65', '\x66', '\x3', '\x2', '\x2', '\x2', '\x66', + 'h', '\x3', '\x2', '\x2', '\x2', 'g', 'i', '\x5', '\x1C', '\xF', '\x2', + 'h', 'g', '\x3', '\x2', '\x2', '\x2', 'h', 'i', '\x3', '\x2', '\x2', '\x2', + 'i', 'k', '\x3', '\x2', '\x2', '\x2', 'j', 'l', '\x5', '\x1E', '\x10', + '\x2', 'k', 'j', '\x3', '\x2', '\x2', '\x2', 'k', 'l', '\x3', '\x2', '\x2', + '\x2', 'l', 'n', '\x3', '\x2', '\x2', '\x2', 'm', 'o', '\x5', ' ', '\x11', + '\x2', 'n', 'm', '\x3', '\x2', '\x2', '\x2', 'n', 'o', '\x3', '\x2', '\x2', + '\x2', 'o', 'q', '\x3', '\x2', '\x2', '\x2', 'p', 'r', '\x5', ',', '\x17', '\x2', 'q', 'p', '\x3', '\x2', '\x2', '\x2', 'q', 'r', '\x3', '\x2', '\x2', - '\x2', 'r', 't', '\x3', '\x2', '\x2', '\x2', 's', 'u', '\x5', '\b', '\x5', - '\x2', 't', 's', '\x3', '\x2', '\x2', '\x2', 't', 'u', '\x3', '\x2', '\x2', - '\x2', 'u', 'v', '\x3', '\x2', '\x2', '\x2', 'v', 'w', '\x5', '\n', '\x6', - '\x2', 'w', '\a', '\x3', '\x2', '\x2', '\x2', 'x', 'y', '\a', ':', '\x2', - '\x2', 'y', 'z', '\t', '\x2', '\x2', '\x2', 'z', '\t', '\x3', '\x2', '\x2', - '\x2', '{', '\x7F', '\x5', '\f', '\a', '\x2', '|', '\x7F', '\x5', '\xE', - '\b', '\x2', '}', '\x7F', '\x5', '\x10', '\t', '\x2', '~', '{', '\x3', - '\x2', '\x2', '\x2', '~', '|', '\x3', '\x2', '\x2', '\x2', '~', '}', '\x3', - '\x2', '\x2', '\x2', '\x7F', '\v', '\x3', '\x2', '\x2', '\x2', '\x80', - '\x81', '\a', '\x3', '\x2', '\x2', '\x81', '\r', '\x3', '\x2', '\x2', - '\x2', '\x82', '\x83', '\a', '>', '\x2', '\x2', '\x83', '\x84', '\x5', - '.', '\x18', '\x2', '\x84', '\xF', '\x3', '\x2', '\x2', '\x2', '\x85', - '\x8A', '\x5', '\x12', '\n', '\x2', '\x86', '\x87', '\a', '\x4', '\x2', - '\x2', '\x87', '\x89', '\x5', '\x12', '\n', '\x2', '\x88', '\x86', '\x3', - '\x2', '\x2', '\x2', '\x89', '\x8C', '\x3', '\x2', '\x2', '\x2', '\x8A', - '\x88', '\x3', '\x2', '\x2', '\x2', '\x8A', '\x8B', '\x3', '\x2', '\x2', - '\x2', '\x8B', '\x11', '\x3', '\x2', '\x2', '\x2', '\x8C', '\x8A', '\x3', - '\x2', '\x2', '\x2', '\x8D', '\x90', '\x5', '.', '\x18', '\x2', '\x8E', - '\x8F', '\a', '!', '\x2', '\x2', '\x8F', '\x91', '\x5', 'X', '-', '\x2', - '\x90', '\x8E', '\x3', '\x2', '\x2', '\x2', '\x90', '\x91', '\x3', '\x2', - '\x2', '\x2', '\x91', '\x13', '\x3', '\x2', '\x2', '\x2', '\x92', '\x93', - '\a', '+', '\x2', '\x2', '\x93', '\x94', '\x5', '\x16', '\f', '\x2', '\x94', - '\x15', '\x3', '\x2', '\x2', '\x2', '\x95', '\x96', '\b', '\f', '\x1', - '\x2', '\x96', '\x9B', '\x5', '\x18', '\r', '\x2', '\x97', '\x99', '\a', - '!', '\x2', '\x2', '\x98', '\x97', '\x3', '\x2', '\x2', '\x2', '\x98', - '\x99', '\x3', '\x2', '\x2', '\x2', '\x99', '\x9A', '\x3', '\x2', '\x2', - '\x2', '\x9A', '\x9C', '\x5', 'X', '-', '\x2', '\x9B', '\x98', '\x3', - '\x2', '\x2', '\x2', '\x9B', '\x9C', '\x3', '\x2', '\x2', '\x2', '\x9C', - '\xA2', '\x3', '\x2', '\x2', '\x2', '\x9D', '\x9E', '\x5', 'X', '-', '\x2', - '\x9E', '\x9F', '\a', '-', '\x2', '\x2', '\x9F', '\xA0', '\x5', '\x18', - '\r', '\x2', '\xA0', '\xA2', '\x3', '\x2', '\x2', '\x2', '\xA1', '\x95', - '\x3', '\x2', '\x2', '\x2', '\xA1', '\x9D', '\x3', '\x2', '\x2', '\x2', - '\xA2', '\xA8', '\x3', '\x2', '\x2', '\x2', '\xA3', '\xA4', '\f', '\x3', - '\x2', '\x2', '\xA4', '\xA5', '\a', '.', '\x2', '\x2', '\xA5', '\xA7', - '\x5', '\x16', '\f', '\x4', '\xA6', '\xA3', '\x3', '\x2', '\x2', '\x2', - '\xA7', '\xAA', '\x3', '\x2', '\x2', '\x2', '\xA8', '\xA6', '\x3', '\x2', - '\x2', '\x2', '\xA8', '\xA9', '\x3', '\x2', '\x2', '\x2', '\xA9', '\x17', - '\x3', '\x2', '\x2', '\x2', '\xAA', '\xA8', '\x3', '\x2', '\x2', '\x2', - '\xAB', '\xAD', '\x5', 'X', '-', '\x2', '\xAC', '\xAE', '\x5', '\x1A', - '\xE', '\x2', '\xAD', '\xAC', '\x3', '\x2', '\x2', '\x2', '\xAD', '\xAE', - '\x3', '\x2', '\x2', '\x2', '\xAE', '\xB4', '\x3', '\x2', '\x2', '\x2', - '\xAF', '\xB0', '\a', '\x5', '\x2', '\x2', '\xB0', '\xB1', '\x5', '\x4', - '\x3', '\x2', '\xB1', '\xB2', '\a', '\x6', '\x2', '\x2', '\xB2', '\xB4', - '\x3', '\x2', '\x2', '\x2', '\xB3', '\xAB', '\x3', '\x2', '\x2', '\x2', - '\xB3', '\xAF', '\x3', '\x2', '\x2', '\x2', '\xB4', '\x19', '\x3', '\x2', - '\x2', '\x2', '\xB5', '\xC3', '\b', '\xE', '\x1', '\x2', '\xB6', '\xB7', - '\f', '\x6', '\x2', '\x2', '\xB7', '\xB8', '\a', '\a', '\x2', '\x2', '\xB8', - '\xC2', '\x5', 'X', '-', '\x2', '\xB9', '\xBA', '\f', '\x5', '\x2', '\x2', - '\xBA', '\xBB', '\a', '\b', '\x2', '\x2', '\xBB', '\xBC', '\a', '\x41', - '\x2', '\x2', '\xBC', '\xC2', '\a', '\t', '\x2', '\x2', '\xBD', '\xBE', - '\f', '\x4', '\x2', '\x2', '\xBE', '\xBF', '\a', '\b', '\x2', '\x2', '\xBF', - '\xC0', '\a', '\x42', '\x2', '\x2', '\xC0', '\xC2', '\a', '\t', '\x2', - '\x2', '\xC1', '\xB6', '\x3', '\x2', '\x2', '\x2', '\xC1', '\xB9', '\x3', - '\x2', '\x2', '\x2', '\xC1', '\xBD', '\x3', '\x2', '\x2', '\x2', '\xC2', - '\xC5', '\x3', '\x2', '\x2', '\x2', '\xC3', '\xC1', '\x3', '\x2', '\x2', - '\x2', '\xC3', '\xC4', '\x3', '\x2', '\x2', '\x2', '\xC4', '\x1B', '\x3', - '\x2', '\x2', '\x2', '\xC5', '\xC3', '\x3', '\x2', '\x2', '\x2', '\xC6', - '\xC7', '\a', '?', '\x2', '\x2', '\xC7', '\xC8', '\x5', '.', '\x18', '\x2', - '\xC8', '\x1D', '\x3', '\x2', '\x2', '\x2', '\xC9', '\xCA', '\a', ',', - '\x2', '\x2', '\xCA', '\xCB', '\a', '$', '\x2', '\x2', '\xCB', '\xCC', - '\x5', 'R', '*', '\x2', '\xCC', '\x1F', '\x3', '\x2', '\x2', '\x2', '\xCD', - '\xCE', '\a', '\x37', '\x2', '\x2', '\xCE', '\xCF', '\a', '$', '\x2', - '\x2', '\xCF', '\xD0', '\x5', '\"', '\x12', '\x2', '\xD0', '!', '\x3', - '\x2', '\x2', '\x2', '\xD1', '\xD6', '\x5', '$', '\x13', '\x2', '\xD2', - '\xD3', '\a', '\x4', '\x2', '\x2', '\xD3', '\xD5', '\x5', '$', '\x13', - '\x2', '\xD4', '\xD2', '\x3', '\x2', '\x2', '\x2', '\xD5', '\xD8', '\x3', - '\x2', '\x2', '\x2', '\xD6', '\xD4', '\x3', '\x2', '\x2', '\x2', '\xD6', - '\xD7', '\x3', '\x2', '\x2', '\x2', '\xD7', '#', '\x3', '\x2', '\x2', - '\x2', '\xD8', '\xD6', '\x3', '\x2', '\x2', '\x2', '\xD9', '\xDB', '\x5', - '.', '\x18', '\x2', '\xDA', '\xDC', '\x5', '&', '\x14', '\x2', '\xDB', - '\xDA', '\x3', '\x2', '\x2', '\x2', '\xDB', '\xDC', '\x3', '\x2', '\x2', - '\x2', '\xDC', '%', '\x3', '\x2', '\x2', '\x2', '\xDD', '\xDE', '\t', - '\x3', '\x2', '\x2', '\xDE', '\'', '\x3', '\x2', '\x2', '\x2', '\xDF', - '\xE0', '\a', '\x35', '\x2', '\x2', '\xE0', '\xE1', '\x5', '*', '\x16', - '\x2', '\xE1', '\xE2', '\a', '\x32', '\x2', '\x2', '\xE2', '\xE3', '\x5', - ',', '\x17', '\x2', '\xE3', ')', '\x3', '\x2', '\x2', '\x2', '\xE4', '\xE5', - '\t', '\x2', '\x2', '\x2', '\xE5', '+', '\x3', '\x2', '\x2', '\x2', '\xE6', - '\xE7', '\t', '\x2', '\x2', '\x2', '\xE7', '-', '\x3', '\x2', '\x2', '\x2', - '\xE8', '\xE9', '\b', '\x18', '\x1', '\x2', '\xE9', '\xF4', '\x5', '\x30', - '\x19', '\x2', '\xEA', '\xEC', '\x5', '\x38', '\x1D', '\x2', '\xEB', '\xED', - '\a', '\x33', '\x2', '\x2', '\xEC', '\xEB', '\x3', '\x2', '\x2', '\x2', - '\xEC', '\xED', '\x3', '\x2', '\x2', '\x2', '\xED', '\xEE', '\x3', '\x2', - '\x2', '\x2', '\xEE', '\xEF', '\a', '#', '\x2', '\x2', '\xEF', '\xF0', - '\x5', '\x38', '\x1D', '\x2', '\xF0', '\xF1', '\a', '\x1F', '\x2', '\x2', - '\xF1', '\xF2', '\x5', '\x38', '\x1D', '\x2', '\xF2', '\xF4', '\x3', '\x2', - '\x2', '\x2', '\xF3', '\xE8', '\x3', '\x2', '\x2', '\x2', '\xF3', '\xEA', - '\x3', '\x2', '\x2', '\x2', '\xF4', '\x100', '\x3', '\x2', '\x2', '\x2', - '\xF5', '\xF6', '\f', '\x6', '\x2', '\x2', '\xF6', '\xF7', '\a', '\n', - '\x2', '\x2', '\xF7', '\xF8', '\x5', '.', '\x18', '\x2', '\xF8', '\xF9', - '\a', '\v', '\x2', '\x2', '\xF9', '\xFA', '\x5', '.', '\x18', '\a', '\xFA', - '\xFF', '\x3', '\x2', '\x2', '\x2', '\xFB', '\xFC', '\f', '\x5', '\x2', - '\x2', '\xFC', '\xFD', '\a', '\f', '\x2', '\x2', '\xFD', '\xFF', '\x5', - '.', '\x18', '\x6', '\xFE', '\xF5', '\x3', '\x2', '\x2', '\x2', '\xFE', - '\xFB', '\x3', '\x2', '\x2', '\x2', '\xFF', '\x102', '\x3', '\x2', '\x2', - '\x2', '\x100', '\xFE', '\x3', '\x2', '\x2', '\x2', '\x100', '\x101', - '\x3', '\x2', '\x2', '\x2', '\x101', '/', '\x3', '\x2', '\x2', '\x2', - '\x102', '\x100', '\x3', '\x2', '\x2', '\x2', '\x103', '\x104', '\b', - '\x19', '\x1', '\x2', '\x104', '\x108', '\x5', '\x38', '\x1D', '\x2', - '\x105', '\x108', '\x5', '\x32', '\x1A', '\x2', '\x106', '\x108', '\x5', - '\x34', '\x1B', '\x2', '\x107', '\x103', '\x3', '\x2', '\x2', '\x2', '\x107', - '\x105', '\x3', '\x2', '\x2', '\x2', '\x107', '\x106', '\x3', '\x2', '\x2', - '\x2', '\x108', '\x111', '\x3', '\x2', '\x2', '\x2', '\x109', '\x10A', - '\f', '\x4', '\x2', '\x2', '\x10A', '\x10B', '\a', '\x1F', '\x2', '\x2', - '\x10B', '\x110', '\x5', '\x30', '\x19', '\x5', '\x10C', '\x10D', '\f', - '\x3', '\x2', '\x2', '\x10D', '\x10E', '\a', '\x36', '\x2', '\x2', '\x10E', - '\x110', '\x5', '\x30', '\x19', '\x4', '\x10F', '\x109', '\x3', '\x2', - '\x2', '\x2', '\x10F', '\x10C', '\x3', '\x2', '\x2', '\x2', '\x110', '\x113', - '\x3', '\x2', '\x2', '\x2', '\x111', '\x10F', '\x3', '\x2', '\x2', '\x2', - '\x111', '\x112', '\x3', '\x2', '\x2', '\x2', '\x112', '\x31', '\x3', - '\x2', '\x2', '\x2', '\x113', '\x111', '\x3', '\x2', '\x2', '\x2', '\x114', - '\x116', '\x5', '\x38', '\x1D', '\x2', '\x115', '\x117', '\a', '\x33', - '\x2', '\x2', '\x116', '\x115', '\x3', '\x2', '\x2', '\x2', '\x116', '\x117', - '\x3', '\x2', '\x2', '\x2', '\x117', '\x118', '\x3', '\x2', '\x2', '\x2', - '\x118', '\x119', '\a', '-', '\x2', '\x2', '\x119', '\x11A', '\a', '\x5', - '\x2', '\x2', '\x11A', '\x11B', '\x5', 'R', '*', '\x2', '\x11B', '\x11C', - '\a', '\x6', '\x2', '\x2', '\x11C', '\x33', '\x3', '\x2', '\x2', '\x2', - '\x11D', '\x11F', '\x5', '\x38', '\x1D', '\x2', '\x11E', '\x120', '\a', - '\x33', '\x2', '\x2', '\x11F', '\x11E', '\x3', '\x2', '\x2', '\x2', '\x11F', - '\x120', '\x3', '\x2', '\x2', '\x2', '\x120', '\x121', '\x3', '\x2', '\x2', - '\x2', '\x121', '\x122', '\a', '\x31', '\x2', '\x2', '\x122', '\x124', - '\x5', '\x38', '\x1D', '\x2', '\x123', '\x125', '\x5', '\x36', '\x1C', - '\x2', '\x124', '\x123', '\x3', '\x2', '\x2', '\x2', '\x124', '\x125', - '\x3', '\x2', '\x2', '\x2', '\x125', '\x35', '\x3', '\x2', '\x2', '\x2', - '\x126', '\x127', '\a', '\'', '\x2', '\x2', '\x127', '\x128', '\a', '\x42', - '\x2', '\x2', '\x128', '\x37', '\x3', '\x2', '\x2', '\x2', '\x129', '\x12A', - '\b', '\x1D', '\x1', '\x2', '\x12A', '\x12B', '\x5', 'J', '&', '\x2', - '\x12B', '\x14E', '\x3', '\x2', '\x2', '\x2', '\x12C', '\x12D', '\f', - '\n', '\x2', '\x2', '\x12D', '\x12E', '\x5', ':', '\x1E', '\x2', '\x12E', - '\x12F', '\x5', '\x38', '\x1D', '\v', '\x12F', '\x14D', '\x3', '\x2', - '\x2', '\x2', '\x130', '\x131', '\f', '\t', '\x2', '\x2', '\x131', '\x132', - '\x5', '<', '\x1F', '\x2', '\x132', '\x133', '\x5', '\x38', '\x1D', '\n', - '\x133', '\x14D', '\x3', '\x2', '\x2', '\x2', '\x134', '\x135', '\f', - '\b', '\x2', '\x2', '\x135', '\x136', '\x5', '>', ' ', '\x2', '\x136', - '\x137', '\x5', '\x38', '\x1D', '\t', '\x137', '\x14D', '\x3', '\x2', - '\x2', '\x2', '\x138', '\x139', '\f', '\a', '\x2', '\x2', '\x139', '\x13A', - '\x5', '@', '!', '\x2', '\x13A', '\x13B', '\x5', '\x38', '\x1D', '\b', - '\x13B', '\x14D', '\x3', '\x2', '\x2', '\x2', '\x13C', '\x13D', '\f', - '\x6', '\x2', '\x2', '\x13D', '\x13E', '\x5', '\x42', '\"', '\x2', '\x13E', - '\x13F', '\x5', '\x38', '\x1D', '\a', '\x13F', '\x14D', '\x3', '\x2', - '\x2', '\x2', '\x140', '\x141', '\f', '\x5', '\x2', '\x2', '\x141', '\x142', - '\x5', '\x44', '#', '\x2', '\x142', '\x143', '\x5', '\x38', '\x1D', '\x6', - '\x143', '\x14D', '\x3', '\x2', '\x2', '\x2', '\x144', '\x145', '\f', - '\x4', '\x2', '\x2', '\x145', '\x146', '\x5', '\x46', '$', '\x2', '\x146', - '\x147', '\x5', '\x38', '\x1D', '\x5', '\x147', '\x14D', '\x3', '\x2', - '\x2', '\x2', '\x148', '\x149', '\f', '\x3', '\x2', '\x2', '\x149', '\x14A', - '\x5', 'H', '%', '\x2', '\x14A', '\x14B', '\x5', '\x38', '\x1D', '\x4', - '\x14B', '\x14D', '\x3', '\x2', '\x2', '\x2', '\x14C', '\x12C', '\x3', - '\x2', '\x2', '\x2', '\x14C', '\x130', '\x3', '\x2', '\x2', '\x2', '\x14C', - '\x134', '\x3', '\x2', '\x2', '\x2', '\x14C', '\x138', '\x3', '\x2', '\x2', - '\x2', '\x14C', '\x13C', '\x3', '\x2', '\x2', '\x2', '\x14C', '\x140', - '\x3', '\x2', '\x2', '\x2', '\x14C', '\x144', '\x3', '\x2', '\x2', '\x2', - '\x14C', '\x148', '\x3', '\x2', '\x2', '\x2', '\x14D', '\x150', '\x3', - '\x2', '\x2', '\x2', '\x14E', '\x14C', '\x3', '\x2', '\x2', '\x2', '\x14E', - '\x14F', '\x3', '\x2', '\x2', '\x2', '\x14F', '\x39', '\x3', '\x2', '\x2', - '\x2', '\x150', '\x14E', '\x3', '\x2', '\x2', '\x2', '\x151', '\x152', - '\t', '\x4', '\x2', '\x2', '\x152', ';', '\x3', '\x2', '\x2', '\x2', '\x153', - '\x154', '\t', '\x5', '\x2', '\x2', '\x154', '=', '\x3', '\x2', '\x2', - '\x2', '\x155', '\x156', '\t', '\x6', '\x2', '\x2', '\x156', '?', '\x3', - '\x2', '\x2', '\x2', '\x157', '\x158', '\t', '\a', '\x2', '\x2', '\x158', - '\x41', '\x3', '\x2', '\x2', '\x2', '\x159', '\x15A', '\a', '\x17', '\x2', - '\x2', '\x15A', '\x43', '\x3', '\x2', '\x2', '\x2', '\x15B', '\x15C', - '\a', '\x18', '\x2', '\x2', '\x15C', '\x45', '\x3', '\x2', '\x2', '\x2', - '\x15D', '\x15E', '\a', '\x19', '\x2', '\x2', '\x15E', 'G', '\x3', '\x2', - '\x2', '\x2', '\x15F', '\x160', '\a', '\x1A', '\x2', '\x2', '\x160', 'I', - '\x3', '\x2', '\x2', '\x2', '\x161', '\x166', '\x5', 'N', '(', '\x2', - '\x162', '\x163', '\x5', 'L', '\'', '\x2', '\x163', '\x164', '\x5', 'J', - '&', '\x2', '\x164', '\x166', '\x3', '\x2', '\x2', '\x2', '\x165', '\x161', - '\x3', '\x2', '\x2', '\x2', '\x165', '\x162', '\x3', '\x2', '\x2', '\x2', - '\x166', 'K', '\x3', '\x2', '\x2', '\x2', '\x167', '\x168', '\t', '\b', - '\x2', '\x2', '\x168', 'M', '\x3', '\x2', '\x2', '\x2', '\x169', '\x16A', - '\b', '(', '\x1', '\x2', '\x16A', '\x19A', '\x5', 'X', '-', '\x2', '\x16B', - '\x19A', '\a', '\x44', '\x2', '\x2', '\x16C', '\x19A', '\x5', 'Z', '.', - '\x2', '\x16D', '\x16F', '\a', '\b', '\x2', '\x2', '\x16E', '\x170', '\x5', - 'R', '*', '\x2', '\x16F', '\x16E', '\x3', '\x2', '\x2', '\x2', '\x16F', - '\x170', '\x3', '\x2', '\x2', '\x2', '\x170', '\x171', '\x3', '\x2', '\x2', - '\x2', '\x171', '\x19A', '\a', '\t', '\x2', '\x2', '\x172', '\x174', '\a', - '\x1C', '\x2', '\x2', '\x173', '\x175', '\x5', 'T', '+', '\x2', '\x174', - '\x173', '\x3', '\x2', '\x2', '\x2', '\x174', '\x175', '\x3', '\x2', '\x2', - '\x2', '\x175', '\x176', '\x3', '\x2', '\x2', '\x2', '\x176', '\x19A', - '\a', '\x1D', '\x2', '\x2', '\x177', '\x178', '\a', '\x5', '\x2', '\x2', - '\x178', '\x179', '\x5', '.', '\x18', '\x2', '\x179', '\x17A', '\a', '\x6', - '\x2', '\x2', '\x17A', '\x19A', '\x3', '\x2', '\x2', '\x2', '\x17B', '\x17C', - '\a', '\x5', '\x2', '\x2', '\x17C', '\x17D', '\x5', '\x4', '\x3', '\x2', - '\x17D', '\x17E', '\a', '\x6', '\x2', '\x2', '\x17E', '\x19A', '\x3', - '\x2', '\x2', '\x2', '\x17F', '\x180', '\a', '(', '\x2', '\x2', '\x180', - '\x181', '\a', '\x5', '\x2', '\x2', '\x181', '\x182', '\x5', '\x4', '\x3', - '\x2', '\x182', '\x183', '\a', '\x6', '\x2', '\x2', '\x183', '\x19A', - '\x3', '\x2', '\x2', '\x2', '\x184', '\x185', '\a', ' ', '\x2', '\x2', - '\x185', '\x186', '\a', '\x5', '\x2', '\x2', '\x186', '\x187', '\x5', - '\x4', '\x3', '\x2', '\x187', '\x188', '\a', '\x6', '\x2', '\x2', '\x188', - '\x19A', '\x3', '\x2', '\x2', '\x2', '\x189', '\x18A', '\a', '\x1E', '\x2', - '\x2', '\x18A', '\x18B', '\a', '\x5', '\x2', '\x2', '\x18B', '\x18C', - '\x5', '\x4', '\x3', '\x2', '\x18C', '\x18D', '\a', '\x6', '\x2', '\x2', - '\x18D', '\x19A', '\x3', '\x2', '\x2', '\x2', '\x18E', '\x18F', '\a', - ')', '\x2', '\x2', '\x18F', '\x190', '\a', '\x5', '\x2', '\x2', '\x190', - '\x191', '\x5', '\x4', '\x3', '\x2', '\x191', '\x192', '\a', '\x6', '\x2', - '\x2', '\x192', '\x19A', '\x3', '\x2', '\x2', '\x2', '\x193', '\x194', - '\a', '/', '\x2', '\x2', '\x194', '\x195', '\a', '\x5', '\x2', '\x2', - '\x195', '\x196', '\x5', '\x4', '\x3', '\x2', '\x196', '\x197', '\a', - '\x6', '\x2', '\x2', '\x197', '\x19A', '\x3', '\x2', '\x2', '\x2', '\x198', - '\x19A', '\x5', 'P', ')', '\x2', '\x199', '\x169', '\x3', '\x2', '\x2', - '\x2', '\x199', '\x16B', '\x3', '\x2', '\x2', '\x2', '\x199', '\x16C', - '\x3', '\x2', '\x2', '\x2', '\x199', '\x16D', '\x3', '\x2', '\x2', '\x2', - '\x199', '\x172', '\x3', '\x2', '\x2', '\x2', '\x199', '\x177', '\x3', - '\x2', '\x2', '\x2', '\x199', '\x17B', '\x3', '\x2', '\x2', '\x2', '\x199', - '\x17F', '\x3', '\x2', '\x2', '\x2', '\x199', '\x184', '\x3', '\x2', '\x2', - '\x2', '\x199', '\x189', '\x3', '\x2', '\x2', '\x2', '\x199', '\x18E', - '\x3', '\x2', '\x2', '\x2', '\x199', '\x193', '\x3', '\x2', '\x2', '\x2', - '\x199', '\x198', '\x3', '\x2', '\x2', '\x2', '\x19A', '\x1A5', '\x3', - '\x2', '\x2', '\x2', '\x19B', '\x19C', '\f', '\n', '\x2', '\x2', '\x19C', - '\x19D', '\a', '\a', '\x2', '\x2', '\x19D', '\x1A4', '\x5', 'X', '-', - '\x2', '\x19E', '\x19F', '\f', '\t', '\x2', '\x2', '\x19F', '\x1A0', '\a', - '\b', '\x2', '\x2', '\x1A0', '\x1A1', '\x5', '.', '\x18', '\x2', '\x1A1', - '\x1A2', '\a', '\t', '\x2', '\x2', '\x1A2', '\x1A4', '\x3', '\x2', '\x2', - '\x2', '\x1A3', '\x19B', '\x3', '\x2', '\x2', '\x2', '\x1A3', '\x19E', - '\x3', '\x2', '\x2', '\x2', '\x1A4', '\x1A7', '\x3', '\x2', '\x2', '\x2', - '\x1A5', '\x1A3', '\x3', '\x2', '\x2', '\x2', '\x1A5', '\x1A6', '\x3', - '\x2', '\x2', '\x2', '\x1A6', 'O', '\x3', '\x2', '\x2', '\x2', '\x1A7', - '\x1A5', '\x3', '\x2', '\x2', '\x2', '\x1A8', '\x1A9', '\a', '<', '\x2', - '\x2', '\x1A9', '\x1AB', '\a', '\a', '\x2', '\x2', '\x1AA', '\x1A8', '\x3', - '\x2', '\x2', '\x2', '\x1AA', '\x1AB', '\x3', '\x2', '\x2', '\x2', '\x1AB', - '\x1AC', '\x3', '\x2', '\x2', '\x2', '\x1AC', '\x1AD', '\x5', 'X', '-', - '\x2', '\x1AD', '\x1AF', '\a', '\x5', '\x2', '\x2', '\x1AE', '\x1B0', - '\x5', 'R', '*', '\x2', '\x1AF', '\x1AE', '\x3', '\x2', '\x2', '\x2', - '\x1AF', '\x1B0', '\x3', '\x2', '\x2', '\x2', '\x1B0', '\x1B1', '\x3', - '\x2', '\x2', '\x2', '\x1B1', '\x1B2', '\a', '\x6', '\x2', '\x2', '\x1B2', - '\x1C0', '\x3', '\x2', '\x2', '\x2', '\x1B3', '\x1B4', '\a', '\x30', '\x2', - '\x2', '\x1B4', '\x1B6', '\a', '\x5', '\x2', '\x2', '\x1B5', '\x1B7', - '\x5', 'R', '*', '\x2', '\x1B6', '\x1B5', '\x3', '\x2', '\x2', '\x2', - '\x1B6', '\x1B7', '\x3', '\x2', '\x2', '\x2', '\x1B7', '\x1B8', '\x3', - '\x2', '\x2', '\x2', '\x1B8', '\x1C0', '\a', '\x6', '\x2', '\x2', '\x1B9', - '\x1BA', '\a', '\x38', '\x2', '\x2', '\x1BA', '\x1BC', '\a', '\x5', '\x2', - '\x2', '\x1BB', '\x1BD', '\x5', 'R', '*', '\x2', '\x1BC', '\x1BB', '\x3', - '\x2', '\x2', '\x2', '\x1BC', '\x1BD', '\x3', '\x2', '\x2', '\x2', '\x1BD', - '\x1BE', '\x3', '\x2', '\x2', '\x2', '\x1BE', '\x1C0', '\a', '\x6', '\x2', - '\x2', '\x1BF', '\x1AA', '\x3', '\x2', '\x2', '\x2', '\x1BF', '\x1B3', - '\x3', '\x2', '\x2', '\x2', '\x1BF', '\x1B9', '\x3', '\x2', '\x2', '\x2', - '\x1C0', 'Q', '\x3', '\x2', '\x2', '\x2', '\x1C1', '\x1C6', '\x5', '.', - '\x18', '\x2', '\x1C2', '\x1C3', '\a', '\x4', '\x2', '\x2', '\x1C3', '\x1C5', - '\x5', '.', '\x18', '\x2', '\x1C4', '\x1C2', '\x3', '\x2', '\x2', '\x2', - '\x1C5', '\x1C8', '\x3', '\x2', '\x2', '\x2', '\x1C6', '\x1C4', '\x3', - '\x2', '\x2', '\x2', '\x1C6', '\x1C7', '\x3', '\x2', '\x2', '\x2', '\x1C7', - 'S', '\x3', '\x2', '\x2', '\x2', '\x1C8', '\x1C6', '\x3', '\x2', '\x2', - '\x2', '\x1C9', '\x1CE', '\x5', 'V', ',', '\x2', '\x1CA', '\x1CB', '\a', - '\x4', '\x2', '\x2', '\x1CB', '\x1CD', '\x5', 'V', ',', '\x2', '\x1CC', - '\x1CA', '\x3', '\x2', '\x2', '\x2', '\x1CD', '\x1D0', '\x3', '\x2', '\x2', - '\x2', '\x1CE', '\x1CC', '\x3', '\x2', '\x2', '\x2', '\x1CE', '\x1CF', - '\x3', '\x2', '\x2', '\x2', '\x1CF', 'U', '\x3', '\x2', '\x2', '\x2', - '\x1D0', '\x1CE', '\x3', '\x2', '\x2', '\x2', '\x1D1', '\x1D2', '\a', - '\x42', '\x2', '\x2', '\x1D2', '\x1D3', '\a', '\v', '\x2', '\x2', '\x1D3', - '\x1D4', '\x5', '.', '\x18', '\x2', '\x1D4', 'W', '\x3', '\x2', '\x2', - '\x2', '\x1D5', '\x1D6', '\t', '\t', '\x2', '\x2', '\x1D6', 'Y', '\x3', - '\x2', '\x2', '\x2', '\x1D7', '\x1D8', '\t', '\n', '\x2', '\x2', '\x1D8', - '[', '\x3', '\x2', '\x2', '\x2', '/', '\x61', '\x64', 'g', 'j', 'm', 'q', - 't', '~', '\x8A', '\x90', '\x98', '\x9B', '\xA1', '\xA8', '\xAD', '\xB3', - '\xC1', '\xC3', '\xD6', '\xDB', '\xEC', '\xF3', '\xFE', '\x100', '\x107', - '\x10F', '\x111', '\x116', '\x11F', '\x124', '\x14C', '\x14E', '\x165', - '\x16F', '\x174', '\x199', '\x1A3', '\x1A5', '\x1AA', '\x1AF', '\x1B6', - '\x1BC', '\x1BF', '\x1C6', '\x1CE', + '\x2', 'r', '\x5', '\x3', '\x2', '\x2', '\x2', 's', 'u', '\a', ':', '\x2', + '\x2', 't', 'v', '\a', '&', '\x2', '\x2', 'u', 't', '\x3', '\x2', '\x2', + '\x2', 'u', 'v', '\x3', '\x2', '\x2', '\x2', 'v', 'x', '\x3', '\x2', '\x2', + '\x2', 'w', 'y', '\x5', '\b', '\x5', '\x2', 'x', 'w', '\x3', '\x2', '\x2', + '\x2', 'x', 'y', '\x3', '\x2', '\x2', '\x2', 'y', 'z', '\x3', '\x2', '\x2', + '\x2', 'z', '{', '\x5', '\n', '\x6', '\x2', '{', '\a', '\x3', '\x2', '\x2', + '\x2', '|', '}', '\a', ';', '\x2', '\x2', '}', '~', '\t', '\x2', '\x2', + '\x2', '~', '\t', '\x3', '\x2', '\x2', '\x2', '\x7F', '\x83', '\x5', '\f', + '\a', '\x2', '\x80', '\x83', '\x5', '\xE', '\b', '\x2', '\x81', '\x83', + '\x5', '\x10', '\t', '\x2', '\x82', '\x7F', '\x3', '\x2', '\x2', '\x2', + '\x82', '\x80', '\x3', '\x2', '\x2', '\x2', '\x82', '\x81', '\x3', '\x2', + '\x2', '\x2', '\x83', '\v', '\x3', '\x2', '\x2', '\x2', '\x84', '\x85', + '\a', '\x3', '\x2', '\x2', '\x85', '\r', '\x3', '\x2', '\x2', '\x2', '\x86', + '\x87', '\a', '?', '\x2', '\x2', '\x87', '\x88', '\x5', '\x32', '\x1A', + '\x2', '\x88', '\xF', '\x3', '\x2', '\x2', '\x2', '\x89', '\x8E', '\x5', + '\x12', '\n', '\x2', '\x8A', '\x8B', '\a', '\x4', '\x2', '\x2', '\x8B', + '\x8D', '\x5', '\x12', '\n', '\x2', '\x8C', '\x8A', '\x3', '\x2', '\x2', + '\x2', '\x8D', '\x90', '\x3', '\x2', '\x2', '\x2', '\x8E', '\x8C', '\x3', + '\x2', '\x2', '\x2', '\x8E', '\x8F', '\x3', '\x2', '\x2', '\x2', '\x8F', + '\x11', '\x3', '\x2', '\x2', '\x2', '\x90', '\x8E', '\x3', '\x2', '\x2', + '\x2', '\x91', '\x94', '\x5', '\x32', '\x1A', '\x2', '\x92', '\x93', '\a', + '!', '\x2', '\x2', '\x93', '\x95', '\x5', '\\', '/', '\x2', '\x94', '\x92', + '\x3', '\x2', '\x2', '\x2', '\x94', '\x95', '\x3', '\x2', '\x2', '\x2', + '\x95', '\x13', '\x3', '\x2', '\x2', '\x2', '\x96', '\x97', '\a', '+', + '\x2', '\x2', '\x97', '\x98', '\x5', '\x16', '\f', '\x2', '\x98', '\x15', + '\x3', '\x2', '\x2', '\x2', '\x99', '\x9A', '\b', '\f', '\x1', '\x2', + '\x9A', '\x9F', '\x5', '\x18', '\r', '\x2', '\x9B', '\x9D', '\a', '!', + '\x2', '\x2', '\x9C', '\x9B', '\x3', '\x2', '\x2', '\x2', '\x9C', '\x9D', + '\x3', '\x2', '\x2', '\x2', '\x9D', '\x9E', '\x3', '\x2', '\x2', '\x2', + '\x9E', '\xA0', '\x5', '\\', '/', '\x2', '\x9F', '\x9C', '\x3', '\x2', + '\x2', '\x2', '\x9F', '\xA0', '\x3', '\x2', '\x2', '\x2', '\xA0', '\xA6', + '\x3', '\x2', '\x2', '\x2', '\xA1', '\xA2', '\x5', '\\', '/', '\x2', '\xA2', + '\xA3', '\a', '-', '\x2', '\x2', '\xA3', '\xA4', '\x5', '\x18', '\r', + '\x2', '\xA4', '\xA6', '\x3', '\x2', '\x2', '\x2', '\xA5', '\x99', '\x3', + '\x2', '\x2', '\x2', '\xA5', '\xA1', '\x3', '\x2', '\x2', '\x2', '\xA6', + '\xAC', '\x3', '\x2', '\x2', '\x2', '\xA7', '\xA8', '\f', '\x3', '\x2', + '\x2', '\xA8', '\xA9', '\a', '.', '\x2', '\x2', '\xA9', '\xAB', '\x5', + '\x16', '\f', '\x4', '\xAA', '\xA7', '\x3', '\x2', '\x2', '\x2', '\xAB', + '\xAE', '\x3', '\x2', '\x2', '\x2', '\xAC', '\xAA', '\x3', '\x2', '\x2', + '\x2', '\xAC', '\xAD', '\x3', '\x2', '\x2', '\x2', '\xAD', '\x17', '\x3', + '\x2', '\x2', '\x2', '\xAE', '\xAC', '\x3', '\x2', '\x2', '\x2', '\xAF', + '\xB1', '\x5', '\\', '/', '\x2', '\xB0', '\xB2', '\x5', '\x1A', '\xE', + '\x2', '\xB1', '\xB0', '\x3', '\x2', '\x2', '\x2', '\xB1', '\xB2', '\x3', + '\x2', '\x2', '\x2', '\xB2', '\xB8', '\x3', '\x2', '\x2', '\x2', '\xB3', + '\xB4', '\a', '\x5', '\x2', '\x2', '\xB4', '\xB5', '\x5', '\x4', '\x3', + '\x2', '\xB5', '\xB6', '\a', '\x6', '\x2', '\x2', '\xB6', '\xB8', '\x3', + '\x2', '\x2', '\x2', '\xB7', '\xAF', '\x3', '\x2', '\x2', '\x2', '\xB7', + '\xB3', '\x3', '\x2', '\x2', '\x2', '\xB8', '\x19', '\x3', '\x2', '\x2', + '\x2', '\xB9', '\xC7', '\b', '\xE', '\x1', '\x2', '\xBA', '\xBB', '\f', + '\x6', '\x2', '\x2', '\xBB', '\xBC', '\a', '\a', '\x2', '\x2', '\xBC', + '\xC6', '\x5', '\\', '/', '\x2', '\xBD', '\xBE', '\f', '\x5', '\x2', '\x2', + '\xBE', '\xBF', '\a', '\b', '\x2', '\x2', '\xBF', '\xC0', '\a', '\x42', + '\x2', '\x2', '\xC0', '\xC6', '\a', '\t', '\x2', '\x2', '\xC1', '\xC2', + '\f', '\x4', '\x2', '\x2', '\xC2', '\xC3', '\a', '\b', '\x2', '\x2', '\xC3', + '\xC4', '\a', '\x43', '\x2', '\x2', '\xC4', '\xC6', '\a', '\t', '\x2', + '\x2', '\xC5', '\xBA', '\x3', '\x2', '\x2', '\x2', '\xC5', '\xBD', '\x3', + '\x2', '\x2', '\x2', '\xC5', '\xC1', '\x3', '\x2', '\x2', '\x2', '\xC6', + '\xC9', '\x3', '\x2', '\x2', '\x2', '\xC7', '\xC5', '\x3', '\x2', '\x2', + '\x2', '\xC7', '\xC8', '\x3', '\x2', '\x2', '\x2', '\xC8', '\x1B', '\x3', + '\x2', '\x2', '\x2', '\xC9', '\xC7', '\x3', '\x2', '\x2', '\x2', '\xCA', + '\xCB', '\a', '@', '\x2', '\x2', '\xCB', '\xCC', '\x5', '\x32', '\x1A', + '\x2', '\xCC', '\x1D', '\x3', '\x2', '\x2', '\x2', '\xCD', '\xCE', '\a', + ',', '\x2', '\x2', '\xCE', '\xCF', '\a', '$', '\x2', '\x2', '\xCF', '\xD0', + '\x5', 'V', ',', '\x2', '\xD0', '\x1F', '\x3', '\x2', '\x2', '\x2', '\xD1', + '\xD2', '\a', '\x37', '\x2', '\x2', '\xD2', '\xD3', '\a', '$', '\x2', + '\x2', '\xD3', '\xD9', '\x5', '&', '\x14', '\x2', '\xD4', '\xD5', '\a', + '\x37', '\x2', '\x2', '\xD5', '\xD6', '\a', '$', '\x2', '\x2', '\xD6', + '\xD7', '\a', '\x38', '\x2', '\x2', '\xD7', '\xD9', '\x5', '\"', '\x12', + '\x2', '\xD8', '\xD1', '\x3', '\x2', '\x2', '\x2', '\xD8', '\xD4', '\x3', + '\x2', '\x2', '\x2', '\xD9', '!', '\x3', '\x2', '\x2', '\x2', '\xDA', + '\xDF', '\x5', '$', '\x13', '\x2', '\xDB', '\xDC', '\a', '\x4', '\x2', + '\x2', '\xDC', '\xDE', '\x5', '$', '\x13', '\x2', '\xDD', '\xDB', '\x3', + '\x2', '\x2', '\x2', '\xDE', '\xE1', '\x3', '\x2', '\x2', '\x2', '\xDF', + '\xDD', '\x3', '\x2', '\x2', '\x2', '\xDF', '\xE0', '\x3', '\x2', '\x2', + '\x2', '\xE0', '#', '\x3', '\x2', '\x2', '\x2', '\xE1', '\xDF', '\x3', + '\x2', '\x2', '\x2', '\xE2', '\xE4', '\x5', 'T', '+', '\x2', '\xE3', '\xE5', + '\x5', '*', '\x16', '\x2', '\xE4', '\xE3', '\x3', '\x2', '\x2', '\x2', + '\xE4', '\xE5', '\x3', '\x2', '\x2', '\x2', '\xE5', '%', '\x3', '\x2', + '\x2', '\x2', '\xE6', '\xEB', '\x5', '(', '\x15', '\x2', '\xE7', '\xE8', + '\a', '\x4', '\x2', '\x2', '\xE8', '\xEA', '\x5', '(', '\x15', '\x2', + '\xE9', '\xE7', '\x3', '\x2', '\x2', '\x2', '\xEA', '\xED', '\x3', '\x2', + '\x2', '\x2', '\xEB', '\xE9', '\x3', '\x2', '\x2', '\x2', '\xEB', '\xEC', + '\x3', '\x2', '\x2', '\x2', '\xEC', '\'', '\x3', '\x2', '\x2', '\x2', + '\xED', '\xEB', '\x3', '\x2', '\x2', '\x2', '\xEE', '\xF0', '\x5', '\x32', + '\x1A', '\x2', '\xEF', '\xF1', '\x5', '*', '\x16', '\x2', '\xF0', '\xEF', + '\x3', '\x2', '\x2', '\x2', '\xF0', '\xF1', '\x3', '\x2', '\x2', '\x2', + '\xF1', ')', '\x3', '\x2', '\x2', '\x2', '\xF2', '\xF3', '\t', '\x3', + '\x2', '\x2', '\xF3', '+', '\x3', '\x2', '\x2', '\x2', '\xF4', '\xF5', + '\a', '\x35', '\x2', '\x2', '\xF5', '\xF6', '\x5', '.', '\x18', '\x2', + '\xF6', '\xF7', '\a', '\x32', '\x2', '\x2', '\xF7', '\xF8', '\x5', '\x30', + '\x19', '\x2', '\xF8', '-', '\x3', '\x2', '\x2', '\x2', '\xF9', '\xFA', + '\t', '\x2', '\x2', '\x2', '\xFA', '/', '\x3', '\x2', '\x2', '\x2', '\xFB', + '\xFC', '\t', '\x2', '\x2', '\x2', '\xFC', '\x31', '\x3', '\x2', '\x2', + '\x2', '\xFD', '\xFE', '\b', '\x1A', '\x1', '\x2', '\xFE', '\x109', '\x5', + '\x34', '\x1B', '\x2', '\xFF', '\x101', '\x5', '<', '\x1F', '\x2', '\x100', + '\x102', '\a', '\x33', '\x2', '\x2', '\x101', '\x100', '\x3', '\x2', '\x2', + '\x2', '\x101', '\x102', '\x3', '\x2', '\x2', '\x2', '\x102', '\x103', + '\x3', '\x2', '\x2', '\x2', '\x103', '\x104', '\a', '#', '\x2', '\x2', + '\x104', '\x105', '\x5', '<', '\x1F', '\x2', '\x105', '\x106', '\a', '\x1F', + '\x2', '\x2', '\x106', '\x107', '\x5', '<', '\x1F', '\x2', '\x107', '\x109', + '\x3', '\x2', '\x2', '\x2', '\x108', '\xFD', '\x3', '\x2', '\x2', '\x2', + '\x108', '\xFF', '\x3', '\x2', '\x2', '\x2', '\x109', '\x115', '\x3', + '\x2', '\x2', '\x2', '\x10A', '\x10B', '\f', '\x6', '\x2', '\x2', '\x10B', + '\x10C', '\a', '\n', '\x2', '\x2', '\x10C', '\x10D', '\x5', '\x32', '\x1A', + '\x2', '\x10D', '\x10E', '\a', '\v', '\x2', '\x2', '\x10E', '\x10F', '\x5', + '\x32', '\x1A', '\a', '\x10F', '\x114', '\x3', '\x2', '\x2', '\x2', '\x110', + '\x111', '\f', '\x5', '\x2', '\x2', '\x111', '\x112', '\a', '\f', '\x2', + '\x2', '\x112', '\x114', '\x5', '\x32', '\x1A', '\x6', '\x113', '\x10A', + '\x3', '\x2', '\x2', '\x2', '\x113', '\x110', '\x3', '\x2', '\x2', '\x2', + '\x114', '\x117', '\x3', '\x2', '\x2', '\x2', '\x115', '\x113', '\x3', + '\x2', '\x2', '\x2', '\x115', '\x116', '\x3', '\x2', '\x2', '\x2', '\x116', + '\x33', '\x3', '\x2', '\x2', '\x2', '\x117', '\x115', '\x3', '\x2', '\x2', + '\x2', '\x118', '\x119', '\b', '\x1B', '\x1', '\x2', '\x119', '\x11D', + '\x5', '<', '\x1F', '\x2', '\x11A', '\x11D', '\x5', '\x36', '\x1C', '\x2', + '\x11B', '\x11D', '\x5', '\x38', '\x1D', '\x2', '\x11C', '\x118', '\x3', + '\x2', '\x2', '\x2', '\x11C', '\x11A', '\x3', '\x2', '\x2', '\x2', '\x11C', + '\x11B', '\x3', '\x2', '\x2', '\x2', '\x11D', '\x126', '\x3', '\x2', '\x2', + '\x2', '\x11E', '\x11F', '\f', '\x4', '\x2', '\x2', '\x11F', '\x120', + '\a', '\x1F', '\x2', '\x2', '\x120', '\x125', '\x5', '\x34', '\x1B', '\x5', + '\x121', '\x122', '\f', '\x3', '\x2', '\x2', '\x122', '\x123', '\a', '\x36', + '\x2', '\x2', '\x123', '\x125', '\x5', '\x34', '\x1B', '\x4', '\x124', + '\x11E', '\x3', '\x2', '\x2', '\x2', '\x124', '\x121', '\x3', '\x2', '\x2', + '\x2', '\x125', '\x128', '\x3', '\x2', '\x2', '\x2', '\x126', '\x124', + '\x3', '\x2', '\x2', '\x2', '\x126', '\x127', '\x3', '\x2', '\x2', '\x2', + '\x127', '\x35', '\x3', '\x2', '\x2', '\x2', '\x128', '\x126', '\x3', + '\x2', '\x2', '\x2', '\x129', '\x12B', '\x5', '<', '\x1F', '\x2', '\x12A', + '\x12C', '\a', '\x33', '\x2', '\x2', '\x12B', '\x12A', '\x3', '\x2', '\x2', + '\x2', '\x12B', '\x12C', '\x3', '\x2', '\x2', '\x2', '\x12C', '\x12D', + '\x3', '\x2', '\x2', '\x2', '\x12D', '\x12E', '\a', '-', '\x2', '\x2', + '\x12E', '\x12F', '\a', '\x5', '\x2', '\x2', '\x12F', '\x130', '\x5', + 'V', ',', '\x2', '\x130', '\x131', '\a', '\x6', '\x2', '\x2', '\x131', + '\x37', '\x3', '\x2', '\x2', '\x2', '\x132', '\x134', '\x5', '<', '\x1F', + '\x2', '\x133', '\x135', '\a', '\x33', '\x2', '\x2', '\x134', '\x133', + '\x3', '\x2', '\x2', '\x2', '\x134', '\x135', '\x3', '\x2', '\x2', '\x2', + '\x135', '\x136', '\x3', '\x2', '\x2', '\x2', '\x136', '\x137', '\a', + '\x31', '\x2', '\x2', '\x137', '\x139', '\x5', '<', '\x1F', '\x2', '\x138', + '\x13A', '\x5', ':', '\x1E', '\x2', '\x139', '\x138', '\x3', '\x2', '\x2', + '\x2', '\x139', '\x13A', '\x3', '\x2', '\x2', '\x2', '\x13A', '\x39', + '\x3', '\x2', '\x2', '\x2', '\x13B', '\x13C', '\a', '\'', '\x2', '\x2', + '\x13C', '\x13D', '\a', '\x43', '\x2', '\x2', '\x13D', ';', '\x3', '\x2', + '\x2', '\x2', '\x13E', '\x13F', '\b', '\x1F', '\x1', '\x2', '\x13F', '\x140', + '\x5', 'N', '(', '\x2', '\x140', '\x163', '\x3', '\x2', '\x2', '\x2', + '\x141', '\x142', '\f', '\n', '\x2', '\x2', '\x142', '\x143', '\x5', '>', + ' ', '\x2', '\x143', '\x144', '\x5', '<', '\x1F', '\v', '\x144', '\x162', + '\x3', '\x2', '\x2', '\x2', '\x145', '\x146', '\f', '\t', '\x2', '\x2', + '\x146', '\x147', '\x5', '@', '!', '\x2', '\x147', '\x148', '\x5', '<', + '\x1F', '\n', '\x148', '\x162', '\x3', '\x2', '\x2', '\x2', '\x149', '\x14A', + '\f', '\b', '\x2', '\x2', '\x14A', '\x14B', '\x5', '\x42', '\"', '\x2', + '\x14B', '\x14C', '\x5', '<', '\x1F', '\t', '\x14C', '\x162', '\x3', '\x2', + '\x2', '\x2', '\x14D', '\x14E', '\f', '\a', '\x2', '\x2', '\x14E', '\x14F', + '\x5', '\x44', '#', '\x2', '\x14F', '\x150', '\x5', '<', '\x1F', '\b', + '\x150', '\x162', '\x3', '\x2', '\x2', '\x2', '\x151', '\x152', '\f', + '\x6', '\x2', '\x2', '\x152', '\x153', '\x5', '\x46', '$', '\x2', '\x153', + '\x154', '\x5', '<', '\x1F', '\a', '\x154', '\x162', '\x3', '\x2', '\x2', + '\x2', '\x155', '\x156', '\f', '\x5', '\x2', '\x2', '\x156', '\x157', + '\x5', 'H', '%', '\x2', '\x157', '\x158', '\x5', '<', '\x1F', '\x6', '\x158', + '\x162', '\x3', '\x2', '\x2', '\x2', '\x159', '\x15A', '\f', '\x4', '\x2', + '\x2', '\x15A', '\x15B', '\x5', 'J', '&', '\x2', '\x15B', '\x15C', '\x5', + '<', '\x1F', '\x5', '\x15C', '\x162', '\x3', '\x2', '\x2', '\x2', '\x15D', + '\x15E', '\f', '\x3', '\x2', '\x2', '\x15E', '\x15F', '\x5', 'L', '\'', + '\x2', '\x15F', '\x160', '\x5', '<', '\x1F', '\x4', '\x160', '\x162', + '\x3', '\x2', '\x2', '\x2', '\x161', '\x141', '\x3', '\x2', '\x2', '\x2', + '\x161', '\x145', '\x3', '\x2', '\x2', '\x2', '\x161', '\x149', '\x3', + '\x2', '\x2', '\x2', '\x161', '\x14D', '\x3', '\x2', '\x2', '\x2', '\x161', + '\x151', '\x3', '\x2', '\x2', '\x2', '\x161', '\x155', '\x3', '\x2', '\x2', + '\x2', '\x161', '\x159', '\x3', '\x2', '\x2', '\x2', '\x161', '\x15D', + '\x3', '\x2', '\x2', '\x2', '\x162', '\x165', '\x3', '\x2', '\x2', '\x2', + '\x163', '\x161', '\x3', '\x2', '\x2', '\x2', '\x163', '\x164', '\x3', + '\x2', '\x2', '\x2', '\x164', '=', '\x3', '\x2', '\x2', '\x2', '\x165', + '\x163', '\x3', '\x2', '\x2', '\x2', '\x166', '\x167', '\t', '\x4', '\x2', + '\x2', '\x167', '?', '\x3', '\x2', '\x2', '\x2', '\x168', '\x169', '\t', + '\x5', '\x2', '\x2', '\x169', '\x41', '\x3', '\x2', '\x2', '\x2', '\x16A', + '\x16B', '\t', '\x6', '\x2', '\x2', '\x16B', '\x43', '\x3', '\x2', '\x2', + '\x2', '\x16C', '\x16D', '\t', '\a', '\x2', '\x2', '\x16D', '\x45', '\x3', + '\x2', '\x2', '\x2', '\x16E', '\x16F', '\a', '\x17', '\x2', '\x2', '\x16F', + 'G', '\x3', '\x2', '\x2', '\x2', '\x170', '\x171', '\a', '\x18', '\x2', + '\x2', '\x171', 'I', '\x3', '\x2', '\x2', '\x2', '\x172', '\x173', '\a', + '\x19', '\x2', '\x2', '\x173', 'K', '\x3', '\x2', '\x2', '\x2', '\x174', + '\x175', '\a', '\x1A', '\x2', '\x2', '\x175', 'M', '\x3', '\x2', '\x2', + '\x2', '\x176', '\x17B', '\x5', 'R', '*', '\x2', '\x177', '\x178', '\x5', + 'P', ')', '\x2', '\x178', '\x179', '\x5', 'N', '(', '\x2', '\x179', '\x17B', + '\x3', '\x2', '\x2', '\x2', '\x17A', '\x176', '\x3', '\x2', '\x2', '\x2', + '\x17A', '\x177', '\x3', '\x2', '\x2', '\x2', '\x17B', 'O', '\x3', '\x2', + '\x2', '\x2', '\x17C', '\x17D', '\t', '\b', '\x2', '\x2', '\x17D', 'Q', + '\x3', '\x2', '\x2', '\x2', '\x17E', '\x17F', '\b', '*', '\x1', '\x2', + '\x17F', '\x1AF', '\x5', '\\', '/', '\x2', '\x180', '\x1AF', '\a', '\x45', + '\x2', '\x2', '\x181', '\x1AF', '\x5', '^', '\x30', '\x2', '\x182', '\x184', + '\a', '\b', '\x2', '\x2', '\x183', '\x185', '\x5', 'V', ',', '\x2', '\x184', + '\x183', '\x3', '\x2', '\x2', '\x2', '\x184', '\x185', '\x3', '\x2', '\x2', + '\x2', '\x185', '\x186', '\x3', '\x2', '\x2', '\x2', '\x186', '\x1AF', + '\a', '\t', '\x2', '\x2', '\x187', '\x189', '\a', '\x1C', '\x2', '\x2', + '\x188', '\x18A', '\x5', 'X', '-', '\x2', '\x189', '\x188', '\x3', '\x2', + '\x2', '\x2', '\x189', '\x18A', '\x3', '\x2', '\x2', '\x2', '\x18A', '\x18B', + '\x3', '\x2', '\x2', '\x2', '\x18B', '\x1AF', '\a', '\x1D', '\x2', '\x2', + '\x18C', '\x18D', '\a', '\x5', '\x2', '\x2', '\x18D', '\x18E', '\x5', + '\x32', '\x1A', '\x2', '\x18E', '\x18F', '\a', '\x6', '\x2', '\x2', '\x18F', + '\x1AF', '\x3', '\x2', '\x2', '\x2', '\x190', '\x191', '\a', '\x5', '\x2', + '\x2', '\x191', '\x192', '\x5', '\x4', '\x3', '\x2', '\x192', '\x193', + '\a', '\x6', '\x2', '\x2', '\x193', '\x1AF', '\x3', '\x2', '\x2', '\x2', + '\x194', '\x195', '\a', '(', '\x2', '\x2', '\x195', '\x196', '\a', '\x5', + '\x2', '\x2', '\x196', '\x197', '\x5', '\x4', '\x3', '\x2', '\x197', '\x198', + '\a', '\x6', '\x2', '\x2', '\x198', '\x1AF', '\x3', '\x2', '\x2', '\x2', + '\x199', '\x19A', '\a', ' ', '\x2', '\x2', '\x19A', '\x19B', '\a', '\x5', + '\x2', '\x2', '\x19B', '\x19C', '\x5', '\x4', '\x3', '\x2', '\x19C', '\x19D', + '\a', '\x6', '\x2', '\x2', '\x19D', '\x1AF', '\x3', '\x2', '\x2', '\x2', + '\x19E', '\x19F', '\a', '\x1E', '\x2', '\x2', '\x19F', '\x1A0', '\a', + '\x5', '\x2', '\x2', '\x1A0', '\x1A1', '\x5', '\x4', '\x3', '\x2', '\x1A1', + '\x1A2', '\a', '\x6', '\x2', '\x2', '\x1A2', '\x1AF', '\x3', '\x2', '\x2', + '\x2', '\x1A3', '\x1A4', '\a', ')', '\x2', '\x2', '\x1A4', '\x1A5', '\a', + '\x5', '\x2', '\x2', '\x1A5', '\x1A6', '\x5', '\x4', '\x3', '\x2', '\x1A6', + '\x1A7', '\a', '\x6', '\x2', '\x2', '\x1A7', '\x1AF', '\x3', '\x2', '\x2', + '\x2', '\x1A8', '\x1A9', '\a', '/', '\x2', '\x2', '\x1A9', '\x1AA', '\a', + '\x5', '\x2', '\x2', '\x1AA', '\x1AB', '\x5', '\x4', '\x3', '\x2', '\x1AB', + '\x1AC', '\a', '\x6', '\x2', '\x2', '\x1AC', '\x1AF', '\x3', '\x2', '\x2', + '\x2', '\x1AD', '\x1AF', '\x5', 'T', '+', '\x2', '\x1AE', '\x17E', '\x3', + '\x2', '\x2', '\x2', '\x1AE', '\x180', '\x3', '\x2', '\x2', '\x2', '\x1AE', + '\x181', '\x3', '\x2', '\x2', '\x2', '\x1AE', '\x182', '\x3', '\x2', '\x2', + '\x2', '\x1AE', '\x187', '\x3', '\x2', '\x2', '\x2', '\x1AE', '\x18C', + '\x3', '\x2', '\x2', '\x2', '\x1AE', '\x190', '\x3', '\x2', '\x2', '\x2', + '\x1AE', '\x194', '\x3', '\x2', '\x2', '\x2', '\x1AE', '\x199', '\x3', + '\x2', '\x2', '\x2', '\x1AE', '\x19E', '\x3', '\x2', '\x2', '\x2', '\x1AE', + '\x1A3', '\x3', '\x2', '\x2', '\x2', '\x1AE', '\x1A8', '\x3', '\x2', '\x2', + '\x2', '\x1AE', '\x1AD', '\x3', '\x2', '\x2', '\x2', '\x1AF', '\x1BA', + '\x3', '\x2', '\x2', '\x2', '\x1B0', '\x1B1', '\f', '\n', '\x2', '\x2', + '\x1B1', '\x1B2', '\a', '\a', '\x2', '\x2', '\x1B2', '\x1B9', '\x5', '\\', + '/', '\x2', '\x1B3', '\x1B4', '\f', '\t', '\x2', '\x2', '\x1B4', '\x1B5', + '\a', '\b', '\x2', '\x2', '\x1B5', '\x1B6', '\x5', '\x32', '\x1A', '\x2', + '\x1B6', '\x1B7', '\a', '\t', '\x2', '\x2', '\x1B7', '\x1B9', '\x3', '\x2', + '\x2', '\x2', '\x1B8', '\x1B0', '\x3', '\x2', '\x2', '\x2', '\x1B8', '\x1B3', + '\x3', '\x2', '\x2', '\x2', '\x1B9', '\x1BC', '\x3', '\x2', '\x2', '\x2', + '\x1BA', '\x1B8', '\x3', '\x2', '\x2', '\x2', '\x1BA', '\x1BB', '\x3', + '\x2', '\x2', '\x2', '\x1BB', 'S', '\x3', '\x2', '\x2', '\x2', '\x1BC', + '\x1BA', '\x3', '\x2', '\x2', '\x2', '\x1BD', '\x1BE', '\a', '=', '\x2', + '\x2', '\x1BE', '\x1C0', '\a', '\a', '\x2', '\x2', '\x1BF', '\x1BD', '\x3', + '\x2', '\x2', '\x2', '\x1BF', '\x1C0', '\x3', '\x2', '\x2', '\x2', '\x1C0', + '\x1C1', '\x3', '\x2', '\x2', '\x2', '\x1C1', '\x1C2', '\x5', '\\', '/', + '\x2', '\x1C2', '\x1C4', '\a', '\x5', '\x2', '\x2', '\x1C3', '\x1C5', + '\x5', 'V', ',', '\x2', '\x1C4', '\x1C3', '\x3', '\x2', '\x2', '\x2', + '\x1C4', '\x1C5', '\x3', '\x2', '\x2', '\x2', '\x1C5', '\x1C6', '\x3', + '\x2', '\x2', '\x2', '\x1C6', '\x1C7', '\a', '\x6', '\x2', '\x2', '\x1C7', + '\x1D5', '\x3', '\x2', '\x2', '\x2', '\x1C8', '\x1C9', '\a', '\x30', '\x2', + '\x2', '\x1C9', '\x1CB', '\a', '\x5', '\x2', '\x2', '\x1CA', '\x1CC', + '\x5', 'V', ',', '\x2', '\x1CB', '\x1CA', '\x3', '\x2', '\x2', '\x2', + '\x1CB', '\x1CC', '\x3', '\x2', '\x2', '\x2', '\x1CC', '\x1CD', '\x3', + '\x2', '\x2', '\x2', '\x1CD', '\x1D5', '\a', '\x6', '\x2', '\x2', '\x1CE', + '\x1CF', '\a', '\x39', '\x2', '\x2', '\x1CF', '\x1D1', '\a', '\x5', '\x2', + '\x2', '\x1D0', '\x1D2', '\x5', 'V', ',', '\x2', '\x1D1', '\x1D0', '\x3', + '\x2', '\x2', '\x2', '\x1D1', '\x1D2', '\x3', '\x2', '\x2', '\x2', '\x1D2', + '\x1D3', '\x3', '\x2', '\x2', '\x2', '\x1D3', '\x1D5', '\a', '\x6', '\x2', + '\x2', '\x1D4', '\x1BF', '\x3', '\x2', '\x2', '\x2', '\x1D4', '\x1C8', + '\x3', '\x2', '\x2', '\x2', '\x1D4', '\x1CE', '\x3', '\x2', '\x2', '\x2', + '\x1D5', 'U', '\x3', '\x2', '\x2', '\x2', '\x1D6', '\x1DB', '\x5', '\x32', + '\x1A', '\x2', '\x1D7', '\x1D8', '\a', '\x4', '\x2', '\x2', '\x1D8', '\x1DA', + '\x5', '\x32', '\x1A', '\x2', '\x1D9', '\x1D7', '\x3', '\x2', '\x2', '\x2', + '\x1DA', '\x1DD', '\x3', '\x2', '\x2', '\x2', '\x1DB', '\x1D9', '\x3', + '\x2', '\x2', '\x2', '\x1DB', '\x1DC', '\x3', '\x2', '\x2', '\x2', '\x1DC', + 'W', '\x3', '\x2', '\x2', '\x2', '\x1DD', '\x1DB', '\x3', '\x2', '\x2', + '\x2', '\x1DE', '\x1E3', '\x5', 'Z', '.', '\x2', '\x1DF', '\x1E0', '\a', + '\x4', '\x2', '\x2', '\x1E0', '\x1E2', '\x5', 'Z', '.', '\x2', '\x1E1', + '\x1DF', '\x3', '\x2', '\x2', '\x2', '\x1E2', '\x1E5', '\x3', '\x2', '\x2', + '\x2', '\x1E3', '\x1E1', '\x3', '\x2', '\x2', '\x2', '\x1E3', '\x1E4', + '\x3', '\x2', '\x2', '\x2', '\x1E4', 'Y', '\x3', '\x2', '\x2', '\x2', + '\x1E5', '\x1E3', '\x3', '\x2', '\x2', '\x2', '\x1E6', '\x1E7', '\a', + '\x43', '\x2', '\x2', '\x1E7', '\x1E8', '\a', '\v', '\x2', '\x2', '\x1E8', + '\x1E9', '\x5', '\x32', '\x1A', '\x2', '\x1E9', '[', '\x3', '\x2', '\x2', + '\x2', '\x1EA', '\x1EB', '\t', '\t', '\x2', '\x2', '\x1EB', ']', '\x3', + '\x2', '\x2', '\x2', '\x1EC', '\x1ED', '\t', '\n', '\x2', '\x2', '\x1ED', + '_', '\x3', '\x2', '\x2', '\x2', '\x32', '\x65', 'h', 'k', 'n', 'q', 'u', + 'x', '\x82', '\x8E', '\x94', '\x9C', '\x9F', '\xA5', '\xAC', '\xB1', '\xB7', + '\xC5', '\xC7', '\xD8', '\xDF', '\xE4', '\xEB', '\xF0', '\x101', '\x108', + '\x113', '\x115', '\x11C', '\x124', '\x126', '\x12B', '\x134', '\x139', + '\x161', '\x163', '\x17A', '\x184', '\x189', '\x1AE', '\x1B8', '\x1BA', + '\x1BF', '\x1C4', '\x1CB', '\x1D1', '\x1D4', '\x1DB', '\x1E3', }; public static readonly ATN _ATN = diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/Pipeline/CosmosQueryExecutionContextFactory.cs b/Microsoft.Azure.Cosmos/src/Query/Core/Pipeline/CosmosQueryExecutionContextFactory.cs index fa98aa209e..4364e5ce01 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/Pipeline/CosmosQueryExecutionContextFactory.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/Pipeline/CosmosQueryExecutionContextFactory.cs @@ -205,7 +205,8 @@ private static async Task> TryCreateCoreContextAsy bool hasDistinct = sqlQuery.SelectClause.HasDistinct; bool hasGroupBy = sqlQuery.GroupByClause != default; bool hasAggregates = AggregateProjectionDetector.HasAggregate(sqlQuery.SelectClause.SelectSpec); - bool createPassthroughQuery = !hasAggregates && !hasDistinct && !hasGroupBy; + bool hasOrderBy = sqlQuery.OrderByClause != default; + bool createPassthroughQuery = !hasAggregates && !hasDistinct && !hasGroupBy && !hasOrderBy; if (createPassthroughQuery) { @@ -305,6 +306,7 @@ private static async Task> TryCreateFromPartitione && partitionedQueryExecutionInfo.QueryRanges[0].IsSingleValue); bool serverStreamingQuery = !partitionedQueryExecutionInfo.QueryInfo.HasAggregates && !partitionedQueryExecutionInfo.QueryInfo.HasDistinct + && !partitionedQueryExecutionInfo.QueryInfo.HasNonStreamingOrderBy && !partitionedQueryExecutionInfo.QueryInfo.HasGroupBy; bool streamingSinglePartitionQuery = singleLogicalPartitionKeyQuery && serverStreamingQuery; @@ -584,7 +586,7 @@ private static async Task GetPartitionedQueryExec inputParameters.SqlQuerySpec, cosmosQueryContext.ResourceLink, inputParameters.PartitionKey, - inputParameters.IsNonStreamingOrderByQueryFeatureDisabled, + inputParameters.IsHybridSearchQueryPlanOptimizationDisabled, trace, cancellationToken); } @@ -601,6 +603,7 @@ private static async Task GetPartitionedQueryExec inputParameters.PartitionKey != null, containerQueryProperties.GeospatialType, cosmosQueryContext.UseSystemPrefix, + inputParameters.IsHybridSearchQueryPlanOptimizationDisabled, trace, cancellationToken); } @@ -832,7 +835,7 @@ private InputParameters( PartitionedQueryExecutionInfo partitionedQueryExecutionInfo, bool returnResultsInDeterministicOrder, bool enableOptimisticDirectExecution, - bool isNonStreamingOrderByQueryFeatureDisabled, + bool isHybridSearchQueryPlanOptimizationDisabled, bool enableDistributedQueryGatewayMode, TestInjections testInjections) { @@ -847,7 +850,7 @@ private InputParameters( this.PartitionedQueryExecutionInfo = partitionedQueryExecutionInfo; this.ReturnResultsInDeterministicOrder = returnResultsInDeterministicOrder; this.EnableOptimisticDirectExecution = enableOptimisticDirectExecution; - this.IsNonStreamingOrderByQueryFeatureDisabled = isNonStreamingOrderByQueryFeatureDisabled; + this.IsHybridSearchQueryPlanOptimizationDisabled = isHybridSearchQueryPlanOptimizationDisabled; this.EnableDistributedQueryGatewayMode = enableDistributedQueryGatewayMode; this.TestInjections = testInjections; } @@ -864,7 +867,7 @@ public static InputParameters Create( PartitionedQueryExecutionInfo partitionedQueryExecutionInfo, bool? returnResultsInDeterministicOrder, bool enableOptimisticDirectExecution, - bool isNonStreamingOrderByQueryFeatureDisabled, + bool isHybridSearchQueryPlanOptimizationDisabled, bool enableDistributedQueryGatewayMode, TestInjections testInjections) { @@ -903,7 +906,7 @@ public static InputParameters Create( partitionedQueryExecutionInfo: partitionedQueryExecutionInfo, returnResultsInDeterministicOrder: returnResultsInDeterministicOrder.GetValueOrDefault(InputParameters.DefaultReturnResultsInDeterministicOrder), enableOptimisticDirectExecution: enableOptimisticDirectExecution, - isNonStreamingOrderByQueryFeatureDisabled: isNonStreamingOrderByQueryFeatureDisabled, + isHybridSearchQueryPlanOptimizationDisabled: isHybridSearchQueryPlanOptimizationDisabled, enableDistributedQueryGatewayMode: enableDistributedQueryGatewayMode, testInjections: testInjections); } @@ -920,7 +923,7 @@ public static InputParameters Create( public bool ReturnResultsInDeterministicOrder { get; } public TestInjections TestInjections { get; } public bool EnableOptimisticDirectExecution { get; } - public bool IsNonStreamingOrderByQueryFeatureDisabled { get; } + public bool IsHybridSearchQueryPlanOptimizationDisabled { get; } public bool EnableDistributedQueryGatewayMode { get; } public InputParameters WithContinuationToken(CosmosElement token) @@ -937,7 +940,7 @@ public InputParameters WithContinuationToken(CosmosElement token) this.PartitionedQueryExecutionInfo, this.ReturnResultsInDeterministicOrder, this.EnableOptimisticDirectExecution, - this.IsNonStreamingOrderByQueryFeatureDisabled, + this.IsHybridSearchQueryPlanOptimizationDisabled, this.EnableDistributedQueryGatewayMode, this.TestInjections); } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/Pipeline/CrossPartition/HybridSearch/HybridSearchCrossPartitionQueryPipelineStage.cs b/Microsoft.Azure.Cosmos/src/Query/Core/Pipeline/CrossPartition/HybridSearch/HybridSearchCrossPartitionQueryPipelineStage.cs index b6ac31ed82..83caa63ff0 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/Pipeline/CrossPartition/HybridSearch/HybridSearchCrossPartitionQueryPipelineStage.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/Pipeline/CrossPartition/HybridSearch/HybridSearchCrossPartitionQueryPipelineStage.cs @@ -96,6 +96,8 @@ public static TryCatch MonadicCreate( { TryCatch ComponentPipelineFactory(QueryInfo rewrittenQueryInfo) { + HybridSearchDebugTraceHelpers.TraceQuerySpec(sqlQuerySpec); + return PipelineFactory.MonadicCreate( documentContainer, sqlQuerySpec, @@ -244,8 +246,11 @@ private async ValueTask MoveNextAsync_RunComponentQueriesAsync(ITrace trac return await this.MoveNextAsync_DrainSingletonComponentAsync(trace, cancellationToken); } + IReadOnlyList componentWeights = ExtractComponentWeights(this.hybridSearchQueryInfo); + TryCatch<(IReadOnlyList, QueryPage)> tryCollateSortedPipelineStageResults = await CollateSortedPipelineStageResultsAsync( this.queryPipelineStages, + componentWeights, this.maxConcurrency, trace, cancellationToken); @@ -286,6 +291,8 @@ private async ValueTask MoveNextAsync_DrainSingletonComponentAsync(ITrace QueryPage page = sourceStage.Current.Result; + HybridSearchDebugTraceHelpers.TraceQueryResultTSVHeader(1); + List documents = new List(page.Documents.Count); foreach (CosmosElement cosmosElement in page.Documents) { @@ -393,8 +400,26 @@ private static TryCatch> CreateQueryPipelineStages( return TryCatch>.FromResult(queryPipelineStages); } + private static IReadOnlyList ExtractComponentWeights(HybridSearchQueryInfo hybridSearchQueryInfo) + { + bool useDefaultComponentWeight = (hybridSearchQueryInfo.ComponentWeights == null) || (hybridSearchQueryInfo.ComponentWeights.Count == 0); + + List result = new List(hybridSearchQueryInfo.ComponentQueryInfos.Count); + for (int index = 0; index < hybridSearchQueryInfo.ComponentQueryInfos.Count; ++index) + { + QueryInfo queryInfo = hybridSearchQueryInfo.ComponentQueryInfos[index]; + SortOrder sortOrder = queryInfo.HasOrderBy ? queryInfo.OrderBy[0] : SortOrder.Descending; + + double componentWeight = useDefaultComponentWeight ? 1.0 : hybridSearchQueryInfo.ComponentWeights[index]; + result.Add(new ComponentWeight(componentWeight, sortOrder)); + } + + return result; + } + private static async ValueTask, QueryPage)>> CollateSortedPipelineStageResultsAsync( IReadOnlyList queryPipelineStages, + IReadOnlyList componentWeights, int maxConcurrency, ITrace trace, CancellationToken cancellationToken) @@ -439,14 +464,14 @@ private static TryCatch> CreateQueryPipelineStages( IReadOnlyList> componentScores = tryGetComponentScores.Result; - foreach (List scoreTuples in componentScores) + for (int index = 0; index < componentScores.Count; ++index) { - scoreTuples.Sort((x, y) => (-1) * x.Score.CompareTo(y.Score)); // sort descending, since higher scores are better + componentScores[index].Sort((x, y) => componentWeights[index].Comparison(x.Score, y.Score)); } int[,] ranks = ComputeRanks(componentScores); - ComputeRrfScores(ranks, queryResults); + ComputeRrfScores(ranks, componentWeights, queryResults); HybridSearchDebugTraceHelpers.TraceQueryResultsWithRanks(queryResults, ranks); @@ -578,7 +603,7 @@ private static TryCatch>> RetrieveComponentScores for (int index = 0; index < componentScores[componentIndex].Count; ++index) { // Identical scores should have the same rank - if ((index > 0) && (componentScores[componentIndex][index].Score < componentScores[componentIndex][index - 1].Score)) + if ((index > 0) && (componentScores[componentIndex][index].Score != componentScores[componentIndex][index - 1].Score)) { ++rank; } @@ -592,16 +617,18 @@ private static TryCatch>> RetrieveComponentScores private static void ComputeRrfScores( int[,] ranks, + IReadOnlyList componentWeights, List queryResults) { int componentCount = ranks.GetLength(0); + Debug.Assert(componentWeights.Count == componentCount, "The number of component weights should match the number of components"); for (int index = 0; index < queryResults.Count; ++index) { double rrfScore = 0; for (int componentIndex = 0; componentIndex < componentCount; ++componentIndex) { - rrfScore += 1.0 / (RrfConstant + ranks[componentIndex, index]); + rrfScore += componentWeights[componentIndex].Weight / (RrfConstant + ranks[componentIndex, index]); } queryResults[index] = queryResults[index].WithScore(rrfScore); @@ -610,14 +637,19 @@ private static void ComputeRrfScores( private static QueryInfo RewriteOrderByQueryInfo(QueryInfo queryInfo, GlobalFullTextSearchStatistics statistics, int componentCount) { - Debug.Assert(queryInfo.HasOrderBy, "The component query should have an order by"); - Debug.Assert(queryInfo.HasNonStreamingOrderBy, "The component query is a non streaming order by"); + IReadOnlyList rewrittenOrderByExpressions = queryInfo.OrderByExpressions; - List rewrittenOrderByExpressions = new List(queryInfo.OrderByExpressions.Count); - foreach (string orderByExpression in queryInfo.OrderByExpressions) + if (queryInfo.HasOrderBy) { - string rewrittenOrderByExpression = FormatComponentQueryTextWorkaround(orderByExpression, statistics, componentCount); - rewrittenOrderByExpressions.Add(rewrittenOrderByExpression); + Debug.Assert(queryInfo.HasNonStreamingOrderBy, "The component query is a non streaming order by"); + List orderByExpressions = new List(queryInfo.OrderByExpressions.Count); + foreach (string orderByExpression in queryInfo.OrderByExpressions) + { + string rewrittenOrderByExpression = FormatComponentQueryTextWorkaround(orderByExpression, statistics, componentCount); + orderByExpressions.Add(rewrittenOrderByExpression); + } + + rewrittenOrderByExpressions = orderByExpressions; } string rewrittenQuery = FormatComponentQueryTextWorkaround(queryInfo.RewrittenQuery, statistics, componentCount); @@ -750,6 +782,21 @@ private static string FormatComponentQueryTextWorkaround(string format, GlobalFu return TryCatch<(GlobalFullTextSearchStatistics, QueryPage)>.FromResult((globalStatisticsAggregator.GetResult(), queryPage)); } + private class ComponentWeight + { + public double Weight { get; } + + public Comparison Comparison { get; } + + public ComponentWeight(double weight, SortOrder sortOrder) + { + this.Weight = weight; + + int comparisonFactor = (sortOrder == SortOrder.Ascending) ? 1 : -1; + this.Comparison = (x, y) => comparisonFactor * x.CompareTo(y); + } + } + private readonly struct ScoreTuple { public double Score { get; } @@ -907,6 +954,19 @@ private static class HybridSearchDebugTraceHelpers private const bool Enabled = false; #pragma warning disable CS0162 // Unreachable code detected + [Conditional("DEBUG")] + public static void TraceQuerySpec(SqlQuerySpec querySpec) + { + if (Enabled) + { + CosmosSerializerCore serializerCore = new CosmosSerializerCore(); + System.IO.Stream stream = serializerCore.ToStreamSqlQuerySpec(querySpec, ResourceType.Document); + string content = new System.IO.StreamReader(stream).ReadToEnd(); + System.Diagnostics.Trace.WriteLine(content); + System.Diagnostics.Trace.WriteLine("\n"); + } + } + [Conditional("DEBUG")] public static void TraceQueryResults(IReadOnlyList queryResults, int componentCount) { @@ -983,7 +1043,7 @@ private static StringBuilder AppendQueryResult(HybridSearchQueryResult queryResu return builder; } - private static void TraceQueryResultTSVHeader(int componentCount) + public static void TraceQueryResultTSVHeader(int componentCount) { StringBuilder builder = new StringBuilder(); builder.Append("_rid"); diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/Pipeline/CrossPartition/HybridSearch/HybridSearchQueryResult.cs b/Microsoft.Azure.Cosmos/src/Query/Core/Pipeline/CrossPartition/HybridSearch/HybridSearchQueryResult.cs index bfd19db547..07b4ee2b17 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/Pipeline/CrossPartition/HybridSearch/HybridSearchQueryResult.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/Pipeline/CrossPartition/HybridSearch/HybridSearchQueryResult.cs @@ -49,22 +49,33 @@ public static HybridSearchQueryResult Create(CosmosElement document) throw new ArgumentException($"{FieldNames.Rid} must exist."); } - if (!cosmosObject.TryGetValue(FieldNames.Payload, out CosmosObject outerPayload)) - { - throw new ArgumentException($"{FieldNames.Payload} must exist."); - } + bool outerPayloadExists = cosmosObject.TryGetValue(FieldNames.Payload, out CosmosObject outerPayload); - if (!outerPayload.TryGetValue(FieldNames.Payload, out CosmosObject innerPayload)) + HybridSearchQueryResult result; + if (outerPayloadExists && outerPayload.TryGetValue(FieldNames.ComponentScores, out CosmosArray componentScores)) { - throw new ArgumentException($"{FieldNames.Payload} must exist nested within the outer payload field."); - } + // Using the older format where the payload is nested. + if (!outerPayload.TryGetValue(FieldNames.Payload, out CosmosElement innerPayload)) + { + innerPayload = CosmosUndefined.Create(); + } - if (!outerPayload.TryGetValue(FieldNames.ComponentScores, out CosmosArray componentScores)) + result = new HybridSearchQueryResult(rid, componentScores, innerPayload); + } + else { - throw new ArgumentException($"{FieldNames.ComponentScores} must exist."); + // Using the newer format where the payload is not nested. + if (!cosmosObject.TryGetValue(FieldNames.ComponentScores, out componentScores)) + { + throw new ArgumentException($"{FieldNames.ComponentScores} must exist."); + } + + CosmosElement payload = outerPayloadExists ? outerPayload : CosmosUndefined.Create(); + + result = new HybridSearchQueryResult(rid, componentScores, payload); } - return new HybridSearchQueryResult(rid, componentScores, innerPayload); + return result; } private static class FieldNames diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/Pipeline/PipelineFactory.cs b/Microsoft.Azure.Cosmos/src/Query/Core/Pipeline/PipelineFactory.cs index 7a447f0e0b..b63da96b67 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/Pipeline/PipelineFactory.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/Pipeline/PipelineFactory.cs @@ -165,7 +165,7 @@ public static TryCatch MonadicCreate( } else if (queryInfo.HasLimit && (queryInfo.Limit.Value > 0)) { - top = (queryInfo.Offset ?? 0) + queryInfo.Limit.Value; + top = Math.Min((queryInfo.Offset ?? 0) + queryInfo.Limit.Value, int.MaxValue); } else { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/QueryAdvisor/QueryAdviceRuleDocumentation.xml b/Microsoft.Azure.Cosmos/src/Query/Core/QueryAdvisor/QueryAdviceRuleDocumentation.xml index 6f5885f4cd..e3afa6126c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/QueryAdvisor/QueryAdviceRuleDocumentation.xml +++ b/Microsoft.Azure.Cosmos/src/Query/Core/QueryAdvisor/QueryAdviceRuleDocumentation.xml @@ -1,12 +1,12 @@  @@ -14,44 +14,44 @@ https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/queryadvisor/ - [CDATA["Query uses ARRAY_CONTAINS with the the third argument set to true."]] - [CDATA["Instead of ARRAY_CONTAINS, consider using EXISTS with a subquery, which may improve performance."]] - - - [CDATA["Query uses Distinct and Join."]] - [CDATA["Instead of DISTINCT with a JOIN, consider using EXISTS with a subquery, which may improve performance."]] + [CDATA["Query uses ARRAY_CONTAINS with partial matching."]] + [CDATA["Instead of using ARRAY_CONTAINS with partial matching, consider using EXISTS with a subquery. "]] + - [CDATA["Query uses CONTAINS."]] - [CDATA["Instead of CONTAINS, consider using STARTSWTIH or computed properties, which may improve performance."]] + [CDATA["Query uses CONTAINS."]] + [CDATA["If you are matching on a string prefix, consider using STARTSWITH."]] - [CDATA["Query uses case-insensitive string search functions STARTSWITH or StringEquals."]] - [CDATA["Instead of case-insensitive string search, consider creating a computed property with LOWER on the string field, which may improve performance."]] + [CDATA["Query uses case-insensitive string search functions STARTSWITH or StringEquals."]] + [CDATA["Instead of a case-insensitive string search, consider defining a computed property that converts the string to lowercase."]] - [CDATA["Query uses case-insensitive ENDSWITH."]] - [CDATA["Instead of case-insensitive ENDSWITH, consider creating a computed property with REVERSE on the string field, and use STARTSWITH for comparison, which may improve performance."]] - - - [CDATA["Query uses deterministic scalar expressions in Group By clause."]] - [CDATA["Instead of using scalar expressions in GROUP BY clause, consider creating computed properties of these expressions, which may improve performance."]] + [CDATA["Query uses ENDSWITH."]] + [CDATA["Instead of using ENDSWITH, consider defining a computed property that reverses the string and using STARTSWITH in the query for comparison."]] + - [CDATA["Query uses Upper or Lower string comparison."]] - [CDATA[""]] + [CDATA["Query uses UPPER or LOWER in the WHERE clause."]] + [CDATA["Consider defining a computed property on the UPPER/LOWER function expression."]] - [CDATA["Query uses GetCurrentDateTime."]] - [CDATA["Instead of using GetCurrentDateTime, consider using GetCurrentDateTimeStatic, which may improve performance."]] + [CDATA["GetCurrentDateTime in the WHERE clause."]] + [CDATA["Consider using GetCurrentDateTimeStatic instead of GetCurrentDateTime in the WHERE clause."]] - [CDATA["Query uses GetCurrentTicks."]] - [CDATA["Instead of using GetCurrentTicks, consider using GetCurrentTicksStatic, which may improve performance."]] + [CDATA["GetCurrentTicks in the WHERE clause."]] + [CDATA["Consider using GetCurrentTicksStatic instead of GetCurrentTicks in the WHERE clause."]] - [CDATA["Query uses GetCurrentTimestamp."]] - [CDATA["Instead of using GetCurrentTimestamp, consider using GetCurrentTimestampStatic, which may improve performance."]] + [CDATA["GetCurrentTimestamp in the WHERE clause."]] + [CDATA["Consider using GetCurrentTimestampStatic instead of GetCurrentTimestamp in the WHERE clause ."]] \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/QueryAdvisor/RuleDirectory.cs b/Microsoft.Azure.Cosmos/src/Query/Core/QueryAdvisor/RuleDirectory.cs index 380b660425..377eb4ec34 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/QueryAdvisor/RuleDirectory.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/QueryAdvisor/RuleDirectory.cs @@ -38,7 +38,7 @@ public string GetRuleMessage(string ruleId) return null; } - return rule.Element("Message")?.Value.Replace("[CDATA[\"", String.Empty).Replace("\"]]", String.Empty); // removing the CDATA tags + return rule.Element("Description")?.Value.Replace("[CDATA[\"", String.Empty).Replace("\"]]", String.Empty); // removing the CDATA tags } } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/QueryClient/CosmosDistributedQueryClient.cs b/Microsoft.Azure.Cosmos/src/Query/Core/QueryClient/CosmosDistributedQueryClient.cs index 4035095240..0483dfaaeb 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/QueryClient/CosmosDistributedQueryClient.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/QueryClient/CosmosDistributedQueryClient.cs @@ -130,7 +130,7 @@ private static TryCatch CreatePage(DocumentServiceResponse response, queryMetricsText, IndexUtilizationInfo.Empty, ClientSideMetrics.Empty))); - trace.AddDatum("Query Metrics", datum); + trace.AddDatum(TraceDatumKeys.QueryMetrics, datum); } Headers headers = new Headers(response.Headers); diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/QueryClient/CosmosQueryClient.cs b/Microsoft.Azure.Cosmos/src/Query/Core/QueryClient/CosmosQueryClient.cs index 5d8d3b1461..454dd35217 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/QueryClient/CosmosQueryClient.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/QueryClient/CosmosQueryClient.cs @@ -48,6 +48,7 @@ public abstract Task> TryGetPartitionedQ bool hasLogicalPartitionKey, bool allowDCount, bool useSystemPrefix, + bool isHybridSearchQueryPlanOptimizationDisabled, Cosmos.GeospatialType geospatialType, CancellationToken cancellationToken); diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/QueryPlan/PartitionedQueryExecutionInfoInternal.cs b/Microsoft.Azure.Cosmos/src/Query/Core/QueryPlan/PartitionedQueryExecutionInfoInternal.cs index b420bd5357..f5704dc910 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/QueryPlan/PartitionedQueryExecutionInfoInternal.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/QueryPlan/PartitionedQueryExecutionInfoInternal.cs @@ -26,9 +26,7 @@ public List> QueryRanges set; } - // Change to the below after Direct package upgrade - // [JsonProperty(Constants.Properties.HybridSearchQueryInfo)] - [JsonProperty("hybridSearchQueryInfo")] + [JsonProperty(Constants.Properties.HybridSearchQueryInfo)] public HybridSearchQueryInfo HybridSearchQueryInfo { get; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/QueryPlan/QueryFeature.cs b/Microsoft.Azure.Cosmos/src/Query/Core/QueryPlan/QueryFeature.cs index 6802f7903c..78a7e26113 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/QueryPlan/QueryFeature.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/QueryPlan/QueryFeature.cs @@ -32,6 +32,7 @@ enum QueryFeatures : ulong ListAndSetAggregate = 1 << 12, CountIf = 1 << 13, HybridSearch = 1 << 14, - WeightedRankFusion = 1 << 15, + WeightedRankFusion = 1 << 15, + HybridSearchSkipOrderByRewrite = 1 << 16, } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/QueryPlan/QueryPartitionProvider.cs b/Microsoft.Azure.Cosmos/src/Query/Core/QueryPlan/QueryPartitionProvider.cs index 4cf370241f..4251adcab3 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/QueryPlan/QueryPartitionProvider.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/QueryPlan/QueryPartitionProvider.cs @@ -127,6 +127,7 @@ public TryCatch TryGetPartitionedQueryExecutionIn bool hasLogicalPartitionKey, bool allowDCount, bool useSystemPrefix, + bool hybridSearchSkipOrderByRewrite, GeospatialType geospatialType) { TryCatch tryGetInternalQueryInfo = this.TryGetPartitionedQueryExecutionInfoInternal( @@ -139,6 +140,7 @@ public TryCatch TryGetPartitionedQueryExecutionIn hasLogicalPartitionKey: hasLogicalPartitionKey, allowDCount: allowDCount, useSystemPrefix: useSystemPrefix, + hybridSearchSkipOrderByRewrite: hybridSearchSkipOrderByRewrite, geospatialType: geospatialType); if (!tryGetInternalQueryInfo.Succeeded) @@ -190,6 +192,7 @@ internal TryCatch TryGetPartitionedQueryE bool hasLogicalPartitionKey, bool allowDCount, bool useSystemPrefix, + bool hybridSearchSkipOrderByRewrite, GeospatialType geospatialType) { if (querySpecJsonString == null || partitionKeyDefinition == null) @@ -242,7 +245,8 @@ internal TryCatch TryGetPartitionedQueryE bHasLogicalPartitionKey = Convert.ToInt32(hasLogicalPartitionKey), bIsContinuationExpected = Convert.ToInt32(isContinuationExpected), bRequireFormattableOrderByQuery = Convert.ToInt32(requireFormattableOrderByQuery), - bUseSystemPrefix = Convert.ToInt32(useSystemPrefix), + bUseSystemPrefix = Convert.ToInt32(useSystemPrefix), + bHybridSearchSkipOrderByRewrite = Convert.ToInt32(hybridSearchSkipOrderByRewrite), eGeospatialType = Convert.ToInt32(geospatialType), ePartitionKind = Convert.ToInt32(partitionKind) }; @@ -328,8 +332,6 @@ internal TryCatch TryGetPartitionedQueryE innerException)); } - Debug.Assert(!(queryInfoInternal.QueryInfo.HasTop && queryInfoInternal.QueryInfo.HasLimit)); - return TryCatch.FromResult(queryInfoInternal); } @@ -383,7 +385,7 @@ internal static TryCatch TryCreateServiceProvider(string queryEngineConf Exception exception = Marshal.GetExceptionForHR((int)errorCode); if (exception != null) { - DefaultTrace.TraceWarning("QueryPartitionProvider.TryCreateServiceProvider failed with exception {0}", exception); + DefaultTrace.TraceWarning("QueryPartitionProvider.TryCreateServiceProvider failed with exception {0}", exception?.Message); return TryCatch.FromException(exception); } @@ -391,7 +393,7 @@ internal static TryCatch TryCreateServiceProvider(string queryEngineConf } catch (Exception ex) { - DefaultTrace.TraceWarning("QueryPartitionProvider.TryCreateServiceProvider failed with exception {0}", ex); + DefaultTrace.TraceWarning("QueryPartitionProvider.TryCreateServiceProvider failed with exception {0}", ex.Message); return TryCatch.FromException(ex); } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/QueryPlan/QueryPlanHandler.cs b/Microsoft.Azure.Cosmos/src/Query/Core/QueryPlan/QueryPlanHandler.cs index 3b7d54717e..bc983b2f03 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/QueryPlan/QueryPlanHandler.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/QueryPlan/QueryPlanHandler.cs @@ -29,6 +29,7 @@ public async Task> TryGetQueryPlanAsync( VectorEmbeddingPolicy vectorEmbeddingPolicy, bool hasLogicalPartitionKey, bool useSystemPrefix, + bool isHybridSearchQueryPlanOptimizationDisabled, GeospatialType geospatialType, CancellationToken cancellationToken) { @@ -51,6 +52,7 @@ public async Task> TryGetQueryPlanAsync( vectorEmbeddingPolicy, hasLogicalPartitionKey, useSystemPrefix, + isHybridSearchQueryPlanOptimizationDisabled, geospatialType, cancellationToken); if (!tryGetQueryInfo.Succeeded) @@ -68,6 +70,7 @@ private Task> TryGetQueryInfoAsync( VectorEmbeddingPolicy vectorEmbeddingPolicy, bool hasLogicalPartitionKey, bool useSystemPrefix, + bool isHybridSearchQueryPlanOptimizationDisabled, Cosmos.GeospatialType geospatialType, CancellationToken cancellationToken = default) { @@ -83,7 +86,8 @@ private Task> TryGetQueryInfoAsync( allowNonValueAggregateQuery: true, hasLogicalPartitionKey: hasLogicalPartitionKey, allowDCount: true, - useSystemPrefix: useSystemPrefix, + useSystemPrefix: useSystemPrefix, + isHybridSearchQueryPlanOptimizationDisabled: isHybridSearchQueryPlanOptimizationDisabled, geospatialType: geospatialType, cancellationToken: cancellationToken); } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/QueryPlan/QueryPlanRetriever.cs b/Microsoft.Azure.Cosmos/src/Query/Core/QueryPlan/QueryPlanRetriever.cs index a6108d0b4a..88f53c4d3e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/QueryPlan/QueryPlanRetriever.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/QueryPlan/QueryPlanRetriever.cs @@ -1,157 +1,161 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.QueryPlan -{ - using System; - using System.Runtime.InteropServices; - using System.Threading; - using System.Threading.Tasks; - using Microsoft.Azure.Cosmos.Query.Core.Monads; - using Microsoft.Azure.Cosmos.Query.Core.QueryClient; - using Microsoft.Azure.Cosmos.Resource.CosmosExceptions; - using Microsoft.Azure.Cosmos.Tracing; - using OperationType = Documents.OperationType; - using PartitionKeyDefinition = Documents.PartitionKeyDefinition; - using ResourceType = Documents.ResourceType; - - internal static class QueryPlanRetriever - { - private static readonly QueryFeatures SupportedQueryFeatures = - QueryFeatures.Aggregate - | QueryFeatures.Distinct - | QueryFeatures.GroupBy - | QueryFeatures.MultipleOrderBy - | QueryFeatures.MultipleAggregates - | QueryFeatures.OffsetAndLimit - | QueryFeatures.OrderBy - | QueryFeatures.Top - | QueryFeatures.NonValueAggregate +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.QueryPlan +{ + using System; + using System.Runtime.InteropServices; + using System.Threading; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos.Query.Core.Monads; + using Microsoft.Azure.Cosmos.Query.Core.QueryClient; + using Microsoft.Azure.Cosmos.Resource.CosmosExceptions; + using Microsoft.Azure.Cosmos.Tracing; + using OperationType = Documents.OperationType; + using PartitionKeyDefinition = Documents.PartitionKeyDefinition; + using ResourceType = Documents.ResourceType; + + internal static class QueryPlanRetriever + { + private static readonly QueryFeatures SupportedQueryFeatures = + QueryFeatures.Aggregate + | QueryFeatures.Distinct + | QueryFeatures.GroupBy + | QueryFeatures.MultipleOrderBy + | QueryFeatures.MultipleAggregates + | QueryFeatures.OffsetAndLimit + | QueryFeatures.OrderBy + | QueryFeatures.Top + | QueryFeatures.NonValueAggregate | QueryFeatures.DCount | QueryFeatures.NonStreamingOrderBy | QueryFeatures.CountIf - | QueryFeatures.HybridSearch; + | QueryFeatures.HybridSearch + | QueryFeatures.WeightedRankFusion + | QueryFeatures.HybridSearchSkipOrderByRewrite; + + private static readonly QueryFeatures SupportedQueryFeaturesWithHybridSearchQueryPlanOptimizationDisabled = + SupportedQueryFeatures & (~QueryFeatures.HybridSearchSkipOrderByRewrite); - private static readonly QueryFeatures SupportedQueryFeaturesWithoutNonStreamingOrderBy = - SupportedQueryFeatures & (~QueryFeatures.NonStreamingOrderBy); - private static readonly string SupportedQueryFeaturesString = SupportedQueryFeatures.ToString(); - private static readonly string SupportedQueryFeaturesWithoutNonStreamingOrderByString = - SupportedQueryFeaturesWithoutNonStreamingOrderBy.ToString(); + private static readonly string SupportedQueryFeaturesWithHybridSearchQueryPlanOptimizationDisabledString = + SupportedQueryFeaturesWithHybridSearchQueryPlanOptimizationDisabled.ToString(); - private static string GetSupportedQueryFeaturesString(bool isNonStreamingOrderByQueryFeatureDisabled) + private static string GetSupportedQueryFeaturesString(bool isHybridSearchQueryPlanOptimizationDisabled) { - return isNonStreamingOrderByQueryFeatureDisabled ? - SupportedQueryFeaturesWithoutNonStreamingOrderByString : + return isHybridSearchQueryPlanOptimizationDisabled ? + SupportedQueryFeaturesWithHybridSearchQueryPlanOptimizationDisabledString : SupportedQueryFeaturesString; - } - - public static async Task GetQueryPlanWithServiceInteropAsync( - CosmosQueryClient queryClient, - SqlQuerySpec sqlQuerySpec, - Documents.ResourceType resourceType, + } + + public static async Task GetQueryPlanWithServiceInteropAsync( + CosmosQueryClient queryClient, + SqlQuerySpec sqlQuerySpec, + Documents.ResourceType resourceType, PartitionKeyDefinition partitionKeyDefinition, - VectorEmbeddingPolicy vectorEmbeddingPolicy, - bool hasLogicalPartitionKey, - GeospatialType geospatialType, - bool useSystemPrefix, - ITrace trace, - CancellationToken cancellationToken = default) - { - if (queryClient == null) - { - throw new ArgumentNullException(nameof(queryClient)); - } - - if (sqlQuerySpec == null) - { - throw new ArgumentNullException(nameof(sqlQuerySpec)); - } - - if (partitionKeyDefinition == null) - { - throw new ArgumentNullException(nameof(partitionKeyDefinition)); - } - - cancellationToken.ThrowIfCancellationRequested(); - - using (ITrace serviceInteropTrace = trace.StartChild("Service Interop Query Plan", TraceComponent.Query, TraceLevel.Info)) - { - QueryPlanHandler queryPlanHandler = new QueryPlanHandler(queryClient); - - TryCatch tryGetQueryPlan = await queryPlanHandler.TryGetQueryPlanAsync( - sqlQuerySpec, - resourceType, + VectorEmbeddingPolicy vectorEmbeddingPolicy, + bool hasLogicalPartitionKey, + GeospatialType geospatialType, + bool useSystemPrefix, + bool isHybridSearchQueryPlanOptimizationDisabled, + ITrace trace, + CancellationToken cancellationToken = default) + { + if (queryClient == null) + { + throw new ArgumentNullException(nameof(queryClient)); + } + + if (sqlQuerySpec == null) + { + throw new ArgumentNullException(nameof(sqlQuerySpec)); + } + + if (partitionKeyDefinition == null) + { + throw new ArgumentNullException(nameof(partitionKeyDefinition)); + } + + cancellationToken.ThrowIfCancellationRequested(); + + using (ITrace serviceInteropTrace = trace.StartChild("Service Interop Query Plan", TraceComponent.Query, TraceLevel.Info)) + { + QueryPlanHandler queryPlanHandler = new QueryPlanHandler(queryClient); + + TryCatch tryGetQueryPlan = await queryPlanHandler.TryGetQueryPlanAsync( + sqlQuerySpec, + resourceType, partitionKeyDefinition, - vectorEmbeddingPolicy, - hasLogicalPartitionKey, - useSystemPrefix, - geospatialType, - cancellationToken); - - if (!tryGetQueryPlan.Succeeded) - { - if (ExceptionToCosmosException.TryCreateFromException(tryGetQueryPlan.Exception, serviceInteropTrace, out CosmosException cosmosException)) - { - throw cosmosException; - } - else - { - throw ExceptionWithStackTraceException.UnWrapMonadExcepion(tryGetQueryPlan.Exception, serviceInteropTrace); - } - } - - return tryGetQueryPlan.Result; - } - } - - public static Task GetQueryPlanThroughGatewayAsync( - CosmosQueryContext queryContext, - SqlQuerySpec sqlQuerySpec, - string resourceLink, + vectorEmbeddingPolicy, + hasLogicalPartitionKey, + useSystemPrefix, + isHybridSearchQueryPlanOptimizationDisabled, + geospatialType, + cancellationToken); + + if (!tryGetQueryPlan.Succeeded) + { + if (ExceptionToCosmosException.TryCreateFromException(tryGetQueryPlan.Exception, serviceInteropTrace, out CosmosException cosmosException)) + { + throw cosmosException; + } + else + { + throw ExceptionWithStackTraceException.UnWrapMonadExcepion(tryGetQueryPlan.Exception, serviceInteropTrace); + } + } + + return tryGetQueryPlan.Result; + } + } + + public static Task GetQueryPlanThroughGatewayAsync( + CosmosQueryContext queryContext, + SqlQuerySpec sqlQuerySpec, + string resourceLink, PartitionKey? partitionKey, - bool isNonStreamingOrderByQueryFeatureDisabled, - ITrace trace, - CancellationToken cancellationToken = default) - { - if (queryContext == null) - { - throw new ArgumentNullException(nameof(queryContext)); - } - - if (sqlQuerySpec == null) - { - throw new ArgumentNullException(nameof(sqlQuerySpec)); - } - - if (resourceLink == null) - { - throw new ArgumentNullException(nameof(resourceLink)); - } - - cancellationToken.ThrowIfCancellationRequested(); - - using (ITrace gatewayQueryPlanTrace = trace.StartChild("Gateway QueryPlan", TraceComponent.Query, TraceLevel.Info)) - { - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) - && Documents.ServiceInteropWrapper.Is64BitProcess) - { - // It's Windows and x64, should have loaded the DLL - gatewayQueryPlanTrace.AddDatum("ServiceInterop unavailable", true); - } - - return queryContext.ExecuteQueryPlanRequestAsync( - resourceLink, - ResourceType.Document, - OperationType.QueryPlan, - sqlQuerySpec, - partitionKey, - GetSupportedQueryFeaturesString(isNonStreamingOrderByQueryFeatureDisabled), - trace, - cancellationToken); - } - } - } + bool isHybridSearchQueryPlanOptimizationDisabled, + ITrace trace, + CancellationToken cancellationToken = default) + { + if (queryContext == null) + { + throw new ArgumentNullException(nameof(queryContext)); + } + + if (sqlQuerySpec == null) + { + throw new ArgumentNullException(nameof(sqlQuerySpec)); + } + + if (resourceLink == null) + { + throw new ArgumentNullException(nameof(resourceLink)); + } + + cancellationToken.ThrowIfCancellationRequested(); + + using (ITrace gatewayQueryPlanTrace = trace.StartChild("Gateway QueryPlan", TraceComponent.Query, TraceLevel.Info)) + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + && Documents.ServiceInteropWrapper.Is64BitProcess) + { + // It's Windows and x64, should have loaded the DLL + gatewayQueryPlanTrace.AddDatum("ServiceInterop unavailable", true); + } + + return queryContext.ExecuteQueryPlanRequestAsync( + resourceLink, + ResourceType.Document, + OperationType.QueryPlan, + sqlQuerySpec, + partitionKey, + GetSupportedQueryFeaturesString(isHybridSearchQueryPlanOptimizationDisabled), + trace, + cancellationToken); + } + } + } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/v2Query/DocumentQueryExecutionContextBase.cs b/Microsoft.Azure.Cosmos/src/Query/v2Query/DocumentQueryExecutionContextBase.cs index bbcabfc41c..71d1001380 100644 --- a/Microsoft.Azure.Cosmos/src/Query/v2Query/DocumentQueryExecutionContextBase.cs +++ b/Microsoft.Azure.Cosmos/src/Query/v2Query/DocumentQueryExecutionContextBase.cs @@ -186,7 +186,8 @@ public async Task GetPartitionedQueryExecutionInf isContinuationExpected: isContinuationExpected, allowNonValueAggregateQuery: allowNonValueAggregateQuery, hasLogicalPartitionKey: hasLogicalPartitionKey, - allowDCount: allowDCount, + allowDCount: allowDCount, + hybridSearchSkipOrderByRewrite: false, geospatialType: geospatialType, useSystemPrefix: false); if (!tryGetPartitionedQueryExecutionInfo.Succeeded) diff --git a/Microsoft.Azure.Cosmos/src/Query/v2Query/ProxyDocumentQueryExecutionContext.cs b/Microsoft.Azure.Cosmos/src/Query/v2Query/ProxyDocumentQueryExecutionContext.cs index 448f9bb0bb..e60e6e64c6 100644 --- a/Microsoft.Azure.Cosmos/src/Query/v2Query/ProxyDocumentQueryExecutionContext.cs +++ b/Microsoft.Azure.Cosmos/src/Query/v2Query/ProxyDocumentQueryExecutionContext.cs @@ -37,7 +37,9 @@ internal sealed class ProxyDocumentQueryExecutionContext : IDocumentQueryExecuti private readonly Guid correlatedActivityId; +#pragma warning disable IDE0044 // Add readonly modifier private IDocumentQueryExecutionContext innerExecutionContext; +#pragma warning restore IDE0044 // Add readonly modifier private ProxyDocumentQueryExecutionContext( IDocumentQueryExecutionContext innerExecutionContext, diff --git a/Microsoft.Azure.Cosmos/src/Query/v3Query/CosmosQueryClientCore.cs b/Microsoft.Azure.Cosmos/src/Query/v3Query/CosmosQueryClientCore.cs index 770e12a984..15e2189629 100644 --- a/Microsoft.Azure.Cosmos/src/Query/v3Query/CosmosQueryClientCore.cs +++ b/Microsoft.Azure.Cosmos/src/Query/v3Query/CosmosQueryClientCore.cs @@ -6,11 +6,9 @@ namespace Microsoft.Azure.Cosmos { using System; using System.Collections.Generic; - using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; - using System.Text; using System.Threading; using System.Threading.Tasks; @@ -101,6 +99,7 @@ public override async Task> TryGetPartit bool hasLogicalPartitionKey, bool allowDCount, bool useSystemPrefix, + bool isHybridSearchQueryPlanOptimizationDisabled, Cosmos.GeospatialType geospatialType, CancellationToken cancellationToken) { @@ -126,6 +125,7 @@ public override async Task> TryGetPartit hasLogicalPartitionKey: hasLogicalPartitionKey, allowDCount: allowDCount, useSystemPrefix: useSystemPrefix, + hybridSearchSkipOrderByRewrite: !isHybridSearchQueryPlanOptimizationDisabled, geospatialType: geospatialType); } @@ -302,7 +302,7 @@ private static TryCatch GetCosmosElementResponse( ResponseMessage cosmosResponseMessage, ITrace trace) { - using (ITrace getCosmosElementResponse = trace.StartChild("Get Cosmos Element Response", TraceComponent.Json, Tracing.TraceLevel.Info)) + using (ITrace getCosmosElementResponse = trace.StartChild(TraceDatumKeys.GetCosmosElementResponse, TraceComponent.Json, Tracing.TraceLevel.Info)) { using (cosmosResponseMessage) { @@ -313,7 +313,7 @@ private static TryCatch GetCosmosElementResponse( cosmosResponseMessage.Headers.QueryMetricsText, IndexUtilizationInfo.Empty, ClientSideMetrics.Empty))); - trace.AddDatum("Query Metrics", datum); + trace.AddDatum(TraceDatumKeys.QueryMetrics, datum); } if (!cosmosResponseMessage.IsSuccessStatusCode) @@ -369,16 +369,7 @@ internal static TryCatch CreateQueryPage( // } // } - QueryState queryState; - if (headers.ContinuationToken != null) - { - queryState = new QueryState(CosmosString.Create(headers.ContinuationToken)); - } - else - { - queryState = default; - } - + QueryState queryState = (headers.ContinuationToken != null) ? new QueryState(CosmosString.Create(headers.ContinuationToken)) : default; Dictionary additionalHeaders = new Dictionary(); foreach (string key in headers) { @@ -529,7 +520,7 @@ public static void ParseRestStream( // You want to create a CosmosElement for each document in "Documents". ReadOnlyMemory content = memoryStream.TryGetBuffer(out ArraySegment buffer) ? buffer : (ReadOnlyMemory)memoryStream.ToArray(); - IJsonNavigator jsonNavigator = JsonNavigator.Create(content); + IJsonNavigator jsonNavigator = JsonNavigator.Create(content); string resourceName = resourceType switch { diff --git a/Microsoft.Azure.Cosmos/src/Query/v3Query/FeedResponse.cs b/Microsoft.Azure.Cosmos/src/Query/v3Query/FeedResponse.cs index 816bb7ff6d..33da048e5e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/v3Query/FeedResponse.cs +++ b/Microsoft.Azure.Cosmos/src/Query/v3Query/FeedResponse.cs @@ -60,7 +60,7 @@ protected FeedResponse() /// /// The query advice. /// - internal virtual string QueryAdvice => null; + public virtual string QueryAdvice => null; /// /// Request Message for this feed response diff --git a/Microsoft.Azure.Cosmos/src/Query/v3Query/QueryIterator.cs b/Microsoft.Azure.Cosmos/src/Query/v3Query/QueryIterator.cs index 62cc1d56a6..5891066b42 100644 --- a/Microsoft.Azure.Cosmos/src/Query/v3Query/QueryIterator.cs +++ b/Microsoft.Azure.Cosmos/src/Query/v3Query/QueryIterator.cs @@ -54,7 +54,6 @@ private QueryIterator( this.hasMoreResults = true; this.correlatedActivityId = correlatedActivityId; - this.querySpec = sqlQuerySpec; this.container = container; this.SetupInfoForTelemetry( @@ -150,7 +149,7 @@ public static QueryIterator Create( partitionedQueryExecutionInfo: partitionedQueryExecutionInfo, returnResultsInDeterministicOrder: queryRequestOptions.ReturnResultsInDeterministicOrder, enableOptimisticDirectExecution: queryRequestOptions.EnableOptimisticDirectExecution, - isNonStreamingOrderByQueryFeatureDisabled: queryRequestOptions.IsNonStreamingOrderByQueryFeatureDisabled, + isHybridSearchQueryPlanOptimizationDisabled: queryRequestOptions.IsHybridSearchQueryPlanOptimizationDisabled, enableDistributedQueryGatewayMode: queryRequestOptions.EnableDistributedQueryGatewayMode && (clientContext.ClientOptions.ConnectionMode == ConnectionMode.Gateway), testInjections: queryRequestOptions.TestSettings); diff --git a/Microsoft.Azure.Cosmos/src/Query/v3Query/QueryResponse.cs b/Microsoft.Azure.Cosmos/src/Query/v3Query/QueryResponse.cs index ef993ac79d..40886bf1f8 100644 --- a/Microsoft.Azure.Cosmos/src/Query/v3Query/QueryResponse.cs +++ b/Microsoft.Azure.Cosmos/src/Query/v3Query/QueryResponse.cs @@ -204,7 +204,7 @@ private QueryResponse( private Lazy QueryAdviceText { get; } - internal override string QueryAdvice => this.QueryAdviceText?.Value; + public override string QueryAdvice => this.QueryAdviceText?.Value; public override IEnumerator GetEnumerator() { diff --git a/Microsoft.Azure.Cosmos/src/Query/v3Query/ReadFeedResponse.cs b/Microsoft.Azure.Cosmos/src/Query/v3Query/ReadFeedResponse.cs index fb017b7cf0..ad84b52b1a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/v3Query/ReadFeedResponse.cs +++ b/Microsoft.Azure.Cosmos/src/Query/v3Query/ReadFeedResponse.cs @@ -38,7 +38,7 @@ internal ReadFeedResponse( public override string IndexMetrics { get; } - internal override string QueryAdvice { get; } + public override string QueryAdvice { get; } internal override RequestMessage RequestMessage { get; } diff --git a/Microsoft.Azure.Cosmos/src/RMResources.Designer.cs b/Microsoft.Azure.Cosmos/src/RMResources.Designer.cs index 9c0beffd71..fa43c0e4d3 100644 --- a/Microsoft.Azure.Cosmos/src/RMResources.Designer.cs +++ b/Microsoft.Azure.Cosmos/src/RMResources.Designer.cs @@ -282,6 +282,17 @@ internal static string CannotSpecifyPKRangeForNonPartitionedResource } } + /// + /// Looks up a localized string similar to {0} capability is not supported on subscription {1}. + /// + internal static string CapabilityNotSupportedOnSubscription + { + get + { + return ResourceManager.GetString("CapabilityNotSupportedOnSubscription", resourceCulture); + } + } + /// /// Looks up a localized string similar to StartTime cannot have DateTimeKind.Unspecified.. /// @@ -799,6 +810,17 @@ internal static string EnableMultipleWriteLocationsAndEnableServerlessNotSupport } } + /// + /// Looks up a localized string similar to Serverless accounts do not support partition merge. + /// + internal static string MergeNotSupportedForServerless + { + get + { + return ResourceManager.GetString("MergeNotSupportedForServerless", resourceCulture); + } + } + /// /// Looks up a localized string similar to Cannot set EnableMultipleWriteLocations on an account with EnableTieredStorageV1. /// @@ -1085,17 +1107,6 @@ internal static string FeatureNotSupportedOnSubscription } } - /// - /// Looks up a localized string similar to MaterializedViews is not supported on this account type. - /// - internal static string MaterializedViewsNotSupportedOnZoneRedundantAccount - { - get - { - return ResourceManager.GetString("MaterializedViewsNotSupportedOnZoneRedundantAccount", resourceCulture); - } - } - /// /// Looks up a localized string similar to Federation {0} in region {1} is not found. /// @@ -1321,10 +1332,10 @@ internal static string InvalidAuthHeaderFormat } } - /// - /// Looks up a localized string similar to The backend response was not in the correct format.. - /// - internal static string InvalidBackendResponse + /// + /// Looks up a localized string similar to The backend response was not in the correct format.. + /// + internal static string InvalidBackendResponse { get { @@ -4321,8 +4332,8 @@ internal static string FailoverDisabled return ResourceManager.GetString("FailoverDisabled", resourceCulture); } } - - /// + + /// /// Looks up a localized string similar to Cannot perform failover priority change as it is disabled for the account. /// internal static string FailoverPriorityChangeDisabled @@ -4972,5 +4983,16 @@ internal static string DisableCmkNotSupported return ResourceManager.GetString("DisableCmkNotSupported", resourceCulture); } } + + /// + /// Looks up a localized string similar to Soft Delete and Multiple Write Locations cannot be enabled on the same account.. + /// + internal static string SoftDeletionNotSupportedWithMultipleWriteLocations + { + get + { + return ResourceManager.GetString("SoftDeletionNotSupportedWithMultipleWriteLocations", resourceCulture); + } + } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/RMResources.resx b/Microsoft.Azure.Cosmos/src/RMResources.resx index be76baec1a..43e42d69d5 100644 --- a/Microsoft.Azure.Cosmos/src/RMResources.resx +++ b/Microsoft.Azure.Cosmos/src/RMResources.resx @@ -861,9 +861,6 @@ Feature {0} is not supported in {1} region - - Materialized Views are not supported on account with zone redundant region - Database and Write Location are not matching @@ -1054,6 +1051,9 @@ If you would like to serve this query through continuation tokens, then please r Serverless accounts do not support multiple regions. + + Serverless accounts do not support partition merge. + "Operation '{0}' on resource '{1}' is not allowed through Azure Cosmos DB endpoint. Please switch on such operations for your account, or perform this operation through Azure Resource Manager, Azure Portal, Azure CLI or Azure Powershell" @@ -1455,4 +1455,10 @@ If you would like to serve this query through continuation tokens, then please r Cannot provide an empty KeyVaultKeyUri to an account with CMK Enabled. More info: https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-setup-customer-managed-keys?tabs=azure-portal + + {0} capability is not supported on subscription {1} + + + Soft Delete and Multiple Write Locations cannot be enabled on the same account. + \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/ReadFeed/ReadFeedIteratorCore.cs b/Microsoft.Azure.Cosmos/src/ReadFeed/ReadFeedIteratorCore.cs index 2d64c4500c..a03f7bc838 100644 --- a/Microsoft.Azure.Cosmos/src/ReadFeed/ReadFeedIteratorCore.cs +++ b/Microsoft.Azure.Cosmos/src/ReadFeed/ReadFeedIteratorCore.cs @@ -39,7 +39,6 @@ public ReadFeedIteratorCore( CancellationToken cancellationToken) { this.container = container; - this.operationName = OpenTelemetryConstants.Operations.ReadFeedRanges; this.queryRequestOptions = queryRequestOptions; @@ -134,6 +133,7 @@ public ReadFeedIteratorCore( catch (Exception exception) when (exception.InnerException is JsonParseException) { MalformedContinuationTokenException malformedContinuationTokenException = new MalformedContinuationTokenException(exception.Message); +#pragma warning disable CDX1002 // DontUseExceptionStackTrace throw CosmosExceptionFactory.CreateBadRequestException( message: $"Malformed Continuation Token: {tokenAsString}.", headers: CosmosQueryResponseMessageHeaders.ConvertToQueryHeaders( @@ -145,6 +145,7 @@ public ReadFeedIteratorCore( stackTrace: exception.StackTrace, innerException: malformedContinuationTokenException, trace: null); +#pragma warning restore CDX1002 // DontUseExceptionStackTrace } } diff --git a/Microsoft.Azure.Cosmos/src/ReadManyQueryHelper.cs b/Microsoft.Azure.Cosmos/src/ReadManyQueryHelper.cs index 6ebcda267c..68fc4c354a 100644 --- a/Microsoft.Azure.Cosmos/src/ReadManyQueryHelper.cs +++ b/Microsoft.Azure.Cosmos/src/ReadManyQueryHelper.cs @@ -304,6 +304,15 @@ private QueryDefinition CreateReadManyQueryDefinitionForOther(List<(string, Part } for (int j = 0; j < this.partitionKeySelectors.Count; j++) { + if (pkValues[j] == Undefined.Value) + { + queryStringBuilder.Append(" AND "); + queryStringBuilder.Append("IS_DEFINED(c"); + queryStringBuilder.Append(this.partitionKeySelectors[j]); + queryStringBuilder.Append(") = false"); + continue; + } + queryStringBuilder.Append(" AND "); queryStringBuilder.Append("c"); queryStringBuilder.Append(this.partitionKeySelectors[j]); diff --git a/Microsoft.Azure.Cosmos/src/Regions.cs b/Microsoft.Azure.Cosmos/src/Regions.cs index b510b10c3e..2be568ec55 100644 --- a/Microsoft.Azure.Cosmos/src/Regions.cs +++ b/Microsoft.Azure.Cosmos/src/Regions.cs @@ -35,6 +35,11 @@ public static class Regions /// public const string EastUS2 = "East US 2"; + /// + /// Name of the Azure East US 3 region in the Azure Cosmos DB service. + /// + public const string EastUS3 = "East US 3"; + /// /// Name of the Azure Central US region in the Azure Cosmos DB service. /// diff --git a/Microsoft.Azure.Cosmos/src/RenameCollectionAwareClientRetryPolicy.cs b/Microsoft.Azure.Cosmos/src/RenameCollectionAwareClientRetryPolicy.cs index 7b2ceefd55..6587ef302a 100644 --- a/Microsoft.Azure.Cosmos/src/RenameCollectionAwareClientRetryPolicy.cs +++ b/Microsoft.Azure.Cosmos/src/RenameCollectionAwareClientRetryPolicy.cs @@ -118,7 +118,7 @@ private async Task ShouldRetryInternalAsync( // When ResolveCollectionAsync throws an exception ignore it because it's an attempt to recover an existing // error. When the recovery fails we return ShouldRetryResult.NoRetry and propaganate the original exception to the client - DefaultTrace.TraceCritical("Can't recover from session unavailable exception because resolving collection name {0} failed with {1}", request.ResourceAddress, e.ToString()); + DefaultTrace.TraceCritical("Can't recover from session unavailable exception because resolving collection name {0} failed with {1}", request.ResourceAddress, e.Message); } } } diff --git a/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs b/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs index 0ec14ec5de..b287b7199b 100644 --- a/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs +++ b/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs @@ -1,120 +1,120 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos -{ - using System; - using System.Text; - using Microsoft.Azure.Cosmos.CosmosElements; - using Microsoft.Azure.Cosmos.Query; - using Microsoft.Azure.Cosmos.Query.Core; - using Microsoft.Azure.Cosmos.Query.Core.Pipeline; - using Microsoft.Azure.Documents; - - /// - /// The Cosmos query request options - /// - public class QueryRequestOptions : RequestOptions - { - /// - /// Gets or sets the request option for document query requests in the Azure Cosmos DB service. - /// - /// - /// - /// ResponseContinuationTokenLimitInKb is used to limit the length of continuation token in the query response. Valid values are >= 0. - /// - /// - public int? ResponseContinuationTokenLimitInKb { get; set; } - - /// - /// Gets or sets the option to enable scans on the queries which couldn't be served - /// as indexing was opted out on the requested paths in the Azure Cosmos DB service. - /// - /// - /// Option is true if scan on queries is enabled; otherwise, false. - /// - public bool? EnableScanInQuery { get; set; } - - /// - /// Gets or sets the option to enable low precision order by in the Azure Cosmos DB service. - /// - /// - /// The option to enable low-precision order by. - /// - public bool? EnableLowPrecisionOrderBy { get; set; } - - /// - /// Gets or sets the option for customers to opt in for direct (optimistic) execution of the query. - /// - /// - /// Direct (optimistic) execution offers improved performance for several kinds of queries such as a single partition streaming query. - /// - public bool EnableOptimisticDirectExecution { get; set; } = ConfigurationManager.IsOptimisticDirectExecutionEnabled(defaultValue: false); - - /// - /// Gets or sets the maximum number of items that can be buffered client side during - /// parallel query execution in the Azure Cosmos DB service. - /// A positive property value limits the number of buffered - /// items to the set value. If it is set to less than 0, the system automatically - /// decides the number of items to buffer. - /// - /// - /// The maximum count of items that can be buffered during parallel query execution. - /// - /// - /// This is only suggestive and cannot be abided by in certain cases. - /// - public int? MaxBufferedItemCount { get; set; } - - /// - /// Gets or sets the maximum number of items to be returned in the enumeration operation in the Azure Cosmos DB service. - /// - /// - /// The maximum number of items to be returned in the enumeration operation. - /// - /// - /// Used for query pagination. - /// '-1' Used for dynamic page size. - /// This is a maximum. Query can return 0 items in the page. - /// - public int? MaxItemCount { get; set; } - - /// - /// Gets or sets the number of concurrent operations run client side during - /// parallel query execution in the Azure Cosmos DB service. - /// A positive property value limits the number of - /// concurrent operations to the set value. If it is set to less than 0, the - /// system automatically decides the number of concurrent operations to run. - /// - /// - /// The maximum number of concurrent operations during parallel execution. - /// Defaults will be executed serially with no-parallelism - /// - public int? MaxConcurrency { get; set; } - - /// - /// Gets or sets the for the current request in the Azure Cosmos DB service. - /// - /// - /// Only applicable to Item operations - /// - public PartitionKey? PartitionKey { get; set; } - - /// - /// Gets or sets the request option for document query requests in the Azure Cosmos DB service. - /// - /// - /// - /// PopulateIndexMetrics is used to obtain the index metrics to understand how the query engine used existing indexes - /// and how it could use potential new indexes. - /// The results will be displayed in FeedResponse.IndexMetrics. Please note that this options will incur overhead, so it should be - /// enabled only when debugging slow queries. - /// - /// - public bool? PopulateIndexMetrics { get; set; } - - /// +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos +{ + using System; + using System.Text; + using Microsoft.Azure.Cosmos.CosmosElements; + using Microsoft.Azure.Cosmos.Query; + using Microsoft.Azure.Cosmos.Query.Core; + using Microsoft.Azure.Cosmos.Query.Core.Pipeline; + using Microsoft.Azure.Documents; + + /// + /// The Cosmos query request options + /// + public class QueryRequestOptions : RequestOptions + { + /// + /// Gets or sets the request option for document query requests in the Azure Cosmos DB service. + /// + /// + /// + /// ResponseContinuationTokenLimitInKb is used to limit the length of continuation token in the query response. Valid values are >= 0. + /// + /// + public int? ResponseContinuationTokenLimitInKb { get; set; } + + /// + /// Gets or sets the option to enable scans on the queries which couldn't be served + /// as indexing was opted out on the requested paths in the Azure Cosmos DB service. + /// + /// + /// Option is true if scan on queries is enabled; otherwise, false. + /// + public bool? EnableScanInQuery { get; set; } + + /// + /// Gets or sets the option to enable low precision order by in the Azure Cosmos DB service. + /// + /// + /// The option to enable low-precision order by. + /// + public bool? EnableLowPrecisionOrderBy { get; set; } + + /// + /// Gets or sets the option for customers to opt in for direct (optimistic) execution of the query. + /// + /// + /// Direct (optimistic) execution offers improved performance for several kinds of queries such as a single partition streaming query. + /// + public bool EnableOptimisticDirectExecution { get; set; } = ConfigurationManager.IsOptimisticDirectExecutionEnabled(defaultValue: false); + + /// + /// Gets or sets the maximum number of items that can be buffered client side during + /// parallel query execution in the Azure Cosmos DB service. + /// A positive property value limits the number of buffered + /// items to the set value. If it is set to less than 0, the system automatically + /// decides the number of items to buffer. + /// + /// + /// The maximum count of items that can be buffered during parallel query execution. + /// + /// + /// This is only suggestive and cannot be abided by in certain cases. + /// + public int? MaxBufferedItemCount { get; set; } + + /// + /// Gets or sets the maximum number of items to be returned in the enumeration operation in the Azure Cosmos DB service. + /// + /// + /// The maximum number of items to be returned in the enumeration operation. + /// + /// + /// Used for query pagination. + /// '-1' Used for dynamic page size. + /// This is a maximum. Query can return 0 items in the page. + /// + public int? MaxItemCount { get; set; } + + /// + /// Gets or sets the number of concurrent operations run client side during + /// parallel query execution in the Azure Cosmos DB service. + /// A positive property value limits the number of + /// concurrent operations to the set value. If it is set to less than 0, the + /// system automatically decides the number of concurrent operations to run. + /// + /// + /// The maximum number of concurrent operations during parallel execution. + /// Defaults will be executed serially with no-parallelism + /// + public int? MaxConcurrency { get; set; } + + /// + /// Gets or sets the for the current request in the Azure Cosmos DB service. + /// + /// + /// Only applicable to Item operations + /// + public PartitionKey? PartitionKey { get; set; } + + /// + /// Gets or sets the request option for document query requests in the Azure Cosmos DB service. + /// + /// + /// + /// PopulateIndexMetrics is used to obtain the index metrics to understand how the query engine used existing indexes + /// and how it could use potential new indexes. + /// The results will be displayed in FeedResponse.IndexMetrics. Please note that this options will incur overhead, so it should be + /// enabled only when debugging slow queries. + /// + /// + public bool? PopulateIndexMetrics { get; set; } + + /// /// Gets or sets the request option for document query requests in the Azure Cosmos DB service. /// /// @@ -123,142 +123,162 @@ public class QueryRequestOptions : RequestOptions /// The results will be displayed in FeedResponse.QueryAdvice. Please note that this options will incur overhead, so it should be /// enabled only when debugging queries. /// + /// + /// + /// page = itemQuery.ReadNextAsync().Result; + /// + /// // query advice is the same across pages so we only need to log it once + /// if (queryAdvice == null) + /// { + /// queryAdvice = page.QueryAdvice; + /// } + /// } + /// ]]> + /// + /// + /// + public bool? PopulateQueryAdvice { get; set; } + + /// + /// Gets or sets the consistency level required for the request in the Azure Cosmos DB service. + /// + /// + /// The consistency level required for the request. + /// + /// + /// Azure Cosmos DB offers 5 different consistency levels. Strong, Bounded Staleness, Session, Consistent Prefix and Eventual - in order of strongest to weakest consistency. + /// + /// While this is set at a database account level, Azure Cosmos DB allows a developer to override the default consistency level + /// for each individual request. + /// + /// + public ConsistencyLevel? ConsistencyLevel + { + get => this.BaseConsistencyLevel; + set => this.BaseConsistencyLevel = value; + } + + /// + /// Gets or sets the token for use with session consistency in the Azure Cosmos DB service. + /// + /// + /// The token for use with session consistency. + /// + /// + /// + /// One of the for Azure Cosmos DB is Session. In fact, this is the default level applied to accounts. + /// + /// When working with Session consistency, each new write request to Azure Cosmos DB is assigned a new SessionToken. + /// The CosmosClient will use this token internally with each read/query request to ensure that the set consistency level is maintained. + /// + /// + /// In some scenarios you need to manage this Session yourself; + /// Consider a web application with multiple nodes, each node will have its own instance of + /// If you wanted these nodes to participate in the same session (to be able read your own writes consistently across web tiers) + /// you would have to send the SessionToken from of the write action on one node + /// to the client tier, using a cookie or some other mechanism, and have that token flow back to the web tier for subsequent reads. + /// If you are using a round-robin load balancer which does not maintain session affinity between requests, such as the Azure Load Balancer, + /// the read could potentially land on a different node to the write request, where the session was created. + /// + /// + /// + /// If you do not flow the Azure Cosmos DB SessionToken across as described above you could end up with inconsistent read results for a period of time. + /// + /// + /// /// - internal bool? PopulateQueryAdvice { get; set; } + public string SessionToken { get; set; } + + /// + /// Gets or sets the for requests against the dedicated gateway. Learn more about dedicated gateway here. + /// These options are only exercised when is set to ConnectionMode.Gateway and the dedicated gateway endpoint is used for sending requests. + /// These options have no effect otherwise. + /// + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } /// - /// Gets or sets the consistency level required for the request in the Azure Cosmos DB service. - /// - /// - /// The consistency level required for the request. - /// - /// - /// Azure Cosmos DB offers 5 different consistency levels. Strong, Bounded Staleness, Session, Consistent Prefix and Eventual - in order of strongest to weakest consistency. - /// - /// While this is set at a database account level, Azure Cosmos DB allows a developer to override the default consistency level - /// for each individual request. - /// - /// - public ConsistencyLevel? ConsistencyLevel - { - get => this.BaseConsistencyLevel; - set => this.BaseConsistencyLevel = value; - } - - /// - /// Gets or sets the token for use with session consistency in the Azure Cosmos DB service. - /// - /// - /// The token for use with session consistency. - /// - /// - /// - /// One of the for Azure Cosmos DB is Session. In fact, this is the default level applied to accounts. - /// - /// When working with Session consistency, each new write request to Azure Cosmos DB is assigned a new SessionToken. - /// The CosmosClient will use this token internally with each read/query request to ensure that the set consistency level is maintained. - /// - /// - /// In some scenarios you need to manage this Session yourself; - /// Consider a web application with multiple nodes, each node will have its own instance of - /// If you wanted these nodes to participate in the same session (to be able read your own writes consistently across web tiers) - /// you would have to send the SessionToken from of the write action on one node - /// to the client tier, using a cookie or some other mechanism, and have that token flow back to the web tier for subsequent reads. - /// If you are using a round-robin load balancer which does not maintain session affinity between requests, such as the Azure Load Balancer, - /// the read could potentially land on a different node to the write request, where the session was created. - /// - /// - /// - /// If you do not flow the Azure Cosmos DB SessionToken across as described above you could end up with inconsistent read results for a period of time. - /// - /// - /// - /// - public string SessionToken { get; set; } - - /// - /// Gets or sets the for requests against the dedicated gateway. Learn more about dedicated gateway here. - /// These options are only exercised when is set to ConnectionMode.Gateway and the dedicated gateway endpoint is used for sending requests. - /// These options have no effect otherwise. - /// - public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } - - /// - /// Enables printing query in Traces db.query.text attribute. By default, query is not printed. - /// Users have the option to enable printing parameterized or all queries, - /// but has to beware that customer data may be shown when the later option is chosen. It's the user's responsibility to sanitize the queries if necessary. + /// Enables printing query in Traces db.query.text attribute. By default, query is not printed. + /// Users have the option to enable printing parameterized or all queries, + /// but has to beware that customer data may be shown when the later option is chosen. It's the user's responsibility to sanitize the queries if necessary. /// public QueryTextMode QueryTextMode { get; set; } = QueryTextMode.None; - - internal CosmosElement CosmosElementContinuationToken { get; set; } - - internal string StartId { get; set; } - - internal string EndId { get; set; } - - internal EnumerationDirection? EnumerationDirection { get; set; } - - internal CosmosSerializationFormatOptions CosmosSerializationFormatOptions { get; set; } - - internal SupportedSerializationFormats? SupportedSerializationFormats { get; set; } - - internal bool? ReturnResultsInDeterministicOrder { get; set; } - - internal TestInjections TestSettings { get; set; } - - internal FeedRange FeedRange { get; set; } - - internal bool IsNonStreamingOrderByQueryFeatureDisabled { get; set; } = ConfigurationManager.IsNonStreamingOrderByQueryFeatureDisabled(defaultValue: false); + + internal CosmosElement CosmosElementContinuationToken { get; set; } + + internal string StartId { get; set; } + + internal string EndId { get; set; } + + internal EnumerationDirection? EnumerationDirection { get; set; } + + internal CosmosSerializationFormatOptions CosmosSerializationFormatOptions { get; set; } + + internal SupportedSerializationFormats? SupportedSerializationFormats { get; set; } + + internal bool? ReturnResultsInDeterministicOrder { get; set; } + + internal TestInjections TestSettings { get; set; } + + internal FeedRange FeedRange { get; set; } + + internal bool IsHybridSearchQueryPlanOptimizationDisabled { get; set; } = ConfigurationManager.IsHybridSearchQueryPlanOptimizationDisabled(defaultValue: true); // This is a temporary flag to enable the distributed query gateway mode. // This flag will be removed once we have a way for the client to determine - // that we are talking to a distributed query gateway. - internal bool EnableDistributedQueryGatewayMode { get; set; } = ConfigurationManager.IsDistributedQueryGatewayModeEnabled(defaultValue: false); - - /// - /// Fill the CosmosRequestMessage headers with the set properties - /// - /// The - internal override void PopulateRequestOptions(RequestMessage request) - { - if (this.PartitionKey != null && request.ResourceType != ResourceType.Document) - { - throw new ArgumentException($"{nameof(this.PartitionKey)} can only be set for item operations"); - } - - // Cross partition is only applicable to item operations. - if (this.PartitionKey == null && !this.IsEffectivePartitionKeyRouting && request.ResourceType == ResourceType.Document) - { - request.Headers.Add(HttpConstants.HttpHeaders.EnableCrossPartitionQuery, bool.TrueString); - } - - RequestOptions.SetSessionToken(request, this.SessionToken); - - // Flow the pageSize only when we are not doing client eval - if (this.MaxItemCount.HasValue) - { - request.Headers.CosmosMessageHeaders.PageSize = this.MaxItemCount.ToString(); - } - - if (this.MaxConcurrency.HasValue && this.MaxConcurrency > 0) - { - request.Headers.Add(HttpConstants.HttpHeaders.ParallelizeCrossPartitionQuery, bool.TrueString); - } - - if (this.EnableScanInQuery.HasValue && this.EnableScanInQuery.Value) - { - request.Headers.Add(HttpConstants.HttpHeaders.EnableScanInQuery, bool.TrueString); - } - - if (this.EnableLowPrecisionOrderBy != null) - { - request.Headers.Add(HttpConstants.HttpHeaders.EnableLowPrecisionOrderBy, this.EnableLowPrecisionOrderBy.ToString()); - } - - if (this.ResponseContinuationTokenLimitInKb != null) - { - request.Headers.Add(HttpConstants.HttpHeaders.ResponseContinuationTokenLimitInKB, this.ResponseContinuationTokenLimitInKb.ToString()); - } + // that we are talking to a distributed query gateway. + internal bool EnableDistributedQueryGatewayMode { get; set; } = ConfigurationManager.IsDistributedQueryGatewayModeEnabled(defaultValue: false); + + /// + /// Fill the CosmosRequestMessage headers with the set properties + /// + /// The + internal override void PopulateRequestOptions(RequestMessage request) + { + if (this.PartitionKey != null && request.ResourceType != ResourceType.Document) + { + throw new ArgumentException($"{nameof(this.PartitionKey)} can only be set for item operations"); + } + + // Cross partition is only applicable to item operations. + if (this.PartitionKey == null && !this.IsEffectivePartitionKeyRouting && request.ResourceType == ResourceType.Document) + { + request.Headers.Add(HttpConstants.HttpHeaders.EnableCrossPartitionQuery, bool.TrueString); + } + + RequestOptions.SetSessionToken(request, this.SessionToken); + + // Flow the pageSize only when we are not doing client eval + if (this.MaxItemCount.HasValue) + { + request.Headers.CosmosMessageHeaders.PageSize = this.MaxItemCount.ToString(); + } + + if (this.MaxConcurrency.HasValue && this.MaxConcurrency > 0) + { + request.Headers.Add(HttpConstants.HttpHeaders.ParallelizeCrossPartitionQuery, bool.TrueString); + } + + if (this.EnableScanInQuery.HasValue && this.EnableScanInQuery.Value) + { + request.Headers.Add(HttpConstants.HttpHeaders.EnableScanInQuery, bool.TrueString); + } + + if (this.EnableLowPrecisionOrderBy != null) + { + request.Headers.Add(HttpConstants.HttpHeaders.EnableLowPrecisionOrderBy, this.EnableLowPrecisionOrderBy.ToString()); + } + + if (this.ResponseContinuationTokenLimitInKb != null) + { + request.Headers.Add(HttpConstants.HttpHeaders.ResponseContinuationTokenLimitInKB, this.ResponseContinuationTokenLimitInKb.ToString()); + } // All query APIs (GetItemQueryIterator, GetItemLinqQueryable and GetItemQueryStreamIterator) turn into ReadFeed operation if query text is null. // In such a case, query pipelines are still involved (including QueryRequestOptions). In general backend only honors SupportedSerializationFormats @@ -266,54 +286,54 @@ internal override void PopulateRequestOptions(RequestMessage request) if (request.OperationType == OperationType.Query) { request.Headers.CosmosMessageHeaders.SupportedSerializationFormats = this.SupportedSerializationFormats?.ToString() ?? DocumentQueryExecutionContextBase.DefaultSupportedSerializationFormats; - } - - if (this.StartId != null) - { - request.Headers.Set(HttpConstants.HttpHeaders.StartId, Convert.ToBase64String(Encoding.UTF8.GetBytes(this.StartId))); - } - - if (this.EndId != null) - { - request.Headers.Set(HttpConstants.HttpHeaders.EndId, Convert.ToBase64String(Encoding.UTF8.GetBytes(this.EndId))); - } - - if (this.StartId != null || this.EndId != null) - { - request.Headers.Set(HttpConstants.HttpHeaders.ReadFeedKeyType, ReadFeedKeyType.ResourceId.ToString()); - } - - if (this.EnumerationDirection.HasValue) - { - request.Headers.Set(HttpConstants.HttpHeaders.EnumerationDirection, this.EnumerationDirection.Value.ToString()); - } - - if (this.PopulateIndexMetrics.HasValue) - { - request.Headers.CosmosMessageHeaders.Add(HttpConstants.HttpHeaders.PopulateIndexMetricsV2, this.PopulateIndexMetrics.ToString()); - } - + } + + if (this.StartId != null) + { + request.Headers.Set(HttpConstants.HttpHeaders.StartId, Convert.ToBase64String(Encoding.UTF8.GetBytes(this.StartId))); + } + + if (this.EndId != null) + { + request.Headers.Set(HttpConstants.HttpHeaders.EndId, Convert.ToBase64String(Encoding.UTF8.GetBytes(this.EndId))); + } + + if (this.StartId != null || this.EndId != null) + { + request.Headers.Set(HttpConstants.HttpHeaders.ReadFeedKeyType, ReadFeedKeyType.ResourceId.ToString()); + } + + if (this.EnumerationDirection.HasValue) + { + request.Headers.Set(HttpConstants.HttpHeaders.EnumerationDirection, this.EnumerationDirection.Value.ToString()); + } + + if (this.PopulateIndexMetrics.HasValue) + { + request.Headers.CosmosMessageHeaders.Add(HttpConstants.HttpHeaders.PopulateIndexMetricsV2, this.PopulateIndexMetrics.ToString()); + } + if (this.PopulateQueryAdvice.HasValue) { request.Headers.CosmosMessageHeaders.Add(HttpConstants.HttpHeaders.PopulateQueryAdvice, this.PopulateQueryAdvice.ToString()); } - DedicatedGatewayRequestOptions.PopulateMaxIntegratedCacheStalenessOption(this.DedicatedGatewayRequestOptions, request); - DedicatedGatewayRequestOptions.PopulateBypassIntegratedCacheOption(this.DedicatedGatewayRequestOptions, request); - - request.Headers.Add(HttpConstants.HttpHeaders.PopulateQueryMetrics, bool.TrueString); - - base.PopulateRequestOptions(request); - } - - internal static void FillContinuationToken( - RequestMessage request, - string continuationToken) - { - if (!string.IsNullOrWhiteSpace(continuationToken)) - { - request.Headers.ContinuationToken = continuationToken; - } - } - } + DedicatedGatewayRequestOptions.PopulateMaxIntegratedCacheStalenessOption(this.DedicatedGatewayRequestOptions, request); + DedicatedGatewayRequestOptions.PopulateBypassIntegratedCacheOption(this.DedicatedGatewayRequestOptions, request); + + request.Headers.Add(HttpConstants.HttpHeaders.PopulateQueryMetrics, bool.TrueString); + + base.PopulateRequestOptions(request); + } + + internal static void FillContinuationToken( + RequestMessage request, + string continuationToken) + { + if (!string.IsNullOrWhiteSpace(continuationToken)) + { + request.Headers.ContinuationToken = continuationToken; + } + } + } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/RequestOptions/RequestOptions.cs b/Microsoft.Azure.Cosmos/src/RequestOptions/RequestOptions.cs index 62b3c7f81f..fdb9472a84 100644 --- a/Microsoft.Azure.Cosmos/src/RequestOptions/RequestOptions.cs +++ b/Microsoft.Azure.Cosmos/src/RequestOptions/RequestOptions.cs @@ -124,7 +124,12 @@ public class RequestOptions /// cannot be set in RequestOptions. /// /// - internal int? ThroughputBucket { get; set; } +#if PREVIEW + public +#else + internal +#endif + int? ThroughputBucket { get; set; } /// /// Fill the CosmosRequestMessage headers with the set properties diff --git a/Microsoft.Azure.Cosmos/src/Resource/ClientContextCore.cs b/Microsoft.Azure.Cosmos/src/Resource/ClientContextCore.cs index 86658cf9a3..e98979eea1 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/ClientContextCore.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/ClientContextCore.cs @@ -85,7 +85,8 @@ internal static CosmosClientContext Create( cosmosClientId: cosmosClient.Id, remoteCertificateValidationCallback: ClientContextCore.SslCustomValidationCallBack(clientOptions.GetServerCertificateCustomValidationCallback()), cosmosClientTelemetryOptions: clientOptions.CosmosClientTelemetryOptions, - chaosInterceptorFactory: clientOptions.ChaosInterceptorFactory); + chaosInterceptorFactory: clientOptions.ChaosInterceptorFactory, + enableAsyncCacheExceptionNoSharing: clientOptions.EnableAsyncCacheExceptionNoSharing); return ClientContextCore.Create( cosmosClient, @@ -638,7 +639,7 @@ private static void RecordMetrics(Func getOperationName, } catch (Exception ex) { - DefaultTrace.TraceError(ex.ToString()); + DefaultTrace.TraceError(ex.Message); } } diff --git a/Microsoft.Azure.Cosmos/src/Resource/Container/ContainerCore.Items.cs b/Microsoft.Azure.Cosmos/src/Resource/Container/ContainerCore.Items.cs index 6e23513ff6..194963aab6 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/Container/ContainerCore.Items.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/Container/ContainerCore.Items.cs @@ -112,7 +112,7 @@ public async Task> ReadItemAsync( ITrace trace, ItemRequestOptions requestOptions = null, CancellationToken cancellationToken = default) - { + { ResponseMessage response = await this.ProcessItemStreamAsync( partitionKey: partitionKey, itemId: id, @@ -120,7 +120,7 @@ public async Task> ReadItemAsync( operationType: OperationType.Read, requestOptions: requestOptions, trace: trace, - targetResponseSerializationFormat: default, + targetResponseSerializationFormat: this.GetTargetResponseSerializationFormat(), cancellationToken: cancellationToken); return this.ClientContext.ResponseFactory.CreateItemResponse(response); @@ -249,7 +249,7 @@ public async Task> DeleteItemAsync( operationType: OperationType.Delete, requestOptions: requestOptions, trace: trace, - targetResponseSerializationFormat: default, + targetResponseSerializationFormat: this.GetTargetResponseSerializationFormat(), cancellationToken: cancellationToken); return this.ClientContext.ResponseFactory.CreateItemResponse(response); @@ -847,8 +847,13 @@ private async Task ExtractPartitionKeyAndProcessItemStreamAsync Stream itemStream; using (trace.StartChild("ItemSerialize")) - { - itemStream = this.ClientContext.SerializerCore.ToStream(item); + { + // Serializing the item to a binary stream should be avoided when triggers are present in the item request options. + // This is because when triggers are present in the request options, the backend will pass the stream to the javascript + // engine, which does not support binary encoded content at the moment. For long term, since trigger operations won't + // be supported in the backend, avoiding the binary encoding in such cases, will be the ideal approach. + bool canUseBinaryEncoding = !ContainerCore.IsTriggerPresentInRequestOptions(requestOptions); + itemStream = this.ClientContext.SerializerCore.ToStream(item, canUseBinaryEncodingForPointOperations: canUseBinaryEncoding); } // User specified PK value, no need to extract it @@ -861,7 +866,7 @@ private async Task ExtractPartitionKeyAndProcessItemStreamAsync operationType, requestOptions, trace: trace, - targetResponseSerializationFormat: default, + targetResponseSerializationFormat: this.GetTargetResponseSerializationFormat(), cancellationToken: cancellationToken); } @@ -877,7 +882,7 @@ private async Task ExtractPartitionKeyAndProcessItemStreamAsync operationType, requestOptions, trace: trace, - targetResponseSerializationFormat: default, + targetResponseSerializationFormat: this.GetTargetResponseSerializationFormat(), cancellationToken: cancellationToken); if (responseMessage.IsSuccessStatusCode) @@ -921,10 +926,16 @@ private async Task ProcessItemStreamAsync( } ContainerInternal.ValidatePartitionKey(partitionKey, requestOptions); - string resourceUri = this.GetResourceUri(requestOptions, operationType, itemId); + string resourceUri = this.GetResourceUri(requestOptions, operationType, itemId); // Convert Text to Binary Stream. - if (ConfigurationManager.IsBinaryEncodingEnabled()) + // Exception: Serializing a text stream to a binary stream should be avoided when triggers are present in the item request options. + // This is because when triggers are present in the request options, the backend will pass the stream to the javascript + // engine, which does not support binary encoded content at the moment. For long term, since trigger operations won't + // be supported in the backend, avoiding the binary encoding in such cases, will be the ideal approach. + if (ConfigurationManager.IsBinaryEncodingEnabled() + && !ContainerCore.IsTriggerPresentInRequestOptions(requestOptions) + && !this.ClientContext.ClientOptions.EnableStreamPassThrough) { streamPayload = CosmosSerializationUtil.TrySerializeStreamToTargetFormat( targetSerializationFormat: ContainerCore.GetTargetRequestSerializationFormat(), @@ -947,7 +958,8 @@ private async Task ProcessItemStreamAsync( cancellationToken: cancellationToken); // Convert Binary Stream to Text. - if (targetResponseSerializationFormat.HasValue + if (!this.ClientContext.ClientOptions.EnableStreamPassThrough + && targetResponseSerializationFormat.HasValue && (requestOptions == null || !requestOptions.EnableBinaryResponseOnPointOperations) && responseMessage?.Content is CloneableStream outputCloneableStream) { @@ -1286,6 +1298,16 @@ private ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderPrivate( applyBuilderConfiguration: changeFeedProcessor.ApplyBuildConfiguration).WithChangeFeedMode(mode); } + private JsonSerializationFormat? GetTargetResponseSerializationFormat() + { + if (this.ClientContext.ClientOptions.IsCustomSerializerProvided()) + { + return JsonSerializationFormat.Text; + } + + return default; + } + private static JsonSerializationFormat GetTargetRequestSerializationFormat() { return ConfigurationManager.IsBinaryEncodingEnabled() @@ -1607,6 +1629,17 @@ private static bool IsYMaxWithinX( Documents.Routing.Range y) { return x.Max == y.Max || x.Contains(y.Max); + } + + /// + /// Checks if the request options contain any triggers (pre or post). + /// + /// An instance of . + /// A boolean flag indicating if triggers were present in the request options. + private static bool IsTriggerPresentInRequestOptions( + ItemRequestOptions requestOptions) + { + return requestOptions?.PreTriggers != null || requestOptions?.PostTriggers != null; } } } diff --git a/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosException.cs b/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosException.cs index fe555fc26b..6aec746285 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosException.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosException.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.Cosmos /// /// The Cosmos Client exception /// - public class CosmosException : Exception + public class CosmosException : Exception, ICloneable { private readonly string stackTrace; private readonly Lazy lazyMessage; @@ -142,7 +142,9 @@ public override string StackTrace } else { +#pragma warning disable CDX1002 // DontUseExceptionStackTrace return base.StackTrace; +#pragma warning restore CDX1002 // DontUseExceptionStackTrace } } } @@ -261,18 +263,22 @@ private string ToStringHelper( if (this.InnerException != null) { stringBuilder.Append(" ---> "); +#pragma warning disable CDX1000 // DontConvertExceptionToObject stringBuilder.Append(this.InnerException); +#pragma warning restore CDX1000 // DontConvertExceptionToObject stringBuilder.AppendLine(); stringBuilder.Append(" "); stringBuilder.Append("--- End of inner exception stack trace ---"); stringBuilder.AppendLine(); } +#pragma warning disable CDX1002 // DontUseExceptionStackTrace if (this.StackTrace != null) { stringBuilder.Append(this.StackTrace); stringBuilder.AppendLine(); } +#pragma warning restore CDX1002 // DontUseExceptionStackTrace if (this.Diagnostics != null) { @@ -302,5 +308,16 @@ internal static void RecordOtelAttributes(CosmosException exception, DiagnosticS CosmosDbEventSource.RecordDiagnosticsForExceptions(exception.Diagnostics); } } + + /// + /// Creates a shallow copy of the current exception instance. + /// This ensures that the cloned exception retains the same properties but does not + /// excessively proliferate stack traces or deep-copy unnecessary objects. + /// + /// A shallow copy of the current . + public object Clone() + { + return this.MemberwiseClone(); + } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosExceptionFactory.cs b/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosExceptionFactory.cs index acbe9c564b..c8457d380e 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosExceptionFactory.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosExceptionFactory.cs @@ -32,8 +32,9 @@ internal static CosmosException Create( else { httpStatusCode = HttpStatusCode.InternalServerError; - } - + } + +#pragma warning disable CDX1002 // DontUseExceptionStackTrace return CosmosExceptionFactory.Create( httpStatusCode, dce.Message, @@ -41,7 +42,8 @@ internal static CosmosException Create( headers, trace, dce.Error, - dce.InnerException); + dce.InnerException); +#pragma warning restore CDX1002 // DontUseExceptionStackTrace } internal static CosmosException Create( @@ -77,8 +79,9 @@ internal static CosmosException Create( if (!string.IsNullOrEmpty(contentMessage)) { errorMessage = string.IsNullOrEmpty(errorMessage) ? contentMessage : $"Error Message: {errorMessage}; Content {contentMessage};"; - } - + } + +#pragma warning disable CDX1002 // DontUseExceptionStackTrace return CosmosExceptionFactory.Create( responseMessage.StatusCode, errorMessage, @@ -86,7 +89,8 @@ internal static CosmosException Create( responseMessage.Headers, responseMessage.Trace, error, - responseMessage.CosmosException?.InnerException); + responseMessage.CosmosException?.InnerException); +#pragma warning restore CDX1002 // DontUseExceptionStackTrace } internal static CosmosException Create( diff --git a/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosNullReferenceException.cs b/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosNullReferenceException.cs index cbee4c59ec..70632d5cf2 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosNullReferenceException.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosNullReferenceException.cs @@ -16,7 +16,7 @@ namespace Microsoft.Azure.Cosmos /// adds a way to access the CosmosDiagnostics and appends additional information /// to the message for easier troubleshooting. /// - internal class CosmosNullReferenceException : NullReferenceException + internal class CosmosNullReferenceException : NullReferenceException, ICloneable { private readonly NullReferenceException originalException; @@ -49,7 +49,9 @@ public override string Source public override string Message => this.originalException.Message + this.Diagnostics.ToString(); /// +#pragma warning disable CDX1002 // DontUseExceptionStackTrace public override string StackTrace => this.originalException.StackTrace; +#pragma warning restore CDX1002 // DontUseExceptionStackTrace /// public override IDictionary Data => this.originalException.Data; @@ -86,5 +88,16 @@ internal static void RecordOtelAttributes(CosmosNullReferenceException exception CosmosDbEventSource.RecordDiagnosticsForExceptions(exception.Diagnostics); } + + /// + /// Creates a shallow copy of the current exception instance. + /// This ensures that the cloned exception retains the same properties but does not + /// excessively proliferate stack traces or deep-copy unnecessary objects. + /// + /// A shallow copy of the current . + public object Clone() + { + return this.MemberwiseClone(); + } } } diff --git a/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosObjectDisposedException.cs b/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosObjectDisposedException.cs index c6f097355d..e32c3b758d 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosObjectDisposedException.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosObjectDisposedException.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.Cosmos /// adds a way to access the CosmosDiagnostics and appends additional information /// to the message for easier troubleshooting. /// - internal class CosmosObjectDisposedException : ObjectDisposedException + internal class CosmosObjectDisposedException : ObjectDisposedException, ICloneable { private readonly ObjectDisposedException originalException; private readonly CosmosClient cosmosClient; @@ -59,9 +59,6 @@ public override string Source /// public override string Message { get; } - /// - public override string StackTrace => this.originalException.StackTrace; - /// public override IDictionary Data => this.originalException.Data; @@ -86,7 +83,7 @@ public override Exception GetBaseException() /// public override string ToString() { - return $"{this.Message} {Environment.NewLine}CosmosDiagnostics: {this.Diagnostics} StackTrace: {this.StackTrace}"; + return $"{this.Message} {Environment.NewLine}CosmosDiagnostics: {this.Diagnostics}"; } /// @@ -102,5 +99,16 @@ internal static void RecordOtelAttributes(CosmosObjectDisposedException exceptio CosmosDbEventSource.RecordDiagnosticsForExceptions(exception.Diagnostics); } + + /// + /// Creates a shallow copy of the current exception instance. + /// This ensures that the cloned exception retains the same properties but does not + /// excessively proliferate stack traces or deep-copy unnecessary objects. + /// + /// A shallow copy of the current . + public object Clone() + { + return this.MemberwiseClone(); + } } } diff --git a/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosOperationCanceledException.cs b/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosOperationCanceledException.cs index 010d968bd0..4ed0ac8fb4 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosOperationCanceledException.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosOperationCanceledException.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.Cosmos /// diagnostics of the operation that was canceled. /// [Serializable] - public class CosmosOperationCanceledException : OperationCanceledException + public class CosmosOperationCanceledException : OperationCanceledException, ICloneable { private readonly OperationCanceledException originalException; private readonly Lazy lazyMessage; @@ -54,8 +54,10 @@ internal CosmosOperationCanceledException( } using (ITrace child = trace.StartChild("CosmosOperationCanceledException")) - { - child.AddDatum("Operation Cancelled Exception", originalException); + { +#pragma warning disable CDX1000 // DontConvertExceptionToObject + child.AddDatum("Operation Cancelled Exception", originalException); +#pragma warning restore CDX1000 // DontConvertExceptionToObject } this.Diagnostics = new CosmosTraceDiagnostics(trace); this.tokenCancellationRequested = originalException.CancellationToken.IsCancellationRequested; @@ -84,14 +86,16 @@ public override string Source { get => this.originalException.Source; set => this.originalException.Source = value; - } - - /// - public override string Message => this.lazyMessage.Value; - - /// - public override string StackTrace => this.originalException.StackTrace; - + } + + /// + public override string Message => this.lazyMessage.Value; + + /// +#pragma warning disable CDX1002 // DontUseExceptionStackTrace + public override string StackTrace => this.originalException.StackTrace; +#pragma warning restore CDX1002 // DontUseExceptionStackTrace + /// public override IDictionary Data => this.originalException.Data; @@ -150,11 +154,24 @@ internal static void RecordOtelAttributes(CosmosOperationCanceledException excep /// The StreamingContext that contains contextual information about the source or destination. public override void GetObjectData(SerializationInfo info, StreamingContext context) { - base.GetObjectData(info, context); - info.AddValue("originalException", this.originalException); + base.GetObjectData(info, context); +#pragma warning disable CDX1000 // DontConvertExceptionToObject + info.AddValue("originalException", this.originalException); +#pragma warning restore CDX1000 // DontConvertExceptionToObject info.AddValue("tokenCancellationRequested", this.tokenCancellationRequested); info.AddValue("lazyMessage", this.lazyMessage.Value); info.AddValue("toStringMessage", this.toStringMessage.Value); - } + } + + /// + /// Creates a shallow copy of the current exception instance. + /// This ensures that the cloned exception retains the same properties but does not + /// excessively proliferate stack traces or deep-copy unnecessary objects. + /// + /// A shallow copy of the current . + public object Clone() + { + return this.MemberwiseClone(); + } } } diff --git a/Microsoft.Azure.Cosmos/src/Resource/CosmosResponseFactoryCore.cs b/Microsoft.Azure.Cosmos/src/Resource/CosmosResponseFactoryCore.cs index 14d405ffc6..6667870655 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/CosmosResponseFactoryCore.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/CosmosResponseFactoryCore.cs @@ -6,6 +6,7 @@ namespace Microsoft.Azure.Cosmos { using System; using Microsoft.Azure.Cosmos.Scripts; + using Microsoft.Azure.Cosmos.Tracing.TraceData; internal sealed class CosmosResponseFactoryCore : CosmosResponseFactoryInternal { @@ -53,7 +54,7 @@ private FeedResponse CreateQueryFeedResponseHelper( { if (cosmosResponseMessage is QueryResponse queryResponse) { - using (cosmosResponseMessage.Trace.StartChild("Query Response Serialization")) + using (cosmosResponseMessage.Trace.StartChild(TraceDatumKeys.QueryResponseSerialization)) { return QueryResponse.CreateResponse( cosmosQueryResponse: queryResponse, @@ -61,7 +62,7 @@ private FeedResponse CreateQueryFeedResponseHelper( } } - using (cosmosResponseMessage.Trace.StartChild("Feed Response Serialization")) + using (cosmosResponseMessage.Trace.StartChild(TraceDatumKeys.FeedResponseSerialization)) { return ReadFeedResponse.CreateResponse( cosmosResponseMessage, @@ -73,7 +74,7 @@ private FeedResponse CreateQueryFeedResponseHelper( private FeedResponse CreateChangeFeedResponseHelper( ResponseMessage cosmosResponseMessage) { - using (cosmosResponseMessage.Trace.StartChild("ChangeFeed Response Serialization")) + using (cosmosResponseMessage.Trace.StartChild(TraceDatumKeys.ChangeFeedResponseSerialization)) { return ReadFeedResponse.CreateResponse( cosmosResponseMessage, diff --git a/Microsoft.Azure.Cosmos/src/Resource/Scripts/Scripts.cs b/Microsoft.Azure.Cosmos/src/Resource/Scripts/Scripts.cs index 6237329b26..178d362cae 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/Scripts/Scripts.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/Scripts/Scripts.cs @@ -16,6 +16,66 @@ namespace Microsoft.Azure.Cosmos.Scripts /// public abstract class Scripts { + /// + /// Creates a stored procedure as an asynchronous operation in the Azure Cosmos DB service. + /// + /// The Stored Procedure to create. + /// + /// + /// A containing a containing the created stored procedure + /// + /// This creates and executes a stored procedure that appends a string to the first item returned from the query. + /// + /// + /// + /// + public abstract Task CreateStoredProcedureStreamAsync( + StoredProcedureProperties storedProcedureProperties, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default); + /// /// Creates a stored procedure as an asynchronous operation in the Azure Cosmos DB service. /// @@ -214,6 +274,32 @@ public abstract FeedIterator GetStoredProcedureQueryStreamIterator( string continuationToken = null, QueryRequestOptions requestOptions = null); + /// + /// Reads a from the Azure Cosmos service as an asynchronous operation. + /// + /// + /// + /// + /// A containing a . + /// /// + /// This reads an existing stored procedure. + /// + /// + /// + /// + public abstract Task ReadStoredProcedureStreamAsync( + string id, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default); + /// /// Reads a from the Azure Cosmos service as an asynchronous operation. /// @@ -238,6 +324,38 @@ public abstract Task ReadStoredProcedureAsync( RequestOptions requestOptions = null, CancellationToken cancellationToken = default); + /// + /// Replaces a in the Azure Cosmos service as an asynchronous operation. + /// + /// The Stored Procedure to replace + /// + /// + /// A containing a . + /// /// + /// This examples replaces an existing stored procedure. + /// + /// + /// + /// + public abstract Task ReplaceStoredProcedureStreamAsync( + StoredProcedureProperties storedProcedureProperties, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default); + /// /// Replaces a in the Azure Cosmos service as an asynchronous operation. /// @@ -265,6 +383,11 @@ public abstract Task ReadStoredProcedureAsync( /// /// Scripts scripts = this.container.Scripts; /// StoredProcedureResponse response = await scripts.ReplaceStoredProcedureAsync(new StoredProcedureProperties("testTriggerId", body)); + /// if (!response.IsSuccessStatusCode) + /// { + /// //Handle and log exception + /// return; + /// } /// ]]> /// /// @@ -273,13 +396,34 @@ public abstract Task ReplaceStoredProcedureAsync( RequestOptions requestOptions = null, CancellationToken cancellationToken = default); + /// + /// Deletes a from the Azure Cosmos service as an asynchronous operation. + /// + /// + /// + /// + /// A containing a which will contain the response to the request issued. + /// + /// This examples gets a reference to an existing stored procedure and deletes it. + /// + /// + /// + /// + public abstract Task DeleteStoredProcedureStreamAsync( + string id, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default); + /// /// Delete a from the Azure Cosmos DB service as an asynchronous operation. /// /// The identifier of the Stored Procedure to delete. /// (Optional) The options for the stored procedure request. /// (Optional) representing request cancellation. - /// A containing a which will contain the response to the request issued. + /// A containing a which will contain the response to the request issued. /// https://aka.ms/cosmosdb-dot-net-exceptions /// /// This examples gets a reference to an existing stored procedure and deletes it. @@ -287,6 +431,11 @@ public abstract Task ReplaceStoredProcedureAsync( /// /// /// @@ -398,6 +547,11 @@ public abstract Task> ExecuteStoredProce /// sprocId, /// new PartitionKey(testPartitionId), /// new dynamic[] {"myPrefixString", "myPostfixString"}); + /// if (!sprocResponse.IsSuccessStatusCode) + /// { + /// //Handle and log exception + /// return; + /// } /// /// using (StreamReader sr = new StreamReader(sprocResponse.Content)) /// { @@ -482,6 +636,57 @@ public abstract Task ExecuteStoredProcedureStreamAsync( StoredProcedureRequestOptions requestOptions = null, CancellationToken cancellationToken = default); + /// + /// Creates a trigger as an asynchronous operation in the Azure Cosmos DB service. + /// + /// The object. + /// + /// + /// A task object representing the service response for the asynchronous operation. + /// + /// This creates a trigger then uses the trigger in a create item. + /// + /// () { "addTax" }, + /// }; + /// + /// // Create a new item with trigger set in the request options + /// ItemResponse createdItem = await this.container.Items.CreateItemAsync(item.status, item, options); + /// double itemTax = createdItem.Resource.tax; + /// ]]> + /// + /// + public abstract Task CreateTriggerStreamAsync( + TriggerProperties triggerProperties, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default); + /// /// Creates a trigger as an asynchronous operation in the Azure Cosmos DB service. /// @@ -660,6 +865,32 @@ public abstract FeedIterator GetTriggerQueryStreamIterator( string continuationToken = null, QueryRequestOptions requestOptions = null); + /// + /// Reads a from the Azure Cosmos service as an asynchronous operation. + /// + /// + /// + /// + /// A containing a containing the read resource record. + /// + /// This reads an existing trigger + /// + /// + /// + /// + public abstract Task ReadTriggerStreamAsync( + string id, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default); + /// /// Reads a from the Azure Cosmos service as an asynchronous operation. /// @@ -685,6 +916,48 @@ public abstract Task ReadTriggerAsync( RequestOptions requestOptions = null, CancellationToken cancellationToken = default); + /// + /// Replaces a in the Azure Cosmos service as an asynchronous operation. + /// + /// The object. + /// + /// + /// A containing a containing the updated resource record. + /// + /// This examples replaces an existing trigger. + /// + /// + /// + /// + public abstract Task ReplaceTriggerStreamAsync( + TriggerProperties triggerProperties, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default); + /// /// Replaces a in the Azure Cosmos service as an asynchronous operation. /// @@ -725,6 +998,32 @@ public abstract Task ReplaceTriggerAsync( RequestOptions requestOptions = null, CancellationToken cancellationToken = default); + /// + /// Delete a from the Azure Cosmos service as an asynchronous operation. + /// + /// + /// + /// + /// A containing a which will contain information about the request issued. + /// + /// This examples gets a reference to an existing trigger and deletes it. + /// + /// + /// + /// + public abstract Task DeleteTriggerStreamAsync( + string id, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default); + /// /// Delete a from the Azure Cosmos service as an asynchronous operation. /// @@ -747,6 +1046,56 @@ public abstract Task DeleteTriggerAsync( RequestOptions requestOptions = null, CancellationToken cancellationToken = default); + /// + /// Creates a user defined function as an asynchronous operation in the Azure Cosmos DB service. + /// + /// The object. + /// + /// + /// A task object representing the service response for the asynchronous operation. + /// + /// This creates a user defined function then uses the function in an item query. + /// + /// @expensive and t.status = @status") + /// .WithParameter("@expensive", 9000) + /// .WithParameter("@status", "Done"); + /// + /// using (FeedIterator setIterator = this.container.Items.GetItemsQueryIterator( + /// sqlQueryDefinition: sqlQuery, + /// partitionKey: "Done") + /// { + /// while (setIterator.HasMoreResults) + /// { + /// foreach (var tax in await setIterator.ReadNextAsync()) + /// { + /// Console.WriteLine(tax); + /// } + /// } + /// } + /// ]]> + /// + /// + public abstract Task CreateUserDefinedFunctionStreamAsync( + UserDefinedFunctionProperties userDefinedFunctionProperties, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default); + /// /// Creates a user defined function as an asynchronous operation in the Azure Cosmos DB service. /// @@ -938,6 +1287,32 @@ public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator( string continuationToken = null, QueryRequestOptions requestOptions = null); + /// + /// Reads a from the Azure Cosmos DB service as an asynchronous operation. + /// + /// + /// + /// + /// A containing a containing the read resource record. + /// + /// This reads an existing user defined function. + /// + /// + /// + /// + public abstract Task ReadUserDefinedFunctionStreamAsync( + string id, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default); + /// /// Reads a from the Azure Cosmos DB service as an asynchronous operation. /// @@ -963,6 +1338,38 @@ public abstract Task ReadUserDefinedFunctionAsync( RequestOptions requestOptions = null, CancellationToken cancellationToken = default); + /// + /// Replaces a in the Azure Cosmos DB service as an asynchronous operation. + /// + /// The object. + /// + /// + /// A containing a containing the updated resource record. + /// + /// This examples replaces an existing user defined function. + /// + /// + /// + /// + public abstract Task ReplaceUserDefinedFunctionStreamAsync( + UserDefinedFunctionProperties userDefinedFunctionProperties, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default); + /// /// Replaces a in the Azure Cosmos DB service as an asynchronous operation. /// @@ -993,6 +1400,32 @@ public abstract Task ReplaceUserDefinedFunctionAsyn RequestOptions requestOptions = null, CancellationToken cancellationToken = default); + /// + /// Delete a from the Azure Cosmos DB service as an asynchronous operation. + /// + /// + /// + /// + /// A containing a which will contain information about the request issued. + /// + /// This examples gets a reference to an existing user defined function and deletes it. + /// + /// + /// + /// + public abstract Task DeleteUserDefinedFunctionStreamAsync( + string id, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default); + /// /// Delete a from the Azure Cosmos DB service as an asynchronous operation. /// diff --git a/Microsoft.Azure.Cosmos/src/Resource/Scripts/ScriptsCore.cs b/Microsoft.Azure.Cosmos/src/Resource/Scripts/ScriptsCore.cs index 1ad57063a4..3dd7540d9b 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/Scripts/ScriptsCore.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/Scripts/ScriptsCore.cs @@ -5,11 +5,13 @@ namespace Microsoft.Azure.Cosmos.Scripts { using System; + using System.ClientModel.Primitives; using System.IO; using System.Threading; using System.Threading.Tasks; using Microsoft.Azure.Cosmos.Tracing; using Microsoft.Azure.Documents; + using RequestOptions = Microsoft.Azure.Cosmos.RequestOptions; internal abstract class ScriptsCore : Scripts { @@ -25,21 +27,36 @@ internal ScriptsCore( protected CosmosClientContext ClientContext { get; } - public Task CreateStoredProcedureAsync( + public Task CreateStoredProcedureStreamAsync( StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions, ITrace trace, CancellationToken cancellationToken) { - return this.ProcessScriptsCreateOperationAsync( + return this.ProcessStreamOperationAsync( resourceUri: this.container.LinkUri, resourceType: ResourceType.StoredProcedure, operationType: OperationType.Create, + requestOptions: requestOptions, + partitionKey: null, streamPayload: this.ClientContext.SerializerCore.ToStream(storedProcedureProperties), + trace: trace, + cancellationToken: cancellationToken); + } + + public async Task CreateStoredProcedureAsync( + StoredProcedureProperties storedProcedureProperties, + RequestOptions requestOptions, + ITrace trace, + CancellationToken cancellationToken) + { + ResponseMessage response = await this.CreateStoredProcedureStreamAsync( + storedProcedureProperties: storedProcedureProperties, requestOptions: requestOptions, - responseFunc: this.ClientContext.ResponseFactory.CreateStoredProcedureResponse, trace: trace, cancellationToken: cancellationToken); + + return this.ClientContext.ResponseFactory.CreateStoredProcedureResponse(response); } public override FeedIterator GetStoredProcedureQueryStreamIterator( @@ -111,7 +128,7 @@ public override FeedIterator GetStoredProcedureQueryIterator( resourceType: ResourceType.StoredProcedure)); } - public Task ReadStoredProcedureAsync( + public Task ReadStoredProcedureStreamAsync( string id, RequestOptions requestOptions, ITrace trace, @@ -122,31 +139,75 @@ public Task ReadStoredProcedureAsync( throw new ArgumentNullException(nameof(id)); } - return this.ProcessStoredProcedureOperationAsync( - id: id, + string linkUri = this.ClientContext.CreateLink( + parentLink: this.container.LinkUri, + uriPathSegment: Paths.StoredProceduresPathSegment, + id: id); + + return this.ProcessStreamOperationAsync( + resourceUri: linkUri, + resourceType: ResourceType.StoredProcedure, operationType: OperationType.Read, + requestOptions: requestOptions, + partitionKey: null, streamPayload: null, + trace: trace, + cancellationToken: cancellationToken); + } + + public async Task ReadStoredProcedureAsync( + string id, + RequestOptions requestOptions, + ITrace trace, + CancellationToken cancellationToken) + { + ResponseMessage response = await this.ReadStoredProcedureStreamAsync( + id: id, requestOptions: requestOptions, trace: trace, cancellationToken: cancellationToken); + + return this.ClientContext.ResponseFactory.CreateStoredProcedureResponse(response); } - public Task ReplaceStoredProcedureAsync( + public Task ReplaceStoredProcedureStreamAsync( StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions, ITrace trace, CancellationToken cancellationToken) { - return this.ProcessStoredProcedureOperationAsync( - id: storedProcedureProperties.Id, + string linkUri = this.ClientContext.CreateLink( + parentLink: this.container.LinkUri, + uriPathSegment: Paths.StoredProceduresPathSegment, + id: storedProcedureProperties.Id); + + return this.ProcessStreamOperationAsync( + resourceUri: linkUri, + resourceType: ResourceType.StoredProcedure, operationType: OperationType.Replace, + requestOptions: requestOptions, + partitionKey: null, streamPayload: this.ClientContext.SerializerCore.ToStream(storedProcedureProperties), + trace: trace, + cancellationToken: cancellationToken); + } + + public async Task ReplaceStoredProcedureAsync( + StoredProcedureProperties storedProcedureProperties, + RequestOptions requestOptions, + ITrace trace, + CancellationToken cancellationToken) + { + ResponseMessage response = await this.ReplaceStoredProcedureStreamAsync( + storedProcedureProperties: storedProcedureProperties, requestOptions: requestOptions, trace: trace, cancellationToken: cancellationToken); + + return this.ClientContext.ResponseFactory.CreateStoredProcedureResponse(response); } - public Task DeleteStoredProcedureAsync( + public Task DeleteStoredProcedureStreamAsync( string id, RequestOptions requestOptions, ITrace trace, @@ -157,13 +218,35 @@ public Task DeleteStoredProcedureAsync( throw new ArgumentNullException(nameof(id)); } - return this.ProcessStoredProcedureOperationAsync( - id: id, + string linkUri = this.ClientContext.CreateLink( + parentLink: this.container.LinkUri, + uriPathSegment: Paths.StoredProceduresPathSegment, + id: id); + + return this.ProcessStreamOperationAsync( + resourceUri: linkUri, + resourceType: ResourceType.StoredProcedure, operationType: OperationType.Delete, + requestOptions: requestOptions, + partitionKey: null, streamPayload: null, + trace: trace, + cancellationToken: cancellationToken); + } + + public async Task DeleteStoredProcedureAsync( + string id, + RequestOptions requestOptions, + ITrace trace, + CancellationToken cancellationToken) + { + ResponseMessage response = await this.DeleteStoredProcedureStreamAsync( + id: id, requestOptions: requestOptions, trace: trace, cancellationToken: cancellationToken); + + return this.ClientContext.ResponseFactory.CreateStoredProcedureResponse(response); } public async Task> ExecuteStoredProcedureAsync( @@ -239,7 +322,7 @@ public Task ExecuteStoredProcedureStreamAsync( cancellationToken: cancellationToken); } - public Task CreateTriggerAsync( + public Task CreateTriggerStreamAsync( TriggerProperties triggerProperties, RequestOptions requestOptions, ITrace trace, @@ -260,15 +343,30 @@ public Task CreateTriggerAsync( throw new ArgumentNullException(nameof(triggerProperties.Body)); } - return this.ProcessScriptsCreateOperationAsync( + return this.ProcessStreamOperationAsync( resourceUri: this.container.LinkUri, resourceType: ResourceType.Trigger, operationType: OperationType.Create, + requestOptions: requestOptions, + partitionKey: null, streamPayload: this.ClientContext.SerializerCore.ToStream(triggerProperties), + trace: trace, + cancellationToken: cancellationToken); + } + + public async Task CreateTriggerAsync( + TriggerProperties triggerProperties, + RequestOptions requestOptions, + ITrace trace, + CancellationToken cancellationToken) + { + ResponseMessage response = await this.CreateTriggerStreamAsync( + triggerProperties: triggerProperties, requestOptions: requestOptions, - responseFunc: this.ClientContext.ResponseFactory.CreateTriggerResponse, trace: trace, cancellationToken: cancellationToken); + + return this.ClientContext.ResponseFactory.CreateTriggerResponse(response); } public override FeedIterator GetTriggerQueryStreamIterator( @@ -340,7 +438,7 @@ public override FeedIterator GetTriggerQueryIterator( resourceType: ResourceType.Trigger)); } - public Task ReadTriggerAsync( + public Task ReadTriggerStreamAsync( string id, RequestOptions requestOptions, ITrace trace, @@ -351,16 +449,38 @@ public Task ReadTriggerAsync( throw new ArgumentNullException(nameof(id)); } - return this.ProcessTriggerOperationAsync( - id: id, + string linkUri = this.ClientContext.CreateLink( + parentLink: this.container.LinkUri, + uriPathSegment: Paths.TriggersPathSegment, + id: id); + + return this.ProcessStreamOperationAsync( + resourceUri: linkUri, + resourceType: ResourceType.Trigger, operationType: OperationType.Read, + requestOptions: requestOptions, + partitionKey: null, streamPayload: null, + trace: trace, + cancellationToken: cancellationToken); + } + + public async Task ReadTriggerAsync( + string id, + RequestOptions requestOptions, + ITrace trace, + CancellationToken cancellationToken) + { + ResponseMessage response = await this.ReadTriggerStreamAsync( + id: id, requestOptions: requestOptions, trace: trace, cancellationToken: cancellationToken); + + return this.ClientContext.ResponseFactory.CreateTriggerResponse(response); } - public Task ReplaceTriggerAsync( + public Task ReplaceTriggerStreamAsync( TriggerProperties triggerProperties, RequestOptions requestOptions, ITrace trace, @@ -381,16 +501,38 @@ public Task ReplaceTriggerAsync( throw new ArgumentNullException(nameof(triggerProperties.Body)); } - return this.ProcessTriggerOperationAsync( - id: triggerProperties.Id, + string linkUri = this.ClientContext.CreateLink( + parentLink: this.container.LinkUri, + uriPathSegment: Paths.TriggersPathSegment, + id: triggerProperties.Id); + + return this.ProcessStreamOperationAsync( + resourceUri: linkUri, + resourceType: ResourceType.Trigger, operationType: OperationType.Replace, + requestOptions: requestOptions, + partitionKey: null, streamPayload: this.ClientContext.SerializerCore.ToStream(triggerProperties), + trace: trace, + cancellationToken: cancellationToken); + } + + public async Task ReplaceTriggerAsync( + TriggerProperties triggerProperties, + RequestOptions requestOptions, + ITrace trace, + CancellationToken cancellationToken) + { + ResponseMessage response = await this.ReplaceTriggerStreamAsync( + triggerProperties: triggerProperties, requestOptions: requestOptions, trace: trace, cancellationToken: cancellationToken); + + return this.ClientContext.ResponseFactory.CreateTriggerResponse(response); } - public Task DeleteTriggerAsync( + public Task DeleteTriggerStreamAsync( string id, RequestOptions requestOptions, ITrace trace, @@ -400,17 +542,38 @@ public Task DeleteTriggerAsync( { throw new ArgumentNullException(nameof(id)); } + string linkUri = this.ClientContext.CreateLink( + parentLink: this.container.LinkUri, + uriPathSegment: Paths.TriggersPathSegment, + id: id); - return this.ProcessTriggerOperationAsync( - id: id, + return this.ProcessStreamOperationAsync( + resourceUri: linkUri, + resourceType: ResourceType.Trigger, operationType: OperationType.Delete, + requestOptions: requestOptions, + partitionKey: null, streamPayload: null, + trace: trace, + cancellationToken: cancellationToken); + } + + public async Task DeleteTriggerAsync( + string id, + RequestOptions requestOptions, + ITrace trace, + CancellationToken cancellationToken) + { + ResponseMessage response = await this.DeleteTriggerStreamAsync( + id: id, requestOptions: requestOptions, trace: trace, cancellationToken: cancellationToken); + + return this.ClientContext.ResponseFactory.CreateTriggerResponse(response); } - public Task CreateUserDefinedFunctionAsync( + public Task CreateUserDefinedFunctionStreamAsync( UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions, ITrace trace, @@ -431,15 +594,30 @@ public Task CreateUserDefinedFunctionAsync( throw new ArgumentNullException(nameof(userDefinedFunctionProperties.Body)); } - return this.ProcessScriptsCreateOperationAsync( + return this.ProcessStreamOperationAsync( resourceUri: this.container.LinkUri, resourceType: ResourceType.UserDefinedFunction, operationType: OperationType.Create, + requestOptions: requestOptions, + partitionKey: null, streamPayload: this.ClientContext.SerializerCore.ToStream(userDefinedFunctionProperties), + trace: trace, + cancellationToken: cancellationToken); + } + + public async Task CreateUserDefinedFunctionAsync( + UserDefinedFunctionProperties userDefinedFunctionProperties, + RequestOptions requestOptions, + ITrace trace, + CancellationToken cancellationToken) + { + ResponseMessage response = await this.CreateUserDefinedFunctionStreamAsync( + userDefinedFunctionProperties: userDefinedFunctionProperties, requestOptions: requestOptions, - responseFunc: this.ClientContext.ResponseFactory.CreateUserDefinedFunctionResponse, trace: trace, cancellationToken: cancellationToken); + + return this.ClientContext.ResponseFactory.CreateUserDefinedFunctionResponse(response); } public override FeedIterator GetUserDefinedFunctionQueryStreamIterator( @@ -511,7 +689,7 @@ public override FeedIterator GetUserDefinedFunctionQueryIterator( resourceType: ResourceType.UserDefinedFunction)); } - public Task ReadUserDefinedFunctionAsync( + public Task ReadUserDefinedFunctionStreamAsync( string id, RequestOptions requestOptions, ITrace trace, @@ -522,16 +700,38 @@ public Task ReadUserDefinedFunctionAsync( throw new ArgumentNullException(nameof(id)); } - return this.ProcessUserDefinedFunctionOperationAsync( - id: id, + string linkUri = this.ClientContext.CreateLink( + parentLink: this.container.LinkUri, + uriPathSegment: Paths.UserDefinedFunctionsPathSegment, + id: id); + + return this.ProcessStreamOperationAsync( + resourceUri: linkUri, + resourceType: ResourceType.UserDefinedFunction, operationType: OperationType.Read, + requestOptions: requestOptions, + partitionKey: null, streamPayload: null, + trace: trace, + cancellationToken: cancellationToken); + } + + public async Task ReadUserDefinedFunctionAsync( + string id, + RequestOptions requestOptions, + ITrace trace, + CancellationToken cancellationToken) + { + ResponseMessage response = await this.ReadUserDefinedFunctionStreamAsync( + id: id, requestOptions: requestOptions, trace: trace, cancellationToken: cancellationToken); + + return this.ClientContext.ResponseFactory.CreateUserDefinedFunctionResponse(response); } - public Task ReplaceUserDefinedFunctionAsync( + public Task ReplaceUserDefinedFunctionStreamAsync( UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions, ITrace trace, @@ -552,16 +752,38 @@ public Task ReplaceUserDefinedFunctionAsync( throw new ArgumentNullException(nameof(userDefinedFunctionProperties.Body)); } - return this.ProcessUserDefinedFunctionOperationAsync( - id: userDefinedFunctionProperties.Id, - operationType: OperationType.Replace, - streamPayload: this.ClientContext.SerializerCore.ToStream(userDefinedFunctionProperties), + string linkUri = this.ClientContext.CreateLink( + parentLink: this.container.LinkUri, + uriPathSegment: Paths.UserDefinedFunctionsPathSegment, + id: userDefinedFunctionProperties.Id); + + return this.ProcessStreamOperationAsync( + resourceUri: linkUri, + resourceType: ResourceType.UserDefinedFunction, + operationType: OperationType.Replace, + requestOptions: requestOptions, + partitionKey: null, + streamPayload: this.ClientContext.SerializerCore.ToStream(userDefinedFunctionProperties), + trace: trace, + cancellationToken: cancellationToken); + } + + public async Task ReplaceUserDefinedFunctionAsync( + UserDefinedFunctionProperties userDefinedFunctionProperties, + RequestOptions requestOptions, + ITrace trace, + CancellationToken cancellationToken) + { + ResponseMessage response = await this.ReplaceUserDefinedFunctionStreamAsync( + userDefinedFunctionProperties: userDefinedFunctionProperties, requestOptions: requestOptions, trace: trace, cancellationToken: cancellationToken); + + return this.ClientContext.ResponseFactory.CreateUserDefinedFunctionResponse(response); } - public Task DeleteUserDefinedFunctionAsync( + public Task DeleteUserDefinedFunctionStreamAsync( string id, RequestOptions requestOptions, ITrace trace, @@ -572,42 +794,38 @@ public Task DeleteUserDefinedFunctionAsync( throw new ArgumentNullException(nameof(id)); } - return this.ProcessUserDefinedFunctionOperationAsync( - id: id, + string linkUri = this.ClientContext.CreateLink( + parentLink: this.container.LinkUri, + uriPathSegment: Paths.UserDefinedFunctionsPathSegment, + id: id); + + return this.ProcessStreamOperationAsync( + resourceUri: linkUri, + resourceType: ResourceType.UserDefinedFunction, operationType: OperationType.Delete, - streamPayload: null, requestOptions: requestOptions, + partitionKey: null, + streamPayload: null, trace: trace, cancellationToken: cancellationToken); } - private async Task ProcessStoredProcedureOperationAsync( + public async Task DeleteUserDefinedFunctionAsync( string id, - OperationType operationType, - Stream streamPayload, RequestOptions requestOptions, ITrace trace, CancellationToken cancellationToken) { - string linkUri = this.ClientContext.CreateLink( - parentLink: this.container.LinkUri, - uriPathSegment: Paths.StoredProceduresPathSegment, - id: id); - - ResponseMessage response = await this.ProcessStreamOperationAsync( - resourceUri: linkUri, - resourceType: ResourceType.StoredProcedure, - operationType: operationType, + ResponseMessage response = await this.DeleteUserDefinedFunctionStreamAsync( + id: id, requestOptions: requestOptions, - partitionKey: null, - streamPayload: streamPayload, trace: trace, cancellationToken: cancellationToken); - return this.ClientContext.ResponseFactory.CreateStoredProcedureResponse(response); + return this.ClientContext.ResponseFactory.CreateUserDefinedFunctionResponse(response); } - private async Task ProcessTriggerOperationAsync( + private async Task ProcessStoredProcedureOperationAsync( string id, OperationType operationType, Stream streamPayload, @@ -617,12 +835,12 @@ private async Task ProcessTriggerOperationAsync( { string linkUri = this.ClientContext.CreateLink( parentLink: this.container.LinkUri, - uriPathSegment: Paths.TriggersPathSegment, + uriPathSegment: Paths.StoredProceduresPathSegment, id: id); ResponseMessage response = await this.ProcessStreamOperationAsync( resourceUri: linkUri, - resourceType: ResourceType.Trigger, + resourceType: ResourceType.StoredProcedure, operationType: operationType, requestOptions: requestOptions, partitionKey: null, @@ -630,7 +848,7 @@ private async Task ProcessTriggerOperationAsync( trace: trace, cancellationToken: cancellationToken); - return this.ClientContext.ResponseFactory.CreateTriggerResponse(response); + return this.ClientContext.ResponseFactory.CreateStoredProcedureResponse(response); } private Task ProcessStreamOperationAsync( @@ -655,54 +873,5 @@ private Task ProcessStreamOperationAsync( trace: trace, cancellationToken: cancellationToken); } - - private async Task ProcessScriptsCreateOperationAsync( - string resourceUri, - ResourceType resourceType, - OperationType operationType, - Stream streamPayload, - RequestOptions requestOptions, - Func responseFunc, - ITrace trace, - CancellationToken cancellationToken) - { - ResponseMessage response = await this.ProcessStreamOperationAsync( - resourceUri: resourceUri, - resourceType: resourceType, - operationType: operationType, - requestOptions: requestOptions, - partitionKey: null, - streamPayload: streamPayload, - trace: trace, - cancellationToken: cancellationToken); - - return responseFunc(response); - } - - private async Task ProcessUserDefinedFunctionOperationAsync( - string id, - OperationType operationType, - Stream streamPayload, - RequestOptions requestOptions, - ITrace trace, - CancellationToken cancellationToken) - { - string linkUri = this.ClientContext.CreateLink( - parentLink: this.container.LinkUri, - uriPathSegment: Paths.UserDefinedFunctionsPathSegment, - id: id); - - ResponseMessage response = await this.ProcessStreamOperationAsync( - resourceUri: linkUri, - resourceType: ResourceType.UserDefinedFunction, - operationType: operationType, - requestOptions: requestOptions, - partitionKey: null, - streamPayload: streamPayload, - trace: trace, - cancellationToken: cancellationToken); - - return this.ClientContext.ResponseFactory.CreateUserDefinedFunctionResponse(response); - } } } diff --git a/Microsoft.Azure.Cosmos/src/Resource/Scripts/ScriptsInlineCore.cs b/Microsoft.Azure.Cosmos/src/Resource/Scripts/ScriptsInlineCore.cs index bea3309b7f..e29ebbc8ba 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/Scripts/ScriptsInlineCore.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/Scripts/ScriptsInlineCore.cs @@ -8,7 +8,6 @@ namespace Microsoft.Azure.Cosmos.Scripts using System.Threading; using System.Threading.Tasks; using Microsoft.Azure.Cosmos.Telemetry.OpenTelemetry; - using Microsoft.Azure.Cosmos.Tracing; // This class acts as a wrapper for environments that use SynchronizationContext. internal sealed class ScriptsInlineCore : ScriptsCore @@ -22,6 +21,25 @@ internal ScriptsInlineCore( { } + public override Task CreateStoredProcedureStreamAsync( + StoredProcedureProperties storedProcedureProperties, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default) + { + return this.ClientContext.OperationHelperAsync( + operationName: nameof(CreateStoredProcedureStreamAsync), + containerName: this.container.Id, + databaseName: this.container.Database.Id, + operationType: Documents.OperationType.Create, + requestOptions: requestOptions, + task: (trace) => base.CreateStoredProcedureStreamAsync( + storedProcedureProperties, + requestOptions, + trace, + cancellationToken), + openTelemetry: new (OpenTelemetryConstants.Operations.CreateStoredProcedure, (response) => new OpenTelemetryResponse(response))); + } + public override Task CreateStoredProcedureAsync( StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions = null, @@ -85,6 +103,25 @@ public override FeedIterator GetStoredProcedureQueryStreamIterator( this.ClientContext); } + public override Task ReadStoredProcedureStreamAsync( + string id, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default) + { + return this.ClientContext.OperationHelperAsync( + operationName: nameof(ReadStoredProcedureStreamAsync), + containerName: this.container.Id, + databaseName: this.container.Database.Id, + operationType: Documents.OperationType.Read, + requestOptions: requestOptions, + task: (trace) => base.ReadStoredProcedureStreamAsync( + id, + requestOptions, + trace, + cancellationToken), + openTelemetry: new (OpenTelemetryConstants.Operations.ReadStoredProcedure, (response) => new OpenTelemetryResponse(response))); + } + public override Task ReadStoredProcedureAsync( string id, RequestOptions requestOptions = null, @@ -100,6 +137,25 @@ public override Task ReadStoredProcedureAsync( openTelemetry: new (OpenTelemetryConstants.Operations.ReadStoredProcedure, (response) => new OpenTelemetryResponse(response))); } + public override Task ReplaceStoredProcedureStreamAsync( + StoredProcedureProperties storedProcedureProperties, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default) + { + return this.ClientContext.OperationHelperAsync( + operationName: nameof(ReplaceStoredProcedureStreamAsync), + containerName: this.container.Id, + databaseName: this.container.Database.Id, + operationType: Documents.OperationType.Replace, + requestOptions: requestOptions, + task: (trace) => base.ReplaceStoredProcedureStreamAsync( + storedProcedureProperties, + requestOptions, + trace, + cancellationToken), + openTelemetry: new (OpenTelemetryConstants.Operations.ReplaceStoredProcedure, (response) => new OpenTelemetryResponse(response))); + } + public override Task ReplaceStoredProcedureAsync( StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions = null, @@ -115,6 +171,25 @@ public override Task ReplaceStoredProcedureAsync( openTelemetry: new (OpenTelemetryConstants.Operations.ReplaceStoredProcedure, (response) => new OpenTelemetryResponse(response))); } + public override Task DeleteStoredProcedureStreamAsync( + string id, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default) + { + return this.ClientContext.OperationHelperAsync( + operationName: nameof(DeleteStoredProcedureStreamAsync), + containerName: this.container.Id, + databaseName: this.container.Database.Id, + operationType: Documents.OperationType.Delete, + requestOptions: requestOptions, + task: (trace) => base.DeleteStoredProcedureStreamAsync( + id, + requestOptions, + trace, + cancellationToken), + openTelemetry: new (OpenTelemetryConstants.Operations.DeleteStoreProcedure, (response) => new OpenTelemetryResponse(response))); + } + public override Task DeleteStoredProcedureAsync( string id, RequestOptions requestOptions = null, @@ -181,6 +256,25 @@ public override Task ExecuteStoredProcedureStreamAsync( openTelemetry: new (OpenTelemetryConstants.Operations.ExecuteStoredProcedure, (response) => new OpenTelemetryResponse(response))); } + public override Task CreateTriggerStreamAsync( + TriggerProperties triggerProperties, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default) + { + return this.ClientContext.OperationHelperAsync( + operationName: nameof(CreateTriggerStreamAsync), + containerName: this.container.Id, + databaseName: this.container.Database.Id, + operationType: Documents.OperationType.Create, + requestOptions: requestOptions, + task: (trace) => base.CreateTriggerStreamAsync( + triggerProperties, + requestOptions, + trace, + cancellationToken), + openTelemetry: new (OpenTelemetryConstants.Operations.CreateTrigger, (response) => new OpenTelemetryResponse(response))); + } + public override Task CreateTriggerAsync( TriggerProperties triggerProperties, RequestOptions requestOptions = null, @@ -244,6 +338,25 @@ public override FeedIterator GetTriggerQueryStreamIterator( this.ClientContext); } + public override Task ReadTriggerStreamAsync( + string id, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default) + { + return this.ClientContext.OperationHelperAsync( + operationName: nameof(ReadTriggerStreamAsync), + containerName: this.container.Id, + databaseName: this.container.Database.Id, + operationType: Documents.OperationType.Read, + requestOptions: requestOptions, + task: (trace) => base.ReadTriggerStreamAsync( + id, + requestOptions, + trace, + cancellationToken), + openTelemetry: new (OpenTelemetryConstants.Operations.ReadTrigger, (response) => new OpenTelemetryResponse(response))); + } + public override Task ReadTriggerAsync( string id, RequestOptions requestOptions = null, @@ -259,6 +372,25 @@ public override Task ReadTriggerAsync( openTelemetry: new (OpenTelemetryConstants.Operations.ReadTrigger, (response) => new OpenTelemetryResponse(response))); } + public override Task ReplaceTriggerStreamAsync( + TriggerProperties triggerProperties, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default) + { + return this.ClientContext.OperationHelperAsync( + operationName: nameof(ReplaceTriggerStreamAsync), + containerName: this.container.Id, + databaseName: this.container.Database.Id, + operationType: Documents.OperationType.Replace, + requestOptions: requestOptions, + task: (trace) => base.ReplaceTriggerStreamAsync( + triggerProperties, + requestOptions, + trace, + cancellationToken), + openTelemetry: new (OpenTelemetryConstants.Operations.ReplaceTrigger, (response) => new OpenTelemetryResponse(response))); + } + public override Task ReplaceTriggerAsync( TriggerProperties triggerProperties, RequestOptions requestOptions = null, @@ -274,6 +406,25 @@ public override Task ReplaceTriggerAsync( openTelemetry: new (OpenTelemetryConstants.Operations.ReplaceTrigger, (response) => new OpenTelemetryResponse(response))); } + public override Task DeleteTriggerStreamAsync( + string id, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default) + { + return this.ClientContext.OperationHelperAsync( + operationName: nameof(DeleteTriggerStreamAsync), + containerName: this.container.Id, + databaseName: this.container.Database.Id, + operationType: Documents.OperationType.Delete, + requestOptions: requestOptions, + task: (trace) => base.DeleteTriggerStreamAsync( + id, + requestOptions, + trace, + cancellationToken), + openTelemetry: new (OpenTelemetryConstants.Operations.DeleteTrigger, (response) => new OpenTelemetryResponse(response))); + } + public override Task DeleteTriggerAsync( string id, RequestOptions requestOptions = null, @@ -289,6 +440,25 @@ public override Task DeleteTriggerAsync( openTelemetry: new (OpenTelemetryConstants.Operations.DeleteTrigger, (response) => new OpenTelemetryResponse(response))); } + public override Task CreateUserDefinedFunctionStreamAsync( + UserDefinedFunctionProperties userDefinedFunctionProperties, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default) + { + return this.ClientContext.OperationHelperAsync( + operationName: nameof(CreateUserDefinedFunctionStreamAsync), + containerName: this.container.Id, + databaseName: this.container.Database.Id, + operationType: Documents.OperationType.Create, + requestOptions: requestOptions, + task: (trace) => base.CreateUserDefinedFunctionStreamAsync( + userDefinedFunctionProperties, + requestOptions, + trace, + cancellationToken), + openTelemetry: new (OpenTelemetryConstants.Operations.CreateUserDefinedFunction, (response) => new OpenTelemetryResponse(response))); + } + public override Task CreateUserDefinedFunctionAsync( UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions = null, @@ -352,6 +522,25 @@ public override FeedIterator GetUserDefinedFunctionQueryStreamIterator( this.ClientContext); } + public override Task ReadUserDefinedFunctionStreamAsync( + string id, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default) + { + return this.ClientContext.OperationHelperAsync( + operationName: nameof(ReadUserDefinedFunctionStreamAsync), + containerName: this.container.Id, + databaseName: this.container.Database.Id, + operationType: Documents.OperationType.Read, + requestOptions: requestOptions, + task: (trace) => base.ReadUserDefinedFunctionStreamAsync( + id, + requestOptions, + trace, + cancellationToken), + openTelemetry: new (OpenTelemetryConstants.Operations.ReadUserDefinedFunction, (response) => new OpenTelemetryResponse(response))); + } + public override Task ReadUserDefinedFunctionAsync( string id, RequestOptions requestOptions = null, @@ -367,6 +556,25 @@ public override Task ReadUserDefinedFunctionAsync( openTelemetry: new (OpenTelemetryConstants.Operations.ReadUserDefinedFunction, (response) => new OpenTelemetryResponse(response))); } + public override Task ReplaceUserDefinedFunctionStreamAsync( + UserDefinedFunctionProperties userDefinedFunctionProperties, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default) + { + return this.ClientContext.OperationHelperAsync( + operationName: nameof(ReplaceUserDefinedFunctionStreamAsync), + containerName: this.container.Id, + databaseName: this.container.Database.Id, + operationType: Documents.OperationType.Replace, + requestOptions: requestOptions, + task: (trace) => base.ReplaceUserDefinedFunctionStreamAsync( + userDefinedFunctionProperties, + requestOptions, + trace, + cancellationToken), + openTelemetry: new (OpenTelemetryConstants.Operations.ReplaceUserDefinedFunctions, (response) => new OpenTelemetryResponse(response))); + } + public override Task ReplaceUserDefinedFunctionAsync( UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions = null, @@ -382,6 +590,25 @@ public override Task ReplaceUserDefinedFunctionAsyn openTelemetry: new (OpenTelemetryConstants.Operations.ReplaceUserDefinedFunctions, (response) => new OpenTelemetryResponse(response))); } + public override Task DeleteUserDefinedFunctionStreamAsync( + string id, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default) + { + return this.ClientContext.OperationHelperAsync( + operationName: nameof(DeleteUserDefinedFunctionStreamAsync), + containerName: this.container.Id, + databaseName: this.container.Database.Id, + operationType: Documents.OperationType.Delete, + requestOptions: requestOptions, + task: (trace) => base.DeleteUserDefinedFunctionStreamAsync( + id, + requestOptions, + trace, + cancellationToken), + openTelemetry: new (OpenTelemetryConstants.Operations.DeleteUserDefinedFunctions, (response) => new OpenTelemetryResponse(response))); + } + public override Task DeleteUserDefinedFunctionAsync( string id, RequestOptions requestOptions = null, diff --git a/Microsoft.Azure.Cosmos/src/Resource/Settings/AccountProperties.cs b/Microsoft.Azure.Cosmos/src/Resource/Settings/AccountProperties.cs index ae3d35fae2..9157964b9e 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/Settings/AccountProperties.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/Settings/AccountProperties.cs @@ -28,6 +28,9 @@ public class AccountProperties /// internal AccountProperties() { + this.ThinClientWritableLocationsInternal = new Collection(); + this.ThinClientReadableLocationsInternal = new Collection(); + this.QueryEngineConfigurationInternal = new Lazy>(() => this.QueryStringToDictConverter()); } @@ -127,6 +130,18 @@ internal Collection ReadLocationsInternal set => this.readRegions = value; } + /// + /// Gets or sets the set of ThinClient writable locations parsed from AdditionalProperties. + /// + [JsonIgnore] + internal Collection ThinClientWritableLocationsInternal { get; set; } + + /// + /// Gets or sets the set of ThinClient readable locations parsed from AdditionalProperties. + /// + [JsonIgnore] + internal Collection ThinClientReadableLocationsInternal { get; set; } + /// /// Gets the storage quota for media storage in the databaseAccount from the Azure Cosmos DB service. /// @@ -229,6 +244,12 @@ internal long ProvisionedDocumentStorageInMB [JsonProperty(PropertyName = Constants.Properties.EnableMultipleWriteLocations)] internal bool EnableMultipleWriteLocations { get; set; } + /// + /// Gets the featured enabled value for Per Partition Automatic Failover + /// + [JsonProperty(PropertyName = Constants.Properties.EnablePerPartitionFailoverBehavior)] + internal bool? EnablePartitionLevelFailover { get; set; } + private IDictionary QueryStringToDictConverter() { if (!string.IsNullOrEmpty(this.QueryEngineConfigurationString)) @@ -246,6 +267,7 @@ private IDictionary QueryStringToDictConverter() /// This ensures that if resource is read and updated none of the fields will be lost in the process. /// [JsonExtensionData] - internal IDictionary AdditionalProperties { get; private set; } + internal IDictionary AdditionalProperties { get; set; } + } } diff --git a/Microsoft.Azure.Cosmos/src/Resource/Settings/ContainerProperties.cs b/Microsoft.Azure.Cosmos/src/Resource/Settings/ContainerProperties.cs index 32f0dd7732..8879993b4a 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/Settings/ContainerProperties.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/Settings/ContainerProperties.cs @@ -366,12 +366,7 @@ public Collection ComputedProperties /// /// [JsonIgnore] -#if PREVIEW - public -#else - internal -#endif - FullTextPolicy FullTextPolicy + public FullTextPolicy FullTextPolicy { get => this.fullTextPolicyInternal; set => this.fullTextPolicyInternal = value; @@ -426,7 +421,12 @@ public GeospatialConfig GeospatialConfig /// /// JSON path used for containers partitioning + /// + /// For hierarchical partition keys, please use /// + /// + /// Throws NotImplementedException for hierarchical partition keys + /// [JsonIgnore] public string PartitionKeyPath { diff --git a/Microsoft.Azure.Cosmos/src/Resource/Settings/FullTextIndexPath.cs b/Microsoft.Azure.Cosmos/src/Resource/Settings/FullTextIndexPath.cs index f79855c2bf..e5fa6119f9 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/Settings/FullTextIndexPath.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/Settings/FullTextIndexPath.cs @@ -38,12 +38,7 @@ namespace Microsoft.Azure.Cosmos /// } /// ]]> /// -#if PREVIEW - public -#else - internal -#endif - sealed class FullTextIndexPath + public sealed class FullTextIndexPath { /// /// Gets or sets the full path in a document used for full text indexing. diff --git a/Microsoft.Azure.Cosmos/src/Resource/Settings/FullTextPath.cs b/Microsoft.Azure.Cosmos/src/Resource/Settings/FullTextPath.cs index d191b3072b..d75dbab347 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/Settings/FullTextPath.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/Settings/FullTextPath.cs @@ -31,12 +31,7 @@ namespace Microsoft.Azure.Cosmos /// } /// ]]> /// -#if PREVIEW - public -#else - internal -#endif - sealed class FullTextPath : IEquatable + public class FullTextPath : IEquatable { /// /// Gets or sets a string containing the path of the full text index. @@ -47,7 +42,7 @@ sealed class FullTextPath : IEquatable /// /// Gets or sets a string containing the language of the full text path. /// - [JsonProperty(PropertyName = "language")] + [JsonProperty(PropertyName = "language", NullValueHandling = NullValueHandling.Ignore)] public string Language { get; set; } /// @@ -67,11 +62,6 @@ public void ValidateFullTextPath() throw new ArgumentException("Argument {0} can't be null or empty.", nameof(this.Path)); } - if (string.IsNullOrEmpty(this.Language)) - { - throw new ArgumentException("Argument {0} can't be null or empty.", nameof(this.Language)); - } - if (this.Path[0] != '/') { throw new ArgumentException("The argument {0} is not a valid path.", this.Path); diff --git a/Microsoft.Azure.Cosmos/src/Resource/Settings/FullTextPolicy.cs b/Microsoft.Azure.Cosmos/src/Resource/Settings/FullTextPolicy.cs index 147dc7f752..52fa2fe593 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/Settings/FullTextPolicy.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/Settings/FullTextPolicy.cs @@ -12,12 +12,7 @@ namespace Microsoft.Azure.Cosmos /// Represents the full text policy configuration for specifying the full text paths on items in the container in the Azure Cosmos DB service. /// /// -#if PREVIEW - public -#else - internal -#endif - sealed class FullTextPolicy + public sealed class FullTextPolicy { [JsonProperty(PropertyName = "fullTextPaths", NullValueHandling = NullValueHandling.Ignore)] private Collection fullTextPathsInternal; diff --git a/Microsoft.Azure.Cosmos/src/Resource/Settings/IndexingPolicy.cs b/Microsoft.Azure.Cosmos/src/Resource/Settings/IndexingPolicy.cs index 0f4042cf13..acc18cf140 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/Settings/IndexingPolicy.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/Settings/IndexingPolicy.cs @@ -160,13 +160,7 @@ public IndexingPolicy() /// ]]> /// [JsonProperty(PropertyName = "fullTextIndexes", NullValueHandling = NullValueHandling.Ignore)] -#if PREVIEW - - public -#else - internal -#endif - Collection FullTextIndexes{ get; set; } = new Collection(); + public Collection FullTextIndexes{ get; set; } = new Collection(); /// /// This contains additional values for scenarios where the SDK is not aware of new fields. diff --git a/Microsoft.Azure.Cosmos/src/Resource/Settings/VectorIndexPath.cs b/Microsoft.Azure.Cosmos/src/Resource/Settings/VectorIndexPath.cs index d288b67ce8..84907bec46 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/Settings/VectorIndexPath.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/Settings/VectorIndexPath.cs @@ -70,7 +70,9 @@ public sealed class VectorIndexPath /// /// Gets or sets the quantization byte size for the vector index path. This is only applicable for the quantizedFlat and diskann vector index types. - /// The allowed range for this parameter is between 1 and the minimum of vector dimensions and 512. + /// The allowed range for this parameter is between 1 and min(dimensions, 512). + /// e.g. if dimensions is 256, then allowed range for QuantizationByteSize is between 1 and 256 if dimensions is 1024, + /// then allowed range for QuantizationByteSize is between 1 and 512 /// [JsonIgnore] #if PREVIEW @@ -102,10 +104,14 @@ int IndexingSearchListSize /// /// Gets or sets the vector index shard key for the vector index path. This is only applicable for the quantizedFlat and diskann vector index types. - /// The maximum length of the vector index shard key is 1. /// [JsonProperty(PropertyName = "vectorIndexShardKey", NullValueHandling = NullValueHandling.Ignore)] - internal string[] VectorIndexShardKey { get; set; } +#if PREVIEW + public +#else + internal +#endif + string[] VectorIndexShardKey { get; set; } /// /// This contains additional values for scenarios where the SDK is not aware of new fields. diff --git a/Microsoft.Azure.Cosmos/src/ResourceThrottleRetryPolicy.cs b/Microsoft.Azure.Cosmos/src/ResourceThrottleRetryPolicy.cs index a99bc594f7..8dae27d467 100644 --- a/Microsoft.Azure.Cosmos/src/ResourceThrottleRetryPolicy.cs +++ b/Microsoft.Azure.Cosmos/src/ResourceThrottleRetryPolicy.cs @@ -123,7 +123,9 @@ private object GetExceptionMessage(Exception exception) return exception.Message; } +#pragma warning disable CDX1000 // DontConvertExceptionToObject return exception; +#pragma warning restore CDX1000 // DontConvertExceptionToObject } /// diff --git a/Microsoft.Azure.Cosmos/src/RetryPolicy.cs b/Microsoft.Azure.Cosmos/src/RetryPolicy.cs index 47e64f0cbc..1cee73250e 100644 --- a/Microsoft.Azure.Cosmos/src/RetryPolicy.cs +++ b/Microsoft.Azure.Cosmos/src/RetryPolicy.cs @@ -13,7 +13,7 @@ internal sealed class RetryPolicy : IRetryPolicyFactory private readonly GlobalPartitionEndpointManager partitionKeyRangeLocationCache; private readonly GlobalEndpointManager globalEndpointManager; private readonly bool enableEndpointDiscovery; - private readonly bool isPertitionLevelFailoverEnabled; + private readonly bool isPartitionLevelFailoverEnabled; private readonly RetryOptions retryOptions; /// @@ -25,7 +25,7 @@ public RetryPolicy( GlobalPartitionEndpointManager partitionKeyRangeLocationCache) { this.enableEndpointDiscovery = connectionPolicy.EnableEndpointDiscovery; - this.isPertitionLevelFailoverEnabled = connectionPolicy.EnablePartitionLevelFailover; + this.isPartitionLevelFailoverEnabled = connectionPolicy.EnablePartitionLevelFailover; this.globalEndpointManager = globalEndpointManager; this.retryOptions = connectionPolicy.RetryOptions; this.partitionKeyRangeLocationCache = partitionKeyRangeLocationCache; @@ -41,7 +41,7 @@ public IDocumentClientRetryPolicy GetRequestPolicy() this.partitionKeyRangeLocationCache, this.retryOptions, this.enableEndpointDiscovery, - this.isPertitionLevelFailoverEnabled); + this.isPartitionLevelFailoverEnabled); return clientRetryPolicy; } diff --git a/Microsoft.Azure.Cosmos/src/Routing/AsyncCache.cs b/Microsoft.Azure.Cosmos/src/Routing/AsyncCache.cs index ba93c64cf2..14a76ea4a8 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/AsyncCache.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/AsyncCache.cs @@ -20,20 +20,25 @@ namespace Microsoft.Azure.Cosmos.Common /// Type of values. internal sealed class AsyncCache { + private readonly bool enableAsyncCacheExceptionNoSharing; private readonly IEqualityComparer valueEqualityComparer; private readonly IEqualityComparer keyEqualityComparer; - private ConcurrentDictionary> values; - public AsyncCache(IEqualityComparer valueEqualityComparer, IEqualityComparer keyEqualityComparer = null) + public AsyncCache( + IEqualityComparer valueEqualityComparer, + IEqualityComparer keyEqualityComparer = null, + bool enableAsyncCacheExceptionNoSharing = true) { this.keyEqualityComparer = keyEqualityComparer ?? EqualityComparer.Default; this.values = new ConcurrentDictionary>(this.keyEqualityComparer); this.valueEqualityComparer = valueEqualityComparer; + this.enableAsyncCacheExceptionNoSharing = enableAsyncCacheExceptionNoSharing; } - public AsyncCache() - : this(EqualityComparer.Default) + public AsyncCache(bool enableAsyncCacheExceptionNoSharing = true) + : this(valueEqualityComparer: EqualityComparer.Default, + enableAsyncCacheExceptionNoSharing: enableAsyncCacheExceptionNoSharing) { } @@ -148,12 +153,38 @@ public async Task GetAsync( { return await generator; } - catch (Exception) when (object.ReferenceEquals(actualValue, newLazyValue)) + catch (Exception ex) when (object.ReferenceEquals(actualValue, newLazyValue)) { // If the lambda this thread added to values triggered an exception remove it from the cache. this.TryRemoveValue(key, actualValue); + + if (this.enableAsyncCacheExceptionNoSharing) + { + // Creates a shallow copy of specific exception types to prevent stack trace proliferation + // and rethrows them, doesn't process other exceptions. + if (ExceptionHandlingUtility.TryCloneException(ex, out Exception clone)) + { + throw clone; + } + } + throw; - } + } + catch (Exception ex) + { + if (this.enableAsyncCacheExceptionNoSharing) + { + // Creates a shallow copy of specific exception types to prevent stack trace proliferation + // and rethrows them, doesn't process other exceptions. + if (ExceptionHandlingUtility.TryCloneException(ex, out Exception clone)) + { + throw clone; + } + } + + throw; + } + } public void Remove(TKey key) diff --git a/Microsoft.Azure.Cosmos/src/Routing/AsyncCacheNonBlocking.cs b/Microsoft.Azure.Cosmos/src/Routing/AsyncCacheNonBlocking.cs index 4025863d19..df3d1636d8 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/AsyncCacheNonBlocking.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/AsyncCacheNonBlocking.cs @@ -20,6 +20,7 @@ namespace Microsoft.Azure.Cosmos /// internal sealed class AsyncCacheNonBlocking : IDisposable { + private readonly bool enableAsyncCacheExceptionNoSharing; private readonly CancellationTokenSource cancellationTokenSource; private readonly ConcurrentDictionary> values; private readonly Func removeFromCacheOnBackgroundRefreshException; @@ -30,7 +31,8 @@ internal sealed class AsyncCacheNonBlocking : IDisposable public AsyncCacheNonBlocking( Func removeFromCacheOnBackgroundRefreshException = null, IEqualityComparer keyEqualityComparer = null, - CancellationToken cancellationToken = default) + CancellationToken cancellationToken = default, + bool enableAsyncCacheExceptionNoSharing = true) { this.keyEqualityComparer = keyEqualityComparer ?? EqualityComparer.Default; this.values = new ConcurrentDictionary>(this.keyEqualityComparer); @@ -38,10 +40,13 @@ public AsyncCacheNonBlocking( this.cancellationTokenSource = cancellationToken == default ? new CancellationTokenSource() : CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); + this.enableAsyncCacheExceptionNoSharing = enableAsyncCacheExceptionNoSharing; } - public AsyncCacheNonBlocking() - : this(removeFromCacheOnBackgroundRefreshException: null, keyEqualityComparer: null) + public AsyncCacheNonBlocking(bool enableAsyncCacheExceptionNoSharing = true) + : this(removeFromCacheOnBackgroundRefreshException: null, + keyEqualityComparer: null, + enableAsyncCacheExceptionNoSharing: enableAsyncCacheExceptionNoSharing) { } @@ -95,7 +100,7 @@ public async Task GetAsync( { try { - TValue cachedResult = await initialLazyValue.GetValueAsync(); + TValue cachedResult = await initialLazyValue.GetValueAsync(singleValueInitFunc); if (forceRefresh == null || !forceRefresh(cachedResult)) { return cachedResult; @@ -113,9 +118,18 @@ public async Task GetAsync( "AsyncCacheNonBlocking Failed GetAsync. key: {0}, tryRemoved: {1}, Exception: {2}", key, removed, - e); + e.Message); } + if (this.enableAsyncCacheExceptionNoSharing) + { + // Creates a shallow copy of specific exception types to prevent stack trace proliferation + // and rethrows them, doesn't process other exceptions. + if (ExceptionHandlingUtility.TryCloneException(e, out Exception clone)) + { + throw clone; + } + } throw; } @@ -129,7 +143,7 @@ public async Task GetAsync( // The AsyncLazyWithRefreshTask is lazy and won't create the task until GetValue is called. // It's possible multiple threads will call the GetOrAdd for the same key. The current asyncLazy may // not be used if another thread adds it first. - AsyncLazyWithRefreshTask asyncLazy = new AsyncLazyWithRefreshTask(singleValueInitFunc, this.cancellationTokenSource.Token); + AsyncLazyWithRefreshTask asyncLazy = new AsyncLazyWithRefreshTask(this.cancellationTokenSource.Token); AsyncLazyWithRefreshTask result = this.values.GetOrAdd( key, asyncLazy); @@ -137,7 +151,7 @@ public async Task GetAsync( // Another thread async lazy was inserted. Just await on the inserted lazy object. if (!object.ReferenceEquals(asyncLazy, result)) { - return await result.GetValueAsync(); + return await result.GetValueAsync(singleValueInitFunc); } // This means the current caller async lazy was inserted into the concurrent dictionary. @@ -145,17 +159,27 @@ public async Task GetAsync( // the concurrent dictionary. try { - return await result.GetValueAsync(); + return await result.GetValueAsync(singleValueInitFunc); } catch (Exception e) { DefaultTrace.TraceError( "AsyncCacheNonBlocking Failed GetAsync with key: {0}, Exception: {1}", key.ToString(), - e.ToString()); + e.Message); // Remove the failed task from the dictionary so future requests can send other calls.. this.values.TryRemove(key, out _); + + if (this.enableAsyncCacheExceptionNoSharing) + { + // Creates a shallow copy of specific exception types to prevent stack trace proliferation + // and rethrows them, doesn't process other exceptions. + if (ExceptionHandlingUtility.TryCloneException(e, out Exception clone)) + { + throw clone; + } + } throw; } } @@ -196,7 +220,7 @@ public void Refresh( Task continuationTask = backgroundRefreshTask .ContinueWith( - task => DefaultTrace.TraceVerbose("Failed to refresh addresses in the background with exception: {0}", task.Exception), + task => DefaultTrace.TraceVerbose("Failed to refresh addresses in the background with exception: {0}", task.Exception.Message), TaskContinuationOptions.OnlyOnFaulted); } } @@ -238,7 +262,7 @@ private async Task UpdateCacheAndGetValueFromBackgroundTaskAsync( key, operationName, removed, - ex); + ex.Message); } throw; @@ -253,7 +277,6 @@ private async Task UpdateCacheAndGetValueFromBackgroundTaskAsync( private sealed class AsyncLazyWithRefreshTask { private readonly CancellationToken cancellationToken; - private readonly Func> createValueFunc; private readonly object valueLock = new (); private readonly object removedFromCacheLock = new (); @@ -266,24 +289,22 @@ public AsyncLazyWithRefreshTask( CancellationToken cancellationToken) { this.cancellationToken = cancellationToken; - this.createValueFunc = null; this.value = Task.FromResult(value); this.refreshInProgress = null; } public AsyncLazyWithRefreshTask( - Func> taskFactory, CancellationToken cancellationToken) { this.cancellationToken = cancellationToken; - this.createValueFunc = taskFactory; this.value = null; this.refreshInProgress = null; } public bool IsValueCreated => this.value != null; - public Task GetValueAsync() + public Task GetValueAsync( + Func> createValueFunc) { // The task was already created so just return it. Task valueSnapshot = this.value; @@ -303,7 +324,7 @@ public Task GetValueAsync() } this.cancellationToken.ThrowIfCancellationRequested(); - this.value = this.createValueFunc(default); + this.value = createValueFunc(default); return this.value; } } @@ -418,7 +439,7 @@ private void Dispose(bool disposing) catch (ObjectDisposedException exception) { // Need to access the exception to avoid unobserved exception - DefaultTrace.TraceInformation($"AsyncCacheNonBlocking was already disposed: {0}", exception); + DefaultTrace.TraceInformation($"AsyncCacheNonBlocking was already disposed: {0}", exception.Message); } this.isDisposed = true; diff --git a/Microsoft.Azure.Cosmos/src/Routing/AvailabilityStrategy/AvailabilityStrategy.cs b/Microsoft.Azure.Cosmos/src/Routing/AvailabilityStrategy/AvailabilityStrategy.cs index 0109653315..5760533564 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/AvailabilityStrategy/AvailabilityStrategy.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/AvailabilityStrategy/AvailabilityStrategy.cs @@ -26,22 +26,6 @@ public static AvailabilityStrategy DisabledStrategy() return new DisabledAvailabilityStrategy(); } - /// - /// After a request's duration passes a threshold, this strategy will send out - /// hedged request to other regions. The first hedge request will be sent after the threshold. - /// After that, the strategy will send out a request every thresholdStep - /// until the request is completed or regions are exausted - /// - /// how long before SDK begins hedging - /// Period of time between first hedge and next hedging attempts - /// the cross region hedging availability strategy - public static AvailabilityStrategy CrossRegionHedgingStrategy( - TimeSpan threshold, - TimeSpan? thresholdStep) - { - return new CrossRegionHedgingAvailabilityStrategy(threshold, thresholdStep, false); - } - /// /// After a request's duration passes a threshold, this strategy will send out /// hedged request to other regions. The first hedge request will be sent after the threshold. @@ -55,12 +39,7 @@ public static AvailabilityStrategy CrossRegionHedgingStrategy( /// This is expected and applications that adopt this feature should be prepared to handle these exceptions. /// Application might not be able to be deterministic on Create vs Replace in the case of Upsert Operations /// the cross region hedging availability -#if PREVIEW - public -#else - internal -#endif - static AvailabilityStrategy CrossRegionHedgingStrategy( + public static AvailabilityStrategy CrossRegionHedgingStrategy( TimeSpan threshold, TimeSpan? thresholdStep, bool enableMultiWriteRegionHedge = false) diff --git a/Microsoft.Azure.Cosmos/src/Routing/AvailabilityStrategy/CrossRegionHedgingAvailabilityStrategy.cs b/Microsoft.Azure.Cosmos/src/Routing/AvailabilityStrategy/CrossRegionHedgingAvailabilityStrategy.cs index a3c8f016c3..6a1d7c0910 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/AvailabilityStrategy/CrossRegionHedgingAvailabilityStrategy.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/AvailabilityStrategy/CrossRegionHedgingAvailabilityStrategy.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Cosmos internal class CrossRegionHedgingAvailabilityStrategy : AvailabilityStrategyInternal { private const string HedgeContext = "Hedge Context"; - private const string ResponseRegion = "Response Region"; + private const string HedgeConfig = "Hedge Config"; /// /// Latency threshold which activates the first region hedging @@ -44,6 +44,8 @@ internal class CrossRegionHedgingAvailabilityStrategy : AvailabilityStrategyInte /// public bool EnableMultiWriteRegionHedge { get; private set; } + private readonly string HedgeConfigText; + /// /// Constructor for hedging availability strategy /// @@ -68,6 +70,8 @@ public CrossRegionHedgingAvailabilityStrategy( this.Threshold = threshold; this.ThresholdStep = thresholdStep ?? TimeSpan.FromMilliseconds(-1); this.EnableMultiWriteRegionHedge = enableMultiWriteRegionHedge; + + this.HedgeConfigText = $"t:{this.Threshold.TotalMilliseconds}ms, s:{this.ThresholdStep.TotalMilliseconds}ms, w:{this.EnableMultiWriteRegionHedge}"; } /// @@ -134,13 +138,12 @@ internal override async Task ExecuteAvailabilityStrategyAsync( : await StreamExtension.AsClonableStreamAsync(request.Content))) { IReadOnlyCollection hedgeRegions = client.DocumentClient.GlobalEndpointManager - .GetApplicableRegions( - request.RequestOptions?.ExcludeRegions, - OperationTypeExtensions.IsReadOperation(request.OperationType)); + .GetApplicableRegions( + request.RequestOptions?.ExcludeRegions, + OperationTypeExtensions.IsReadOperation(request.OperationType)); List requestTasks = new List(hedgeRegions.Count + 1); - Task primaryRequest = null; HedgingResponse hedgeResponse = null; //Send out hedged requests @@ -153,33 +156,17 @@ internal override async Task ExecuteAvailabilityStrategyAsync( CancellationToken timerToken = timerTokenSource.Token; using (Task hedgeTimer = Task.Delay(awaitTime, timerToken)) { - if (requestNumber == 0) - { - primaryRequest = this.RequestSenderAndResultCheckAsync( - sender, - request, - hedgeRegions.ElementAt(requestNumber), - cancellationToken, - cancellationTokenSource, - trace); - - requestTasks.Add(primaryRequest); - } - else - { - Task requestTask = this.CloneAndSendAsync( - sender: sender, - request: request, - clonedBody: clonedBody, - hedgeRegions: hedgeRegions, - requestNumber: requestNumber, - trace: trace, - cancellationToken: cancellationToken, - cancellationTokenSource: cancellationTokenSource); - - requestTasks.Add(requestTask); - } - + Task requestTask = this.CloneAndSendAsync( + sender: sender, + request: request, + clonedBody: clonedBody, + hedgeRegions: hedgeRegions, + requestNumber: requestNumber, + trace: trace, + cancellationToken: cancellationToken, + cancellationTokenSource: cancellationTokenSource); + + requestTasks.Add(requestTask); requestTasks.Add(hedgeTimer); Task completedTask = await Task.WhenAny(requestTasks); @@ -202,13 +189,14 @@ internal override async Task ExecuteAvailabilityStrategyAsync( if (hedgeResponse.IsNonTransient) { cancellationTokenSource.Cancel(); + + ((CosmosTraceDiagnostics)hedgeResponse.ResponseMessage.Diagnostics).Value.AddOrUpdateDatum( + HedgeConfig, + this.HedgeConfigText); //Take is not inclusive, so we need to add 1 to the request number which starts at 0 ((CosmosTraceDiagnostics)hedgeResponse.ResponseMessage.Diagnostics).Value.AddOrUpdateDatum( HedgeContext, hedgeRegions.Take(requestNumber + 1)); - ((CosmosTraceDiagnostics)hedgeResponse.ResponseMessage.Diagnostics).Value.AddOrUpdateDatum( - ResponseRegion, - hedgeResponse.ResponseRegion); return hedgeResponse.ResponseMessage; } } @@ -231,12 +219,12 @@ internal override async Task ExecuteAvailabilityStrategyAsync( if (hedgeResponse.IsNonTransient || requestTasks.Count == 0) { cancellationTokenSource.Cancel(); + ((CosmosTraceDiagnostics)hedgeResponse.ResponseMessage.Diagnostics).Value.AddOrUpdateDatum( + HedgeConfig, + this.HedgeConfigText); ((CosmosTraceDiagnostics)hedgeResponse.ResponseMessage.Diagnostics).Value.AddOrUpdateDatum( HedgeContext, hedgeRegions); - ((CosmosTraceDiagnostics)hedgeResponse.ResponseMessage.Diagnostics).Value.AddOrUpdateDatum( - ResponseRegion, - hedgeResponse.ResponseRegion); return hedgeResponse.ResponseMessage; } } @@ -270,15 +258,17 @@ private async Task CloneAndSendAsync( { clonedRequest.RequestOptions ??= new RequestOptions(); - List excludeRegions = new List(hedgeRegions); - string region = excludeRegions[requestNumber]; - excludeRegions.RemoveAt(requestNumber); - clonedRequest.RequestOptions.ExcludeRegions = excludeRegions; + //we do not want to exclude any regions for the primary request + if (requestNumber > 0) + { + List excludeRegions = new List(hedgeRegions); + excludeRegions.RemoveAt(requestNumber); + clonedRequest.RequestOptions.ExcludeRegions = excludeRegions; + } return await this.RequestSenderAndResultCheckAsync( sender, clonedRequest, - region, cancellationToken, cancellationTokenSource, trace); @@ -288,7 +278,6 @@ private async Task CloneAndSendAsync( private async Task RequestSenderAndResultCheckAsync( Func> sender, RequestMessage request, - string hedgedRegion, CancellationToken cancellationToken, CancellationTokenSource cancellationTokenSource, ITrace trace) @@ -303,18 +292,18 @@ private async Task RequestSenderAndResultCheckAsync( cancellationTokenSource.Cancel(); } - return new HedgingResponse(true, response, hedgedRegion); + return new HedgingResponse(true, response); } - return new HedgingResponse(false, response, hedgedRegion); + return new HedgingResponse(false, response); } - catch (OperationCanceledException oce ) when (cancellationTokenSource.IsCancellationRequested) + catch (OperationCanceledException oce) when (cancellationTokenSource.IsCancellationRequested) { throw new CosmosOperationCanceledException(oce, trace); } catch (Exception ex) { - DefaultTrace.TraceError("Exception thrown while executing cross region hedging availability strategy: {0}", ex); + DefaultTrace.TraceError("Exception thrown while executing cross region hedging availability strategy: {0}", ex.Message); throw ex; } } @@ -348,13 +337,11 @@ private sealed class HedgingResponse { public readonly bool IsNonTransient; public readonly ResponseMessage ResponseMessage; - public readonly string ResponseRegion; - public HedgingResponse(bool isNonTransient, ResponseMessage responseMessage, string responseRegion) + public HedgingResponse(bool isNonTransient, ResponseMessage responseMessage) { this.IsNonTransient = isNonTransient; this.ResponseMessage = responseMessage; - this.ResponseRegion = responseRegion; } } } diff --git a/Microsoft.Azure.Cosmos/src/Routing/ClientCollectionCache.cs b/Microsoft.Azure.Cosmos/src/Routing/ClientCollectionCache.cs index 534a0b8a22..995e9020ba 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/ClientCollectionCache.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/ClientCollectionCache.cs @@ -33,7 +33,9 @@ public ClientCollectionCache( IStoreModel storeModel, ICosmosAuthorizationTokenProvider tokenProvider, IRetryPolicyFactory retryPolicy, - TelemetryToServiceHelper telemetryToServiceHelper) + TelemetryToServiceHelper telemetryToServiceHelper, + bool enableAsyncCacheExceptionNoSharing = true) + : base(enableAsyncCacheExceptionNoSharing) { this.storeModel = storeModel ?? throw new ArgumentNullException("storeModel"); this.tokenProvider = tokenProvider; diff --git a/Microsoft.Azure.Cosmos/src/Routing/CollectionCache.cs b/Microsoft.Azure.Cosmos/src/Routing/CollectionCache.cs index 32a83ffed7..caf490a8bb 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/CollectionCache.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/CollectionCache.cs @@ -28,10 +28,17 @@ internal abstract class CollectionCache /// protected class InternalCache { - internal InternalCache() + internal InternalCache( + bool enableAsyncCacheExceptionNoSharing = true) { - this.collectionInfoByName = new AsyncCache(new CollectionRidComparer()); - this.collectionInfoById = new AsyncCache(new CollectionRidComparer()); + this.collectionInfoByName = new AsyncCache( + new CollectionRidComparer(), + enableAsyncCacheExceptionNoSharing: enableAsyncCacheExceptionNoSharing); + + this.collectionInfoById = new AsyncCache( + new CollectionRidComparer(), + enableAsyncCacheExceptionNoSharing: enableAsyncCacheExceptionNoSharing); + this.collectionInfoByNameLastRefreshTime = new ConcurrentDictionary(); this.collectionInfoByIdLastRefreshTime = new ConcurrentDictionary(); } @@ -48,11 +55,12 @@ internal InternalCache() /// protected readonly InternalCache[] cacheByApiList; - protected CollectionCache() + protected CollectionCache( + bool enableAsyncCacheExceptionNoSharing = true) { this.cacheByApiList = new InternalCache[2]; - this.cacheByApiList[0] = new InternalCache(); // for API version < 2018-12-31 - this.cacheByApiList[1] = new InternalCache(); // for API version >= 2018-12-31 + this.cacheByApiList[0] = new InternalCache(enableAsyncCacheExceptionNoSharing); // for API version < 2018-12-31 + this.cacheByApiList[1] = new InternalCache(enableAsyncCacheExceptionNoSharing); // for API version >= 2018-12-31 } /// diff --git a/Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs b/Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs index 26c4412c9e..1df09fa6b5 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs @@ -71,14 +71,15 @@ public GatewayAddressCache( IConnectionStateListener connectionStateListener, long suboptimalPartitionForceRefreshIntervalInSeconds = 600, bool enableTcpConnectionEndpointRediscovery = false, - bool replicaAddressValidationEnabled = false) + bool replicaAddressValidationEnabled = false, + bool enableAsyncCacheExceptionNoSharing = true) { this.addressEndpoint = new Uri(serviceEndpoint + "/" + Paths.AddressPathSegment); this.protocol = protocol; this.tokenProvider = tokenProvider; this.serviceEndpoint = serviceEndpoint; this.serviceConfigReader = serviceConfigReader; - this.serverPartitionAddressCache = new AsyncCacheNonBlocking(); + this.serverPartitionAddressCache = new AsyncCacheNonBlocking(enableAsyncCacheExceptionNoSharing); this.suboptimalServerPartitionTimestamps = new ConcurrentDictionary(); this.serverPartitionAddressToPkRangeIdMap = new ConcurrentDictionary>(); this.suboptimalMasterPartitionTimestamp = DateTime.MaxValue; @@ -448,7 +449,7 @@ private async Task WarmupCachesAndOpenConnectionsAsync( { DefaultTrace.TraceWarning("Failed to warm-up caches and open connections for the server addresses: {0} with exception: {1}. '{2}'", collectionRid, - ex, + ex.Message, System.Diagnostics.Trace.CorrelationManager.ActivityId); } } @@ -478,6 +479,33 @@ private static void SetTransportAddressUrisToUnhealthy( } } } + // Overloaded method, the previous Lazy> will be removed in a future release + // Once this is merged to master, we will cherry-pick the v3 master commit to OSS and create a new OSS release to use the OSS commit in the msdata PR to unblock the build failures from OSS. + private static void SetTransportAddressUrisToUnhealthy( + PartitionAddressInformation stalePartitionAddressInformation, + Lazy> failedEndpoints) + { + if (stalePartitionAddressInformation == null || + failedEndpoints == null || + !failedEndpoints.IsValueCreated) + { + return; + } + + IReadOnlyList perProtocolPartitionAddressInformation = stalePartitionAddressInformation.Get(Protocol.Tcp)?.ReplicaTransportAddressUris; + if (perProtocolPartitionAddressInformation == null) + { + return; + } + + foreach (TransportAddressUri failed in perProtocolPartitionAddressInformation) + { + if (failedEndpoints.Value.ContainsKey(failed)) + { + failed.SetUnhealthy(); + } + } + } private static void LogPartitionCacheRefresh( IClientSideRequestStatistics clientSideRequestStatistics, @@ -740,7 +768,7 @@ private async Task GetMasterAddressesViaGatewayAsync( uri: targetEndpoint, additionalHeaders: headers, resourceType: resourceType, - timeoutPolicy: HttpTimeoutPolicyControlPlaneRetriableHotPath.Instance, + timeoutPolicy: HttpTimeoutPolicyControlPlaneRetriableHotPath.InstanceShouldThrow503OnTimeout, clientSideRequestStatistics: request.RequestContext?.ClientRequestStatistics, cancellationToken: default, documentServiceRequest: faultInjectionRequest)) @@ -756,7 +784,7 @@ private async Task GetMasterAddressesViaGatewayAsync( uri: targetEndpoint, additionalHeaders: headers, resourceType: resourceType, - timeoutPolicy: HttpTimeoutPolicyControlPlaneRetriableHotPath.Instance, + timeoutPolicy: HttpTimeoutPolicyControlPlaneRetriableHotPath.InstanceShouldThrow503OnTimeout, clientSideRequestStatistics: request.RequestContext?.ClientRequestStatistics, cancellationToken: default)) { @@ -846,7 +874,7 @@ private async Task GetServerAddressesViaGatewayAsync( uri: targetEndpoint, additionalHeaders: headers, resourceType: ResourceType.Document, - timeoutPolicy: HttpTimeoutPolicyControlPlaneRetriableHotPath.Instance, + timeoutPolicy: HttpTimeoutPolicyControlPlaneRetriableHotPath.InstanceShouldThrow503OnTimeout, clientSideRequestStatistics: request.RequestContext?.ClientRequestStatistics, cancellationToken: default, documentServiceRequest: faultInjectionRequest)) @@ -862,7 +890,7 @@ private async Task GetServerAddressesViaGatewayAsync( uri: targetEndpoint, additionalHeaders: headers, resourceType: ResourceType.Document, - timeoutPolicy: HttpTimeoutPolicyControlPlaneRetriableHotPath.Instance, + timeoutPolicy: HttpTimeoutPolicyControlPlaneRetriableHotPath.InstanceShouldThrow503OnTimeout, clientSideRequestStatistics: request.RequestContext?.ClientRequestStatistics, cancellationToken: default)) { @@ -1014,7 +1042,7 @@ await this.GetServerAddressesViaGatewayAsync( { DefaultTrace.TraceWarning("Failed to fetch the server addresses for: {0} with exception: {1}. '{2}'", collectionRid, - ex, + ex.Message, System.Diagnostics.Trace.CorrelationManager.ActivityId); return TryCatch.FromException(ex); diff --git a/Microsoft.Azure.Cosmos/src/Routing/GlobalAddressResolver.cs b/Microsoft.Azure.Cosmos/src/Routing/GlobalAddressResolver.cs index 3205d4e60d..88e142e4d3 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/GlobalAddressResolver.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/GlobalAddressResolver.cs @@ -39,6 +39,7 @@ internal sealed class GlobalAddressResolver : IAddressResolverExtension, IDispos private readonly ConcurrentDictionary addressCacheByEndpoint; private readonly bool enableTcpConnectionEndpointRediscovery; private readonly bool isReplicaAddressValidationEnabled; + private readonly bool enableAsyncCacheExceptionNoSharing; private readonly IConnectionStateListener connectionStateListener; private IOpenConnectionsHandler openConnectionsHandler; @@ -52,7 +53,8 @@ public GlobalAddressResolver( IServiceConfigurationReader serviceConfigReader, ConnectionPolicy connectionPolicy, CosmosHttpClient httpClient, - IConnectionStateListener connectionStateListener) + IConnectionStateListener connectionStateListener, + bool enableAsyncCacheExceptionNoSharing = true) { this.endpointManager = endpointManager; this.partitionKeyRangeLocationCache = partitionKeyRangeLocationCache; @@ -72,6 +74,8 @@ public GlobalAddressResolver( this.isReplicaAddressValidationEnabled = ConfigurationManager.IsReplicaAddressValidationEnabled(connectionPolicy); + this.enableAsyncCacheExceptionNoSharing = enableAsyncCacheExceptionNoSharing; + this.maxEndpoints = maxBackupReadEndpoints + 2; // for write and alternate write endpoint (during failover) this.addressCacheByEndpoint = new ConcurrentDictionary(); @@ -85,6 +89,9 @@ public GlobalAddressResolver( { this.GetOrAddEndpoint(endpoint); } + + this.partitionKeyRangeLocationCache.SetBackgroundConnectionPeriodicRefreshTask( + this.TryOpenConnectionToUnhealthyEndpointsAsync); } public async Task OpenAsync( @@ -232,6 +239,72 @@ public async Task ResolveAsync( return await resolver.ResolveAsync(request, forceRefresh, cancellationToken); } + /// + /// Attempts to open connections to unhealthy endpoints by validating and opening Rntbd connections + /// to the backend replicas. Updates the health status of the endpoints if the connection is successful. + /// + /// A dictionary mapping partition key ranges to their corresponding collection resource ID, original failed location, and health status. + /// A task representing the asynchronous operation. + public async Task TryOpenConnectionToUnhealthyEndpointsAsync( + Dictionary> pkRangeUriMappings) + { + foreach (PartitionKeyRange pkRange in pkRangeUriMappings?.Keys) + { + string collectionRid = pkRangeUriMappings[pkRange].Item1; + Uri originalFailedLocation = pkRangeUriMappings[pkRange].Item2; + + DocumentServiceRequest request = DocumentServiceRequest.CreateFromName( + OperationType.Read, + collectionRid, + ResourceType.Collection, + AuthorizationTokenType.PrimaryMasterKey); + + try + { + PartitionAddressInformation addresses = await this.addressCacheByEndpoint[originalFailedLocation] + .AddressCache + .TryGetAddressesAsync( + request, + new PartitionKeyRangeIdentity(collectionRid, pkRange.Id), + request.ServiceIdentity, + false, + CancellationToken.None); + + PerProtocolPartitionAddressInformation currentAddressInfo = addresses.Get(Protocol.Tcp); + IReadOnlyList transportAddressUris = currentAddressInfo.ReplicaTransportAddressUris; + + DefaultTrace.TraceVerbose("Trying to open connection to all the replica addresses for the PkRange: {0}, collectionRid: {1} and originalFailedLocation: {2}", + pkRange.Id, + collectionRid, + originalFailedLocation); + + await this.openConnectionsHandler.TryOpenRntbdChannelsAsync(transportAddressUris); + + foreach (TransportAddressUri transportAddressUri in transportAddressUris) + { + if (transportAddressUri.GetCurrentHealthState().GetHealthStatus() == TransportAddressHealthState.HealthStatus.Connected) + { + DefaultTrace.TraceVerbose("Opened connection to replica addresses: {0}, for the PkRange: {1}, collectionRid: {2} and and current health: {3}", + transportAddressUri.Uri, + pkRange.Id, + collectionRid, + transportAddressUri.GetCurrentHealthState().GetHealthStatus()); + + pkRangeUriMappings[pkRange] = new Tuple(collectionRid, originalFailedLocation, TransportAddressHealthState.HealthStatus.Connected); + } + } + } + catch (Exception ex) + { + DefaultTrace.TraceWarning("Failed to open connection to all the replica addresses for the PkRange: {0}, collectionRid: {1} and originalFailedLocation: {2}, with exception: {3}", + pkRange.Id, + collectionRid, + originalFailedLocation, + ex.Message); + } + } + } + /// /// ReplicatedResourceClient will use this API to get the direct connectivity AddressCache for given request. /// @@ -275,7 +348,8 @@ private EndpointCache GetOrAddEndpoint(Uri endpoint) this.openConnectionsHandler, this.connectionStateListener, enableTcpConnectionEndpointRediscovery: this.enableTcpConnectionEndpointRediscovery, - replicaAddressValidationEnabled: this.isReplicaAddressValidationEnabled); + replicaAddressValidationEnabled: this.isReplicaAddressValidationEnabled, + enableAsyncCacheExceptionNoSharing: this.enableAsyncCacheExceptionNoSharing); string location = this.endpointManager.GetLocation(endpoint); AddressResolver addressResolver = new AddressResolver(null, new NullRequestSigner(), location); diff --git a/Microsoft.Azure.Cosmos/src/Routing/GlobalEndpointManager.cs b/Microsoft.Azure.Cosmos/src/Routing/GlobalEndpointManager.cs index db3e7dbcb1..10367d11b1 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/GlobalEndpointManager.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/GlobalEndpointManager.cs @@ -15,7 +15,8 @@ namespace Microsoft.Azure.Cosmos.Routing using System.Threading.Tasks; using Microsoft.Azure.Cosmos.Common; using Microsoft.Azure.Cosmos.Core.Trace; - using Microsoft.Azure.Documents; + using Microsoft.Azure.Documents; + using Newtonsoft.Json.Linq; /// /// AddressCache implementation for client SDK. Supports cross region address routing based on @@ -33,7 +34,7 @@ internal class GlobalEndpointManager : IGlobalEndpointManager private readonly Uri defaultEndpoint; private readonly ConnectionPolicy connectionPolicy; private readonly IDocumentClientInternal owner; - private readonly AsyncCache databaseAccountCache = new AsyncCache(); + private readonly AsyncCache databaseAccountCache; private readonly TimeSpan MinTimeBetweenAccountRefresh = TimeSpan.FromSeconds(15); private readonly int backgroundRefreshLocationTimeIntervalInMS = GlobalEndpointManager.DefaultBackgroundRefreshLocationTimeIntervalInMS; private readonly object backgroundAccountRefreshLock = new object(); @@ -42,7 +43,10 @@ internal class GlobalEndpointManager : IGlobalEndpointManager private bool isBackgroundAccountRefreshActive = false; private DateTime LastBackgroundRefreshUtc = DateTime.MinValue; - public GlobalEndpointManager(IDocumentClientInternal owner, ConnectionPolicy connectionPolicy) + public GlobalEndpointManager( + IDocumentClientInternal owner, + ConnectionPolicy connectionPolicy, + bool enableAsyncCacheExceptionNoSharing = true) { this.locationCache = new LocationCache( new ReadOnlyCollection(connectionPolicy.PreferredLocations), @@ -56,6 +60,7 @@ public GlobalEndpointManager(IDocumentClientInternal owner, ConnectionPolicy con this.connectionPolicy = connectionPolicy; this.connectionPolicy.PreferenceChanged += this.OnPreferenceChanged; + this.databaseAccountCache = new AsyncCache(enableAsyncCacheExceptionNoSharing); #if !(NETSTANDARD15 || NETSTANDARD16) #if NETSTANDARD20 @@ -95,6 +100,10 @@ public GlobalEndpointManager(IDocumentClientInternal owner, ConnectionPolicy con public ReadOnlyCollection WriteEndpoints => this.locationCache.WriteEndpoints; + public ReadOnlyCollection ThinClientReadEndpoints => this.locationCache.ThinClientReadEndpoints; + + public ReadOnlyCollection ThinClientWriteEndpoints => this.locationCache.ThinClientWriteEndpoints; + public int PreferredLocationCount { get @@ -334,16 +343,30 @@ private async Task GetAndUpdateAccountPropertiesAsync(Uri endpoint) if (databaseAccount != null) { this.AccountProperties = databaseAccount; - this.CancellationTokenSource.Cancel(); + try + { + this.CancellationTokenSource.Cancel(); + } + catch (ObjectDisposedException) + { + // Ignore the exception if the cancellation token source is already disposed + } } } catch (Exception e) { - DefaultTrace.TraceInformation("GlobalEndpointManager: Fail to reach gateway endpoint {0}, {1}", endpoint, e.ToString()); + DefaultTrace.TraceInformation("GlobalEndpointManager: Fail to reach gateway endpoint {0}, {1}", endpoint, e.Message); if (GetAccountPropertiesHelper.IsNonRetriableException(e)) { DefaultTrace.TraceInformation("GlobalEndpointManager: Exception is not retriable"); - this.CancellationTokenSource.Cancel(); + try + { + this.CancellationTokenSource.Cancel(); + } + catch (ObjectDisposedException) + { + // Ignore the exception if the cancellation token source is already disposed + } this.NonRetriableException = e; } else @@ -400,15 +423,36 @@ private static IEnumerable GetServiceEndpoints( } } } - public void Dispose() { - if (Interlocked.Increment(ref this.disposeCounter) == 1) + // Dispose of unmanaged resources. + this.Dispose(true); + // Suppress finalization. + GC.SuppressFinalize(this); + } + protected virtual void Dispose(bool disposing) + { + if (Interlocked.Increment(ref this.disposeCounter) != 1) { - this.CancellationTokenSource?.Cancel(); - this.CancellationTokenSource?.Dispose(); + return; + } + + if (disposing) + { + try + { + this.CancellationTokenSource?.Cancel(); + this.CancellationTokenSource?.Dispose(); + } + catch (ObjectDisposedException) + { + // Ignore exceptions during dispose + } + } + } + } public virtual Uri ResolveServiceEndpoint(DocumentServiceRequest request) @@ -488,13 +532,67 @@ public void Dispose() { this.connectionPolicy.PreferenceChanged -= this.OnPreferenceChanged; if (!this.cancellationTokenSource.IsCancellationRequested) - { - // This can cause task canceled exceptions if the user disposes of the object while awaiting an async call. - this.cancellationTokenSource.Cancel(); - // The background timer task can hit a ObjectDisposedException but it's an async background task - // that is never awaited on so it will not be thrown back to the caller. - this.cancellationTokenSource.Dispose(); + { + try + { + // This can cause task canceled exceptions if the user disposes of the object while awaiting an async call. + this.cancellationTokenSource.Cancel(); + // The background timer task can hit a ObjectDisposedException but it's an async background task + // that is never awaited on so it will not be thrown back to the caller. + this.cancellationTokenSource.Dispose(); + } + catch (ObjectDisposedException) + { + // Ignore the exception if the cancellation token source is already disposed + + } } + } + + /// + /// Parse thinClientWritableLocations / thinClientReadableLocations from AdditionalProperties. + /// + private static void ParseThinClientLocationsFromAdditionalProperties(AccountProperties databaseAccount) + { + if (databaseAccount?.AdditionalProperties != null) + { + if (databaseAccount.AdditionalProperties.TryGetValue("thinClientWritableLocations", out JToken writableToken) + && writableToken is JArray writableArray) + { + databaseAccount.ThinClientWritableLocationsInternal = ParseAccountRegionArray(writableArray); + } + + if (databaseAccount.AdditionalProperties.TryGetValue("thinClientReadableLocations", out JToken readableToken) + && readableToken is JArray readableArray) + { + databaseAccount.ThinClientReadableLocationsInternal = ParseAccountRegionArray(readableArray); + } + } + } + + private static Collection ParseAccountRegionArray(JArray array) + { + Collection result = new Collection(); + foreach (JToken token in array) + { + if (token is not JObject obj) + { + continue; + } + + string? regionName = obj["name"]?.ToString(); + string? endpointStr = obj["databaseAccountEndpoint"]?.ToString(); + + if (!string.IsNullOrEmpty(regionName) && !string.IsNullOrEmpty(endpointStr)) + { + result.Add(new AccountRegion + { + Name = regionName, + Endpoint = endpointStr + }); + } + } + return result; } public virtual void InitializeAccountPropertiesAndStartBackgroundRefresh(AccountProperties databaseAccount) @@ -504,6 +602,15 @@ public virtual void InitializeAccountPropertiesAndStartBackgroundRefresh(Account return; } + bool isPPafEnabled = ConfigurationManager.IsPartitionLevelFailoverEnabled(defaultValue: false); + if (databaseAccount.EnablePartitionLevelFailover.HasValue) + { + isPPafEnabled = databaseAccount.EnablePartitionLevelFailover.Value; + } + + this.connectionPolicy.EnablePartitionLevelFailover = isPPafEnabled; + GlobalEndpointManager.ParseThinClientLocationsFromAdditionalProperties(databaseAccount); + this.locationCache.OnDatabaseAccountRead(databaseAccount); if (this.isBackgroundAccountRefreshActive) @@ -604,7 +711,7 @@ private async void StartLocationBackgroundRefreshLoop() return; } - DefaultTrace.TraceCritical("GlobalEndpointManager: StartLocationBackgroundRefreshWithTimer() - Unable to refresh database account from any serviceEndpoint. Exception: {0}", ex.ToString()); + DefaultTrace.TraceCritical("GlobalEndpointManager: StartLocationBackgroundRefreshWithTimer() - Unable to refresh database account from any serviceEndpoint. Exception: {0}", ex.Message); } // Call itself to create a loop to continuously do background refresh every 5 minutes @@ -658,6 +765,8 @@ private async Task RefreshDatabaseAccountInternalAsync(bool forceRefresh) { this.LastBackgroundRefreshUtc = DateTime.UtcNow; AccountProperties accountProperties = await this.GetDatabaseAccountAsync(true); + + GlobalEndpointManager.ParseThinClientLocationsFromAdditionalProperties(accountProperties); this.locationCache.OnDatabaseAccountRead(accountProperties); @@ -665,7 +774,7 @@ private async Task RefreshDatabaseAccountInternalAsync(bool forceRefresh) catch (Exception ex) { DefaultTrace.TraceWarning("Failed to refresh database account with exception: {0}. Activity Id: '{1}'", - ex, + ex.Message, System.Diagnostics.Trace.CorrelationManager.ActivityId); } finally @@ -713,6 +822,11 @@ public IList GetEffectivePreferredLocations() return this.connectionPolicy.PreferredLocations?.Count > 0 ? this.connectionPolicy.PreferredLocations : this.locationCache.EffectivePreferredLocations; + } + + public Uri ResolveThinClientEndpoint(DocumentServiceRequest request) + { + return this.locationCache.ResolveThinClientEndpoint(request, request.IsReadOnlyRequest); } } } diff --git a/Microsoft.Azure.Cosmos/src/Routing/GlobalPartitionEndpointManager.cs b/Microsoft.Azure.Cosmos/src/Routing/GlobalPartitionEndpointManager.cs index cdc42f3cb4..a00045c402 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/GlobalPartitionEndpointManager.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/GlobalPartitionEndpointManager.cs @@ -5,6 +5,8 @@ namespace Microsoft.Azure.Cosmos.Routing { using System; + using System.Collections.Generic; + using System.Threading.Tasks; using Microsoft.Azure.Documents; internal abstract class GlobalPartitionEndpointManager @@ -22,5 +24,34 @@ public abstract bool TryAddPartitionLevelLocationOverride( /// public abstract bool TryMarkEndpointUnavailableForPartitionKeyRange( DocumentServiceRequest request); + + /// + /// Increments the failure counter for the specified partition and checks if the partition can fail over. + /// This method is used to determine if a partition should be failed over based on the number of request failures. + /// + public abstract bool IncrementRequestFailureCounterAndCheckIfPartitionCanFailover( + DocumentServiceRequest request); + + /// + /// Determines if a request is eligible for per-partition automatic failover. + /// A request is eligible if it is a write request, partition level failover is enabled, + /// and the global endpoint manager cannot use multiple write locations for the request. + /// + public abstract bool IsRequestEligibleForPerPartitionAutomaticFailover( + DocumentServiceRequest request); + + /// + /// Determines if a request is eligible for partition-level circuit breaker. + /// This method checks if the request is a read-only request, if partition-level circuit breaker is enabled, + /// and if the partition key range location cache indicates that the partition can fail over based on the number of request failures. + /// + public abstract bool IsRequestEligibleForPartitionLevelCircuitBreaker( + DocumentServiceRequest request); + + /// + /// Sets the background connection periodic refresh task. + /// + public abstract void SetBackgroundConnectionPeriodicRefreshTask( + Func>, Task> backgroundConnectionInitTask); } } diff --git a/Microsoft.Azure.Cosmos/src/Routing/GlobalPartitionEndpointManagerCore.cs b/Microsoft.Azure.Cosmos/src/Routing/GlobalPartitionEndpointManagerCore.cs index 945e84e8fa..3818fe70ad 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/GlobalPartitionEndpointManagerCore.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/GlobalPartitionEndpointManagerCore.cs @@ -7,181 +7,620 @@ namespace Microsoft.Azure.Cosmos.Routing using System; using System.Collections.Concurrent; using System.Collections.Generic; - using System.Collections.ObjectModel; + using System.Collections.ObjectModel; + using System.Diagnostics; + using System.Threading; + using System.Threading.Tasks; using Microsoft.Azure.Cosmos.Core.Trace; using Microsoft.Azure.Documents; /// /// This class is used to failover single partitions to different regions. - /// The client retry policy will mark a partition as down. The PartitionKeyRangeToLocation + /// The client retry policy will mark a partition as down. The PartitionKeyRangeToLocationForReadAndWrite /// will add an override to the next read region. When the request is retried it will - /// override the default location with the new region from the PartitionKeyRangeToLocation. + /// override the default location with the new region from the PartitionKeyRangeToLocationForReadAndWrite. /// - internal sealed class GlobalPartitionEndpointManagerCore : GlobalPartitionEndpointManager - { - private readonly IGlobalEndpointManager globalEndpointManager; - private readonly Lazy> PartitionKeyRangeToLocation = new Lazy>( + internal sealed class GlobalPartitionEndpointManagerCore : GlobalPartitionEndpointManager, IDisposable + { + /// + /// A readonly object used as a lock to synchronize the background connection initialization. + /// + private readonly object backgroundConnectionInitLock = new (); + + /// + /// An instance of . + /// + private readonly IGlobalEndpointManager globalEndpointManager; + + /// + /// An instance of used to cancel the background connection initialization task. + /// + private readonly CancellationTokenSource cancellationTokenSource = new (); + + /// + /// A readonly integer containing the partition unavailability duration in seconds, before it can be considered for a refresh by the background + /// recursive task. The default value is 5 seconds. + /// + private readonly int partitionUnavailabilityDurationInSeconds = ConfigurationManager.GetAllowedPartitionUnavailabilityDurationInSeconds(5); + + /// + /// A readonly integer containing the partition failback refresh interval in seconds. The default value is 5 minutes. + /// + private readonly int backgroundConnectionInitTimeIntervalInSeconds = ConfigurationManager.GetStalePartitionUnavailabilityRefreshIntervalInSeconds(300); + + /// + /// A readonly boolean flag used to determine if partition level failover is enabled. + /// + private readonly bool isPartitionLevelFailoverEnabled; + + /// + /// A readonly boolean flag used to determine if partition level circuit breaker is enabled. + /// + private readonly bool isPartitionLevelCircuitBreakerEnabled; + + /// + /// A instance of containing the partition key range to failover info mapping. + /// This mapping is primarily used for writes in a single master account. + /// + private readonly Lazy> PartitionKeyRangeToLocationForWrite = new ( () => new ConcurrentDictionary()); - + + /// + /// A instance of containing the partition key range to failover info mapping. + /// This mapping is primarily used for reads in a single master account, and both reads and writes in a multi master account. + /// + private readonly Lazy> PartitionKeyRangeToLocationForReadAndWrite = new ( + () => new ConcurrentDictionary()); + + /// + /// An integer indicating how many times the dispose was invoked. + /// + private int disposeCounter = 0; + + /// + /// A boolean flag indicating if the background connection initialization recursive task is active. + /// + private bool isBackgroundConnectionInitActive = false; + + /// + /// A callback func delegate used by the background connection refresh recursive task to establish rntbd connections to backend replicas. + /// + private Func>, Task>? backgroundOpenConnectionTask; + + /// + /// Initializes a new instance of the class. + /// + /// An instance of . + /// A boolean flag indicating if partition level failover is enabled. + /// A boolean flag indicating if partition level circuit breaker is enabled. public GlobalPartitionEndpointManagerCore( - IGlobalEndpointManager globalEndpointManager) - { - this.globalEndpointManager = globalEndpointManager ?? throw new ArgumentNullException(nameof(globalEndpointManager)); + IGlobalEndpointManager globalEndpointManager, + bool isPartitionLevelFailoverEnabled = false, + bool isPartitionLevelCircuitBreakerEnabled = false) + { + this.isPartitionLevelFailoverEnabled = isPartitionLevelFailoverEnabled; + this.isPartitionLevelCircuitBreakerEnabled = isPartitionLevelCircuitBreakerEnabled; + this.globalEndpointManager = globalEndpointManager ?? throw new ArgumentNullException(nameof(globalEndpointManager)); + this.InitializeAndStartCircuitBreakerFailbackBackgroundRefresh(); } - - private bool CanUsePartitionLevelFailoverLocations(DocumentServiceRequest request) + + /// + public override void SetBackgroundConnectionPeriodicRefreshTask( + Func>, Task> backgroundConnectionInitTask) + { + this.backgroundOpenConnectionTask = backgroundConnectionInitTask; + } + + /// + public override bool TryAddPartitionLevelLocationOverride( + DocumentServiceRequest request) { - if (this.globalEndpointManager.ReadEndpoints.Count <= 1) - { - return false; + if (!this.IsRequestEligibleForPartitionFailover( + request, + shouldValidateFailedLocation: false, + out PartitionKeyRange? partitionKeyRange, + out Uri? _)) + { + return false; + } + + if (partitionKeyRange == null) + { + return false; } - - if (request.ResourceType == ResourceType.Document || - (request.ResourceType == ResourceType.StoredProcedure && request.OperationType == Documents.OperationType.ExecuteJavaScript)) - { - // Disable for multimaster because it currently - // depends on 403.3 to signal the primary region is backup - // and to fail back over - if (!this.globalEndpointManager.CanUseMultipleWriteLocations(request)) - { - return true; - } + + if (this.IsRequestEligibleForPartitionLevelCircuitBreaker(request)) + { + return this.TryRouteRequestForPartitionLevelOverride( + partitionKeyRange, + request, + this.PartitionKeyRangeToLocationForReadAndWrite); + } + else if (this.IsRequestEligibleForPerPartitionAutomaticFailover(request)) + { + return this.TryRouteRequestForPartitionLevelOverride( + partitionKeyRange, + request, + this.PartitionKeyRangeToLocationForWrite); } return false; } - public override bool TryAddPartitionLevelLocationOverride( + /// + public override bool TryMarkEndpointUnavailableForPartitionKeyRange( DocumentServiceRequest request) - { - if (request == null) - { - throw new ArgumentNullException(nameof(request)); - } - - if (request.RequestContext == null) - { - return false; - } + { + if (!this.IsRequestEligibleForPartitionFailover( + request, + shouldValidateFailedLocation: true, + out PartitionKeyRange? partitionKeyRange, + out Uri? failedLocation)) + { + return false; + } + + if (partitionKeyRange == null || failedLocation == null) + { + return false; + } - if (!this.CanUsePartitionLevelFailoverLocations(request)) + if (this.IsRequestEligibleForPartitionLevelCircuitBreaker(request)) { - return false; - } - - PartitionKeyRange? partitionKeyRange = request.RequestContext.ResolvedPartitionKeyRange; - if (partitionKeyRange == null) + // For multi master write accounts, since all the regions are treated as write regions, the next locations to fail over + // will be the preferred read regions that are configured in the application preferred regions in the CosmosClientOptions. + ReadOnlyCollection nextLocations = this.globalEndpointManager.ReadEndpoints; + + return this.TryAddOrUpdatePartitionFailoverInfoAndMoveToNextLocation( + partitionKeyRange, + failedLocation, + nextLocations, + request, + this.PartitionKeyRangeToLocationForReadAndWrite); + } + else if (this.IsRequestEligibleForPerPartitionAutomaticFailover(request)) + { + // For any single master write accounts, the next locations to fail over will be the read regions configured at the account level. + ReadOnlyCollection nextLocations = this.globalEndpointManager.AccountReadEndpoints; + + return this.TryAddOrUpdatePartitionFailoverInfoAndMoveToNextLocation( + partitionKeyRange, + failedLocation, + nextLocations, + request, + this.PartitionKeyRangeToLocationForWrite); + } + + DefaultTrace.TraceInformation("Partition level override was skipped since the request did not met the minimum requirements."); + return false; + } + + /// + public override bool IncrementRequestFailureCounterAndCheckIfPartitionCanFailover( + DocumentServiceRequest request) + { + if (!this.IsRequestEligibleForPartitionFailover( + request, + shouldValidateFailedLocation: true, + out PartitionKeyRange? partitionKeyRange, + out Uri? failedLocation)) + { + return false; + } + + if (partitionKeyRange == null || failedLocation == null) + { + return false; + } + + PartitionKeyRangeFailoverInfo partionFailover; + if (this.IsRequestEligibleForPerPartitionAutomaticFailover(request)) + { + partionFailover = this.PartitionKeyRangeToLocationForWrite.Value.GetOrAdd( + partitionKeyRange, + (_) => new PartitionKeyRangeFailoverInfo( + request.RequestContext.ResolvedCollectionRid, + failedLocation)); + } + else + { + partionFailover = this.PartitionKeyRangeToLocationForReadAndWrite.Value.GetOrAdd( + partitionKeyRange, + (_) => new PartitionKeyRangeFailoverInfo( + request.RequestContext.ResolvedCollectionRid, + failedLocation)); + } + + partionFailover.IncrementRequestFailureCounts( + isReadOnlyRequest: request.IsReadOnlyRequest, + currentTime: DateTime.UtcNow); + + return partionFailover.CanCircuitBreakerTriggerPartitionFailOver( + isReadOnlyRequest: request.IsReadOnlyRequest); + } + + /// + /// Determines if a request is eligible for per-partition automatic failover. + /// A request is eligible if it is a write request, partition level failover is enabled, + /// and the global endpoint manager cannot use multiple write locations for the request. + /// + /// The document service request to check. + /// True if the request is eligible for per-partition automatic failover, otherwise false. + public override bool IsRequestEligibleForPerPartitionAutomaticFailover( + DocumentServiceRequest request) + { + return this.isPartitionLevelFailoverEnabled + && !request.IsReadOnlyRequest + && !this.globalEndpointManager.CanSupportMultipleWriteLocations(request.ResourceType, request.OperationType); + } + + /// + /// Determines if a request is eligible for partition-level circuit breaker. + /// This method checks if the request is a read-only request, if partition-level circuit breaker is enabled, + /// and if the partition key range location cache indicates that the partition can fail over based on the number of request failures. + /// + /// + /// True if the read request is eligible for partition-level circuit breaker, otherwise false. + /// + public override bool IsRequestEligibleForPartitionLevelCircuitBreaker( + DocumentServiceRequest request) + { + return this.isPartitionLevelCircuitBreakerEnabled + && (request.IsReadOnlyRequest + || (!request.IsReadOnlyRequest && this.globalEndpointManager.CanSupportMultipleWriteLocations(request.ResourceType, request.OperationType))); + } + + /// + /// Disposes the class. + /// Usage of the disposeCounter was used to make the operation atomic. + /// + public void Dispose() + { + if (Interlocked.Increment(ref this.disposeCounter) == 1) + { + this.cancellationTokenSource?.Cancel(); + this.cancellationTokenSource?.Dispose(); + } + } + + /// + /// Validates if the given request is eligible for partition failover. + /// + /// An instance of the . + /// A boolean flag indicating whether to validate the failed location. + /// The resolved for the request. + /// The failed location , if applicable. + /// True if the request is valid for partition failover, otherwise false. + /// Thrown when the request is null. + private bool IsRequestEligibleForPartitionFailover( + DocumentServiceRequest request, + bool shouldValidateFailedLocation, + out PartitionKeyRange? partitionKeyRange, + out Uri? failedLocation) + { + partitionKeyRange = default; + failedLocation = default; + + if (request == null) + { + throw new ArgumentNullException(nameof(request)); + } + + if (request.RequestContext == null) + { + return false; + } + + if (!this.CanUsePartitionLevelFailoverLocations(request)) + { + return false; + } + + partitionKeyRange = request.RequestContext.ResolvedPartitionKeyRange; + if (partitionKeyRange == null) + { + return false; + } + + if (shouldValidateFailedLocation) + { + failedLocation = request.RequestContext.LocationEndpointToRoute; + if (failedLocation == null) + { + return false; + } + } + + return true; + } + + /// + /// Determines if partition level failover locations can be used for the given request. + /// + /// An instance of the . + /// True if partition level failover locations can be used, otherwise false. + private bool CanUsePartitionLevelFailoverLocations( + DocumentServiceRequest request) + { + if (this.globalEndpointManager.ReadEndpoints.Count <= 1) { return false; } - if (this.PartitionKeyRangeToLocation.IsValueCreated - && this.PartitionKeyRangeToLocation.Value.TryGetValue( - partitionKeyRange, - out PartitionKeyRangeFailoverInfo partitionKeyRangeFailover)) - { - DefaultTrace.TraceVerbose("Partition level override. URI: {0}, PartitionKeyRange: {1}", - partitionKeyRangeFailover.Current, - partitionKeyRange.Id); - - request.RequestContext.RouteToLocation(partitionKeyRangeFailover.Current); + if (request.ResourceType == ResourceType.Document || + (request.ResourceType == ResourceType.StoredProcedure && request.OperationType == OperationType.ExecuteJavaScript)) + { + // Right now, for single-master only reads are supported for circuit breaker, and writes are supported for automatic. + // failover. For multi master, both reads and writes are supported. Hence return true for both the cases. return true; } return false; - } - - /// - /// Marks the current location unavailable for write - /// - public override bool TryMarkEndpointUnavailableForPartitionKeyRange( - DocumentServiceRequest request) + } + + /// + /// Initialize and start the background connection periodic refresh task. + /// + internal void InitializeAndStartCircuitBreakerFailbackBackgroundRefresh() { - if (request == null) + if (this.cancellationTokenSource.IsCancellationRequested) { - throw new ArgumentNullException(nameof(request)); - } - - // Only do partition level failover if it is a write operation. - // Write operation will throw a write forbidden if it is not the primary - // region. - if (request.IsReadOnlyRequest) + return; + } + + if (this.isBackgroundConnectionInitActive) { - return false; + return; } - if (request.RequestContext == null) + lock (this.backgroundConnectionInitLock) { - return false; - } + if (this.isBackgroundConnectionInitActive) + { + return; + } - if (!this.CanUsePartitionLevelFailoverLocations(request)) - { - return false; + this.isBackgroundConnectionInitActive = true; } - PartitionKeyRange? partitionKeyRange = request.RequestContext.ResolvedPartitionKeyRange; - if (partitionKeyRange == null) + try { - return false; + this.InitiateCircuitBreakerFailbackLoop(); } - - Uri? failedLocation = request.RequestContext.LocationEndpointToRoute; - if (failedLocation == null) + catch { - return false; + this.isBackgroundConnectionInitActive = false; + throw; } - - PartitionKeyRangeFailoverInfo partionFailover = this.PartitionKeyRangeToLocation.Value.GetOrAdd( - partitionKeyRange, - (_) => new PartitionKeyRangeFailoverInfo(failedLocation)); + } - // For any single master write accounts, the next locations to fail over will be the read regions configured at the account level. - // For multi master write accounts, since all the regions are treated as write regions, the next locations to fail over - // will be the preferred read regions that are configured in the application preferred regions in the CosmosClientOptions. - bool isSingleMasterWriteAccount = !this.globalEndpointManager.CanUseMultipleWriteLocations(request); + /// + /// This method that will run a continious loop with a delay of one minute to refresh the connection to the failed backend replicas. + /// The loop will break, when a cancellation is requested. + /// Note that the refresh interval can configured by the end user using the environment variable: + /// AZURE_COSMOS_PPCB_STALE_PARTITION_UNAVAILABILITY_REFRESH_INTERVAL_IN_SECONDS. + /// +#pragma warning disable VSTHRD100 // Avoid async void methods + private async void InitiateCircuitBreakerFailbackLoop() +#pragma warning restore VSTHRD100 // Avoid async void methods + { + while (!this.cancellationTokenSource.IsCancellationRequested) + { + try + { + await Task.Delay( + TimeSpan.FromSeconds(this.backgroundConnectionInitTimeIntervalInSeconds), + this.cancellationTokenSource.Token); - ReadOnlyCollection nextLocations = isSingleMasterWriteAccount - ? this.globalEndpointManager.AccountReadEndpoints - : this.globalEndpointManager.ReadEndpoints; + if (this.cancellationTokenSource.IsCancellationRequested) + { + break; + } - // Will return true if it was able to update to a new region - if (partionFailover.TryMoveNextLocation( - locations: nextLocations, - failedLocation: failedLocation)) - { - DefaultTrace.TraceInformation("Partition level override added to new location. PartitionKeyRange: {0}, failedLocation: {1}, new location: {2}", - partitionKeyRange, - failedLocation, - partionFailover.Current); - - return true; + DefaultTrace.TraceInformation("GlobalPartitionEndpointManagerCore: InitiateCircuitBreakerFailbackLoop() trying to get address and open connections for failed locations."); + await this.TryOpenConnectionToUnhealthyEndpointsAndInitiateFailbackAsync(); + } + catch (Exception ex) + { + if (this.cancellationTokenSource.IsCancellationRequested && (ex is OperationCanceledException || ex is ObjectDisposedException)) + { + break; + } + + DefaultTrace.TraceCritical("GlobalPartitionEndpointManagerCore: InitiateCircuitBreakerFailbackLoop() - Unable to get address and open connections. Exception: {0}", ex.Message); + } } - - // All the locations have been tried. Remove the override information - DefaultTrace.TraceInformation("Partition level override removed. PartitionKeyRange: {0}, failedLocation: {1}", - partitionKeyRange, - failedLocation); - - this.PartitionKeyRangeToLocation.Value.TryRemove(partitionKeyRange, out PartitionKeyRangeFailoverInfo _); - return false; - - } - + } + + /// + /// Attempts to open connections to unhealthy endpoints and initiates failback if the connections are successful. + /// This method checks the partition key ranges that have failed locations and tries to re-establish connections + /// to those locations. If a connection is successfully re-established, it initiates a failback to the original + /// location for the partition key range. + /// + /// A task representing the asynchronous operation. + private async Task TryOpenConnectionToUnhealthyEndpointsAndInitiateFailbackAsync() + { + if (this.cancellationTokenSource.IsCancellationRequested) + { + return; + } + + if (this.backgroundOpenConnectionTask != null) + { + Dictionary> pkRangeToEndpointMappings = new (); + foreach (PartitionKeyRange pkRange in this.PartitionKeyRangeToLocationForReadAndWrite.Value.Keys) + { + PartitionKeyRangeFailoverInfo partionFailover = this.PartitionKeyRangeToLocationForReadAndWrite.Value[pkRange]; + + partionFailover.SnapshotPartitionFailoverTimestamps( + out DateTime firstRequestFailureTime, + out DateTime _); + + if (DateTime.UtcNow - firstRequestFailureTime > TimeSpan.FromSeconds(this.partitionUnavailabilityDurationInSeconds)) + { + // The first failed location would always be the first preferred location. + Uri originalFailedLocation = partionFailover.FirstFailedLocation; + + pkRangeToEndpointMappings.Add( + key: pkRange, + value: new Tuple( + partionFailover.CollectionRid, + originalFailedLocation, + TransportAddressHealthState.HealthStatus.Unhealthy)); + + } + } + + if (pkRangeToEndpointMappings.Count > 0) + { + await this.backgroundOpenConnectionTask(pkRangeToEndpointMappings); + + foreach (PartitionKeyRange pkRange in pkRangeToEndpointMappings.Keys) + { + Uri originalFailedLocation = pkRangeToEndpointMappings[pkRange].Item2; + TransportAddressHealthState.HealthStatus currentHealthState = pkRangeToEndpointMappings[pkRange].Item3; + + if (currentHealthState == TransportAddressHealthState.HealthStatus.Connected) + { + // Initiate Failback to the original failed location. + DefaultTrace.TraceInformation($"Initiating Failback to endpoint: {originalFailedLocation}, for partition key range: {pkRange}"); + this.PartitionKeyRangeToLocationForReadAndWrite.Value.TryRemove(pkRange, out PartitionKeyRangeFailoverInfo _); + } + } + } + } + } + + /// + /// Attempts to route the request to a partition level override location if available. + /// This method checks if there is a failover location for the given partition key range + /// and updates the request context to route to that location. + /// + /// The partition key range for which the request is being routed. + /// The document service request to be routed. + /// The mapping of partition key ranges to their failover locations. + /// True if the request was successfully routed to a partition level override location, otherwise false. + private bool TryRouteRequestForPartitionLevelOverride( + PartitionKeyRange partitionKeyRange, + DocumentServiceRequest request, + Lazy> partitionKeyRangeToLocationMapping) + { + if (partitionKeyRangeToLocationMapping.IsValueCreated + && partitionKeyRangeToLocationMapping.Value.TryGetValue( + partitionKeyRange, + out PartitionKeyRangeFailoverInfo partitionKeyRangeFailover)) + { + if (this.IsRequestEligibleForPartitionLevelCircuitBreaker(request) + && !partitionKeyRangeFailover.CanCircuitBreakerTriggerPartitionFailOver(request.IsReadOnlyRequest)) + { + return false; + } + + string triggeredBy = this.isPartitionLevelFailoverEnabled ? "Automatic Failover" : "Circuit Breaker"; + DefaultTrace.TraceInformation("Attempting to route request for partition level override triggered by {0}, for operation type: {1}. URI: {2}, PartitionKeyRange: {3}", + triggeredBy, + request.OperationType, + partitionKeyRangeFailover.Current, + partitionKeyRange.Id); + + request.RequestContext.RouteToLocation(partitionKeyRangeFailover.Current); + return true; + } + + return false; + } + + /// + /// Attempts to add or update the partition failover information and move to the next available location. + /// This method checks if the current location for the partition key range has failed and updates the failover + /// information to route the request to the next available location. If all locations have been tried, it removes + /// the failover information for the partition key range. + /// + /// The partition key range for which the failover information is being updated. + /// The URI of the failed location. + /// A read-only collection of URIs representing the next available locations. + /// The document service request being routed. + /// The mapping of partition key ranges to their failover information. + /// True if the failover information was successfully updated and the request was routed to a new location, otherwise false. + private bool TryAddOrUpdatePartitionFailoverInfoAndMoveToNextLocation( + PartitionKeyRange partitionKeyRange, + Uri failedLocation, + ReadOnlyCollection nextLocations, + DocumentServiceRequest request, + Lazy> partitionKeyRangeToLocationMapping) + { + string triggeredBy = this.isPartitionLevelFailoverEnabled ? "Automatic Failover" : "Circuit Breaker"; + PartitionKeyRangeFailoverInfo partionFailover = partitionKeyRangeToLocationMapping.Value.GetOrAdd( + partitionKeyRange, + (_) => new PartitionKeyRangeFailoverInfo( + request.RequestContext.ResolvedCollectionRid, + failedLocation)); + + // Will return true if it was able to update to a new region + if (partionFailover.TryMoveNextLocation( + locations: nextLocations, + failedLocation: failedLocation)) + { + DefaultTrace.TraceInformation("Partition level override triggered by {0}, added to new location for {1}. PartitionKeyRange: {2}, failedLocation: {3}, new location: {4}", + triggeredBy, + request.OperationType, + partitionKeyRange, + failedLocation, + partionFailover.Current); + + return true; + } + + // All the locations have been tried. Remove the override information + DefaultTrace.TraceInformation("Partition level override removed for {0}. PartitionKeyRange: {1}, failedLocation: {2}", + request.OperationType, + partitionKeyRange, + failedLocation); + + partitionKeyRangeToLocationMapping.Value.TryRemove(partitionKeyRange, out PartitionKeyRangeFailoverInfo _); + + return false; + } + internal sealed class PartitionKeyRangeFailoverInfo { - // HashSet is not thread safe and should only accessed in the lock - private readonly HashSet FailedLocations; + // HashSet is not thread safe and should only accessed in the lock + private readonly object counterLock = new (); + private readonly object timestampLock = new (); + private readonly ConcurrentDictionary FailedLocations; + private readonly TimeSpan TimeoutCounterResetWindowInMinutes; + private readonly int ReadRequestFailureCounterThreshold; + private readonly int WriteRequestFailureCounterThreshold; + private DateTime LastRequestFailureTime; + private int ConsecutiveReadRequestFailureCount; + private int ConsecutiveWriteRequestFailureCount; - public PartitionKeyRangeFailoverInfo( + public PartitionKeyRangeFailoverInfo( + string collectionRid, Uri currentLocation) - { - this.Current = currentLocation; - this.FailedLocations = new HashSet(); + { + this.CollectionRid = collectionRid; + this.Current = currentLocation; + this.FirstFailedLocation = currentLocation; + this.FailedLocations = new ConcurrentDictionary(); + this.ConsecutiveReadRequestFailureCount = 0; + this.ConsecutiveWriteRequestFailureCount = 0; + this.ReadRequestFailureCounterThreshold = ConfigurationManager.GetCircuitBreakerConsecutiveFailureCountForReads(10); + this.WriteRequestFailureCounterThreshold = ConfigurationManager.GetCircuitBreakerConsecutiveFailureCountForWrites(5); + this.TimeoutCounterResetWindowInMinutes = TimeSpan.FromMinutes(1); + this.FirstRequestFailureTime = DateTime.UtcNow; + this.LastRequestFailureTime = DateTime.UtcNow; } - public Uri Current { get; private set; } - + public Uri Current { get; private set; } + + public Uri FirstFailedLocation { get; private set; } + + public string CollectionRid { get; private set; } + + public DateTime FirstRequestFailureTime { get; private set; } + public bool TryMoveNextLocation( IReadOnlyCollection locations, Uri failedLocation) @@ -207,19 +646,87 @@ public bool TryMoveNextLocation( continue; } - if (this.FailedLocations.Contains(location)) + if (this.FailedLocations.ContainsKey(location)) { continue; } - this.FailedLocations.Add(failedLocation); + this.FailedLocations[failedLocation] = DateTime.UtcNow; this.Current = location; return true; } } return false; - } + } + + public bool CanCircuitBreakerTriggerPartitionFailOver( + bool isReadOnlyRequest) + { + this.SnapshotConsecutiveRequestFailureCount( + out int consecutiveReadRequestFailureCount, + out int consecutiveWriteRequestFailureCount); + + return isReadOnlyRequest + ? consecutiveReadRequestFailureCount > this.ReadRequestFailureCounterThreshold + : consecutiveWriteRequestFailureCount > this.WriteRequestFailureCounterThreshold; + } + + public void IncrementRequestFailureCounts( + bool isReadOnlyRequest, + DateTime currentTime) + { + this.SnapshotPartitionFailoverTimestamps( + out DateTime _, + out DateTime lastRequestFailureTime); + + if (currentTime - lastRequestFailureTime > this.TimeoutCounterResetWindowInMinutes) + { + Interlocked.Exchange(ref this.ConsecutiveReadRequestFailureCount, 0); + Interlocked.Exchange(ref this.ConsecutiveWriteRequestFailureCount, 0); + } + + if (isReadOnlyRequest) + { + Interlocked.Increment(ref this.ConsecutiveReadRequestFailureCount); + } + else + { + Interlocked.Increment(ref this.ConsecutiveWriteRequestFailureCount); + + } + + this.LastRequestFailureTime = currentTime; + } + + /// + /// Helper method to snapshot the connection timestamps. + /// + /// A field containing the last send attempt time. + /// A field containing th e last send attempt time. + public void SnapshotPartitionFailoverTimestamps( + out DateTime firstRequestFailureTime, + out DateTime lastRequestFailureTime) + { + Debug.Assert(!Monitor.IsEntered(this.timestampLock)); + lock (this.timestampLock) + { + firstRequestFailureTime = this.FirstRequestFailureTime; + lastRequestFailureTime = this.LastRequestFailureTime; + } + } + + public void SnapshotConsecutiveRequestFailureCount( + out int consecutiveReadRequestFailureCount, + out int consecutiveWriteRequestFailureCount) + { + Debug.Assert(!Monitor.IsEntered(this.counterLock)); + lock (this.counterLock) + { + consecutiveReadRequestFailureCount = this.ConsecutiveReadRequestFailureCount; + consecutiveWriteRequestFailureCount = this.ConsecutiveWriteRequestFailureCount; + } + } } } } diff --git a/Microsoft.Azure.Cosmos/src/Routing/GlobalPartitionEndpointManagerNoOp.cs b/Microsoft.Azure.Cosmos/src/Routing/GlobalPartitionEndpointManagerNoOp.cs index 2badf8f5e0..67913b742f 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/GlobalPartitionEndpointManagerNoOp.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/GlobalPartitionEndpointManagerNoOp.cs @@ -4,6 +4,9 @@ #nullable enable namespace Microsoft.Azure.Cosmos.Routing { + using System; + using System.Collections.Generic; + using System.Threading.Tasks; using Microsoft.Azure.Documents; internal sealed class GlobalPartitionEndpointManagerNoOp : GlobalPartitionEndpointManager @@ -14,6 +17,12 @@ private GlobalPartitionEndpointManagerNoOp() { } + public override void SetBackgroundConnectionPeriodicRefreshTask( + Func>, Task> backgroundConnectionInitTask) + { + return; + } + public override bool TryAddPartitionLevelLocationOverride( DocumentServiceRequest request) { @@ -25,5 +34,21 @@ public override bool TryMarkEndpointUnavailableForPartitionKeyRange( { return false; } + + public override bool IsRequestEligibleForPartitionLevelCircuitBreaker(DocumentServiceRequest request) + { + return false; + } + + public override bool IsRequestEligibleForPerPartitionAutomaticFailover(DocumentServiceRequest request) + { + return false; + } + + public override bool IncrementRequestFailureCounterAndCheckIfPartitionCanFailover( + DocumentServiceRequest request) + { + return false; + } } } diff --git a/Microsoft.Azure.Cosmos/src/Routing/IGlobalEndpointManager.cs b/Microsoft.Azure.Cosmos/src/Routing/IGlobalEndpointManager.cs index 0857ac48bb..de5e9eaa96 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/IGlobalEndpointManager.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/IGlobalEndpointManager.cs @@ -17,6 +17,10 @@ internal interface IGlobalEndpointManager : IDisposable ReadOnlyCollection WriteEndpoints { get; } + ReadOnlyCollection ThinClientReadEndpoints { get; } + + ReadOnlyCollection ThinClientWriteEndpoints { get; } + int PreferredLocationCount { get; } Uri ResolveServiceEndpoint(DocumentServiceRequest request); diff --git a/Microsoft.Azure.Cosmos/src/Routing/LocationCache.cs b/Microsoft.Azure.Cosmos/src/Routing/LocationCache.cs index 63be207424..cb6d0bc69b 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/LocationCache.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/LocationCache.cs @@ -19,7 +19,9 @@ namespace Microsoft.Azure.Cosmos.Routing internal sealed class LocationCache { private const string UnavailableLocationsExpirationTimeInSeconds = "UnavailableLocationsExpirationTimeInSeconds"; - private static int DefaultUnavailableLocationsExpirationTimeInSeconds = 5 * 60; +#pragma warning disable IDE0044 // Add readonly modifier + private static int DefaultUnavailableLocationsExpirationTimeInSeconds = 5 * 60; +#pragma warning restore IDE0044 // Add readonly modifier private readonly bool enableEndpointDiscovery; private readonly Uri defaultEndpoint; @@ -124,6 +126,42 @@ public ReadOnlyCollection WriteEndpoints return this.locationInfo.WriteEndpoints; } } + + /// + /// Gets the list of thin client read endpoints. + /// + public ReadOnlyCollection ThinClientReadEndpoints + { + get + { + // Hot-path: avoid ConcurrentDictionary methods which acquire locks + if (DateTime.UtcNow - this.lastCacheUpdateTimestamp > this.unavailableLocationsExpirationTime + && this.locationUnavailablityInfoByEndpoint.Any()) + { + this.UpdateLocationCache(); + } + + return this.locationInfo.ThinClientReadEndpoints; + } + } + + /// + /// Gets the list of thin client write endpoints. + /// + public ReadOnlyCollection ThinClientWriteEndpoints + { + get + { + // Hot-path: avoid ConcurrentDictionary methods which acquire locks + if (DateTime.UtcNow - this.lastCacheUpdateTimestamp > this.unavailableLocationsExpirationTime + && this.locationUnavailablityInfoByEndpoint.Any()) + { + this.UpdateLocationCache(); + } + + return this.locationInfo.ThinClientWriteEndpoints; + } + } public ReadOnlyCollection EffectivePreferredLocations => this.locationInfo.EffectivePreferredLocations; @@ -199,7 +237,9 @@ public void OnDatabaseAccountRead(AccountProperties databaseAccount) { this.UpdateLocationCache( databaseAccount.WritableRegions, - databaseAccount.ReadableRegions, + databaseAccount.ReadableRegions, + thinClientWriteLocations: databaseAccount.ThinClientWritableLocationsInternal, + thinClientReadLocations: databaseAccount.ThinClientReadableLocationsInternal, preferenceList: null, enableMultipleWriteLocations: databaseAccount.EnableMultipleWriteLocations); } @@ -214,7 +254,7 @@ public void OnLocationPreferenceChanged(ReadOnlyCollection preferredLoca preferenceList: preferredLocations); } - public bool IsMetaData(DocumentServiceRequest request) + public static bool IsMetaData(DocumentServiceRequest request) { return (request.OperationType != Documents.OperationType.ExecuteJavaScript && request.ResourceType == ResourceType.StoredProcedure) || request.ResourceType != ResourceType.Document; @@ -223,7 +263,7 @@ public bool IsMetaData(DocumentServiceRequest request) public bool IsMultimasterMetadataWriteRequest(DocumentServiceRequest request) { return !request.IsReadOnlyRequest && this.locationInfo.AvailableWriteLocations.Count > 1 - && this.IsMetaData(request) + && LocationCache.IsMetaData(request) && this.CanUseMultipleWriteLocations(); } @@ -259,17 +299,7 @@ public Uri GetHubUri() string writeLocation = currentLocationInfo.AvailableWriteLocations[0]; Uri locationEndpointToRoute = currentLocationInfo.AvailableWriteEndpointByLocation[writeLocation]; return locationEndpointToRoute; - } - - public ReadOnlyCollection GetAvailableReadLocations() - { - return this.locationInfo.AvailableReadLocations; } - - public ReadOnlyCollection GetAvailableWriteLocations() - { - return this.locationInfo.AvailableWriteLocations; - } /// /// Gets available (account-level) read locations. @@ -648,12 +678,14 @@ private void MarkEndpointUnavailable( unavailableEndpoint, unavailableOperationType, updatedInfo.LastUnavailabilityCheckTimeStamp); - } - - private void UpdateLocationCache( - IEnumerable writeLocations = null, - IEnumerable readLocations = null, - ReadOnlyCollection preferenceList = null, + } + + private void UpdateLocationCache( + IEnumerable writeLocations = null, + IEnumerable readLocations = null, + IEnumerable thinClientWriteLocations = null, + IEnumerable thinClientReadLocations = null, + ReadOnlyCollection preferenceList = null, bool? enableMultipleWriteLocations = null) { lock (this.lockObject) @@ -693,6 +725,28 @@ private void UpdateLocationCache( nextLocationInfo.AvailableWriteLocations = availableWriteLocations; nextLocationInfo.AvailableWriteLocationByEndpoint = availableWriteLocationsByEndpoint; + } + + if (thinClientReadLocations != null && thinClientReadLocations.Count() > 0) + { + nextLocationInfo.ThinClientReadEndpointByLocation = this.GetEndpointByLocation( + thinClientReadLocations, + out ReadOnlyCollection thinClientAvailableReadLocations, + out ReadOnlyDictionary thinClientAvailableReadLocationsByEndpoint); + + nextLocationInfo.ThinClientReadLocations = thinClientAvailableReadLocations; + nextLocationInfo.ThinClientReadLocationByEndpoint = thinClientAvailableReadLocationsByEndpoint; + } + + if (thinClientWriteLocations != null && thinClientWriteLocations.Count() > 0) + { + nextLocationInfo.ThinClientWriteEndpointByLocation = this.GetEndpointByLocation( + thinClientWriteLocations, + out ReadOnlyCollection thinClientAvailableWriteLocations, + out ReadOnlyDictionary thinClientAvailableWriteLocationsByEndpoint); + + nextLocationInfo.ThinClientWriteLocations = thinClientAvailableWriteLocations; + nextLocationInfo.ThinClientWriteLocationByEndpoint = thinClientAvailableWriteLocationsByEndpoint; } nextLocationInfo.WriteEndpoints = this.GetPreferredAvailableEndpoints( @@ -707,8 +761,20 @@ private void UpdateLocationCache( expectedAvailableOperation: OperationType.Read, fallbackEndpoint: nextLocationInfo.WriteEndpoints[0]); - nextLocationInfo.EffectivePreferredLocations = nextLocationInfo.PreferredLocations; - + nextLocationInfo.EffectivePreferredLocations = nextLocationInfo.PreferredLocations; + + nextLocationInfo.ThinClientWriteEndpoints = this.GetPreferredAvailableEndpoints( + endpointsByLocation: nextLocationInfo.ThinClientWriteEndpointByLocation, + orderedLocations: nextLocationInfo.ThinClientWriteLocations, + expectedAvailableOperation: OperationType.Write, + fallbackEndpoint: this.defaultEndpoint); + + nextLocationInfo.ThinClientReadEndpoints = this.GetPreferredAvailableEndpoints( + endpointsByLocation: nextLocationInfo.ThinClientReadEndpointByLocation, + orderedLocations: nextLocationInfo.ThinClientReadLocations, + expectedAvailableOperation: OperationType.Read, + fallbackEndpoint: nextLocationInfo.ThinClientWriteEndpoints[0]); + if (nextLocationInfo.PreferredLocations == null || nextLocationInfo.PreferredLocations.Count == 0) { if (!nextLocationInfo.AvailableReadLocationByEndpoint.TryGetValue(this.defaultEndpoint, out string regionForDefaultEndpoint)) @@ -865,12 +931,34 @@ internal bool CanUseMultipleWriteLocations() { return this.useMultipleWriteLocations && this.enableMultipleWriteLocations; } + + internal Uri ResolveThinClientEndpoint(DocumentServiceRequest request, bool isReadRequest) + { + if (request.RequestContext != null && request.RequestContext.LocationEndpointToRoute != null) + { + return request.RequestContext.LocationEndpointToRoute; + } + + DatabaseAccountLocationsInfo snapshot = this.locationInfo; + ReadOnlyCollection endpoints = isReadRequest + ? snapshot.ThinClientReadEndpoints + : snapshot.ThinClientWriteEndpoints; + + int locationIndex = request.RequestContext.LocationIndexToRoute.GetValueOrDefault(0); + Uri chosenEndpoint = endpoints[locationIndex % endpoints.Count]; + + request.RequestContext.RouteToLocation(chosenEndpoint); + return chosenEndpoint; + } private void SetServicePointConnectionLimit(Uri endpoint) { #if !NETSTANDARD16 - ServicePointAccessor servicePoint = ServicePointAccessor.FindServicePoint(endpoint); - servicePoint.ConnectionLimit = this.connectionLimit; + if (ServicePointAccessor.IsSupported) + { + ServicePointAccessor servicePoint = ServicePointAccessor.FindServicePoint(endpoint); + servicePoint.ConnectionLimit = this.connectionLimit; + } #endif } @@ -894,7 +982,21 @@ public DatabaseAccountLocationsInfo(ReadOnlyCollection preferredLocation this.WriteEndpoints = new List() { defaultEndpoint }.AsReadOnly(); this.AccountReadEndpoints = new List() { defaultEndpoint }.AsReadOnly(); this.ReadEndpoints = new List() { defaultEndpoint }.AsReadOnly(); - this.EffectivePreferredLocations = new List().AsReadOnly(); + this.EffectivePreferredLocations = new List().AsReadOnly(); + + this.ThinClientWriteLocations = new List().AsReadOnly(); + this.ThinClientReadLocations = new List().AsReadOnly(); + this.ThinClientWriteEndpointByLocation = + new ReadOnlyDictionary(new Dictionary()); + this.ThinClientReadEndpointByLocation = + new ReadOnlyDictionary(new Dictionary()); + this.ThinClientWriteLocationByEndpoint = + new ReadOnlyDictionary(new Dictionary()); + this.ThinClientReadLocationByEndpoint = + new ReadOnlyDictionary(new Dictionary()); + this.ThinClientWriteEndpoints = new List() { defaultEndpoint }.AsReadOnly(); + this.ThinClientReadEndpoints = new List() { defaultEndpoint }.AsReadOnly(); + } public DatabaseAccountLocationsInfo(DatabaseAccountLocationsInfo other) @@ -909,7 +1011,16 @@ public DatabaseAccountLocationsInfo(DatabaseAccountLocationsInfo other) this.WriteEndpoints = other.WriteEndpoints; this.AccountReadEndpoints = other.AccountReadEndpoints; this.ReadEndpoints = other.ReadEndpoints; - this.EffectivePreferredLocations = other.EffectivePreferredLocations; + this.EffectivePreferredLocations = other.EffectivePreferredLocations; + + this.ThinClientWriteLocations = other.ThinClientWriteLocations; + this.ThinClientReadLocations = other.ThinClientReadLocations; + this.ThinClientWriteEndpointByLocation = other.ThinClientWriteEndpointByLocation; + this.ThinClientReadEndpointByLocation = other.ThinClientReadEndpointByLocation; + this.ThinClientWriteLocationByEndpoint = other.ThinClientWriteLocationByEndpoint; + this.ThinClientReadLocationByEndpoint = other.ThinClientReadLocationByEndpoint; + this.ThinClientWriteEndpoints = other.ThinClientWriteEndpoints; + this.ThinClientReadEndpoints = other.ThinClientReadEndpoints; } public ReadOnlyCollection PreferredLocations { get; set; } @@ -923,7 +1034,17 @@ public DatabaseAccountLocationsInfo(DatabaseAccountLocationsInfo other) public ReadOnlyCollection WriteEndpoints { get; set; } public ReadOnlyCollection ReadEndpoints { get; set; } public ReadOnlyCollection AccountReadEndpoints { get; set; } - public ReadOnlyCollection EffectivePreferredLocations { get; set; } + public ReadOnlyCollection EffectivePreferredLocations { get; set; } + public ReadOnlyCollection ThinClientWriteLocations { get; set; } + public ReadOnlyDictionary ThinClientWriteEndpointByLocation { get; set; } + public ReadOnlyDictionary ThinClientWriteLocationByEndpoint { get; set; } + public ReadOnlyCollection ThinClientWriteEndpoints { get; set; } + + public ReadOnlyCollection ThinClientReadLocations { get; set; } + public ReadOnlyDictionary ThinClientReadEndpointByLocation { get; set; } + public ReadOnlyDictionary ThinClientReadLocationByEndpoint { get; set; } + public ReadOnlyCollection ThinClientReadEndpoints { get; set; } + } [Flags] diff --git a/Microsoft.Azure.Cosmos/src/Routing/PartitionKeyRangeCache.cs b/Microsoft.Azure.Cosmos/src/Routing/PartitionKeyRangeCache.cs index d849e4d3c0..17289aa975 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/PartitionKeyRangeCache.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/PartitionKeyRangeCache.cs @@ -36,10 +36,12 @@ public PartitionKeyRangeCache( ICosmosAuthorizationTokenProvider authorizationTokenProvider, IStoreModel storeModel, CollectionCache collectionCache, - IGlobalEndpointManager endpointManager) + IGlobalEndpointManager endpointManager, + bool enableAsyncCacheExceptionNoSharing = true) { this.routingMapCache = new AsyncCacheNonBlocking( - keyEqualityComparer: StringComparer.Ordinal); + keyEqualityComparer: StringComparer.Ordinal, + enableAsyncCacheExceptionNoSharing: enableAsyncCacheExceptionNoSharing); this.authorizationTokenProvider = authorizationTokenProvider; this.storeModel = storeModel; this.collectionCache = collectionCache; @@ -140,7 +142,7 @@ public virtual async Task TryLookupAsync( rangesString.Append(range.ToRange().ToString()); rangesString.Append(", "); } - DefaultTrace.TraceInformation(string.Format("DocumentClientException in TryLookupAsync Collection: {0}, previousValue: {1} Exception: {2}", collectionRid, rangesString.ToString(), ex.ToString())); + DefaultTrace.TraceInformation(string.Format("DocumentClientException in TryLookupAsync Collection: {0}, previousValue: {1} Exception: {2}", collectionRid, rangesString.ToString(), ex.Message)); } if (ex.StatusCode == HttpStatusCode.NotFound) diff --git a/Microsoft.Azure.Cosmos/src/Routing/PartitionRoutingHelper.cs b/Microsoft.Azure.Cosmos/src/Routing/PartitionRoutingHelper.cs index 6077aea787..1c0f859eab 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/PartitionRoutingHelper.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/PartitionRoutingHelper.cs @@ -33,7 +33,7 @@ public static IReadOnlyList> GetProvidedPartitionKeyRanges( bool hasLogicalPartitionKey, bool allowDCount, bool allowNonValueAggregates, - bool useSystemPrefix, + bool useSystemPrefix, PartitionKeyDefinition partitionKeyDefinition, Cosmos.VectorEmbeddingPolicy vectorEmbeddingPolicy, QueryPartitionProvider queryPartitionProvider, @@ -64,7 +64,8 @@ public static IReadOnlyList> GetProvidedPartitionKeyRanges( isContinuationExpected: isContinuationExpected, allowNonValueAggregateQuery: allowNonValueAggregates, hasLogicalPartitionKey: hasLogicalPartitionKey, - allowDCount: allowDCount, + allowDCount: allowDCount, + hybridSearchSkipOrderByRewrite: false, useSystemPrefix: useSystemPrefix, geospatialType: geospatialType); if (!tryGetPartitionQueryExecutionInfo.Succeeded) diff --git a/Microsoft.Azure.Cosmos/src/Routing/PathParser.cs b/Microsoft.Azure.Cosmos/src/Routing/PathParser.cs index aae5c354a1..be295e613f 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/PathParser.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/PathParser.cs @@ -10,8 +10,12 @@ namespace Microsoft.Azure.Cosmos.Routing internal sealed class PathParser { +#pragma warning disable IDE0044 // Add readonly modifier private static char segmentSeparator = '/'; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private static string errorMessageFormat = "Invalid path, failed at {0}"; +#pragma warning restore IDE0044 // Add readonly modifier /// /// Extract parts from path diff --git a/Microsoft.Azure.Cosmos/src/SerializableNameValueCollection.cs b/Microsoft.Azure.Cosmos/src/SerializableNameValueCollection.cs index c5514d9798..dee10788ae 100644 --- a/Microsoft.Azure.Cosmos/src/SerializableNameValueCollection.cs +++ b/Microsoft.Azure.Cosmos/src/SerializableNameValueCollection.cs @@ -14,7 +14,9 @@ namespace Microsoft.Azure.Cosmos internal sealed class SerializableNameValueCollection : JsonSerializable { +#pragma warning disable IDE0044 // Add readonly modifier private Lazy lazyCollection; +#pragma warning restore IDE0044 // Add readonly modifier public SerializableNameValueCollection() { diff --git a/Microsoft.Azure.Cosmos/src/Serializer/CosmosSerializerCore.cs b/Microsoft.Azure.Cosmos/src/Serializer/CosmosSerializerCore.cs index bc65c189ec..c8a7ed3d6c 100644 --- a/Microsoft.Azure.Cosmos/src/Serializer/CosmosSerializerCore.cs +++ b/Microsoft.Azure.Cosmos/src/Serializer/CosmosSerializerCore.cs @@ -17,9 +17,12 @@ namespace Microsoft.Azure.Cosmos /// internal class CosmosSerializerCore { + private readonly bool isBinaryEncodingEnabled; + private static readonly CosmosSerializer binarySerializer = new CosmosJsonSerializerWrapper( + new CosmosJsonDotNetSerializer(binaryEncodingEnabled: true)); + private static readonly CosmosSerializer propertiesSerializer = new CosmosJsonSerializerWrapper( - new CosmosJsonDotNetSerializer( - ConfigurationManager.IsBinaryEncodingEnabled())); + new CosmosJsonDotNetSerializer()); private readonly CosmosSerializer customSerializer; private readonly CosmosSerializer sqlQuerySpecSerializer; @@ -28,6 +31,7 @@ internal class CosmosSerializerCore internal CosmosSerializerCore( CosmosSerializer customSerializer = null) { + this.isBinaryEncodingEnabled = ConfigurationManager.IsBinaryEncodingEnabled(); if (customSerializer == null) { this.customSerializer = null; @@ -81,9 +85,9 @@ internal T[] FromFeedStream(Stream stream) return serializer.FromStream(stream); } - internal Stream ToStream(T input) + internal Stream ToStream(T input, bool canUseBinaryEncodingForPointOperations = false) { - CosmosSerializer serializer = this.GetSerializer(); + CosmosSerializer serializer = this.GetSerializer(canUseBinaryEncodingForPointOperations); return serializer.ToStream(input); } @@ -116,31 +120,29 @@ internal CosmosSerializer GetCustomOrDefaultSerializer() return this.customSerializer; } - return CosmosSerializerCore.propertiesSerializer; + return this.GetDefaultSerializer(); } - private CosmosSerializer GetSerializer() + private CosmosSerializer GetSerializer( + bool canUseBinaryEncodingForPointOperations = false) { Type inputType = typeof(T); if (inputType == typeof(PatchSpec)) { - if (this.patchOperationSerializer == null) - { - this.patchOperationSerializer = PatchOperationsJsonConverter.CreatePatchOperationsSerializer( + this.patchOperationSerializer ??= PatchOperationsJsonConverter.CreatePatchOperationsSerializer( cosmosSerializer: this.customSerializer ?? new CosmosJsonDotNetSerializer(), propertiesSerializer: CosmosSerializerCore.propertiesSerializer); - } return this.patchOperationSerializer; } - if (this.customSerializer == null) + if (CosmosSerializerCore.IsInputTypeInternal(inputType)) { return CosmosSerializerCore.propertiesSerializer; } - if (CosmosSerializerCore.IsInputTypeInternal(inputType)) + if (this.customSerializer == null) { - return CosmosSerializerCore.propertiesSerializer; + return this.GetDefaultSerializer(canUseBinaryEncodingForPointOperations); } if (inputType == typeof(SqlQuerySpec)) @@ -154,7 +156,11 @@ private CosmosSerializer GetSerializer() string directAssemblyName = typeof(Documents.PartitionKeyRange).Assembly.GetName().Name; string inputAssemblyName = inputType.Assembly.GetName().Name; bool inputIsClientOrDirect = string.Equals(inputAssemblyName, clientAssemblyName) || string.Equals(inputAssemblyName, directAssemblyName); - bool typeIsWhiteListed = inputType == typeof(Document) || (inputType.IsGenericType && inputType.GetGenericTypeDefinition() == typeof(ChangeFeedItem<>)); + bool typeIsWhiteListed = inputType == typeof(Document) + || (inputType.IsGenericType && inputType.GetGenericTypeDefinition() == typeof(ChangeFeedItem<>)) + || inputType == typeof(StoredProcedureResponse) + || inputType == typeof(TriggerResponse) + || inputType == typeof(UserDefinedFunctionResponse); if (!typeIsWhiteListed && inputIsClientOrDirect) { @@ -165,6 +171,14 @@ private CosmosSerializer GetSerializer() return this.customSerializer; } + private CosmosSerializer GetDefaultSerializer( + bool canUseBinaryEncodingForPointOperations = false) + { + return this.isBinaryEncodingEnabled && canUseBinaryEncodingForPointOperations + ? CosmosSerializerCore.binarySerializer + : CosmosSerializerCore.propertiesSerializer; + } + internal static bool IsInputTypeInternal( Type inputType) { @@ -184,4 +198,4 @@ internal static bool IsInputTypeInternal( || inputType == typeof(ChangeFeedQuerySpec); } } -} +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/SessionRetryOptions.cs b/Microsoft.Azure.Cosmos/src/SessionRetryOptions.cs new file mode 100644 index 0000000000..3f4ae5ec8b --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/SessionRetryOptions.cs @@ -0,0 +1,43 @@ +// ------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// ------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos +{ + using System; + using Microsoft.Azure.Documents; + + /// + /// Implementation of ISessionRetryOptions interface, do not want clients to subclass. + /// + internal sealed class SessionRetryOptions : ISessionRetryOptions + { + /// + /// Initializes a new instance of the class. + /// + public SessionRetryOptions() + { + this.MinInRegionRetryTime = ConfigurationManager.GetMinRetryTimeInLocalRegionWhenRemoteRegionPreferred(); + this.MaxInRegionRetryCount = ConfigurationManager.GetMaxRetriesInLocalRegionWhenRemoteRegionPreferred(); + } + /// + /// Sets the minimum retry time for 404/1002 retries within each region for read and write operations. + /// The minimum value is 100ms - this minimum is enforced to provide a way for the local region to catch-up on replication lag. The default value is 500ms - as a recommendation ensure that this value is higher than the steady-state + /// replication latency between the regions you chose + /// + public TimeSpan MinInRegionRetryTime { get; set; } + + /// + /// Sets the maximum number of retries within each region for read and write operations. The minimum value is 1 - the backoff time for the last in-region retry will ensure that the total retry time within the + /// region is at least the min. in-region retry time. + /// + public int MaxInRegionRetryCount { get; set; } + + /// + /// hints which guide SDK-internal retry policies on how early to switch retries to a different region. If true, will retry all replicas once and add a minimum delay before switching to the next region.If false, it will + /// retry in the local region up to 5s + /// + public bool RemoteRegionPreferred { get; set; } = false; + + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/SqlObjects/SqlFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/SqlObjects/SqlFunctionCallScalarExpression.cs index a4a3af39da..7fa607774b 100644 --- a/Microsoft.Azure.Cosmos/src/SqlObjects/SqlFunctionCallScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/SqlObjects/SqlFunctionCallScalarExpression.cs @@ -85,6 +85,7 @@ sealed class SqlFunctionCallScalarExpression : SqlScalarExpression { Names.Endswith, Identifiers.Endswith }, { Names.Exp, Identifiers.Exp }, { Names.Floor, Identifiers.Floor }, + { Names.FullTextScore, Identifiers.FullTextScore }, { Names.FullTextContains, Identifiers.FullTextContains }, { Names.FullTextContainsAll, Identifiers.FullTextContainsAll }, { Names.FullTextContainsAny, Identifiers.FullTextContainsAny }, @@ -122,6 +123,7 @@ sealed class SqlFunctionCallScalarExpression : SqlScalarExpression { Names.Right, Identifiers.Right }, { Names.Round, Identifiers.Round }, { Names.Rtrim, Identifiers.Rtrim }, + { Names.RRF, Identifiers.RRF }, { Names.Sign, Identifiers.Sign }, { Names.Sin, Identifiers.Sin }, { Names.Sqrt, Identifiers.Sqrt }, @@ -248,15 +250,23 @@ public static class Names public const string InternalStIntersects = "_ST_INTERSECTS"; public const string InternalStWithin = "_ST_WITHIN"; public const string InternalTryArrayContains = "_TRY_ARRAY_CONTAINS"; + public const string Abs = "ABS"; public const string Acos = "ACOS"; public const string All = "ALL"; public const string Any = "ANY"; public const string Array = "ARRAY"; + public const string ArrayAvg = "ARRAY_AVG"; public const string ArrayConcat = "ARRAY_CONCAT"; public const string ArrayContains = "ARRAY_CONTAINS"; + public const string ArrayContainsAll = "ARRAY_CONTAINS_ALL"; + public const string ArrayContainsAny = "ARRAY_CONTAINS_ANY"; public const string ArrayLength = "ARRAY_LENGTH"; + public const string ArrayMax = "ARRAY_MAX"; + public const string ArrayMedian = "ARRAY_MEDIAN"; + public const string ArrayMin = "ARRAY_MIN"; public const string ArraySlice = "ARRAY_SLICE"; + public const string ArraySum = "ARRAY_SUM"; public const string Asin = "ASIN"; public const string Atan = "ATAN"; public const string Atn2 = "ATN2"; @@ -281,17 +291,25 @@ public static class Names public const string Udt = "C_UDT"; public const string UInt32 = "C_UINT32"; public const string Ceiling = "CEILING"; + public const string Choose = "CHOOSE"; public const string Concat = "CONCAT"; public const string Contains = "CONTAINS"; + public const string ContainsAllCi = "ContainsAllCi"; + public const string ContainsAllCs = "ContainsAllCs"; + public const string ContainsAnyCi = "ContainsAnyCi"; + public const string ContainsAnyCs = "ContainsAnyCs"; public const string Cos = "COS"; public const string Cot = "COT"; public const string Count = "COUNT"; public const string DateTimeAdd = "DateTimeAdd"; + public const string DateTimeBin = "DateTimeBin"; public const string DateTimeDiff = "DateTimeDiff"; + public const string DateTimeFormat = "DateTimeFormat"; public const string DateTimeFromParts = "DateTimeFromParts"; public const string DateTimePart = "DateTimePart"; public const string DateTimeToTicks = "DateTimeToTicks"; public const string DateTimeToTimestamp = "DateTimeToTimestamp"; + public const string Day = "DAY"; public const string Degrees = "DEGREES"; public const string Documentid = "DOCUMENTID"; public const string Endswith = "ENDSWITH"; @@ -300,9 +318,11 @@ public static class Names public const string FullTextContains = "FullTextContains"; public const string FullTextContainsAll = "FullTextContainsAll"; public const string FullTextContainsAny = "FullTextContainsAny"; + public const string FullTextScore = "FullTextScore"; public const string GetCurrentDateTime = "GetCurrentDateTime"; public const string GetCurrentTicks = "GetCurrentTicks"; public const string GetCurrentTimestamp = "GetCurrentTimestamp"; + public const string Iif = "IIF"; public const string IndexOf = "INDEX_OF"; public const string IntAdd = "IntAdd"; public const string IntBitwiseAnd = "IntBitwiseAnd"; @@ -317,6 +337,7 @@ public static class Names public const string IntSub = "IntSub"; public const string IsArray = "IS_ARRAY"; public const string IsBool = "IS_BOOL"; + public const string IsDateTime = "IS_DATETIME"; public const string IsDefined = "IS_DEFINED"; public const string IsFiniteNumber = "IS_FINITE_NUMBER"; public const string IsInteger = "IS_INTEGER"; @@ -325,6 +346,7 @@ public static class Names public const string IsObject = "IS_OBJECT"; public const string IsPrimitive = "IS_PRIMITIVE"; public const string IsString = "IS_STRING"; + public const string LastIndexOf = "LastIndexOf"; public const string Left = "LEFT"; public const string Length = "LENGTH"; public const string Like = "LIKE"; @@ -334,6 +356,7 @@ public static class Names public const string Ltrim = "LTRIM"; public const string Max = "MAX"; public const string Min = "MIN"; + public const string Month = "MONTH"; public const string ObjectToArray = "ObjectToArray"; public const string Pi = "PI"; public const string Power = "POWER"; @@ -345,7 +368,12 @@ public static class Names public const string Reverse = "REVERSE"; public const string Right = "RIGHT"; public const string Round = "ROUND"; + public const string RRF = "RRF"; public const string Rtrim = "RTRIM"; + public const string SetDifference = "SetDifference"; + public const string SetEqual = "SetEqual"; + public const string SetIntersect = "SetIntersect"; + public const string SetUnion = "SetUnion"; public const string Sign = "SIGN"; public const string Sin = "SIN"; public const string Sqrt = "SQRT"; @@ -357,6 +385,8 @@ public static class Names public const string StIsvaliddetailed = "ST_ISVALIDDETAILED"; public const string StWithin = "ST_WITHIN"; public const string StringEquals = "StringEquals"; + public const string StringJoin = "StringJoin"; + public const string StringSplit = "StringSplit"; public const string StringToArray = "StringToArray"; public const string StringToBoolean = "StringToBoolean"; public const string StringToNull = "StringToNull"; @@ -373,6 +403,8 @@ public static class Names public const string Trim = "TRIM"; public const string Trunc = "TRUNC"; public const string Upper = "UPPER"; + public const string VectorDistance = "VectorDistance"; + public const string Year = "YEAR"; } public static class Identifiers @@ -399,10 +431,17 @@ public static class Identifiers public static readonly SqlIdentifier All = SqlIdentifier.Create(Names.All); public static readonly SqlIdentifier Any = SqlIdentifier.Create(Names.Any); public static readonly SqlIdentifier Array = SqlIdentifier.Create(Names.Array); + public static readonly SqlIdentifier ArrayAvg = SqlIdentifier.Create(Names.ArrayAvg); public static readonly SqlIdentifier ArrayConcat = SqlIdentifier.Create(Names.ArrayConcat); public static readonly SqlIdentifier ArrayContains = SqlIdentifier.Create(Names.ArrayContains); + public static readonly SqlIdentifier ArrayContainsAll = SqlIdentifier.Create(Names.ArrayContainsAll); + public static readonly SqlIdentifier ArrayContainsAny = SqlIdentifier.Create(Names.ArrayContainsAny); public static readonly SqlIdentifier ArrayLength = SqlIdentifier.Create(Names.ArrayLength); + public static readonly SqlIdentifier ArrayMax = SqlIdentifier.Create(Names.ArrayMax); + public static readonly SqlIdentifier ArrayMedian = SqlIdentifier.Create(Names.ArrayMedian); + public static readonly SqlIdentifier ArrayMin = SqlIdentifier.Create(Names.ArrayMin); public static readonly SqlIdentifier ArraySlice = SqlIdentifier.Create(Names.ArraySlice); + public static readonly SqlIdentifier ArraySum = SqlIdentifier.Create(Names.ArraySum); public static readonly SqlIdentifier Asin = SqlIdentifier.Create(Names.Asin); public static readonly SqlIdentifier Atan = SqlIdentifier.Create(Names.Atan); public static readonly SqlIdentifier Atn2 = SqlIdentifier.Create(Names.Atn2); @@ -427,17 +466,25 @@ public static class Identifiers public static readonly SqlIdentifier Udt = SqlIdentifier.Create(Names.Udt); public static readonly SqlIdentifier UInt32 = SqlIdentifier.Create(Names.UInt32); public static readonly SqlIdentifier Ceiling = SqlIdentifier.Create(Names.Ceiling); + public static readonly SqlIdentifier Choose = SqlIdentifier.Create(Names.Choose); public static readonly SqlIdentifier Concat = SqlIdentifier.Create(Names.Concat); public static readonly SqlIdentifier Contains = SqlIdentifier.Create(Names.Contains); + public static readonly SqlIdentifier ContainsAllCi = SqlIdentifier.Create(Names.ContainsAllCi); + public static readonly SqlIdentifier ContainsAllCs = SqlIdentifier.Create(Names.ContainsAllCs); + public static readonly SqlIdentifier ContainsAnyCi = SqlIdentifier.Create(Names.ContainsAnyCi); + public static readonly SqlIdentifier ContainsAnyCs = SqlIdentifier.Create(Names.ContainsAnyCs); public static readonly SqlIdentifier Cos = SqlIdentifier.Create(Names.Cos); public static readonly SqlIdentifier Cot = SqlIdentifier.Create(Names.Cot); public static readonly SqlIdentifier Count = SqlIdentifier.Create(Names.Count); public static readonly SqlIdentifier DateTimeAdd = SqlIdentifier.Create(Names.DateTimeAdd); + public static readonly SqlIdentifier DateTimeBin = SqlIdentifier.Create(Names.DateTimeBin); public static readonly SqlIdentifier DateTimeDiff = SqlIdentifier.Create(Names.DateTimeDiff); + public static readonly SqlIdentifier DateTimeFormat = SqlIdentifier.Create(Names.DateTimeFormat); public static readonly SqlIdentifier DateTimeFromParts = SqlIdentifier.Create(Names.DateTimeFromParts); public static readonly SqlIdentifier DateTimePart = SqlIdentifier.Create(Names.DateTimePart); public static readonly SqlIdentifier DateTimeToTicks = SqlIdentifier.Create(Names.DateTimeToTicks); public static readonly SqlIdentifier DateTimeToTimestamp = SqlIdentifier.Create(Names.DateTimeToTimestamp); + public static readonly SqlIdentifier Day = SqlIdentifier.Create(Names.Day); public static readonly SqlIdentifier Degrees = SqlIdentifier.Create(Names.Degrees); public static readonly SqlIdentifier Documentid = SqlIdentifier.Create(Names.Documentid); public static readonly SqlIdentifier Endswith = SqlIdentifier.Create(Names.Endswith); @@ -446,9 +493,11 @@ public static class Identifiers public static readonly SqlIdentifier FullTextContains = SqlIdentifier.Create(Names.FullTextContains); public static readonly SqlIdentifier FullTextContainsAll = SqlIdentifier.Create(Names.FullTextContainsAll); public static readonly SqlIdentifier FullTextContainsAny = SqlIdentifier.Create(Names.FullTextContainsAny); + public static readonly SqlIdentifier FullTextScore = SqlIdentifier.Create(Names.FullTextScore); public static readonly SqlIdentifier GetCurrentDateTime = SqlIdentifier.Create(Names.GetCurrentDateTime); public static readonly SqlIdentifier GetCurrentTicks = SqlIdentifier.Create(Names.GetCurrentTicks); public static readonly SqlIdentifier GetCurrentTimestamp = SqlIdentifier.Create(Names.GetCurrentTimestamp); + public static readonly SqlIdentifier Iif = SqlIdentifier.Create(Names.Iif); public static readonly SqlIdentifier IndexOf = SqlIdentifier.Create(Names.IndexOf); public static readonly SqlIdentifier IntAdd = SqlIdentifier.Create(Names.IntAdd); public static readonly SqlIdentifier IntBitwiseAnd = SqlIdentifier.Create(Names.IntBitwiseAnd); @@ -463,6 +512,7 @@ public static class Identifiers public static readonly SqlIdentifier IntSub = SqlIdentifier.Create(Names.IntSub); public static readonly SqlIdentifier IsArray = SqlIdentifier.Create(Names.IsArray); public static readonly SqlIdentifier IsBool = SqlIdentifier.Create(Names.IsBool); + public static readonly SqlIdentifier IsDateTime = SqlIdentifier.Create(Names.IsDateTime); public static readonly SqlIdentifier IsDefined = SqlIdentifier.Create(Names.IsDefined); public static readonly SqlIdentifier IsFiniteNumber = SqlIdentifier.Create(Names.IsFiniteNumber); public static readonly SqlIdentifier IsInteger = SqlIdentifier.Create(Names.IsInteger); @@ -471,6 +521,7 @@ public static class Identifiers public static readonly SqlIdentifier IsObject = SqlIdentifier.Create(Names.IsObject); public static readonly SqlIdentifier IsPrimitive = SqlIdentifier.Create(Names.IsPrimitive); public static readonly SqlIdentifier IsString = SqlIdentifier.Create(Names.IsString); + public static readonly SqlIdentifier LastIndexOf = SqlIdentifier.Create(Names.LastIndexOf); public static readonly SqlIdentifier Left = SqlIdentifier.Create(Names.Left); public static readonly SqlIdentifier Length = SqlIdentifier.Create(Names.Length); public static readonly SqlIdentifier Like = SqlIdentifier.Create(Names.Like); @@ -480,6 +531,7 @@ public static class Identifiers public static readonly SqlIdentifier Ltrim = SqlIdentifier.Create(Names.Ltrim); public static readonly SqlIdentifier Max = SqlIdentifier.Create(Names.Max); public static readonly SqlIdentifier Min = SqlIdentifier.Create(Names.Min); + public static readonly SqlIdentifier Month = SqlIdentifier.Create(Names.Month); public static readonly SqlIdentifier ObjectToArray = SqlIdentifier.Create(Names.ObjectToArray); public static readonly SqlIdentifier Pi = SqlIdentifier.Create(Names.Pi); public static readonly SqlIdentifier Power = SqlIdentifier.Create(Names.Power); @@ -491,7 +543,12 @@ public static class Identifiers public static readonly SqlIdentifier Reverse = SqlIdentifier.Create(Names.Reverse); public static readonly SqlIdentifier Right = SqlIdentifier.Create(Names.Right); public static readonly SqlIdentifier Round = SqlIdentifier.Create(Names.Round); + public static readonly SqlIdentifier RRF = SqlIdentifier.Create(Names.RRF); public static readonly SqlIdentifier Rtrim = SqlIdentifier.Create(Names.Rtrim); + public static readonly SqlIdentifier SetDifference = SqlIdentifier.Create(Names.SetDifference); + public static readonly SqlIdentifier SetEqual = SqlIdentifier.Create(Names.SetEqual); + public static readonly SqlIdentifier SetIntersect = SqlIdentifier.Create(Names.SetIntersect); + public static readonly SqlIdentifier SetUnion = SqlIdentifier.Create(Names.SetUnion); public static readonly SqlIdentifier Sign = SqlIdentifier.Create(Names.Sign); public static readonly SqlIdentifier Sin = SqlIdentifier.Create(Names.Sin); public static readonly SqlIdentifier Sqrt = SqlIdentifier.Create(Names.Sqrt); @@ -503,6 +560,8 @@ public static class Identifiers public static readonly SqlIdentifier StIsvaliddetailed = SqlIdentifier.Create(Names.StIsvaliddetailed); public static readonly SqlIdentifier StWithin = SqlIdentifier.Create(Names.StWithin); public static readonly SqlIdentifier StringEquals = SqlIdentifier.Create(Names.StringEquals); + public static readonly SqlIdentifier StringJoin = SqlIdentifier.Create(Names.StringJoin); + public static readonly SqlIdentifier StringSplit = SqlIdentifier.Create(Names.StringSplit); public static readonly SqlIdentifier StringToArray = SqlIdentifier.Create(Names.StringToArray); public static readonly SqlIdentifier StringToBoolean = SqlIdentifier.Create(Names.StringToBoolean); public static readonly SqlIdentifier StringToNull = SqlIdentifier.Create(Names.StringToNull); @@ -519,6 +578,8 @@ public static class Identifiers public static readonly SqlIdentifier Trim = SqlIdentifier.Create(Names.Trim); public static readonly SqlIdentifier Trunc = SqlIdentifier.Create(Names.Trunc); public static readonly SqlIdentifier Upper = SqlIdentifier.Create(Names.Upper); + public static readonly SqlIdentifier VectorDistance = SqlIdentifier.Create(Names.VectorDistance); + public static readonly SqlIdentifier Year = SqlIdentifier.Create(Names.Year); } } } diff --git a/Microsoft.Azure.Cosmos/src/SqlObjects/SqlOrderByItem.cs b/Microsoft.Azure.Cosmos/src/SqlObjects/SqlOrderByItem.cs index e0a973ebdd..a6f7d371d8 100644 --- a/Microsoft.Azure.Cosmos/src/SqlObjects/SqlOrderByItem.cs +++ b/Microsoft.Azure.Cosmos/src/SqlObjects/SqlOrderByItem.cs @@ -17,7 +17,7 @@ sealed class SqlOrderByItem : SqlObject { private SqlOrderByItem( SqlScalarExpression expression, - bool isDescending) + bool? isDescending) { this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); this.IsDescending = isDescending; @@ -25,11 +25,11 @@ private SqlOrderByItem( public SqlScalarExpression Expression { get; } - public bool IsDescending { get; } + public bool? IsDescending { get; } public static SqlOrderByItem Create( SqlScalarExpression expression, - bool isDescending) + bool? isDescending) { return new SqlOrderByItem(expression, isDescending); } diff --git a/Microsoft.Azure.Cosmos/src/SqlObjects/SqlOrderbyClause.cs b/Microsoft.Azure.Cosmos/src/SqlObjects/SqlOrderbyClause.cs index 0716a1a2ad..3d6cd4327e 100644 --- a/Microsoft.Azure.Cosmos/src/SqlObjects/SqlOrderbyClause.cs +++ b/Microsoft.Azure.Cosmos/src/SqlObjects/SqlOrderbyClause.cs @@ -16,31 +16,43 @@ namespace Microsoft.Azure.Cosmos.SqlObjects #endif sealed class SqlOrderByClause : SqlObject { - private SqlOrderByClause(ImmutableArray orderByItems) + private SqlOrderByClause(bool rank, ImmutableArray orderByItems) { foreach (SqlOrderByItem sqlOrderbyItem in orderByItems) { if (sqlOrderbyItem == null) { - throw new ArgumentException($"{nameof(sqlOrderbyItem)} must have have null items."); + throw new ArgumentException($"{nameof(sqlOrderbyItem)} must not have null items."); } } - this.OrderByItems = orderByItems; - } - - public ImmutableArray OrderByItems { get; } + this.OrderByItems = orderByItems; + this.Rank = rank; + } + public ImmutableArray OrderByItems { get; } + public bool Rank { get; } + public static SqlOrderByClause Create(params SqlOrderByItem[] orderByItems) { - return new SqlOrderByClause(orderByItems.ToImmutableArray()); + return new SqlOrderByClause(rank: false, orderByItems.ToImmutableArray()); } public static SqlOrderByClause Create(ImmutableArray orderByItems) { - return new SqlOrderByClause(orderByItems); + return new SqlOrderByClause(rank: false, orderByItems); + } + + public static SqlOrderByClause Create(bool rank, params SqlOrderByItem[] orderByItems) + { + return new SqlOrderByClause(rank, orderByItems.ToImmutableArray()); } + public static SqlOrderByClause Create(bool rank, ImmutableArray orderByItems) + { + return new SqlOrderByClause(rank, orderByItems); + } + public override void Accept(SqlObjectVisitor visitor) { visitor.Visit(this); diff --git a/Microsoft.Azure.Cosmos/src/SqlObjects/Visitors/SqlObjectEqualityVisitor.cs b/Microsoft.Azure.Cosmos/src/SqlObjects/Visitors/SqlObjectEqualityVisitor.cs index 8d7770ba9e..23dae5579c 100644 --- a/Microsoft.Azure.Cosmos/src/SqlObjects/Visitors/SqlObjectEqualityVisitor.cs +++ b/Microsoft.Azure.Cosmos/src/SqlObjects/Visitors/SqlObjectEqualityVisitor.cs @@ -612,13 +612,13 @@ public override bool Visit(SqlOrderByClause first, SqlObject secondAsObject) { return false; } - - if (!SequenceEquals(first.OrderByItems, second.OrderByItems)) - { - return false; - } - - return true; + + if (first.Rank != second.Rank) + { + return false; + } + + return SequenceEquals(first.OrderByItems, second.OrderByItems); } public override bool Visit(SqlOrderByItem first, SqlObject secondAsObject) diff --git a/Microsoft.Azure.Cosmos/src/SqlObjects/Visitors/SqlObjectHasher.cs b/Microsoft.Azure.Cosmos/src/SqlObjects/Visitors/SqlObjectHasher.cs index f4f55009ec..1a8f5aca88 100644 --- a/Microsoft.Azure.Cosmos/src/SqlObjects/Visitors/SqlObjectHasher.cs +++ b/Microsoft.Azure.Cosmos/src/SqlObjects/Visitors/SqlObjectHasher.cs @@ -57,7 +57,8 @@ internal sealed class SqlObjectHasher : SqlObjectVisitor private const int SqlProgramHashCode = -492711050; private const int SqlPropertyNameHashCode = 1262661966; private const int SqlPropertyRefScalarExpressionHashCode = -1586896865; - private const int SqlQueryHashCode = 1968642960; + private const int SqlQueryHashCode = 1968642960; + private const int SqlRankHashCode = 46457293; private const int SqlSelectClauseHashCode = 19731870; private const int SqlSelectClauseDistinctHashCode = 1467616881; private const int SqlSelectItemHashCode = -611151157; @@ -419,11 +420,16 @@ public override int Visit(SqlOffsetSpec sqlObject) public override int Visit(SqlOrderByClause sqlOrderByClause) { - int hashCode = SqlOrderbyClauseHashCode; - for (int i = 0; i < sqlOrderByClause.OrderByItems.Length; i++) - { - hashCode = CombineHashes(hashCode, sqlOrderByClause.OrderByItems[i].Accept(this)); - } + int hashCode = SqlOrderbyClauseHashCode; + if (sqlOrderByClause.Rank) + { + hashCode = CombineHashes(hashCode, SqlRankHashCode); + } + + for (int i = 0; i < sqlOrderByClause.OrderByItems.Length; i++) + { + hashCode = CombineHashes(hashCode, sqlOrderByClause.OrderByItems[i].Accept(this)); + } return hashCode; } @@ -432,14 +438,9 @@ public override int Visit(SqlOrderByItem sqlOrderByItem) { int hashCode = SqlOrderbyItemHashCode; hashCode = CombineHashes(hashCode, sqlOrderByItem.Expression.Accept(this)); - if (sqlOrderByItem.IsDescending) - { - hashCode = CombineHashes(hashCode, SqlOrderbyItemDescendingHashCode); - } - else - { - hashCode = CombineHashes(hashCode, SqlOrderbyItemAscendingHashCode); - } + hashCode = sqlOrderByItem.IsDescending.HasValue && sqlOrderByItem.IsDescending.Value + ? CombineHashes(hashCode, SqlOrderbyItemDescendingHashCode) + : CombineHashes(hashCode, SqlOrderbyItemAscendingHashCode); return hashCode; } @@ -515,7 +516,7 @@ public override int Visit(SqlQuery sqlQuery) } return hashCode; - } + } public override int Visit(SqlSelectClause sqlSelectClause) { diff --git a/Microsoft.Azure.Cosmos/src/SqlObjects/Visitors/SqlObjectObfuscator.cs b/Microsoft.Azure.Cosmos/src/SqlObjects/Visitors/SqlObjectObfuscator.cs index 2120f16567..99f13d251b 100644 --- a/Microsoft.Azure.Cosmos/src/SqlObjects/Visitors/SqlObjectObfuscator.cs +++ b/Microsoft.Azure.Cosmos/src/SqlObjects/Visitors/SqlObjectObfuscator.cs @@ -276,14 +276,14 @@ public override SqlObject Visit(SqlOffsetSpec sqlObject) } public override SqlObject Visit(SqlOrderByClause sqlOrderByClause) - { - SqlOrderByItem[] items = new SqlOrderByItem[sqlOrderByClause.OrderByItems.Length]; - for (int i = 0; i < sqlOrderByClause.OrderByItems.Length; i++) - { - items[i] = sqlOrderByClause.OrderByItems[i].Accept(this) as SqlOrderByItem; - } - - return SqlOrderByClause.Create(items); + { + SqlOrderByItem[] items = new SqlOrderByItem[sqlOrderByClause.OrderByItems.Length]; + for (int i = 0; i < sqlOrderByClause.OrderByItems.Length; i++) + { + items[i] = sqlOrderByClause.OrderByItems[i].Accept(this) as SqlOrderByItem; + } + + return SqlOrderByClause.Create(sqlOrderByClause.Rank, items); } public override SqlObject Visit(SqlOrderByItem sqlOrderByItem) @@ -337,7 +337,7 @@ public override SqlObject Visit(SqlQuery sqlQuery) sqlQuery.GroupByClause?.Accept(this) as SqlGroupByClause, sqlQuery.OrderByClause?.Accept(this) as SqlOrderByClause, sqlQuery.OffsetLimitClause?.Accept(this) as SqlOffsetLimitClause); - } + } public override SqlObject Visit(SqlSelectClause sqlSelectClause) { @@ -423,8 +423,8 @@ public override SqlObject Visit(SqlUndefinedLiteral sqlUndefinedLiteral) public override SqlObject Visit(SqlWhereClause sqlWhereClause) { return SqlWhereClause.Create(sqlWhereClause.FilterExpression.Accept(this) as SqlScalarExpression); - } - + } + private Number64 GetObfuscatedNumber(Number64 value) { Number64 obfuscatedNumber; diff --git a/Microsoft.Azure.Cosmos/src/SqlObjects/Visitors/SqlObjectTextSerializer.cs b/Microsoft.Azure.Cosmos/src/SqlObjects/Visitors/SqlObjectTextSerializer.cs index 150be14275..7e5aa7a742 100644 --- a/Microsoft.Azure.Cosmos/src/SqlObjects/Visitors/SqlObjectTextSerializer.cs +++ b/Microsoft.Azure.Cosmos/src/SqlObjects/Visitors/SqlObjectTextSerializer.cs @@ -421,9 +421,13 @@ public override void Visit(SqlOffsetSpec sqlObject) public override void Visit(SqlOrderByClause sqlOrderByClause) { - this.writer.Write("ORDER BY "); - sqlOrderByClause.OrderByItems[0].Accept(this); + this.writer.Write("ORDER BY "); + if (sqlOrderByClause.Rank) + { + this.writer.Write("RANK "); + } + sqlOrderByClause.OrderByItems[0].Accept(this); for (int i = 1; i < sqlOrderByClause.OrderByItems.Length; i++) { this.writer.Write(", "); @@ -433,14 +437,17 @@ public override void Visit(SqlOrderByClause sqlOrderByClause) public override void Visit(SqlOrderByItem sqlOrderByItem) { - sqlOrderByItem.Expression.Accept(this); - if (sqlOrderByItem.IsDescending) - { - this.writer.Write(" DESC"); - } - else - { - this.writer.Write(" ASC"); + sqlOrderByItem.Expression.Accept(this); + if (sqlOrderByItem.IsDescending.HasValue) + { + if (sqlOrderByItem.IsDescending.Value) + { + this.writer.Write(" DESC"); + } + else + { + this.writer.Write(" ASC"); + } } } diff --git a/Microsoft.Azure.Cosmos/src/StoredProcedureResponse.cs b/Microsoft.Azure.Cosmos/src/StoredProcedureResponse.cs index 776ee179a1..f17fad6531 100644 --- a/Microsoft.Azure.Cosmos/src/StoredProcedureResponse.cs +++ b/Microsoft.Azure.Cosmos/src/StoredProcedureResponse.cs @@ -26,9 +26,15 @@ namespace Microsoft.Azure.Cosmos /// internal class StoredProcedureResponse : IStoredProcedureResponse { +#pragma warning disable IDE0044 // Add readonly modifier private DocumentServiceResponse response; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private TValue responseBody; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private JsonSerializerSettings serializerSettings; +#pragma warning restore IDE0044 // Add readonly modifier /// /// Constructor exposed for mocking purposes in Azure Cosmos DB service. diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetry.cs b/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetry.cs index a56bc1b0b2..1c4b780fbe 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetry.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetry.cs @@ -200,7 +200,7 @@ ConcurrentDictionary cacheRefreshInfo } catch (Exception ex) { - DefaultTrace.TraceError("Exception in EnrichAndSendAsync() : {0}", ex); + DefaultTrace.TraceError("Exception in EnrichAndSendAsync() : {0}", ex.Message); } DefaultTrace.TraceInformation("Telemetry Job Stopped."); @@ -275,7 +275,7 @@ internal void PushCacheDatapoint(string cacheName, TelemetryInformation data) } catch (Exception ex) { - DefaultTrace.TraceError("Latency Recording Failed by Telemetry. Exception : {0}", ex); + DefaultTrace.TraceError("Latency Recording Failed by Telemetry. Exception : {0}", ex.Message); } } @@ -316,7 +316,7 @@ internal void PushOperationDatapoint(TelemetryInformation data) } catch (Exception ex) { - DefaultTrace.TraceError("Latency Recording Failed by Telemetry. Exception : {0}", ex); + DefaultTrace.TraceError("Latency Recording Failed by Telemetry. Exception : {0}", ex.Message); } } @@ -332,7 +332,7 @@ internal void PushOperationDatapoint(TelemetryInformation data) } catch (Exception ex) { - DefaultTrace.TraceError("Request Charge Recording Failed by Telemetry. Request Charge Value : {0} Exception : {1} ", requestChargeToRecord, ex); + DefaultTrace.TraceError("Request Charge Recording Failed by Telemetry. Request Charge Value : {0} Exception : {1} ", requestChargeToRecord, ex.Message); } } diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetryHelper.cs b/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetryHelper.cs index 2399bcb9fb..7b852703a0 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetryHelper.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetryHelper.cs @@ -99,7 +99,7 @@ internal static List RecordSystemUtilization(DiagnosticsHandlerHelpe } catch (Exception ex) { - DefaultTrace.TraceError("System Usage Recording Error : {0} ", ex); + DefaultTrace.TraceError("System Usage Recording Error : {0} ", ex.Message); } return null; } diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetryProcessor.cs b/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetryProcessor.cs index fbbfb68c45..48ebe68e36 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetryProcessor.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetryProcessor.cs @@ -51,7 +51,7 @@ await ClientTelemetryPayloadWriter.SerializedPayloadChunksAsync( } catch (Exception ex) { - DefaultTrace.TraceError("Exception while serializing telemetry payload or sending data to service: {0}", ex); + DefaultTrace.TraceError("Exception while serializing telemetry payload or sending data to service: {0}", ex.Message); } } diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/Collector/TelemetryCollector.cs b/Microsoft.Azure.Cosmos/src/Telemetry/Collector/TelemetryCollector.cs index 9f2161469a..4d81ea3f50 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/Collector/TelemetryCollector.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/Collector/TelemetryCollector.cs @@ -44,7 +44,7 @@ public void CollectCacheInfo(string cacheName, Func functi } catch (Exception ex) { - DefaultTrace.TraceError("Error while collecting cache {0} telemetry. Exception : {1}", cacheName, ex); + DefaultTrace.TraceError("Error while collecting cache {0} telemetry. Exception : {1}", cacheName, ex.Message); } } @@ -65,7 +65,7 @@ public void CollectOperationAndNetworkInfo(Func functionFo } catch (Exception ex) { - DefaultTrace.TraceError("Error while collecting operation telemetry. Exception : {0}", ex); + DefaultTrace.TraceError("Error while collecting operation telemetry. Exception : {0}", ex.Message); } } diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/AppInsightClassicAttributeKeys.cs b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/AppInsightClassicAttributeKeys.cs index 942ece28db..dc1251169f 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/AppInsightClassicAttributeKeys.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/AppInsightClassicAttributeKeys.cs @@ -140,7 +140,9 @@ public void PopulateAttributes(DiagnosticScope scope, public void PopulateAttributes(DiagnosticScope scope, Exception exception) { +#pragma warning disable CDX1002 // DontUseExceptionStackTrace scope.AddAttribute(AppInsightClassicAttributeKeys.ExceptionStacktrace, exception.StackTrace); +#pragma warning restore CDX1002 // DontUseExceptionStackTrace scope.AddAttribute(AppInsightClassicAttributeKeys.ExceptionType, exception.GetType().Name); // If Exception is not registered with open Telemetry diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/CosmosDbClientMetrics.cs b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/CosmosDbClientMetrics.cs index 19cf4d955c..fc46efbcf6 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/CosmosDbClientMetrics.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/CosmosDbClientMetrics.cs @@ -49,7 +49,7 @@ public static class Name /// /// For feed operations (query, readAll, readMany, change feed) batch operations this meter capture the actual item count in responses from the service. /// - public const string RowCount = "db.client.response.row_count"; + public const string RowCount = "db.client.response.returned_rows"; /// /// Number of active SDK client instances. @@ -63,9 +63,14 @@ public static class Name public static class Unit { /// - /// Unit representing a simple count + /// Unit representing active client instances /// - public const string Count = "#"; + public const string Instance = "{instance}"; + + /// + /// Unit representing count of items in response + /// + public const string Item = "{item}"; /// /// Unit representing time in seconds @@ -73,10 +78,9 @@ public static class Unit public const string Sec = "s"; /// - /// Unit representing request units + /// Unit representing request units (RU) /// - public const string RequestUnit = "# RU"; - + public const string RequestUnit = "{request_unit}"; } /// diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/CosmosDbMeterUtil.cs b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/CosmosDbMeterUtil.cs index 920f7f3d90..a5cd04c853 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/CosmosDbMeterUtil.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/CosmosDbMeterUtil.cs @@ -35,7 +35,7 @@ internal static void RecordHistogramMetric( } catch (Exception ex) { - DefaultTrace.TraceWarning($"Failed to record metric. {ex}"); + DefaultTrace.TraceWarning($"Failed to record metric. {ex.Message}"); } } diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/CosmosDbOperationMeter.cs b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/CosmosDbOperationMeter.cs index 2f214f5246..5a084dd67a 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/CosmosDbOperationMeter.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/CosmosDbOperationMeter.cs @@ -75,11 +75,11 @@ internal static void Initialize(CosmosClientTelemetryOptions metricsOptions = nu description: CosmosDbClientMetrics.OperationMetrics.Description.RequestCharge); CosmosDbOperationMeter.ActualItemHistogram ??= OperationMeter.CreateHistogram(name: CosmosDbClientMetrics.OperationMetrics.Name.RowCount, - unit: CosmosDbClientMetrics.OperationMetrics.Unit.Count, + unit: CosmosDbClientMetrics.OperationMetrics.Unit.Item, description: CosmosDbClientMetrics.OperationMetrics.Description.RowCount); CosmosDbOperationMeter.ActiveInstanceCounter ??= OperationMeter.CreateUpDownCounter(name: CosmosDbClientMetrics.OperationMetrics.Name.ActiveInstances, - unit: CosmosDbClientMetrics.OperationMetrics.Unit.Count, + unit: CosmosDbClientMetrics.OperationMetrics.Unit.Instance, description: CosmosDbClientMetrics.OperationMetrics.Description.ActiveInstances); IsEnabled = true; @@ -144,7 +144,7 @@ internal static void AdjustInstanceCount(Uri accountEndpoint, int adjustment) } catch (Exception ex) { - DefaultTrace.TraceWarning($"Failed to adjust instance count. {ex.StackTrace}"); + DefaultTrace.TraceWarning($"Failed to adjust instance count. {ex.Message}"); } } diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryAttributeKeys.cs b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryAttributeKeys.cs index d315f03577..03c7bdf5f2 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryAttributeKeys.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryAttributeKeys.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Cosmos.Telemetry using System.Net; using global::Azure.Core; using Microsoft.Azure.Cosmos.Tracing.TraceData; + using Microsoft.Azure.Cosmos.Util; using Microsoft.Azure.Documents; /// @@ -225,7 +226,9 @@ public void PopulateAttributes(DiagnosticScope scope, public void PopulateAttributes(DiagnosticScope scope, Exception exception) { +#pragma warning disable CDX1002 // DontUseExceptionStackTrace scope.AddAttribute(OpenTelemetryAttributeKeys.ExceptionStacktrace, exception.StackTrace); +#pragma warning restore CDX1002 // DontUseExceptionStackTrace scope.AddAttribute(OpenTelemetryAttributeKeys.ExceptionType, exception.GetType().Name); // If Exception is not registered with open Telemetry @@ -489,10 +492,12 @@ private static string GetErrorType(Exception exception, int? statusCode, int? su return null; } - HttpStatusCode? code = statusCode.HasValue ? (HttpStatusCode)statusCode.Value : null; - SubStatusCodes? subCode = subStatusCode.HasValue ? (SubStatusCodes)subStatusCode.Value : null; + string codeString = statusCode.HasValue ? ((StatusCodes)statusCode.Value).ToString() : string.Empty; + string mappedSubStatusCode = (statusCode.HasValue && subStatusCode.HasValue) + ? SubStatusMappingUtil.GetSubStatusCodeString((StatusCodes)statusCode.Value, (SubStatusCodes)subStatusCode.Value) + : string.Empty; - return $"{exception.GetType().Name}_{code?.ToString()}_{subCode?.ToString()}"; + return $"{exception.GetType().Name}_{codeString}_{mappedSubStatusCode}"; } private static int GetSubStatusCode(ClientSideRequestStatisticsTraceDatum.StoreResponseStatistics tcpStats, ClientSideRequestStatisticsTraceDatum.HttpResponseStatistics? httpStats) diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryResponse.cs b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryResponse.cs index e22c836a51..d74a5462cf 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryResponse.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryResponse.cs @@ -92,7 +92,7 @@ private static Headers GetHeader(TransactionalBatchResponse responseMessage) } catch (NotImplementedException ex) { - DefaultTrace.TraceVerbose("Failed to get headers from TransactionalBatchResponse. Exception: {0}", ex); + DefaultTrace.TraceVerbose("Failed to get headers from TransactionalBatchResponse. Exception: {0}", ex.Message); return null; } } @@ -105,7 +105,7 @@ private static Headers GetHeader(ResponseMessage responseMessage) } catch (NotImplementedException ex) { - DefaultTrace.TraceVerbose("Failed to get headers from ResponseMessage. Exception: {0}", ex); + DefaultTrace.TraceVerbose("Failed to get headers from ResponseMessage. Exception: {0}", ex.Message); return null; } } diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryResponse{T}.cs b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryResponse{T}.cs index a6f3e73380..45ab965bf3 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryResponse{T}.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryResponse{T}.cs @@ -74,7 +74,7 @@ private static Headers GetHeader(FeedResponse responseMessage) } catch (NotImplementedException ex) { - DefaultTrace.TraceWarning("Failed to get headers from FeedResponse. Exception: {0}", ex); + DefaultTrace.TraceWarning("Failed to get headers from FeedResponse. Exception: {0}", ex.Message); return null; } } @@ -87,7 +87,7 @@ private static Headers GetHeader(Response responseMessage) } catch (NotImplementedException ex) { - DefaultTrace.TraceWarning("Failed to get headers from Response. Exception: {0}", ex); + DefaultTrace.TraceWarning("Failed to get headers from Response. Exception: {0}", ex.Message); return null; } } diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/TelemetryToServiceHelper.cs b/Microsoft.Azure.Cosmos/src/Telemetry/TelemetryToServiceHelper.cs index 13092d9d59..421e3006fb 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/TelemetryToServiceHelper.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/TelemetryToServiceHelper.cs @@ -115,7 +115,7 @@ private async Task RetrieveConfigAndInitiateTelemetryAsync(bool faultInjectionCl } else if (!this.cancellationTokenSource.IsCancellationRequested) { - DefaultTrace.TraceWarning("Exception while calling client config {0} ", databaseAccountClientConfigs.Exception); + DefaultTrace.TraceWarning("Exception while calling client config {0} ", databaseAccountClientConfigs.Exception?.Message); } await Task.Delay( @@ -125,7 +125,7 @@ await Task.Delay( } catch (Exception ex) { - DefaultTrace.TraceWarning("Exception while running client config job: {0}", ex); + DefaultTrace.TraceWarning("Exception while running client config job: {0}", ex.Message); } } @@ -267,7 +267,7 @@ private void InitializeClientTelemetry(AccountClientConfiguration clientConfig) } catch (Exception ex) { - DefaultTrace.TraceWarning($"Error While starting Telemetry Job : {0}. Hence disabling Client Telemetry", ex); + DefaultTrace.TraceWarning($"Error While starting Telemetry Job : {0}. Hence disabling Client Telemetry", ex.Message); this.connectionPolicy.CosmosClientTelemetryOptions.DisableSendingMetricsToService = true; } } @@ -300,7 +300,7 @@ private void StopClientTelemetry() } catch (Exception ex) { - DefaultTrace.TraceWarning("Error While stopping Telemetry Job : {0}", ex); + DefaultTrace.TraceWarning("Error While stopping Telemetry Job : {0}", ex.Message); } } } diff --git a/Microsoft.Azure.Cosmos/src/ThinClientConstants.cs b/Microsoft.Azure.Cosmos/src/ThinClientConstants.cs new file mode 100644 index 0000000000..9a86df2922 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/ThinClientConstants.cs @@ -0,0 +1,21 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ +namespace Microsoft.Azure.Cosmos +{ + using System; + using System.Collections.Generic; + using System.Text; + + internal static class ThinClientConstants + { + public const string RoutedViaProxy = "x-ms-thinclient-route-via-proxy"; + public const string ProxyStartEpk = "x-ms-thinclient-range-min"; + public const string ProxyEndEpk = "x-ms-thinclient-range-max"; + + public const string ProxyOperationType = "x-ms-thinclient-proxy-operation-type"; + public const string ProxyResourceType = "x-ms-thinclient-proxy-resource-type"; + public const string EffectivePartitionKey = "x-ms-effective-partition-key"; + public const string EnableThinClientEndpointDiscoveryHeaderName = "x-ms-cosmos-use-thinclient"; + } +} diff --git a/Microsoft.Azure.Cosmos/src/ThinClientStoreClient.cs b/Microsoft.Azure.Cosmos/src/ThinClientStoreClient.cs new file mode 100644 index 0000000000..b0756cd341 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/ThinClientStoreClient.cs @@ -0,0 +1,182 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos +{ + using System; + using System.Collections.Concurrent; + using System.IO; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos.Core.Trace; + using Microsoft.Azure.Cosmos.Routing; + using Microsoft.Azure.Cosmos.Tracing; + using Microsoft.Azure.Documents; + using Newtonsoft.Json; + using static Microsoft.Azure.Cosmos.ThinClientTransportSerializer; + + /// + /// A TransportClient that sends requests to proxy endpoint. + /// And then processes the response back into DocumentServiceResponse objects. + /// + internal class ThinClientStoreClient : GatewayStoreClient + { + private readonly ObjectPool bufferProviderWrapperPool; + + public ThinClientStoreClient( + CosmosHttpClient httpClient, + ICommunicationEventSource eventSource, + JsonSerializerSettings serializerSettings = null) + : base(httpClient, + eventSource, + serializerSettings) + { + this.bufferProviderWrapperPool = new ObjectPool(() => new BufferProviderWrapper()); + } + + public override async Task InvokeAsync( + DocumentServiceRequest request, + ResourceType resourceType, + Uri physicalAddress, + Uri thinClientEndpoint, + string globalDatabaseAccountName, + ClientCollectionCache clientCollectionCache, + CancellationToken cancellationToken) + { + using (HttpResponseMessage responseMessage = await this.InvokeClientAsync( + request, + resourceType, + physicalAddress, + thinClientEndpoint, + globalDatabaseAccountName, + clientCollectionCache, + cancellationToken)) + { + HttpResponseMessage proxyResponse = await ThinClientTransportSerializer.ConvertProxyResponseAsync(responseMessage); + return await ThinClientStoreClient.ParseResponseAsync(proxyResponse, request.SerializerSettings ?? base.SerializerSettings, request); + } + } + + internal override async Task InvokeStoreAsync(Uri baseAddress, ResourceOperation resourceOperation, DocumentServiceRequest request) + { + Uri physicalAddress = ThinClientStoreClient.IsFeedRequest(request.OperationType) ? + HttpTransportClient.GetResourceFeedUri(resourceOperation.resourceType, baseAddress, request) : + HttpTransportClient.GetResourceEntryUri(resourceOperation.resourceType, baseAddress, request); + + using (HttpResponseMessage responseMessage = await this.InvokeClientAsync( + request, + resourceOperation.resourceType, + physicalAddress, + default, + default, + default, + default)) + { + return await HttpTransportClient.ProcessHttpResponse(request.ResourceAddress, string.Empty, responseMessage, physicalAddress, request); + } + } + + private async ValueTask PrepareRequestForProxyAsync( + DocumentServiceRequest request, + Uri physicalAddress, + Uri thinClientEndpoint, + string globalDatabaseAccountName, + ClientCollectionCache clientCollectionCache) + { + HttpRequestMessage requestMessage = base.PrepareRequestMessageAsync(request, physicalAddress).Result; + requestMessage.Version = new Version(2, 0); + + BufferProviderWrapper bufferProviderWrapper = this.bufferProviderWrapperPool.Get(); + try + { + PartitionKeyRange partitionKeyRange = request.RequestContext?.ResolvedPartitionKeyRange; + + if (partitionKeyRange != null) + { + requestMessage.Headers.TryAddWithoutValidation( + ThinClientConstants.ProxyStartEpk, + partitionKeyRange?.MinInclusive); + + requestMessage.Headers.TryAddWithoutValidation( + ThinClientConstants.ProxyEndEpk, + partitionKeyRange?.MaxExclusive); + } + + requestMessage.Headers.TryAddWithoutValidation( + ThinClientConstants.ProxyOperationType, + request.OperationType.ToOperationTypeString()); + + requestMessage.Headers.TryAddWithoutValidation( + ThinClientConstants.ProxyResourceType, + request.ResourceType.ToResourceTypeString()); + + Stream contentStream = await ThinClientTransportSerializer.SerializeProxyRequestAsync( + bufferProviderWrapper, + globalDatabaseAccountName, + clientCollectionCache, + requestMessage); + + if (!contentStream.CanSeek) + { + throw new InvalidOperationException( + $"The serializer returned a non-seekable stream ({contentStream.GetType().FullName})."); + } + + requestMessage.Content = new StreamContent(contentStream); + requestMessage.Content.Headers.ContentLength = contentStream.Length; + + requestMessage.RequestUri = thinClientEndpoint; + requestMessage.Method = HttpMethod.Post; + + return requestMessage; + } + finally + { + this.bufferProviderWrapperPool.Return(bufferProviderWrapper); + } + } + + private Task InvokeClientAsync( + DocumentServiceRequest request, + ResourceType resourceType, + Uri physicalAddress, + Uri thinClientEndpoint, + string globalDatabaseAccountName, + ClientCollectionCache clientCollectionCache, + CancellationToken cancellationToken) + { + DefaultTrace.TraceInformation("In {0}, OperationType: {1}, ResourceType: {2}", nameof(ThinClientStoreClient), request.OperationType, request.ResourceType); + return base.httpClient.SendHttpAsync( + () => this.PrepareRequestForProxyAsync(request, physicalAddress, thinClientEndpoint, globalDatabaseAccountName, clientCollectionCache), + resourceType, + HttpTimeoutPolicy.GetTimeoutPolicy(request, isThinClientEnabled: true), + request.RequestContext.ClientRequestStatistics, + cancellationToken, + request); + } + + internal class ObjectPool + { + private readonly ConcurrentBag Objects; + private readonly Func ObjectGenerator; + + public ObjectPool(Func objectGenerator) + { + this.ObjectGenerator = objectGenerator ?? throw new ArgumentNullException(nameof(objectGenerator)); + this.Objects = new ConcurrentBag(); + } + + public T Get() + { + return this.Objects.TryTake(out T item) ? item : this.ObjectGenerator(); + } + + public void Return(T item) + { + this.Objects.Add(item); + } + } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/ThinClientStoreModel.cs b/Microsoft.Azure.Cosmos/src/ThinClientStoreModel.cs new file mode 100644 index 0000000000..d9e8867625 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/ThinClientStoreModel.cs @@ -0,0 +1,165 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos +{ + using System; + using System.Net; + using System.Threading; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos.Core.Trace; + using Microsoft.Azure.Cosmos.Routing; + using Microsoft.Azure.Documents; + using Newtonsoft.Json; + + /// + /// An IStoreModelExtension implementation that routes operations through the ThinClient proxy. + /// It applies session tokens, resolves partition key ranges, and delegates requests to ThinClientStoreClient. + /// + internal class ThinClientStoreModel : GatewayStoreModel + { + private ThinClientStoreClient thinClientStoreClient; + + public ThinClientStoreModel( + GlobalEndpointManager endpointManager, + GlobalPartitionEndpointManager globalPartitionEndpointManager, + ISessionContainer sessionContainer, + ConsistencyLevel defaultConsistencyLevel, + DocumentClientEventSource eventSource, + JsonSerializerSettings serializerSettings, + CosmosHttpClient httpClient) + : base(endpointManager, + sessionContainer, + defaultConsistencyLevel, + eventSource, + serializerSettings, + httpClient, + globalPartitionEndpointManager) + { + this.thinClientStoreClient = new ThinClientStoreClient( + httpClient, + eventSource, + serializerSettings); + } + + public override async Task ProcessMessageAsync( + DocumentServiceRequest request, + CancellationToken cancellationToken = default) + { + if (!ThinClientStoreModel.IsOperationSupportedByThinClient(request)) + { + return await base.ProcessMessageAsync(request, cancellationToken); + } + + await GatewayStoreModel.ApplySessionTokenAsync( + request, + base.defaultConsistencyLevel, + base.sessionContainer, + base.partitionKeyRangeCache, + base.clientCollectionCache, + base.endpointManager); + + DocumentServiceResponse response; + try + { + Uri physicalAddress = ThinClientStoreClient.IsFeedRequest(request.OperationType) ? base.GetFeedUri(request) : base.GetEntityUri(request); + if (request.ResourceType.Equals(ResourceType.Document) && base.endpointManager.TryGetLocationForGatewayDiagnostics( + request.RequestContext.LocationEndpointToRoute, + out string regionName)) + { + request.RequestContext.RegionName = regionName; + } + + AccountProperties properties = await this.GetDatabaseAccountPropertiesAsync(); + response = await this.thinClientStoreClient.InvokeAsync( + request, + request.ResourceType, + physicalAddress, + this.endpointManager.ResolveThinClientEndpoint(request), + properties.Id, + base.clientCollectionCache, + cancellationToken); + } + catch (DocumentClientException exception) + { + if ((!ReplicatedResourceClient.IsMasterResource(request.ResourceType)) && + (exception.StatusCode == HttpStatusCode.PreconditionFailed || exception.StatusCode == HttpStatusCode.Conflict + || (exception.StatusCode == HttpStatusCode.NotFound && exception.GetSubStatus() != SubStatusCodes.ReadSessionNotAvailable))) + { + await base.CaptureSessionTokenAndHandleSplitAsync( + exception.StatusCode, + exception.GetSubStatus(), + request, + exception.Headers); + } + + throw; + } + + await this.CaptureSessionTokenAndHandleSplitAsync( + response.StatusCode, + response.SubStatusCode, + request, + response.Headers); + + return response; + } + + public static bool IsOperationSupportedByThinClient( + DocumentServiceRequest request) + { + // Thin proxy supports the following operations for Document resources. + return request.ResourceType == ResourceType.Document + && (request.OperationType == OperationType.Batch + || request.OperationType == OperationType.Patch + || request.OperationType == OperationType.Create + || request.OperationType == OperationType.Read + || request.OperationType == OperationType.Upsert + || request.OperationType == OperationType.Replace + || request.OperationType == OperationType.Delete + || request.OperationType == OperationType.Query); + } + + private async Task GetDatabaseAccountPropertiesAsync() + { + try + { + AccountProperties accountProperties = await this.endpointManager.GetDatabaseAccountAsync(); + + if (accountProperties != null) + { + return accountProperties; + } + + throw new InvalidOperationException("Failed to retrieve AccountProperties. The response was null."); + } + catch (Exception ex) + { + DefaultTrace.TraceError("Exception while retrieving database account information: {0}", ex.Message); + throw; + } + } + + protected override void Dispose(bool disposing) + { + if (disposing) + { + if (this.thinClientStoreClient != null) + { + try + { + this.thinClientStoreClient.Dispose(); + } + catch (Exception exception) + { + DefaultTrace.TraceWarning("Exception {0} thrown during dispose of HttpClient, this could happen if there are inflight request during the dispose of client", + exception.Message); + } + this.thinClientStoreClient = null; + } + } + base.Dispose(disposing); + } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/ThinClientTransportSerializer.cs b/Microsoft.Azure.Cosmos/src/ThinClientTransportSerializer.cs new file mode 100644 index 0000000000..bb5e6536f9 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/ThinClientTransportSerializer.cs @@ -0,0 +1,279 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos +{ + using System; + using System.Buffers; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos.Routing; + using Microsoft.Azure.Cosmos.Tracing; + using Microsoft.Azure.Documents; + using Microsoft.Azure.Documents.Collections; + + /// + /// A static helper class providing serialization and deserialization + /// of requests/responses to and from the RNTBD protocol for the ThinClient scenario. + /// + internal static class ThinClientTransportSerializer + { + public sealed class BufferProviderWrapper + { + internal BufferProvider Provider { get; set; } = new (); + } + + /// + /// Serialize the Proxy request to the RNTBD protocol format. + /// Today this takes the HttprequestMessage and reconstructs the DSR. + /// If the SDK can push properties to the HttpRequestMessage then the handler above having + /// the DSR can allow us to push that directly to the serialization. + /// + public static async Task SerializeProxyRequestAsync( + BufferProviderWrapper bufferProvider, + string accountName, + ClientCollectionCache clientCollectionCache, + HttpRequestMessage requestMessage) + { + // Skip this and use the original DSR. + OperationType operationType = (OperationType)Enum.Parse(typeof(OperationType), requestMessage.Headers.GetValues(ThinClientConstants.ProxyOperationType).First()); + ResourceType resourceType = (ResourceType)Enum.Parse(typeof(ResourceType), requestMessage.Headers.GetValues(ThinClientConstants.ProxyResourceType).First()); + + Guid activityId = Guid.Parse(requestMessage.Headers.GetValues(HttpConstants.HttpHeaders.ActivityId).First()); + + Stream requestStream = null; + if (requestMessage.Content != null) + { + requestStream = await requestMessage.Content.ReadAsStreamAsync(); + } + + RequestNameValueCollection dictionaryCollection = new RequestNameValueCollection(); + foreach (KeyValuePair> header in requestMessage.Headers) + { + dictionaryCollection.Set(header.Key, string.Join(",", header.Value)); + } + + using DocumentServiceRequest request = new ( + operationType, + resourceType, + requestMessage.RequestUri.PathAndQuery, + requestStream, + AuthorizationTokenType.PrimaryMasterKey, + dictionaryCollection); + + ContainerProperties collection = await clientCollectionCache.ResolveCollectionAsync( + request, + CancellationToken.None, + NoOpTrace.Singleton); + + if (operationType.IsPointOperation()) + { + string partitionKey = request.Headers.Get(HttpConstants.HttpHeaders.PartitionKey); + + if (string.IsNullOrEmpty(partitionKey)) + { + throw new InternalServerErrorException(); + } + + string epk = GetEffectivePartitionKeyHash(partitionKey, collection.PartitionKey); + + request.Properties = new Dictionary + { + { ThinClientConstants.EffectivePartitionKey, HexStringUtility.HexStringToBytes(epk) } + }; + } + else if (request.Headers[ThinClientConstants.ProxyStartEpk] != null) + { + // Re-add EPK headers removed by RequestInvokerHandler through Properties + request.Properties = new Dictionary + { + { WFConstants.BackendHeaders.StartEpkHash, HexStringUtility.HexStringToBytes(request.Headers[ThinClientConstants.ProxyStartEpk]) }, + { WFConstants.BackendHeaders.EndEpkHash, HexStringUtility.HexStringToBytes(request.Headers[ThinClientConstants.ProxyEndEpk]) } + }; + + request.Headers.Add(HttpConstants.HttpHeaders.ReadFeedKeyType, RntbdConstants.RntdbReadFeedKeyType.EffectivePartitionKeyRange.ToString()); + request.Headers.Add(HttpConstants.HttpHeaders.StartEpk, request.Headers[ThinClientConstants.ProxyStartEpk]); + request.Headers.Add(HttpConstants.HttpHeaders.EndEpk, request.Headers[ThinClientConstants.ProxyEndEpk]); + } + request.ResourceId = collection.ResourceId; + request.Headers.Add(WFConstants.BackendHeaders.CollectionRid, collection.ResourceId); + + await request.EnsureBufferedBodyAsync(); + + using Documents.Rntbd.TransportSerialization.SerializedRequest serializedRequest = + Documents.Rntbd.TransportSerialization.BuildRequestForProxy( + request, + new ResourceOperation(operationType, resourceType), + activityId, + bufferProvider.Provider, + accountName, + accountName, + out _, + out _); + + int length = serializedRequest.RequestSize; + byte[] buffer = ArrayPool.Shared.Rent(length); + try + { + await serializedRequest.CopyToStreamAsync(new MemoryStream(buffer, 0, length, true, true)); + + return new MemoryStream(buffer, 0, length, writable: false, publiclyVisible: false); + } + catch + { + ArrayPool.Shared.Return(buffer); + throw; + } + } + + public static string GetEffectivePartitionKeyHash(string partitionJson, PartitionKeyDefinition partitionKeyDefinition) + { + return Documents.PartitionKey.FromJsonString(partitionJson).InternalKey.GetEffectivePartitionKeyString(partitionKeyDefinition); + } + + /// + /// Deserialize the Proxy Response from the RNTBD protocol format to the Http format needed by the caller. + /// Today this takes the HttpResponseMessage and reconstructs the modified Http response. + /// + public static async Task ConvertProxyResponseAsync(HttpResponseMessage responseMessage) + { + using Stream responseStream = await responseMessage.Content.ReadAsStreamAsync(); + + (StatusCodes status, byte[] metadata) = await ThinClientTransportSerializer.ReadHeaderAndMetadataAsync(responseStream); + + if (responseMessage.StatusCode != (HttpStatusCode)status) + { + throw new InternalServerErrorException($"Status code mismatch: Expected {(int)status}, but received {(int)responseMessage.StatusCode}."); + } + + Rntbd.BytesDeserializer bytesDeserializer = new Rntbd.BytesDeserializer(metadata, metadata.Length); + if (!Documents.Rntbd.HeadersTransportSerialization.TryParseMandatoryResponseHeaders(ref bytesDeserializer, out bool payloadPresent, out _)) + { + throw new InternalServerErrorException("Response metadata length mismatch: Unable to parse mandatory headers."); + } + + MemoryStream bodyStream = null; + if (payloadPresent) + { + int length = await ThinClientTransportSerializer.ReadBodyLengthAsync(responseStream); + bodyStream = new MemoryStream(length); + await responseStream.CopyToAsync(bodyStream); + bodyStream.Position = 0; + } + + // TODO(Perf): Clean this up. + bytesDeserializer = new Rntbd.BytesDeserializer(metadata, metadata.Length); + StoreResponse storeResponse = Documents.Rntbd.TransportSerialization.MakeStoreResponse( + status, + Guid.NewGuid(), + bodyStream, + HttpConstants.Versions.CurrentVersion, + ref bytesDeserializer); + + HttpResponseMessage response = new HttpResponseMessage((HttpStatusCode)storeResponse.StatusCode) + { + RequestMessage = responseMessage.RequestMessage + }; + + if (bodyStream != null) + { + response.Content = new StreamContent(bodyStream); + } + + foreach (string header in storeResponse.Headers.Keys()) + { + if (header == HttpConstants.HttpHeaders.SessionToken) + { + string newSessionToken = storeResponse.PartitionKeyRangeId + ":" + storeResponse.Headers.Get(header); + response.Headers.TryAddWithoutValidation(header, newSessionToken); + } + else + { + response.Headers.TryAddWithoutValidation(header, storeResponse.Headers.Get(header)); + } + } + + response.Headers.TryAddWithoutValidation(ThinClientConstants.RoutedViaProxy, "1"); + return response; + } + + private static async Task<(StatusCodes, byte[] metadata)> ReadHeaderAndMetadataAsync(Stream stream) + { + byte[] header = ArrayPool.Shared.Rent(24); + const int headerLength = 24; + try + { + int headerRead = 0; + while (headerRead < headerLength) + { + int read = await stream.ReadAsync(header, headerRead, headerLength - headerRead); + if (read == 0) + { + throw new DocumentClientException("Unexpected read empty bytes", HttpStatusCode.Gone, SubStatusCodes.Unknown); + } + headerRead += read; + } + + uint totalLength = BitConverter.ToUInt32(header, 0); + StatusCodes status = (StatusCodes)BitConverter.ToUInt32(header, 4); + + if (totalLength < headerLength) + { + throw new InternalServerErrorException("Header length mismatch: Total length is smaller than expected."); + } + + int metadataLength = (int)totalLength - headerLength; + byte[] metadata = new byte[metadataLength]; + int responseMetadataRead = 0; + while (responseMetadataRead < metadataLength) + { + int read = await stream.ReadAsync(metadata, responseMetadataRead, metadataLength - responseMetadataRead); + if (read == 0) + { + throw new DocumentClientException("Unexpected read empty bytes", HttpStatusCode.Gone, SubStatusCodes.Unknown); + } + + responseMetadataRead += read; + } + + return (status, metadata); + } + finally + { + ArrayPool.Shared.Return(header); + } + } + + private static async Task ReadBodyLengthAsync(Stream stream) + { + byte[] header = ArrayPool.Shared.Rent(4); + const int headerLength = 4; + try + { + int headerRead = 0; + while (headerRead < headerLength) + { + int read = await stream.ReadAsync(header, headerRead, headerLength - headerRead); + if (read == 0) + { + throw new DocumentClientException("Unexpected read empty bytes", HttpStatusCode.Gone, SubStatusCodes.Unknown); + } + + headerRead += read; + } + + return BitConverter.ToInt32(header, 0); + } + finally + { + ArrayPool.Shared.Return(header); + } + } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/TimerWheel/TimerWheelCore.cs b/Microsoft.Azure.Cosmos/src/TimerWheel/TimerWheelCore.cs index ff68dbd5cf..697c9aab90 100644 --- a/Microsoft.Azure.Cosmos/src/TimerWheel/TimerWheelCore.cs +++ b/Microsoft.Azure.Cosmos/src/TimerWheel/TimerWheelCore.cs @@ -144,7 +144,7 @@ public void OnTimer(object stateInfo) } catch (Exception ex) { - DefaultTrace.TraceWarning($"TimerWheel: OnTimer error : {ex.Message}\n, stack: {ex.StackTrace}"); + DefaultTrace.TraceWarning($"TimerWheel: OnTimer error : {ex.Message}"); } finally { diff --git a/Microsoft.Azure.Cosmos/src/Tracing/TraceData/TraceDatumKeys.cs b/Microsoft.Azure.Cosmos/src/Tracing/TraceData/TraceDatumKeys.cs new file mode 100644 index 0000000000..8aa4b11629 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Tracing/TraceData/TraceDatumKeys.cs @@ -0,0 +1,17 @@ +// ------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// ------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Tracing.TraceData +{ + internal static class TraceDatumKeys + { + public const string ClientSideRequestStats = "Client Side Request Stats"; + public const string TransportRequest = "Microsoft.Azure.Documents.ServerStoreModel Transport Request"; + public const string GetCosmosElementResponse = "Get Cosmos Element Response"; + public const string QueryMetrics = "Query Metrics"; + public const string QueryResponseSerialization = "Query Response Serialization"; + public const string FeedResponseSerialization = "Feed Response Serialization"; + public const string ChangeFeedResponseSerialization = "ChangeFeed Response Serialization"; + } +} diff --git a/Microsoft.Azure.Cosmos/src/Tracing/TraceWriter.TraceJsonWriter.cs b/Microsoft.Azure.Cosmos/src/Tracing/TraceWriter.TraceJsonWriter.cs index b13a1e545b..f3880a517c 100644 --- a/Microsoft.Azure.Cosmos/src/Tracing/TraceWriter.TraceJsonWriter.cs +++ b/Microsoft.Azure.Cosmos/src/Tracing/TraceWriter.TraceJsonWriter.cs @@ -11,7 +11,8 @@ namespace Microsoft.Azure.Cosmos.Tracing using System.Net.Http; using System.Text; using Microsoft.Azure.Cosmos.Json; - using Microsoft.Azure.Cosmos.Tracing.TraceData; + using Microsoft.Azure.Cosmos.Tracing.TraceData; + using Microsoft.Azure.Cosmos.Util; using Microsoft.Azure.Documents; internal static partial class TraceWriter @@ -394,7 +395,7 @@ public void Visit(StoreResult storeResult) this.jsonWriter.WriteStringValue(storeResult.StatusCode.ToString()); this.jsonWriter.WriteFieldName(nameof(storeResult.SubStatusCode)); - this.jsonWriter.WriteStringValue(storeResult.SubStatusCode.ToString()); + this.jsonWriter.WriteStringValue(SubStatusMappingUtil.GetSubStatusCodeString(storeResult.StatusCode, storeResult.SubStatusCode)); this.jsonWriter.WriteFieldName(nameof(storeResult.LSN)); this.jsonWriter.WriteNumberValue(storeResult.LSN); diff --git a/Microsoft.Azure.Cosmos/src/UserAgentContainer.cs b/Microsoft.Azure.Cosmos/src/UserAgentContainer.cs index d91aa8b3fb..ae9e3d4457 100644 --- a/Microsoft.Azure.Cosmos/src/UserAgentContainer.cs +++ b/Microsoft.Azure.Cosmos/src/UserAgentContainer.cs @@ -29,6 +29,17 @@ public UserAgentContainer( this.Suffix = suffix ?? string.Empty; } + public void AppendFeatures( + string features) + { + if (!string.IsNullOrEmpty(features)) + { + this.Suffix = string.IsNullOrEmpty(this.Suffix) + ? features + : $"{features}|{this.Suffix}"; + } + } + internal override string BaseUserAgent => this.cosmosBaseUserAgent ?? string.Empty; protected virtual void GetEnvironmentInformation( diff --git a/Microsoft.Azure.Cosmos/src/Util/ConfigurationManager.cs b/Microsoft.Azure.Cosmos/src/Util/ConfigurationManager.cs index 40f48b555d..9cb151ab3a 100644 --- a/Microsoft.Azure.Cosmos/src/Util/ConfigurationManager.cs +++ b/Microsoft.Azure.Cosmos/src/Util/ConfigurationManager.cs @@ -22,6 +22,46 @@ internal static class ConfigurationManager /// internal static readonly string PartitionLevelFailoverEnabled = "AZURE_COSMOS_PARTITION_LEVEL_FAILOVER_ENABLED"; + /// + /// A read-only string containing the environment variable name for enabling per partition circuit breaker. The default value + /// for this flag is false. + /// + internal static readonly string PartitionLevelCircuitBreakerEnabled = "AZURE_COSMOS_CIRCUIT_BREAKER_ENABLED"; + + /// + /// A read-only string containing the environment variable name for capturing the stale partition refresh task interval time + /// in seconds. The default value for this interval is 60 seconds. + /// + internal static readonly string StalePartitionUnavailabilityRefreshIntervalInSeconds = "AZURE_COSMOS_PPCB_STALE_PARTITION_UNAVAILABILITY_REFRESH_INTERVAL_IN_SECONDS"; + + /// + /// A read-only string containing the environment variable name for capturing the unavailability duration applicable for a failed partition + /// before the partition can be considered for a refresh by the background task. + /// + internal static readonly string AllowedPartitionUnavailabilityDurationInSeconds = "AZURE_COSMOS_PPCB_ALLOWED_PARTITION_UNAVAILABILITY_DURATION_IN_SECONDS"; + + /// + /// Environment variable name to enable thin client mode. + /// + internal static readonly string ThinClientModeEnabled = "AZURE_COSMOS_THIN_CLIENT_ENABLED"; + + /// + /// Environment variable to override AAD scope. + /// + internal static readonly string AADScopeOverride = "AZURE_COSMOS_AAD_SCOPE_OVERRIDE"; + + /// + /// A read-only string containing the environment variable name for capturing the consecutive failure count for reads, before triggering per partition + /// circuit breaker flow. The default value for this interval is 10 consecutive requests within 1 min window. + /// + internal static readonly string CircuitBreakerConsecutiveFailureCountForReads = "AZURE_COSMOS_PPCB_CONSECUTIVE_FAILURE_COUNT_FOR_READS"; + + /// + /// A read-only string containing the environment variable name for capturing the consecutive failure count for writes, before triggering per partition + /// circuit breaker flow. The default value for this interval is 10 consecutive requests within 1 min window. + /// + internal static readonly string CircuitBreakerConsecutiveFailureCountForWrites = "AZURE_COSMOS_PPCB_CONSECUTIVE_FAILURE_COUNT_FOR_WRITES"; + /// /// Environment variable name for overriding optimistic direct execution of queries. /// @@ -30,13 +70,27 @@ internal static class ConfigurationManager /// /// Environment variable name to disable sending non streaming order by query feature flag to the gateway. /// - internal static readonly string NonStreamingOrderByQueryFeatureDisabled = "AZURE_COSMOS_NON_STREAMING_ORDER_BY_FLAG_DISABLED"; + internal static readonly string HybridSearchQueryPlanOptimizationDisabled = "AZURE_COSMOS_HYBRID_SEARCH_QUERYPLAN_OPTIMIZATION_DISABLED"; /// /// Environment variable name to enable distributed query gateway mode. /// internal static readonly string DistributedQueryGatewayModeEnabled = "AZURE_COSMOS_DISTRIBUTED_QUERY_GATEWAY_ENABLED"; + /// + /// intent is If a client specify a value, we will force it to be atleast 100ms, otherwise default is going to be 500ms + /// + internal static readonly string MinInRegionRetryTimeForWritesInMs = "AZURE_COSMOS_SESSION_TOKEN_MISMATCH_IN_REGION_RETRY_TIME_IN_MILLISECONDS"; + internal static readonly int DefaultMinInRegionRetryTimeForWritesInMs = 500; + internal static readonly int MinMinInRegionRetryTimeForWritesInMs = 100; + + /// + /// intent is If a client specify a value, we will force it to be atleast 1, otherwise default is going to be 1(right now both the values are 1 but we have the provision to change them in future). + /// + internal static readonly string MaxRetriesInLocalRegionWhenRemoteRegionPreferred = "AZURE_COSMOS_MAX_RETRIES_IN_LOCAL_REGION_WHEN_REMOTE_REGION_PREFERRED"; + internal static readonly int DefaultMaxRetriesInLocalRegionWhenRemoteRegionPreferred = 1; + internal static readonly int MinMaxRetriesInLocalRegionWhenRemoteRegionPreferred = 1; + /// /// A read-only string containing the environment variable name for enabling binary encoding. This will eventually /// be removed once binary encoding is enabled by default for both preview @@ -44,6 +98,13 @@ internal static class ConfigurationManager /// internal static readonly string BinaryEncodingEnabled = "AZURE_COSMOS_BINARY_ENCODING_ENABLED"; + /// + /// A read-only string containing the environment variable name for enabling binary encoding. This will eventually + /// be removed once binary encoding is enabled by default for both preview + /// and GA. + /// + internal static readonly string TcpChannelMultiplexingEnabled = "AZURE_COSMOS_TCP_CHANNEL_MULTIPLEX_ENABLED"; + public static T GetEnvironmentVariable(string variable, T defaultValue) { string value = Environment.GetEnvironmentVariable(variable); @@ -54,6 +115,26 @@ public static T GetEnvironmentVariable(string variable, T defaultValue) return (T)Convert.ChangeType(value, typeof(T)); } + public static int GetMaxRetriesInLocalRegionWhenRemoteRegionPreferred() + { + return Math.Max( + ConfigurationManager + .GetEnvironmentVariable( + variable: MaxRetriesInLocalRegionWhenRemoteRegionPreferred, + defaultValue: DefaultMaxRetriesInLocalRegionWhenRemoteRegionPreferred), + MinMaxRetriesInLocalRegionWhenRemoteRegionPreferred); + } + + public static TimeSpan GetMinRetryTimeInLocalRegionWhenRemoteRegionPreferred() + { + return TimeSpan.FromMilliseconds(Math.Max( + ConfigurationManager + .GetEnvironmentVariable( + variable: MinInRegionRetryTimeForWritesInMs, + defaultValue: DefaultMinInRegionRetryTimeForWritesInMs), + MinMinInRegionRetryTimeForWritesInMs)); + } + /// /// Gets the boolean value of the replica validation environment variable. Note that, replica validation /// is enabled by default for the preview package and disabled for GA at the moment. The user can set the @@ -95,6 +176,116 @@ public static bool IsPartitionLevelFailoverEnabled( defaultValue: defaultValue); } + /// + /// Gets the boolean value indicating whether the thin client mode is enabled based on the environment variable override. + /// + /// A boolean field containing the default value for thin client mode. + /// A boolean flag indicating if thin client mode is enabled. + public static bool IsThinClientEnabled( + bool defaultValue) + { + return ConfigurationManager + .GetEnvironmentVariable( + variable: ConfigurationManager.ThinClientModeEnabled, + defaultValue: defaultValue); + } + + /// + /// Gets the AAD scope value to override. + /// + /// Emoty string for AAD scope if no scope value is provided. + /// AAD scope value. + public static string AADScopeOverrideValue( + string defaultValue) + { + return ConfigurationManager + .GetEnvironmentVariable( + variable: ConfigurationManager.AADScopeOverride, + defaultValue: defaultValue); + } + + /// + /// Gets the boolean value of the partition level circuit breaker environment variable. Note that, partition level + /// circuit breaker is disabled by default for both preview and GA releases. The user can set the respective + /// environment variable 'AZURE_COSMOS_PARTITION_LEVEL_CIRCUIT_BREAKER_ENABLED' to override the value for both preview and GA. + /// + /// A boolean field containing the default value for partition level circuit breaker. + /// A boolean flag indicating if partition level circuit breaker is enabled. + public static bool IsPartitionLevelCircuitBreakerEnabled( + bool defaultValue) + { + return ConfigurationManager + .GetEnvironmentVariable( + variable: ConfigurationManager.PartitionLevelCircuitBreakerEnabled, + defaultValue: defaultValue); + } + + /// + /// Gets the interval time in seconds for refreshing stale partition unavailability. + /// The default value for this interval is 60 seconds. The user can set the respective + /// environment variable 'AZURE_COSMOS_PPCB_STALE_PARTITION_UNAVAILABILITY_REFRESH_INTERVAL_IN_SECONDS' + /// to override the value. + /// + /// An integer containing the default value for the refresh interval in seconds. + /// An integer representing the refresh interval in seconds. + public static int GetStalePartitionUnavailabilityRefreshIntervalInSeconds( + int defaultValue) + { + return ConfigurationManager + .GetEnvironmentVariable( + variable: ConfigurationManager.StalePartitionUnavailabilityRefreshIntervalInSeconds, + defaultValue: defaultValue); + } + + /// + /// Gets the allowed partition unavailability duration in seconds. + /// The default value for this duration is 5 seconds. The user can set the respective + /// environment variable 'AZURE_COSMOS_PPCB_ALLOWED_PARTITION_UNAVAILABILITY_DURATION_IN_SECONDS' + /// to override the value. + /// + /// An integer containing the default unavailability duration in seconds. + /// An integer representing the allowed partition unavailability duration in seconds. + public static int GetAllowedPartitionUnavailabilityDurationInSeconds( + int defaultValue) + { + return ConfigurationManager + .GetEnvironmentVariable( + variable: ConfigurationManager.AllowedPartitionUnavailabilityDurationInSeconds, + defaultValue: defaultValue); + } + + /// + /// Gets the consecutive failure count for reads before triggering the per partition circuit breaker flow. + /// The default value for this interval is 10 consecutive requests within a 1-minute window. + /// The user can set the respective environment variable 'AZURE_COSMOS_PPCB_CONSECUTIVE_FAILURE_COUNT_FOR_READS' to override the value. + /// + /// An integer containing the default value for the consecutive failure count. + /// An integer representing the consecutive failure count for reads. + public static int GetCircuitBreakerConsecutiveFailureCountForReads( + int defaultValue) + { + return ConfigurationManager + .GetEnvironmentVariable( + variable: ConfigurationManager.CircuitBreakerConsecutiveFailureCountForReads, + defaultValue: defaultValue); + } + + /// + /// Gets the consecutive failure count for writes (applicable for multi master accounts) before triggering + /// the per partition circuit breaker flow. The default value for this interval is 5 consecutive requests within a 1-minute window. + /// The user can set the respective environment variable 'AZURE_COSMOS_PPCB_CONSECUTIVE_FAILURE_COUNT_FOR_WRITES' to override the value. + /// + /// An integer containing the default value for the consecutive failure count. + /// An integer representing the consecutive failure count for writes. + public static int GetCircuitBreakerConsecutiveFailureCountForWrites( + int defaultValue) + { + return ConfigurationManager + .GetEnvironmentVariable( + variable: ConfigurationManager.CircuitBreakerConsecutiveFailureCountForWrites, + defaultValue: defaultValue); + } + /// /// Gets the boolean value indicating whether optimistic direct execution is enabled based on the environment variable override. /// @@ -108,15 +299,15 @@ public static bool IsOptimisticDirectExecutionEnabled( } /// - /// Gets the boolean value indicating whether the non streaming order by query feature flag should be sent to the gateway + /// Gets the boolean value indicating whether the hybrid search query plan optimization feature flag should be sent to the gateway /// based on the environment variable override. /// - public static bool IsNonStreamingOrderByQueryFeatureDisabled( + public static bool IsHybridSearchQueryPlanOptimizationDisabled( bool defaultValue) { return ConfigurationManager .GetEnvironmentVariable( - variable: NonStreamingOrderByQueryFeatureDisabled, + variable: HybridSearchQueryPlanOptimizationDisabled, defaultValue: defaultValue); } @@ -148,5 +339,18 @@ public static bool IsBinaryEncodingEnabled() variable: ConfigurationManager.BinaryEncodingEnabled, defaultValue: defaultValue); } + + /// + /// Gets the boolean value indicating if channel multiplexing enabled on TCP channel. + /// Default: false + /// + /// A boolean flag indicating if channel multiplexing is enabled. + public static bool IsTcpChannelMultiplexingEnabled() + { + return ConfigurationManager + .GetEnvironmentVariable( + variable: ConfigurationManager.TcpChannelMultiplexingEnabled, + defaultValue: false); + } } } diff --git a/Microsoft.Azure.Cosmos/src/Util/Extensions.cs b/Microsoft.Azure.Cosmos/src/Util/Extensions.cs index aaeaaecba7..244fb0d8a1 100644 --- a/Microsoft.Azure.Cosmos/src/Util/Extensions.cs +++ b/Microsoft.Azure.Cosmos/src/Util/Extensions.cs @@ -138,7 +138,7 @@ internal static ResponseMessage ToCosmosResponseMessage(this DocumentClientExcep subStatusCode: cosmosException.Headers.SubStatusCode, responseTimeUtc: DateTime.UtcNow, requestCharge: cosmosException.Headers.RequestCharge, - errorMessage: documentClientException.ToString(), + errorMessage: documentClientException?.Message, method: requestMessage?.Method, requestUri: requestMessage?.RequestUriString, requestSessionToken: requestMessage?.Headers?.Session, @@ -160,7 +160,9 @@ internal static ResponseMessage ToCosmosResponseMessage(this DocumentClientExcep if (requestMessage != null) { requestMessage.Properties.Remove(nameof(DocumentClientException)); +#pragma warning disable CDX1000 // DontConvertExceptionToObject requestMessage.Properties.Add(nameof(DocumentClientException), documentClientException); +#pragma warning restore CDX1000 // DontConvertExceptionToObject } return responseMessage; @@ -202,21 +204,19 @@ private static void TraceExceptionInternal(Exception exception) if (exception is SocketException socketException) { DefaultTrace.TraceWarning( - "Exception {0}: RequesteUri: {1}, SocketErrorCode: {2}, {3}, {4}", + "Exception {0}: RequesteUri: {1}, SocketErrorCode: {2}, {3}", exception.GetType(), requestUri, socketException.SocketErrorCode, - exception.Message, - exception.StackTrace); + exception.Message); } else { DefaultTrace.TraceWarning( - "Exception {0}: RequestUri: {1}, {2}, {3}", + "Exception {0}: RequestUri: {1}, {2}", exception.GetType(), requestUri, - exception.Message, - exception.StackTrace); + exception.Message); } exception = exception.InnerException; diff --git a/Microsoft.Azure.Cosmos/src/Util/ServicePointAccessor.cs b/Microsoft.Azure.Cosmos/src/Util/ServicePointAccessor.cs index 6816eb015a..dee3ea2d11 100644 --- a/Microsoft.Azure.Cosmos/src/Util/ServicePointAccessor.cs +++ b/Microsoft.Azure.Cosmos/src/Util/ServicePointAccessor.cs @@ -1,4 +1,4 @@ -//------------------------------------------------------------ +//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ @@ -15,7 +15,7 @@ namespace Microsoft.Azure.Cosmos internal class ServicePointAccessor { // WebAssembly detection - private static readonly bool IsBrowser = RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER")) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("WEBASSEMBLY")); + public static readonly bool IsSupported = !(RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER")) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("WEBASSEMBLY"))); private readonly ServicePoint servicePoint; @@ -54,7 +54,7 @@ private void TryDisableUseNagleAlgorithm() private void TrySetConnectionLimit(int connectionLimit) { - if (ServicePointAccessor.IsBrowser) + if (!ServicePointAccessor.IsSupported) { // Workaround for WebAssembly. // WebAssembly currently throws a SynchronizationLockException and not a PlatformNotSupportedException. diff --git a/Microsoft.Azure.Cosmos/src/Util/SubStatusMappingUtil.cs b/Microsoft.Azure.Cosmos/src/Util/SubStatusMappingUtil.cs new file mode 100644 index 0000000000..46fe1790d3 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Util/SubStatusMappingUtil.cs @@ -0,0 +1,123 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ +namespace Microsoft.Azure.Cosmos.Util +{ + using Microsoft.Azure.Documents; + + /// + /// Utility for correctly mapping duplicate SubStatus codes. + /// + internal class SubStatusMappingUtil + { + public static string GetSubStatusCodeString(StatusCodes statusCode, SubStatusCodes subStatusCode) + { + if ((int)subStatusCode == 1002) + { + return statusCode == StatusCodes.NotFound + ? nameof(SubStatusCodes.ReadSessionNotAvailable) + : nameof(SubStatusCodes.PartitionKeyRangeGone); + } + + if ((int)subStatusCode == 2001) + { + return statusCode == StatusCodes.NoContent + ? nameof(SubStatusCodes.MissedTargetLsn) + : nameof(SubStatusCodes.SplitIsDisabled); + } + + if ((int)subStatusCode == 2002) + { + return statusCode == StatusCodes.NoContent + ? nameof(SubStatusCodes.MissedTargetLsnOver100) + : nameof(SubStatusCodes.CollectionsInPartitionGotUpdated); + } + + if ((int)subStatusCode == 2003) + { + return statusCode == StatusCodes.NoContent + ? nameof(SubStatusCodes.MissedTargetLsnOver1000) + : nameof(SubStatusCodes.CanNotAcquirePKRangesLock); + } + + if ((int)subStatusCode == 2004) + { + return statusCode == StatusCodes.NoContent + ? nameof(SubStatusCodes.MissedTargetLsnOver10000) + : nameof(SubStatusCodes.ResourceNotFound); + } + + if ((int)subStatusCode == 2011) + { + return statusCode == StatusCodes.NoContent + ? nameof(SubStatusCodes.MissedTargetGlobalCommittedLsn) + : nameof(SubStatusCodes.StorageSplitConflictingWithNWayThroughputSplit); + } + + if ((int)subStatusCode == 2012) + { + return statusCode == StatusCodes.NoContent + ? nameof(SubStatusCodes.MissedTargetGlobalCommittedLsnOver100) + : nameof(SubStatusCodes.MergeIsDisabled); + } + + if ((int)subStatusCode == 1004) + { + return statusCode == StatusCodes.BadRequest + ? nameof(SubStatusCodes.CrossPartitionQueryNotServable) + : nameof(SubStatusCodes.ConfigurationNameNotFound); + } + + if ((int)subStatusCode == 1007) + { + return statusCode == StatusCodes.Gone + ? nameof(SubStatusCodes.CompletingSplit) + : nameof(SubStatusCodes.InsufficientBindablePartitions); + } + + if ((int)subStatusCode == 1008) + { + return statusCode == StatusCodes.Gone + ? nameof(SubStatusCodes.CompletingPartitionMigration) + : nameof(SubStatusCodes.DatabaseAccountNotFound); + } + + if ((int)subStatusCode == 1005) + { + return statusCode == StatusCodes.NotFound + ? nameof(SubStatusCodes.ConfigurationPropertyNotFound) + : nameof(SubStatusCodes.ProvisionLimitReached); + } + + if ((int)subStatusCode == 3207) + { + return statusCode == StatusCodes.Conflict + ? nameof(SubStatusCodes.ConfigurationNameAlreadyExists) + : nameof(SubStatusCodes.PrepareTimeLimitExceeded); + } + + if ((int)subStatusCode == 6001) + { + return statusCode == StatusCodes.ServiceUnavailable + ? nameof(SubStatusCodes.AggregatedHealthStateError) + : nameof(SubStatusCodes.PartitionMigrationWaitForFullSyncReceivedInternalServerErrorDuringCompleteMigrationFromBackend); + } + + if ((int)subStatusCode == 6002) + { + return statusCode == StatusCodes.ServiceUnavailable + ? nameof(SubStatusCodes.ApplicationHealthStateError) + : nameof(SubStatusCodes.PartitionMigrationWaitForFullSyncReceivedInternalServerErrorDuringAbortMigrationFromBackend); + } + + if ((int)subStatusCode == 6003) + { + return statusCode == StatusCodes.ServiceUnavailable + ? nameof(SubStatusCodes.HealthStateError) + : nameof(SubStatusCodes.PartitionMigrationFinalizeMigrationsDidNotCompleteInTenRetries); + } + + return subStatusCode.ToString(); + } + } +} diff --git a/Microsoft.Azure.Cosmos/src/WebExceptionRetryPolicy.cs b/Microsoft.Azure.Cosmos/src/WebExceptionRetryPolicy.cs index be02f3391f..1c65c9310d 100644 --- a/Microsoft.Azure.Cosmos/src/WebExceptionRetryPolicy.cs +++ b/Microsoft.Azure.Cosmos/src/WebExceptionRetryPolicy.cs @@ -56,7 +56,7 @@ public Task ShouldRetryAsync( this.currentBackoffSeconds *= WebExceptionRetryPolicy.backoffMultiplier; } - DefaultTrace.TraceWarning("Received retriable web exception, will retry, {0}", exception); + DefaultTrace.TraceWarning("Received retriable web exception, will retry, {0}", exception.Message); return Task.FromResult(ShouldRetryResult.RetryAfter(backoffTime)); } diff --git a/Microsoft.Azure.Cosmos/src/direct/AddressEnumerator.cs b/Microsoft.Azure.Cosmos/src/direct/AddressEnumerator.cs index 852c2ef92a..034105d983 100644 --- a/Microsoft.Azure.Cosmos/src/direct/AddressEnumerator.cs +++ b/Microsoft.Azure.Cosmos/src/direct/AddressEnumerator.cs @@ -4,6 +4,7 @@ namespace Microsoft.Azure.Documents { using System; + using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using static Microsoft.Azure.Documents.HttpConstants; @@ -32,7 +33,7 @@ private static int GenerateNextRandom(int start, int maxValue) /// This return a random order of the addresses if there are no addresses that failed. Else it moves the failes addresses to the end. /// public IEnumerable GetTransportAddresses(IReadOnlyList transportAddressUris, - Lazy> failedEndpoints, + Lazy> failedEndpoints, bool replicaAddressValidationEnabled) { if (failedEndpoints == null) @@ -205,10 +206,10 @@ private static void Swap( /// A list of ordered by the replica health statuses. private static IEnumerable ReorderReplicasByHealthStatus( IEnumerable randomPermutation, - Lazy> lazyFailedReplicasPerRequest, + Lazy> lazyFailedReplicasPerRequest, bool replicaAddressValidationEnabled) { - HashSet failedReplicasPerRequest = null; + ConcurrentDictionary failedReplicasPerRequest = null; if (lazyFailedReplicasPerRequest != null && lazyFailedReplicasPerRequest.IsValueCreated && lazyFailedReplicasPerRequest.Value.Count > 0) @@ -241,7 +242,7 @@ private static IEnumerable ReorderReplicasByHealthStatus( /// The reordered list of . private static IEnumerable ReorderAddressesWhenReplicaValidationEnabled( IEnumerable addresses, - HashSet failedReplicasPerRequest) + ConcurrentDictionary failedReplicasPerRequest) { List failedReplicas = null, pendingReplicas = null; foreach (TransportAddressUri transportAddressUri in addresses) @@ -294,7 +295,7 @@ private static IEnumerable ReorderAddressesWhenReplicaValid /// The reordered list of . private static IEnumerable MoveFailedReplicasToTheEnd( IEnumerable addresses, - HashSet failedReplicasPerRequest) + ConcurrentDictionary failedReplicasPerRequest) { List failedReplicas = null; foreach (TransportAddressUri transportAddressUri in addresses) @@ -324,6 +325,7 @@ private static IEnumerable MoveFailedReplicasToTheEnd( } } } +#pragma warning disable SA1507 // Code should not contain multiple blank lines in a row #pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved @@ -334,11 +336,14 @@ private static IEnumerable MoveFailedReplicasToTheEnd( /// A set containing the failed endpoints. /// An instance of indicating the effective health status of the address. private static TransportAddressHealthState.HealthStatus GetEffectiveStatus( +#pragma warning restore SA1507 // Code should not contain multiple blank lines in a row #pragma warning restore CS1574 // XML comment has cref attribute that could not be resolved +#pragma warning disable SA1114 // Parameter list should follow declaration TransportAddressUri addressUri, - HashSet failedEndpoints) +#pragma warning restore SA1114 // Parameter list should follow declaration + ConcurrentDictionary failedEndpoints) { - if (failedEndpoints != null && failedEndpoints.Contains(addressUri)) + if (failedEndpoints != null && failedEndpoints.ContainsKey(addressUri)) { return TransportAddressHealthState.HealthStatus.Unhealthy; } diff --git a/Microsoft.Azure.Cosmos/src/direct/AddressSelector.cs b/Microsoft.Azure.Cosmos/src/direct/AddressSelector.cs index cc93f88b18..d7039b826f 100644 --- a/Microsoft.Azure.Cosmos/src/direct/AddressSelector.cs +++ b/Microsoft.Azure.Cosmos/src/direct/AddressSelector.cs @@ -73,13 +73,13 @@ public void StartBackgroundAddressRefresh(DocumentServiceRequest request) if (task.IsFaulted) { DefaultTrace.TraceWarning( - "Background refresh of the addresses failed with {0}", task.Exception.ToString()); + "Background refresh of the addresses failed with {0}", task.Exception?.Message); } }); } catch (Exception exception) { - DefaultTrace.TraceWarning("Background refresh of the addresses failed with {0}", exception.ToString()); + DefaultTrace.TraceWarning("Background refresh of the addresses failed with {0}", exception.Message); } } } diff --git a/Microsoft.Azure.Cosmos/src/direct/Azure.Core/AppContextSwitchHelper.cs b/Microsoft.Azure.Cosmos/src/direct/AppContextSwitchHelper.cs similarity index 97% rename from Microsoft.Azure.Cosmos/src/direct/Azure.Core/AppContextSwitchHelper.cs rename to Microsoft.Azure.Cosmos/src/direct/AppContextSwitchHelper.cs index ccef18f40c..58c75dd5b9 100644 --- a/Microsoft.Azure.Cosmos/src/direct/Azure.Core/AppContextSwitchHelper.cs +++ b/Microsoft.Azure.Cosmos/src/direct/AppContextSwitchHelper.cs @@ -1,47 +1,47 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -// This File is copied from Azure.Core repo i.e. https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/src/Shared/AppContextSwitchHelper.cs - -#nullable enable -#if NETSTANDARD2_0_OR_GREATER -namespace Azure.Core -{ - using System; - /// - /// Helper for interacting with AppConfig settings and their related Environment variable settings. - /// - internal static class AppContextSwitchHelper - { - /// - /// Determines if either an AppContext switch or its corresponding Environment Variable is set - /// - /// Name of the AppContext switch. - /// Name of the Environment variable. - /// If the AppContext switch has been set, returns the value of the switch. - /// If the AppContext switch has not been set, returns the value of the environment variable. - /// False if neither is set. - /// - public static bool GetConfigValue(string appContexSwitchName, string environmentVariableName) - { - // First check for the AppContext switch, giving it priority over the environment variable. - if (AppContext.TryGetSwitch(appContexSwitchName, out bool value)) - { - return value; - } - // AppContext switch wasn't used. Check the environment variable. - string? envVar = Environment.GetEnvironmentVariable(environmentVariableName); - if (envVar != null - && (envVar.Equals("true", StringComparison.OrdinalIgnoreCase) - || envVar.Equals("1", StringComparison.OrdinalIgnoreCase))) - { - return true; - } - - // Default to false. - return false; - } - } -} +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +// This File is copied from Azure.Core repo i.e. https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/src/Shared/AppContextSwitchHelper.cs + +#nullable enable +#if NETSTANDARD2_0_OR_GREATER +namespace Azure.Core +{ + using System; + /// + /// Helper for interacting with AppConfig settings and their related Environment variable settings. + /// + internal static class AppContextSwitchHelper + { + /// + /// Determines if either an AppContext switch or its corresponding Environment Variable is set + /// + /// Name of the AppContext switch. + /// Name of the Environment variable. + /// If the AppContext switch has been set, returns the value of the switch. + /// If the AppContext switch has not been set, returns the value of the environment variable. + /// False if neither is set. + /// + public static bool GetConfigValue(string appContexSwitchName, string environmentVariableName) + { + // First check for the AppContext switch, giving it priority over the environment variable. + if (AppContext.TryGetSwitch(appContexSwitchName, out bool value)) + { + return value; + } + // AppContext switch wasn't used. Check the environment variable. + string? envVar = Environment.GetEnvironmentVariable(environmentVariableName); + if (envVar != null + && (envVar.Equals("true", StringComparison.OrdinalIgnoreCase) + || envVar.Equals("1", StringComparison.OrdinalIgnoreCase))) + { + return true; + } + + // Default to false. + return false; + } + } +} #endif \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/direct/AssemblyKeys.cs b/Microsoft.Azure.Cosmos/src/direct/AssemblyKeys.cs new file mode 100644 index 0000000000..13b42b17a0 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/direct/AssemblyKeys.cs @@ -0,0 +1,16 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ +namespace Microsoft.Azure.Cosmos.Direct +{ + internal static class AssemblyKeys + { + internal const string ProductPublicKey = ", PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9"; + + internal const string TestPublicKey = ", PublicKey=0024000004800000940000000602000000240000525341310004000001000100197c25d0a04f73cb271e8181dba1c0c713df8deebb25864541a66670500f34896d280484b45fe1ff6c29f2ee7aa175d8bcbd0c83cc23901a894a86996030f6292ce6eda6e6f3e6c74b3c5a3ded4903c951e6747e6102969503360f7781bf8bf015058eb89b7621798ccc85aaca036ff1bc1556bb7f62de15908484886aa8bbae"; + + internal const string MoqPublicKey = ", PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7"; + + internal const string FakesPublicKey = ", PublicKey=0024000004800000940000000602000000240000525341310004000001000100e92decb949446f688ab9f6973436c535bf50acd1fd580495aae3f875aa4e4f663ca77908c63b7f0996977cb98fcfdb35e05aa2c842002703cad835473caac5ef14107e3a7fae01120a96558785f48319f66daabc862872b2c53f5ac11fa335c0165e202b4c011334c7bc8f4c4e570cf255190f4e3e2cbc9137ca57cb687947bc"; + } +} diff --git a/Microsoft.Azure.Cosmos/src/direct/BackoffRetryUtility.cs b/Microsoft.Azure.Cosmos/src/direct/BackoffRetryUtility.cs index 2def57999c..bbbd972915 100644 --- a/Microsoft.Azure.Cosmos/src/direct/BackoffRetryUtility.cs +++ b/Microsoft.Azure.Cosmos/src/direct/BackoffRetryUtility.cs @@ -220,7 +220,7 @@ private static async Task ExecuteRetryAsync( catch (Exception ex) { elapsed = stopwatch.Elapsed; - DefaultTrace.TraceInformation("Failed inBackoffAlternateCallback with {0}, proceeding with retry. Time taken: {1}ms", ex.ToString(), elapsed.TotalMilliseconds); + DefaultTrace.TraceInformation("Failed inBackoffAlternateCallback with {0}, proceeding with retry. Time taken: {1}ms", ex.Message, elapsed.TotalMilliseconds); } backoffTime = result.BackoffTime > elapsed ? result.BackoffTime - elapsed : TimeSpan.Zero; diff --git a/Microsoft.Azure.Cosmos/src/direct/BarrierRequestHelper.cs b/Microsoft.Azure.Cosmos/src/direct/BarrierRequestHelper.cs index 1737ade2d9..94780811e0 100644 --- a/Microsoft.Azure.Cosmos/src/direct/BarrierRequestHelper.cs +++ b/Microsoft.Azure.Cosmos/src/direct/BarrierRequestHelper.cs @@ -28,7 +28,8 @@ public static async Task CreateAsync( DocumentServiceRequest request, IAuthorizationTokenProvider authorizationTokenProvider, long? targetLsn, - long? targetGlobalCommittedLsn) + long? targetGlobalCommittedLsn, + bool includeRegionContext = false) { bool isCollectionHeadRequest = BarrierRequestHelper.IsCollectionHeadBarrierRequest(request.ResourceType, request.OperationType); @@ -61,7 +62,9 @@ public static async Task CreateAsync( headers: null, authorizationTokenType: originalRequestTokenType); } +#pragma warning disable SA1108 else if (request.IsNameBased) // Name based server request +#pragma warning restore SA1108 { // get the collection full name // dbs/{id}/colls/{collid}/ @@ -73,7 +76,9 @@ public static async Task CreateAsync( originalRequestTokenType, null); } +#pragma warning disable SA1108 else // RID based Server request +#pragma warning restore SA1108 { barrierLsnRequest = DocumentServiceRequest.Create( OperationType.Head, @@ -154,6 +159,18 @@ await authorizationTokenProvider.AddSystemAuthorizationHeaderAsync( barrierLsnRequest.Headers[WFConstants.BackendHeaders.CollectionRid] = request.Headers[WFConstants.BackendHeaders.CollectionRid]; } + if (includeRegionContext) + { + if (request.RequestContext.LocationEndpointToRoute != null) + { + barrierLsnRequest.RequestContext.RouteToLocation(request.RequestContext.LocationEndpointToRoute); + } + else if (request.RequestContext.LocationIndexToRoute.HasValue) + { + barrierLsnRequest.RequestContext.RouteToLocation(request.RequestContext.LocationIndexToRoute.Value, false); + } + } + if (request.Properties != null && request.Properties.ContainsKey(WFConstants.BackendHeaders.EffectivePartitionKeyString)) { if (barrierLsnRequest.Properties == null) diff --git a/Microsoft.Azure.Cosmos/src/direct/Channel.cs b/Microsoft.Azure.Cosmos/src/direct/Channel.cs index 32d52d2e7d..6cb35b1b88 100644 --- a/Microsoft.Azure.Cosmos/src/direct/Channel.cs +++ b/Microsoft.Azure.Cosmos/src/direct/Channel.cs @@ -216,7 +216,7 @@ public async Task RequestAsync( catch (Exception e) { DefaultTrace.TraceError( - "[RNTBD Channel {0}] Failed to serialize request. Assuming malformed request payload: {1}", this.ConnectionCorrelationId, e); + "[RNTBD Channel {0}] Failed to serialize request. Assuming malformed request payload: {1}", this.ConnectionCorrelationId, e.Message); DocumentClientException clientException = new BadRequestException(e); clientException.Headers.Add( HttpConstants.HttpHeaders.RequestValidationFailure, "1"); @@ -464,7 +464,7 @@ private async Task InitializeAsync(Guid activityId, Func { Trace.CorrelationManager.ActivityId = activityId; - Debug.Assert(task.IsFaulted); - Debug.Assert(task.Exception != null); - Exception e = task.Exception.InnerException; - DefaultTrace.TraceInformation( - "[RNTBD Channel {0}] Timed out task completed. Activity ID = {1}. HRESULT = {2:X}. Exception: {3}", - connectionCorrelationId, activityId, e.HResult, e); + + if (task.IsFaulted && task.Exception != null) + { + Exception e = task.Exception.InnerException; + DefaultTrace.TraceInformation( + "[RNTBD Channel {0}] Timed out task completed with fault. Activity ID = {1}. HRESULT = {2:X}. Exception: {3}", + connectionCorrelationId, activityId, e?.HResult, e?.Message); + } + else if (task.IsCanceled) + { + DefaultTrace.TraceInformation( + "[RNTBD Channel {0}] Timed out task completed with cancellation. Activity ID = {1}.", + connectionCorrelationId, activityId); + } }, - TaskContinuationOptions.OnlyOnFaulted); + TaskContinuationOptions.NotOnRanToCompletion); // Captures both faulted and canceled states } private enum State diff --git a/Microsoft.Azure.Cosmos/src/direct/ChannelDictionary.cs b/Microsoft.Azure.Cosmos/src/direct/ChannelDictionary.cs index aebd505a96..1ed3f210ef 100644 --- a/Microsoft.Azure.Cosmos/src/direct/ChannelDictionary.cs +++ b/Microsoft.Azure.Cosmos/src/direct/ChannelDictionary.cs @@ -15,7 +15,9 @@ internal sealed class ChannelDictionary : IChannelDictionary, IDisposable private readonly ChannelProperties channelProperties; private bool disposed = false; +#pragma warning disable IDE0044 // Add readonly modifier private ConcurrentDictionary channels = +#pragma warning restore IDE0044 // Add readonly modifier new ConcurrentDictionary(); private readonly IChaosInterceptor chaosInterceptor; diff --git a/Microsoft.Azure.Cosmos/src/direct/ClientSideRequestStatistics.cs b/Microsoft.Azure.Cosmos/src/direct/ClientSideRequestStatistics.cs index 11117f3318..a691285ae1 100644 --- a/Microsoft.Azure.Cosmos/src/direct/ClientSideRequestStatistics.cs +++ b/Microsoft.Azure.Cosmos/src/direct/ClientSideRequestStatistics.cs @@ -21,16 +21,30 @@ internal sealed class ClientSideRequestStatistics : IClientSideRequestStatistics private const int MaxSupplementalRequestsForToString = 10; private static bool enableCpuMonitorFlag; +#pragma warning disable IDE0044 // Add readonly modifier private DateTime requestStartTime; +#pragma warning restore IDE0044 // Add readonly modifier private DateTime? requestEndTime; +#pragma warning disable IDE0044 // Add readonly modifier private object lockObject = new object(); +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private object requestEndTimeLock = new object(); +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private List responseStatisticsList; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private List supplementalResponseStatisticsList; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private Dictionary addressResolutionStatistics; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private Lazy> httpResponseStatisticsList; +#pragma warning restore IDE0044 // Add readonly modifier private SystemUsageHistory systemUsageHistory; static ClientSideRequestStatistics() @@ -281,7 +295,7 @@ private void UpdateSystemUsageHistory() { DefaultTrace.TraceCritical( "System usage monitor failed with an unexpected exception: {0}", - ex); + ex.Message); } } } @@ -533,4 +547,8 @@ public void AppendToBuilder(StringBuilder stringBuilder) } } } -} \ No newline at end of file +#pragma warning disable SA1518 // Use line endings correctly at end of file +} + + +#pragma warning restore SA1518 // Use line endings correctly at end of file \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/direct/ComputedProperty.cs b/Microsoft.Azure.Cosmos/src/direct/ComputedProperty.cs index 22f57fc7d3..56bb137a0a 100644 --- a/Microsoft.Azure.Cosmos/src/direct/ComputedProperty.cs +++ b/Microsoft.Azure.Cosmos/src/direct/ComputedProperty.cs @@ -72,6 +72,7 @@ internal override void Validate() /// /// Clones a ComputedProperty object /// + /// public object Clone() { return new ComputedProperty diff --git a/Microsoft.Azure.Cosmos/src/direct/Connection.cs b/Microsoft.Azure.Cosmos/src/direct/Connection.cs index 6495964c2c..7904dc4647 100644 --- a/Microsoft.Azure.Cosmos/src/direct/Connection.cs +++ b/Microsoft.Azure.Cosmos/src/direct/Connection.cs @@ -27,7 +27,7 @@ namespace Microsoft.Azure.Documents.Rntbd // Connection encapsulates the TCP connection to one back-end, and all surrounding // mechanisms (SSL stream, connection state). - internal sealed class Connection : IDisposable + internal sealed class Connection : IConnection, IDisposable { private const int ResponseLengthByteLimit = int.MaxValue; @@ -456,7 +456,7 @@ public bool IsActive(out TimeSpan timeToIdle) /// /// A boolean flag indicating if the request is completed successfully. /// An optional boolean flag indicating if the current operation is read-only in nature. - internal void NotifyConnectionStatus( + public void NotifyConnectionStatus( bool isCompleted, bool isReadRequest = false) { @@ -605,7 +605,7 @@ private async Task OpenSocketAsync(ChannelOpenArguments args) DefaultTrace.TraceInformation( "[RNTBD Connection {0}] Connection.OpenSocketAsync failed. Converting to TransportException. " + - "Connection: {1}. Inner exception: {2}", this.connectionCorrelationId, this, ex); + "Connection: {1}. Inner exception: {2}", this.connectionCorrelationId, this, ex.Message); Debug.Assert(errorCode != TransportErrorCode.Unknown); Debug.Assert(!args.CommonArguments.UserPayload); Debug.Assert(!args.CommonArguments.PayloadSent); @@ -658,7 +658,7 @@ await sslStream.AuthenticateAsClientAsync(host, clientCertificates: null, { DefaultTrace.TraceInformation( "[RNTBD Connection {0}] Connection.NegotiateSslAsync failed. Converting to TransportException. " + - "Connection: {1}. Inner exception: {2}", this.connectionCorrelationId, this, ex); + "Connection: {1}. Inner exception: {2}", this.connectionCorrelationId, this, ex.Message); Debug.Assert(!args.CommonArguments.UserPayload); Debug.Assert(!args.CommonArguments.PayloadSent); throw new TransportException( @@ -993,6 +993,7 @@ await Connection.ConnectReuseAddrAsync( /// Used unless internal clients provide a version that might override decision to use IPv6 addresses. /// /// + /// private static Task ResolveHostIncludingIPv6AddressesAsync(string hostName) => Connection.ResolveHostAsync(hostName, includeIPv6Addresses: true); internal static async Task ResolveHostAsync(string hostName, bool includeIPv6Addresses) @@ -1052,7 +1053,7 @@ private static void EnableTcpKeepAlive(Socket clientSocket, Guid connectionCorre } catch (Exception e) { - DefaultTrace.TraceWarning("[RNTBD Connection {0}] IOControl(KeepAliveValues) failed: {1}", connectionCorrelationId, e); + DefaultTrace.TraceWarning("[RNTBD Connection {0}] IOControl(KeepAliveValues) failed: {1}", connectionCorrelationId, e.Message); // Ignore the exception. } } @@ -1147,7 +1148,7 @@ private static void SetReuseUnicastPort(Socket clientSocket, Guid connectionCorr } catch (Exception e) { - DefaultTrace.TraceWarning("[RNTBD Connection {0}] SetSocketOption(Socket, ReuseUnicastPort) failed: {1}", connectionCorrelationId, e); + DefaultTrace.TraceWarning("[RNTBD Connection {0}] SetSocketOption(Socket, ReuseUnicastPort) failed: {1}", connectionCorrelationId, e.Message); // Ignore the exception. } } diff --git a/Microsoft.Azure.Cosmos/src/direct/ConnectionHealthChecker.cs b/Microsoft.Azure.Cosmos/src/direct/ConnectionHealthChecker.cs index 85a7dea4ce..de1eac5e09 100644 --- a/Microsoft.Azure.Cosmos/src/direct/ConnectionHealthChecker.cs +++ b/Microsoft.Azure.Cosmos/src/direct/ConnectionHealthChecker.cs @@ -23,9 +23,10 @@ internal sealed class ConnectionHealthChecker private const int MinNumberOfSendsSinceLastReceiveForUnhealthyConnection = 3; /// - /// A boolean field indicating if the aggressive timeout detection is enabled. + /// A boolean field indicating if the aggressive timeout detection is enabled. The default value for this flag + /// is `True`. /// - private const bool AggressiveTimeoutDetectionEnabledDefaultValue = false; + private const bool AggressiveTimeoutDetectionEnabledDefaultValue = true; /// /// A constant integer defining the default value for aggressive timeout detection time limit in seconds. diff --git a/Microsoft.Azure.Cosmos/src/direct/ConnectionStateMuxListener.cs b/Microsoft.Azure.Cosmos/src/direct/ConnectionStateMuxListener.cs index fdddbfe4e8..14602af689 100644 --- a/Microsoft.Azure.Cosmos/src/direct/ConnectionStateMuxListener.cs +++ b/Microsoft.Azure.Cosmos/src/direct/ConnectionStateMuxListener.cs @@ -12,10 +12,11 @@ namespace Microsoft.Azure.Documents using System.Threading.Tasks; using Microsoft.Azure.Cosmos.Core.Trace; using Microsoft.Azure.Documents.Rntbd; - + #pragma warning disable CS1570 // XML comment has badly formed XML #pragma warning disable CS1570 // XML comment has badly formed XML #pragma warning disable CS1570 // XML comment has badly formed XML +#pragma warning disable CS1584 // XML comment has syntactically incorrect cref attribute /// /// ConnectionStateListener listens to the connection reset event notification fired by the transport client /// and refreshes the Document client's address cache @@ -28,6 +29,7 @@ namespace Microsoft.Azure.Documents /// /// control the number of concurrent notifications or calles to the registered handlers /// - Default: Environment.ProcessorCount + /// - Can be set through /// - ZERO: no notifications will be sent /// /// can be used in conjunction with this listener @@ -48,6 +50,7 @@ namespace Microsoft.Azure.Documents /// - Task scheduler contention /// internal sealed class ConnectionStateMuxListener : IConnectionStateListener +#pragma warning restore CS1584 // XML comment has syntactically incorrect cref attribute #pragma warning restore CS1570 // XML comment has badly formed XML #pragma warning restore CS1570 // XML comment has badly formed XML #pragma warning restore CS1570 // XML comment has badly formed XML @@ -59,10 +62,12 @@ internal sealed class ConnectionStateMuxListener : IConnectionStateListener public ConnectionStateMuxListener(bool enableTcpConnectionEndpointRediscovery) { - // Default to the processor count +#pragma warning disable CS1587 // XML comment has badly formed XML + /// Default to the processor count this.notificationConcurrency = Environment.ProcessorCount; this.notificationSemaphore = new SemaphoreSlim(this.notificationConcurrency); this.enableTcpConnectionEndpointRediscovery = enableTcpConnectionEndpointRediscovery; +#pragma warning restore CS1587 // XML comment has badly formed XML } public void SetConnectionEventConcurrency(int notificationConcurrency) diff --git a/Microsoft.Azure.Cosmos/src/direct/ConsistencyReader.cs b/Microsoft.Azure.Cosmos/src/direct/ConsistencyReader.cs index 746bc7e743..6f90d9a222 100644 --- a/Microsoft.Azure.Cosmos/src/direct/ConsistencyReader.cs +++ b/Microsoft.Azure.Cosmos/src/direct/ConsistencyReader.cs @@ -138,6 +138,7 @@ internal sealed class ConsistencyReader private readonly IAuthorizationTokenProvider authorizationTokenProvider; private readonly StoreReader storeReader; private readonly QuorumReader quorumReader; + private readonly ISessionRetryOptions sessionRetryOptions; public ConsistencyReader( AddressSelector addressSelector, @@ -145,11 +146,13 @@ public ConsistencyReader( TransportClient transportClient, IServiceConfigurationReader serviceConfigReader, IAuthorizationTokenProvider authorizationTokenProvider, - bool enableReplicaValidation) + bool enableReplicaValidation, + ISessionRetryOptions sessionRetryOptions = null) { this.addressSelector = addressSelector; this.serviceConfigReader = serviceConfigReader; this.authorizationTokenProvider = authorizationTokenProvider; + this.sessionRetryOptions = sessionRetryOptions; this.storeReader = new StoreReader(transportClient, addressSelector, new AddressEnumerator(), sessionContainer, enableReplicaValidation); this.quorumReader = new QuorumReader(transportClient, addressSelector, this.storeReader, serviceConfigReader, authorizationTokenProvider); } @@ -231,9 +234,23 @@ public Task ReadAsync( case ReadMode.Any: if (targetConsistencyLevel == ConsistencyLevel.Session) { + // RequestRetryUtility vs BackoffRetryUtility: is purely for safe flighting purpose only + // Post flighting can be fully pivoted to RequestRetryUtility and remove BackoffRetryUtility below + if (entity.UseStatusCodeFor4041002 + && entity.IsValidRequestFor4041002()) + { + return RequestRetryUtility.ProcessRequestAsync( + executeAsync: () => this.ReadSessionAsync(entity, desiredReadMode), + prepareRequest: () => entity, + policy: new SessionTokenMismatchRetryPolicy( + sessionRetryOptions: this.sessionRetryOptions), + cancellationToken: cancellationToken); + } + return BackoffRetryUtility.ExecuteAsync( callbackMethod: () => this.ReadSessionAsync(entity, desiredReadMode), - retryPolicy: new SessionTokenMismatchRetryPolicy(), + retryPolicy: new SessionTokenMismatchRetryPolicy( + sessionRetryOptions: this.sessionRetryOptions), cancellationToken: cancellationToken); } else @@ -299,7 +316,12 @@ private async Task ReadSessionAsync( try { StoreResponse storeResponse = responses[0].Target.ToResponse(entity.RequestContext.RequestChargeTracker); - if (storeResponse.Status == (int)HttpStatusCode.NotFound && entity.IsValidStatusCodeForExceptionlessRetry(storeResponse.Status)) + + // UseStatusCodeFor4041002: Check is for exceptionless optimization not a functional change + // Purely for flighiting the exception less for 404-1002 only + // Post flighting below exception throwing might not be necessary + if (!entity.IsValidRequestFor4041002() + && (storeResponse.Status == (int)HttpStatusCode.NotFound && entity.IsValidStatusCodeForExceptionlessRetry(storeResponse.Status))) { if (entity.RequestContext.SessionToken != null && responses[0].Target.SessionToken != null && !entity.RequestContext.SessionToken.IsValid(responses[0].Target.SessionToken)) { diff --git a/Microsoft.Azure.Cosmos/src/direct/ConsistencyWriter.cs b/Microsoft.Azure.Cosmos/src/direct/ConsistencyWriter.cs index 126de9b10c..66c8cd4a2f 100644 --- a/Microsoft.Azure.Cosmos/src/direct/ConsistencyWriter.cs +++ b/Microsoft.Azure.Cosmos/src/direct/ConsistencyWriter.cs @@ -54,8 +54,10 @@ internal sealed class ConsistencyWriter private readonly AddressSelector addressSelector; private readonly ISessionContainer sessionContainer; private readonly IServiceConfigurationReader serviceConfigReader; + private readonly IServiceConfigurationReaderExtension serviceConfigurationReaderExtension; private readonly IAuthorizationTokenProvider authorizationTokenProvider; private readonly bool useMultipleWriteLocations; + private readonly ISessionRetryOptions sessionRetryOptions; public ConsistencyWriter( AddressSelector addressSelector, @@ -65,14 +67,17 @@ public ConsistencyWriter( IAuthorizationTokenProvider authorizationTokenProvider, bool useMultipleWriteLocations, bool enableReplicaValidation, - AccountConfigurationProperties accountConfigurationProperties) + AccountConfigurationProperties accountConfigurationProperties, + ISessionRetryOptions sessionRetryOptions = null) { this.transportClient = transportClient; this.addressSelector = addressSelector; this.sessionContainer = sessionContainer; this.serviceConfigReader = serviceConfigReader; + this.serviceConfigurationReaderExtension = serviceConfigReader as IServiceConfigurationReaderExtension; this.authorizationTokenProvider = authorizationTokenProvider; this.useMultipleWriteLocations = useMultipleWriteLocations; + this.sessionRetryOptions = sessionRetryOptions; this.storeReader = new StoreReader( transportClient, addressSelector, @@ -128,9 +133,23 @@ public async Task WriteAsync( string sessionToken = entity.Headers[HttpConstants.HttpHeaders.SessionToken]; try { + // RequestRetryUtility vs BackoffRetryUtility: is purely for safe flighting purpose only + // Post flighting can be fully pivoted to RequestRetryUtility and remove BackoffRetryUtility below + if (entity.UseStatusCodeFor4041002 + && entity.IsValidRequestFor4041002()) + { + return await RequestRetryUtility.ProcessRequestAsync( + executeAsync: () => this.WritePrivateAsync(entity, timeout, forceRefresh), + prepareRequest: () => entity, + policy: new SessionTokenMismatchRetryPolicy( + sessionRetryOptions: this.sessionRetryOptions), + cancellationToken: cancellationToken); + } + return await BackoffRetryUtility.ExecuteAsync( callbackMethod: () => this.WritePrivateAsync(entity, timeout, forceRefresh), - retryPolicy: new SessionTokenMismatchRetryPolicy(), + retryPolicy: new SessionTokenMismatchRetryPolicy( + sessionRetryOptions: this.sessionRetryOptions), cancellationToken: cancellationToken); } finally @@ -260,7 +279,7 @@ private async Task WritePrivateAsync( throw new InternalServerErrorException(); } - if (ReplicatedResourceClient.IsGlobalStrongEnabled() && this.ShouldPerformWriteBarrierForGlobalStrong(storeResult.Target, request.OperationType)) + if (ReplicatedResourceClient.IsGlobalStrongEnabled() && this.ShouldPerformWriteBarrierForGlobalStrong(storeResult.Target, request)) { long lsn = storeResult.Target.LSN; long globalCommittedLsn = storeResult.Target.GlobalCommittedLSN; @@ -279,15 +298,16 @@ private async Task WritePrivateAsync( //if necessary we would have already refreshed cache by now. request.RequestContext.ForceRefreshAddressCache = false; - DefaultTrace.TraceInformation("ConsistencyWriter: globalCommittedLsn {0}, lsn {1}", globalCommittedLsn, lsn); + DefaultTrace.TraceInformation("ConsistencyWriter: globalCommittedLsn {0}, lsn {1}, resourceType {2}, operationType {3}", globalCommittedLsn, lsn, request.ResourceType, request.OperationType); //barrier only if necessary, i.e. when write region completes write, but read regions have not. if (globalCommittedLsn < lsn) { - using (DocumentServiceRequest barrierRequest = await BarrierRequestHelper.CreateAsync(request, this.authorizationTokenProvider, null, request.RequestContext.GlobalCommittedSelectedLSN)) + using (DocumentServiceRequest barrierRequest = await BarrierRequestHelper.CreateAsync(request, this.authorizationTokenProvider, null, request.RequestContext.GlobalCommittedSelectedLSN, includeRegionContext: true)) { if (!await this.WaitForWriteBarrierAsync(barrierRequest, request.RequestContext.GlobalCommittedSelectedLSN)) { - DefaultTrace.TraceError("ConsistencyWriter: Write barrier has not been met for global strong request. SelectedGlobalCommittedLsn: {0}", request.RequestContext.GlobalCommittedSelectedLSN); + DefaultTrace.TraceError("ConsistencyWriter: Write barrier has not been met for global strong request. SelectedGlobalCommittedLsn: {0}, resourceType {1}, operationType {2}", + request.RequestContext.GlobalCommittedSelectedLSN, request.ResourceType, request.OperationType); throw new GoneException(RMResources.GlobalStrongWriteBarrierNotMet, SubStatusCodes.Server_GlobalStrongWriteBarrierNotMet); } } @@ -300,11 +320,12 @@ private async Task WritePrivateAsync( } else { - using (DocumentServiceRequest barrierRequest = await BarrierRequestHelper.CreateAsync(request, this.authorizationTokenProvider, null, request.RequestContext.GlobalCommittedSelectedLSN)) + using (DocumentServiceRequest barrierRequest = await BarrierRequestHelper.CreateAsync(request, this.authorizationTokenProvider, null, request.RequestContext.GlobalCommittedSelectedLSN, includeRegionContext: true)) { if (!await this.WaitForWriteBarrierAsync(barrierRequest, request.RequestContext.GlobalCommittedSelectedLSN)) { - DefaultTrace.TraceWarning("ConsistencyWriter: Write barrier has not been met for global strong request. SelectedGlobalCommittedLsn: {0}", request.RequestContext.GlobalCommittedSelectedLSN); + DefaultTrace.TraceWarning("ConsistencyWriter: Write barrier has not been met for global strong request. SelectedGlobalCommittedLsn: {0}, resourceType {1}, operationType {2}", + request.RequestContext.GlobalCommittedSelectedLSN, request.ResourceType, request.OperationType); throw new GoneException(RMResources.GlobalStrongWriteBarrierNotMet, SubStatusCodes.Server_GlobalStrongWriteBarrierNotMet); } } @@ -313,19 +334,48 @@ private async Task WritePrivateAsync( return request.RequestContext.GlobalStrongWriteStoreResult.Target.ToResponse(); } - internal bool ShouldPerformWriteBarrierForGlobalStrong(StoreResult storeResult, OperationType operationType) + internal bool ShouldPerformWriteBarrierForGlobalStrong( + StoreResult storeResult, + DocumentServiceRequest incomingRequest) { - if (operationType.IsSkippedForWriteBarrier()) + #if !COSMOSCLIENT + bool skipSettingStrongConsistencyHeaderForWrites = false; + + // For write requests sending the header to skip setting strong consistency header, we should not set consistency level header. + if (bool.TryParse(incomingRequest.Headers[HttpConstants.HttpHeaders.SkipSettingStrongConsistencyHeaderForWrites], out skipSettingStrongConsistencyHeaderForWrites) && + skipSettingStrongConsistencyHeaderForWrites) { return false; } + #endif + + if (incomingRequest.OperationType.IsSkippedForWriteBarrier()) + { + return false; + } + + ConsistencyLevel consistencyLevel = this.serviceConfigReader.DefaultConsistencyLevel; + if (this.serviceConfigurationReaderExtension != null && + this.serviceConfigurationReaderExtension.TryGetConsistencyLevel(incomingRequest, out ConsistencyLevel consistencyLevelOverride)) + { + // Allow overriding consistency level for specific resource type and operation type + // This is currently done for meta-data resources for PPAF enabled accounts where consistency level is overridden to Strong if account consistency is less than Strong. + // Strong consistency is crucial to avoid partial updates and ensure that operations reflect a consistent state. + DefaultTrace.TraceInformation( + "ConsistencyWriter: ConsistencyLevel is overridden from {0} to {1} for resourceType {2} and operationType {3}", + consistencyLevel, + consistencyLevelOverride, + incomingRequest.ResourceType.ToResourceTypeString(), + incomingRequest.OperationType.ToOperationTypeString()); + consistencyLevel = consistencyLevelOverride; + } if (storeResult.StatusCode < StatusCodes.StartingErrorCode || storeResult.StatusCode == StatusCodes.Conflict || (storeResult.StatusCode == StatusCodes.NotFound && storeResult.SubStatusCode != SubStatusCodes.ReadSessionNotAvailable) || storeResult.StatusCode == StatusCodes.PreconditionFailed) { - if (this.serviceConfigReader.DefaultConsistencyLevel == ConsistencyLevel.Strong && storeResult.NumberOfReadRegions > 0) + if (consistencyLevel == ConsistencyLevel.Strong && storeResult.NumberOfReadRegions > 0) { return true; } @@ -412,7 +462,9 @@ private async Task WaitForWriteBarrierNewAsync( int writeBarrierRetryCount = 0; long maxGlobalCommittedLsnReceived = 0; - while (writeBarrierRetryCount < defaultBarrierRequestDelays.Length && remainingDelay >= TimeSpan.Zero) +#pragma warning disable SA1108 + while (writeBarrierRetryCount < defaultBarrierRequestDelays.Length && remainingDelay >= TimeSpan.Zero) // Retry loop +#pragma warning restore SA1108 { barrierRequest.RequestContext.TimeoutHelper.ThrowTimeoutIfElapsed(); diff --git a/Microsoft.Azure.Cosmos/src/direct/Constants.cs b/Microsoft.Azure.Cosmos/src/direct/Constants.cs index 59d8c996cb..946477288f 100644 --- a/Microsoft.Azure.Cosmos/src/direct/Constants.cs +++ b/Microsoft.Azure.Cosmos/src/direct/Constants.cs @@ -30,9 +30,9 @@ internal static class Constants public const int Max16KBTokenBufferSize = 16 * 1024; - public const int Max64KBTokenBufferSize = 64 * 1024; + public const int Max64KBTokenBufferSize = 64 * 1024; - public const string FirewallAuthorization = "FirewallAuthorization"; + public const string FirewallAuthorization = "FirewallAuthorization"; // As per https://docs.microsoft.com/en-us/azure/storage/common/storage-redundancy // table secondary endpoint is suffixed by -secondary. @@ -160,12 +160,24 @@ public static class ReadFeedOperationNames public const string FullFidelityChangeFeed = "ChangeFeed/FullFidelity"; } + public static class FeatureNames + { + public const string Fabric = "Fabric"; + public const string Fleet = "Fleet"; + public const string Throttling = "Throttling"; + } + public static class Properties { public const string Resource = "resource"; public const string Options = "options"; + public const string CloudName = "cloudName"; public const string SubscriptionId = "subscriptionId"; public const string FabricClientEndpoints = "fabricClientEndpoints"; + public const string FeatureName = "featureName"; + public const string ConfigName = "configName"; + public const string ConfigValue = "configValue"; + public const string OwningTeam = "owningTeam"; public const string SubscriptionUsageType = "subscriptionUsageType"; public const string EnabledLocations = "enabledLocations"; public const string SubscriptionState = "subscriptionState"; @@ -232,6 +244,8 @@ public static class Properties public const string ParentFederationId = "parentFederationId"; public const string ComputeFederationId = "computeFederationId"; public const string SecondaryEndpoints = "secondaryEndpoints"; + public const string AllowInRegionSecondaryEndpointOverride = "allowInRegionSecondaryEndpointOverride"; + public const string AzureTrafficManagerEndpoint = "azureTrafficManagerEndpoint"; public const string PlacementHint = "placementHint"; public const string CreationTimestamp = "creationTimestamp"; public const string SourceCreationTimestamp = "sourceCreationTimestamp"; @@ -242,6 +256,8 @@ public static class Properties public const string ScaleUnits = "scaleUnits"; public const string Location = "location"; public const string AccessKeyKind = "accessKeyKind"; + public const string AccessKeyModificationTimestamp = "accessKeyModificationTimestamp"; + public const string AccessKeyPublicationTimestamp = "accessKeyPublicationTimestamp"; public const string ShouldBlockNextKeyRotation = "shouldBlockNextKeyRotation"; public const string EnableKeyCredentialUpdateNotification = "enableKeyCredentialUpdateNotification"; public const string Kind = "kind"; @@ -272,6 +288,8 @@ public static class Properties public const string DestinationSubscription = "destinationSubscription"; public const string TargetResourceGroup = "targetResourceGroup"; public const string ConfigurationOverrides = "configurationOverrides"; + public const string ThroughputPoolConfigurationOverrides = "throughputPoolConfigurationOverrides"; + public const string SubscriptionCapabilitiesConfigOverrides = "subscriptionCapabilitiesConfigOverrides"; public const string Name = "name"; public const string Fqdn = "fqdn"; public const string PublicIPAddressResourceName = "publicIPAddressName"; @@ -327,6 +345,7 @@ public static class Properties public const string IsFailedOver = "isFailedOver"; public const string FederationProxyReservedCname = "federationProxyReservedCname"; public const string EnableMultiMasterMigration = "enableMultiMasterMigration"; + public const string PrepareOnlyMultiMasterMigrationForDatabaseAccount = "prepareOnlyMultiMasterMigrationForDatabaseAccount"; public const string EnableNativeGridFS = "enableNativeGridFS"; public const string MongoDefaultsVersion = "mongoDefaultsVersion"; public const string ServerVersion = "serverVersion"; @@ -361,13 +380,22 @@ public static class Properties public const string EnableMigrationConcurrency = "enableMigrationConcurrency"; public const string EnableMinNoOfNodesOnTargetCheck = "enableMinNoOfNodesOnTargetCheck"; public const string ExemptedSourcesFromLocationMigrationCheck = "exemptedSourcesFromLocationMigrationCheck"; + public const string RegionalPartitionMigrationConcurrency = "regionalPartitionMigrationConcurrency"; + public const string EnableRegionalPartitionMigrationConcurrency = "enableRegionalPartitionMigrationConcurrency"; + public const string EnableDefaultProvisionOnAzureTrafficManager = "enableDefaultProvisionOnAzureTrafficManager"; + public const string RegionProximity = "regionProximity"; + public const string IgnoreVectorIndexCatchupFailureForPartitionMigration = "ignoreVectorIndexCatchupFailureForPartitionMigration"; + public const string ServiceAllocationOperationTypesToDeny = "serviceAllocationOperationTypesToDeny"; + public const string ForceDisablePhysicalCopyForMigration = "forceDisablePhysicalCopyForMigration"; public const string MasterValue = "masterValue"; public const string SecondaryValue = "secondaryValue"; public const string ArmLocation = "armLocation"; public const string SubscriptionName = "subscriptionName"; - public const string EnableNRegionSynchronousCommit = "enableNRegionSynchronousCommit"; + public const string EnableNRegionSynchronousCommit = "enableNRegionSynchronousCommit"; + + public const string TargetComputeFederationsForMigration = "targetComputeFederationsForMigration"; //Throughput Pool public const string MinThroughput = "minThroughput"; @@ -437,7 +465,6 @@ public static class Properties public const string DefaultTimeToLive = "defaultTtl"; public const string TimeToLivePropertyPath = "ttlPropertyPath"; public const string AnalyticalStorageTimeToLive = "analyticalStorageTtl"; - public const string AllowDisablingAnalytics = "AllowDisablingAnalytics"; public const string DatabasesLink = "_dbs"; public const string CollectionsLink = "_colls"; @@ -537,6 +564,8 @@ public static class Properties public const string ApiSpecificDefinition = "apiSpecificDefinition"; public const string AllowMaterializedViewsInCollectionDeleteRollForward = "allowMaterializedViewsInCollectionDeleteRollForward"; public const string MaterializedViews = "materializedViews"; + public const string EnsureMultiAZForMVBuilder = "ensureMultiAZForMVBuilder"; + public const string IncludeMaterializedViewsDuringAccountRestoreConfig = "IncludeMaterializedViewsDuringAccountRestoreConfig"; //TieredStorageCollection public const string MaterializedViewContainerType = "containerType"; @@ -613,6 +642,23 @@ public static class Properties public const string ContinuousModeProperties = "continuousModeProperties"; public const string BackupPolicyMigrationState = "migrationState"; + // LTR Backup and restore properties + public const string BackupSessionId = "backupSessionId"; + public const string BackupTimestamp = "backupTimestamp"; + public const string BackupType = "backupType"; + public const string RestoreSessionId = "restoreSessionId"; + public const string BandwidthInMegaBitsPerSecond = "bandwidthInMegaBitsPerSecond"; + public const string MinBandwidthPerContainerInMegaBitsPerSecond = "minBandwidthPerContainerInMegaBitsPerSecond"; + public const string SasUri = "sasUri"; // containerSasUri + public const string CommitBlobUri = "commitBlobUri"; // container commitBlobUri + public const string BackupStorageUnitType = "backupStorageUnitType"; + public const string BackupStorageUnits = "backupStorageUnits"; + public const string BackupStorageDetails = "backupStorageDetails"; + public const string Uri = "uri"; // blobUri + public const string BackupBlobDetails = "backupBlobDetails"; + public const string DataSourceSizeInBytes = "dataSourceSizeInBytes"; + public const string DataTransferredInBytes = "dataTransferredInBytes"; // amount of data restored or backed up + // Tiering Policy public const string CollectionTieringPolicy = "tieringPolicy"; public const string CollectionTieringType = "type"; @@ -700,6 +746,7 @@ public static class Properties public const string TableNames = "tableNames"; public const string RestoreTillEndOfLogChain = "restoreTillEndOfLogChain"; public const int TimeToleranceForRestoreTillEndOfLogChain = 1000; //ms + public const string PkRangeRidOrGeoLinkId = "pkRangeOrGeoLinkRid"; // Restore Properties public const string RestoreTimestampInUtc = "restoreTimestampInUtc"; @@ -805,10 +852,14 @@ public static class Properties public const string BitLockerKeysSettingType = "BitLockerKeysSettingType"; public const string BitLockerKeysRotationState = "BitLockerKeysRotationState"; public const string InfrastructureServices = "InfrastructureServices"; + public const string BuildoutNotes = "BuildoutNotes"; public const string SerializableResourceType = "SerializableResourceType"; public const string EnableTenantProtection = "EnableTenantProtection"; public const string IsEnabledForClusterSpanning = "IsEnabledForClusterSpanning"; public const string EnablePhysicalCopyForMigration = "EnablePhysicalCopyForMigration"; + public const string EnablePhysicalCopyForAddRegion = "EnablePhysicalCopyForAddRegion"; + public const string DisablePhysicalCopyForAddRegion = "DisablePhysicalCopyForAddRegion"; + public const string FabricManagerName = "FabricManagerName"; // Federation settings public const string AllowReutilizationOfComputeResources = "AllowReutilizationOfComputeResources"; @@ -952,6 +1003,7 @@ public static class Properties public const string OfferResourceId = "offerResourceId"; public const string OfferThroughput = "offerThroughput"; public const string OfferTargetThroughput = "offerTargetThroughput"; + public const string PartitionCount = "partitionCount"; public const string BackgroundTaskMaxAllowedThroughputPercent = "BackgroundTaskMaxAllowedThroughputPercent"; public const string OfferIsRUPerMinuteThroughputEnabled = "offerIsRUPerMinuteThroughputEnabled"; public const string OfferIsAutoScaleEnabled = "offerIsAutoScaleEnabled"; @@ -976,6 +1028,7 @@ public static class Properties public const string ThroughputBuckets = "throughputBuckets"; public const string ThroughputBucketId = "id"; public const string ThroughputBucketMaxThroughputPercentage = "maxThroughputPercentage"; + public const string isDefaultBucket = "isDefaultBucket"; public const string AutopilotTier = "tier"; public const string AutopilotTargetTier = "targetTier"; @@ -1008,7 +1061,8 @@ public static class Properties public const string EnableBurstCapacity = "enableBurstCapacity"; public const string EnableUserRateLimitingWithBursting = "enableUserRateLimitingWithBursting"; - + public const string SoftDeletionEnabled = "softDeletionEnabled"; + // Priority Based Execution can be enabled by setting the naming config enablePriorityBasedThrottling to true // When user sets EnablePriorityBasedExecution to true in an account PATCH request, enablePriorityBasedThrottling // is set to true in the account configuration overrrides @@ -1068,6 +1122,7 @@ public static class Properties public const string OperationDisplayResource = "resource"; public const string OperationDisplayOperation = "operation"; public const string OperationDisplayDescription = "description"; + public const string OperationIsDataAction = "isDataAction"; public const string PartitionKey = "partitionKey"; public const string PartitionKeyRangeId = "partitionKeyRangeId"; @@ -1185,6 +1240,10 @@ public static class Properties public const string IpRules = "ipRules"; public const string IpAddressOrRange = "ipAddressOrRange"; + // Property to check if incremental period backup is enabled for a global database account + public const string IncrementalBackupEnabled = "incrementalBackupEnabled"; + public const string IncrementalBackupEnablementTimestamp = "incrementalBackupEnablementTimestamp"; + // Property to check if point in time restore is enabled for a global database account public const string PitrEnabled = "pitrEnabled"; public const string PitrSku = "pitrSku"; @@ -1198,6 +1257,10 @@ public static class Properties // Property to check if FFCF Enabled by Collection Policy is Migrated to PITR public const string IsCollectionPolicyEnabledFFCFAccountMigratedToPITR = "IsCollectionPolicyEnabledFFCFAccountMigratedToPITR"; + // Enable to allow PITR migration of an FFCF enabled collection. + public const string AllowEnablingPITROnFFCFEnabledCollection = "allowEnablingPITROnFFCFEnabledCollection"; + public const string AllowChangeFeedPolicyRemovalDuringPITRMigrationOnFFCFEnabledCollection = "allowChangeFeedPolicyRemovalDuringPITRMigrationOnFFCFEnabledCollection"; + // Property to allow PITR disabling public const string AllowPeriodicMigration = "allowPeriodicMigration"; @@ -1209,7 +1272,6 @@ public static class Properties public const string EnableAnalyticalStorage = "enableAnalyticalStorage"; // Properties related to Autoscale billing improvements. - public const string EnableAutoscaleThroughputUtilizationReporting = "enableAutoscaleThroughputUtilizationReporting"; // Configuration to report throughput utilization for autoscale billing. public const string EnablePerRegionAutoscale = "enablePerRegionAutoscale"; //Configuration to enable PerRegion autoscale billing. public const string EnableThroughputUtilizationPersistence = "enableThroughputUtilizationPersistence"; // configuration to enable throughput utlization persistance for server replica public const string EnablePerRegionPerPartitionAutoscale = "enablePerRegionPerPartitionAutoscale"; // Property used in RP call to enable/disable the AutoscalePerRegion feature @@ -1218,13 +1280,29 @@ public static class Properties //properties to enable MaterializedViews public const string EnableMaterializedViews = "enableMaterializedViews"; //at DB account level. public const string EnableOnlyColdStorageContainersInAccountV1 = "enableOnlyColdStorageContainersInAccountV1"; + public const string EnableMaterializedViewsBuilderProvisioning = "enableMaterializedViewsBuilderProvisioning"; //properties to enable ChangeCapacityMode public const string EnableChangeCapacityMode = "enableChangeCapacityMode"; public const string LogFlushInterval = "logFlushInterval"; + public const string LogFlushIntervalForServerlessCapability = "10"; public const string BatchAcknowledgementIntervalMilliseconds = "batchAcknowledgementIntervalMilliseconds"; + public const string BatchAcknowledgementIntervalMillisecondsForServerlessCapability = "10"; public const string MaxCollections = "maxCollections"; + public const string MaxCollectionsForServerlessCapability = "maxCollectionsForServerlessCapability"; + public const string MaxCollectionsForServerlessCapabilityDefaultValue = "500"; public const string NamingConfigRefreshIntervalInSeconds = "namingConfigRefreshIntervalInSeconds"; + public const string MinCapacityModeMigrationIntervalInHours = "minCapacityModeMigrationIntervalInHours"; + public const double MinCapacityModeMigrationIntervalInHoursDefaultValue = 168; // 1 week + public const string AllowUnsupportedThroughputFeaturesWithServerless = "allowUnsupportedThroughputFeaturesWithServerless"; + public const string AllowMaxConfiguredRUPerPartitionForServerless = "allowMaxConfiguredRUPerPartitionForServerless"; + public const string MaxRetriesForServerlessOfferReplace = "maxRetriesForServerlessOfferReplace"; + public const string DelayBetweenRetriesForServerlessOfferReplaceInSeconds = "delayBetweenRetriesForServerlessOfferReplaceInSeconds"; + public const string DelayBetweenSubsequentOfferReplacesInMilliseconds = "delayBetweenSubsequentOfferReplacesInMilliseconds"; + public const string DisableOfferReplaceForProvisionedToServerless = "disableOfferReplaceForProvisionedToServerless"; + + // Account property to enable operations during offline workflow + public const string EnableAccountOperationsDuringOutage = "EnableAccountOperationsDuringOutage"; // full fidelity change feed (change feed with retention from remote+local storage) enablement + optimizations. public const string EnableFullFidelityChangeFeed = "enableFullFidelityChangeFeed"; @@ -1238,6 +1316,17 @@ public static class Properties public const string EnableFullFidelityChangeFeedSplitHandling = "EnableFullFidelityChangeFeedSplitHandling"; public const string EnableFFCFPartitionSplitArchivalCaching = "enableFFCFPartitionSplitArchivalCaching"; + //Reject Invalid Consistency Level Request + public static readonly string RejectInvalidConsistencyLevelRequests = "rejectInvalidConsistencyLevelRequests"; + +#pragma warning disable SA1203 + public const string GeoStorageAccountNames = "GeoStorageAccountNames"; +#pragma warning restore SA1203 + public const string EnableGeoBackup = "enableGeoBackup"; + public const string GeoLocation = "geoLocation"; + public const string GeoBackupEnableTimestamp = "geoBackupEnableTimestamp"; + public const string GeoBackupDisableTimestamp = "GeoBackupDisableTimestamp"; + // Enable API type check public const string EnableApiTypeCheck = "enableApiTypeCheck"; public const string EnabledApiTypesOverride = "enabledApiTypesOverride"; @@ -1267,7 +1356,7 @@ public static class Properties public const string ReadStatusRevoked = "readStatusRevoked"; public const string TopologyUpsertIntent = "topologyUpsertIntent"; public const string Intent = "intent"; - public const string IntentParamaters = "intentParamaters"; + public const string IntentParamaters = "intentParameters"; public const string RegionName = "regionName"; // Capabilities Resource @@ -1417,6 +1506,9 @@ public static class Properties // PerPartitionFailover Flags // Likely Customer Facing public const string EnablePerPartitionFailoverBehavior = "enablePerPartitionFailoverBehavior"; + public const string AllowAddRemoveRegionWithPerPartitionFailover = "allowAddRemoveRegionWithPerPartitionFailover"; + + public const string EnableAddRegionMaxPartitionConcurrencyForWaitForCatchup = "enableAddRegionMaxPartitionConcurrencyForWaitForCatchup"; // Backend public const string AccountVNETFilterEnabled = "accountVNETFilterEnabled"; @@ -1439,6 +1531,7 @@ public static class Properties public const string EnableNetworkSecurityPerimeter = "enableNetworkSecurityPerimeter"; public const string DisableNetworkSecurityPerimeter = "disableNetworkSecurityPerimeter"; public const string EnableConflictResolutionPolicyUpdate = "enableConflictResolutionPolicyUpdate"; + public const string AllowEnablingMaterializedViewsOnNonPITREnabledAccounts = "allowEnablingMaterializedViewsOnNonPITREnabledAccounts"; // VNET/Subnet Resource(Network Resource Provider) public const string IgnoreMissingVNetServiceEndpoint = "ignoreMissingVNetServiceEndpoint"; @@ -1662,7 +1755,9 @@ public static class Properties public const string EnableListPartitionsFromServerDuringMigration = "EnableListPartitionsFromServerDuringMigration"; public const string DisableDeletions = "disableDeletions"; public const string DisableSDPConfigRollout = "DisableSDPConfigRollout"; + public const string SkipAddRegionValidateDocumentCount = "skipAddRegionValidateDocumentCount"; public const string EnableConsolidatePrivateEndpointDataPlaneUpdates = "enableConsolidatePrivateEndpointDataPlaneUpdates"; + public const string SerializedLargePropertiesMap = "SerializedLargePropertiesMap"; // Data Plane Operation Policy public const string DisableKeyBasedMetadataWriteAccess = "disableKeyBasedMetadataWriteAccess"; @@ -1863,6 +1958,7 @@ public static class Properties public const string EnablePerPartitionAutomaticFailover = "enablePerPartitionAutomaticFailover"; public const string EnableFailoverManager = "enableFailoverManager"; public const string EnablePopulatingGlobalEpochTable = "enablePopulatingGlobalEpochTable"; + public const string AutomaticFailoverProperties = "automaticFailoverProperties"; // Capacity settings properties public const string Capacity = "capacity"; @@ -1964,9 +2060,13 @@ public static class Properties public const string MappedDatabaseAccountWithChildResourcesInfo = "mappedDatabaseAccountWithChildResourcesInfo"; public const string WorkspaceHasEmptyAccountSinceTimestamp = "workspaceHasEmptyAccountSinceTimestamp"; - // StorageNsp Properties + // NSP Properties + public const string AccessRuleName = "accessRuleName"; + public const string AccessRuleSubscriptionIds = "accessRuleSubscriptionIds"; public const string DefaultProfile = "defaultProfile"; public const string DefaultInboundAccessRule = "defaultInboundAccessRule"; + public const string IpAddress = "ipAddress"; + public const string ServiceTagNames = "serviceTagNames"; public const string StorageNsp = "storagensp"; public const string StorageNspProfileName = "storageNspProfileName"; public const string StorageNspAccessRuleDirectionInbound = "Inbound"; @@ -1987,6 +2087,10 @@ public static class Properties public const string SubRegionLoadMetadataList = "subRegionLoadMetadataList"; public const string ExcludeAccountFromPartitionRebalancer = "excludeFromPartitionRebalance"; + // Partition optimized placement hint + public const string ParitionOptimizedPlacementHint = "PARTITION_OPTIMIZED"; + public const string EnableServerlessCapability = "EnableServerless"; + public static class FederationOperations { public const string IsCapOperation = "isCapOperation"; @@ -2007,6 +2111,7 @@ public static class FederationCapActions public static class AzCapabilities { public const string AzEnabled = "AzEnabled"; + public const string TwoAzEnabled = "2AzEnabled"; public const string HybridAzAllocationEnabled = "HybridAzAllocationEnabled"; } @@ -2109,7 +2214,7 @@ public static class UnifiedIndexInternalMetaData public static class GatewayTransactionMetadata { public const string GatewayTransactionId = "gatewayTransactionId"; - public const string TelemetryTimestamp = "telemetryTimestamp"; + public const string TelemetryTimestamp = "telemetryTimestamp"; } public static class InternalStoreProperties @@ -2374,8 +2479,8 @@ public static class SoftDeletionMetadataProperties public const string SoftDeletionMetadata = "softDeletionMetadata"; public const string SerializedSoftDeletionMetadata = "serializedSoftDeletionMetadata"; public const string IsSoftDeleted = "isSoftDeleted"; - public const string SoftDeletionStartTimestampUtc = "softDeletionStartTimestampUtc"; - public const string SoftDeletionResourceExpirationTimestampUtc = "softDeletionResourceExpirationTimestampUtc"; + public const string SoftDeletionStartTimestamp = "softDeletionStartTimestamp"; + public const string SoftDeletionResourceExpirationTimestamp = "softDeletionResourceExpirationTimestamp"; public const string SoftDeletionEnabled = "softDeletionEnabled"; public const string SoftDeleteRetentionPeriodInMinutes = "softDeleteRetentionPeriodInMinutes"; public const string MinMinutesBeforePermanentDeletionAllowed = "minMinutesBeforePermanentDeletionAllowed"; @@ -2399,6 +2504,10 @@ public static class ManagedServiceIdentityProperties public const string FederatedClientId = "&FederatedClientId="; public const string SourceInternalId = "&SourceInternalId="; + + // for KBEF migration of "msiClientSecretEncrypted". + public const string EnableSkipMsiClientSecretEncryption = "enableSkipMsiClientSecretEncryption"; + public const string IsMsiClientSecretEncryptionSkipped = "isMsiClientSecretEncryptionSkipped"; } public static class LogStoreConstants @@ -2586,6 +2695,12 @@ public static class ReseedPartitionParameters public static string IsSharedThroughputPartition = "isSharedThroughputPartition"; } + public static class PLB + { + public const string ServiceBasedLoadBalancingType = "PartitionBased"; + public const string StorageBasedLoadBalancingType = "StorageBased"; + } + public static class MigratePartitionCallerSource { public static string Test = "Test"; @@ -2603,6 +2718,11 @@ public static class MigratePartitionCallerSource public static string FederationBuildout_CanaryAccountMigration = "FederationBuildout_CanaryAccountMigration"; public static string USER_InPlaceAZMigration = "USER_InPlaceAZMigration"; public static string ACIS_MigrateMasterBetweenZonalAndRegional = "ACIS_MigrateMasterBetweenZonalAndRegional"; +#pragma warning disable SA1310 // Field names should not contain underscore + public static string Automigrator_Decommissioning = "Automigrator_Decommissioning"; +#pragma warning restore SA1310 // Field names should not contain underscore + public static string LBaaS = "LBaaS_{0}"; + public static string DefaultExemptedSources = "ACIS_Manual,PLB_StorageBased_localRegion,PLB_StorageBased_CrossRegion,USER_InPlaceAZMigration,ACIS_CrossSubregionAccountMigration"; } public static class EnvironmentVariables @@ -2674,11 +2794,31 @@ public static class ChaosConstant public const string SupportedRegionsForInjectingFaultsConstant = "SupportedRegionsForInjectingFaultsConstant"; } + public static class RegionOutageEntityConstants + { + public const string ArmLocation = "ArmLocation"; + public const string Regions = "Regions"; + } + public static class FleetConstants { public const string FleetName = "fleetName"; + public const string FleetLocation = "fleetLocation"; + public const string FleetspaceName = "fleetspaceName"; + public const string FleetResourceId = "fleetResourceId"; + public const string FleetspaceResourceId = "fleetspaceResourceId"; public const string FleetInstanceId = "fleetInstanceId"; public const string IsThroughputPoolingEnabled = "isThroughputPoolingEnabled"; + public const string FleetspaceApiKind = "fleetspaceApiKind"; + public const string FleetUriTemplate = "/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.DocumentDB/fleets/{2}"; + public const string FleetspaceUriTemplate = "/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.DocumentDB/fleets/{2}/fleetspaces/{3}"; + public const string Fleets = "fleets"; + public const string FleetArmResourceType = Properties.CosmosResourceProvider + "/" + Fleets; + public const string GlobalDatabaseAccountFleetResponse = "globalDatabaseAccountFleetResponse"; + public const string ServiceTier = "serviceTier"; + public const string StorageLocationType = "storageLocationType"; + public const string StorageLocationUri = "storageLocationUri"; + public const string StorageLocationTenantId = "storageLocationTenantId"; } public static class BackgroundTaskNames @@ -2698,6 +2838,21 @@ public static class BackgroundTaskProperties public static class AccountPlacementProperties { public const string AccountPlacementRanking = "AccountPlacementRanking"; + public const string IsHybridAzEnabled = "IsHybridAzEnabled"; } + + public static class RegionProximity + { + public const string ConfigurationIdPrefix = "regionproximity_"; + public const string SourceRegionQueryParam = "regionproximitysourceregion"; + } + + public static class SDPConfigRolloutProperties + { + public const string DatabaseAccount = "databaseAccount"; + public const string SDPConfigRolloutName = "sdpConfigRolloutName"; + } + + public const string SkipUnnecessaryCustomCertificateValidation = "skipUnnecessaryCustomCertificateValidation"; } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/direct/CpuMonitor.cs b/Microsoft.Azure.Cosmos/src/direct/CpuMonitor.cs index f0ab408343..90f96a98a5 100644 --- a/Microsoft.Azure.Cosmos/src/direct/CpuMonitor.cs +++ b/Microsoft.Azure.Cosmos/src/direct/CpuMonitor.cs @@ -63,7 +63,7 @@ public void Start() { DefaultTrace.TraceError( "The CPU monitor refresh task failed. Exception: {0}", - t.Exception); + t.Exception?.Message); }, TaskContinuationOptions.OnlyOnFaulted); this.periodicTask.ContinueWith(t => diff --git a/Microsoft.Azure.Cosmos/src/direct/CustomNetCoreTypes.cs b/Microsoft.Azure.Cosmos/src/direct/CustomNetCoreTypes.cs new file mode 100644 index 0000000000..26d43b01c8 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/direct/CustomNetCoreTypes.cs @@ -0,0 +1,148 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Documents +{ + using System; + using System.Net.Security; + using System.Runtime.InteropServices; + +#if NETSTANDARD15 || NETSTANDARD16 + + /// + /// This is a hack to make MessageContractMemberAttribute mean nothing when compiling for .NET Standard 1.6 + /// so as to avoid adding #if/#endif around it in the StoreResponse class that uses them. + /// + internal abstract partial class MessageContractMemberAttribute : Attribute + { + public bool HasProtectionLevel { get { return default(bool); } } + + public string Name { get { return default(string); } set { } } + + public string Namespace { get { return default(string); } set { } } + + public ProtectionLevel ProtectionLevel { get { return default(ProtectionLevel); } set { } } + } + + /// + /// This is a hack to make MessageContractAttribute mean nothing when compiling for .NET Standard 1.6 + /// so as to avoid adding #if/#endif around it in the StoreResponse class that uses them. + /// + internal sealed partial class MessageContractAttribute : Attribute + { + public bool HasProtectionLevel { get { return default(bool); } } + + public bool IsWrapped { get { return default(bool); } set { } } + + public ProtectionLevel ProtectionLevel { get { return default(ProtectionLevel); } set { } } + + public string WrapperName { get { return default(string); } set { } } + + public string WrapperNamespace { get { return default(string); } set { } } + } + + /// + /// This is a hack to make MessageBodyMemberAttribute mean nothing when compiling for .NET Standard 1.6 + /// so as to avoid adding #if/#endif around it in the StoreResponse class that uses them. + /// + internal class MessageBodyMemberAttribute : MessageContractMemberAttribute + { + public int Order { get { return default(int); } set { } } + } + + /// + /// This is a hack to make MessageHeaderAttribute mean nothing when compiling for .NET Standard 1.6 + /// so as to avoid adding #if/#endif around it in the StoreResponse class that uses them. + /// + internal class MessageHeaderAttribute : MessageContractMemberAttribute + { + public string Actor { get { return default(string); } set { } } + + public bool MustUnderstand { get { return default(bool); } set { } } + + public bool Relay { get { return default(bool); } set { } } + } + + /// + /// This is a hack to add ICloneable interface as part of our namespace since it doesn't exist in .NET Standard 1.6 + /// That way we will avoid adding #if/#endif around the classes that currently implement it. Any .NET Core 1.0 app + /// will not be using this type anyways. + /// + [ComVisible(true)] + internal interface ICloneable + { + Object Clone(); + } + + /// + /// This is a hack to make Serializable attribute mean nothing when compiling for .NET Standard 1.6 + /// so as to avoid adding #if/#endif around it in the entire codebase. + /// + internal class SerializableAttribute : Attribute + { + + } + + /// + /// This replaces the use of ConfigurationErrorsException with Exception. This exception is thrown only + /// in one internal method and is not caught within our code, so it'ss safe to use Exception here. + /// + internal class ConfigurationErrorsException : Exception + { + public ConfigurationErrorsException(string message) + :base(message) + { + + } + } + + /// + /// CorrelationManager is not yet available in .NET Standard 1.6 and will be available in .NET Standard 2.0 + /// Got the source code from corefx repo and exposing it here from the Trace class. + /// + internal sealed class Trace + { + private static CorrelationManager s_correlationManager = null; + + public static CorrelationManager CorrelationManager + { + get + { + if (s_correlationManager == null) + { + s_correlationManager = new CorrelationManager(); + } + + return s_correlationManager; + } + } + } + + /// + /// Used in UriUtility class. Not available in .NET Standard 1.6 + /// + internal enum UriPartial + { + Scheme, + Authority, + Path, + Query + } +#endif + + /// + /// Dummy QueryRequestPerformanceActivity class as we don't support PerfCounters yet. + /// +#pragma warning disable SA1649 // File name should match first type name + internal class QueryRequestPerformanceActivity +#pragma warning restore SA1649 // File name should match first type name + { + public void ActivityComplete(bool markComplete) +#pragma warning disable SA1505 + { + + } +#pragma warning restore SA1505 + } +} diff --git a/Microsoft.Azure.Cosmos/src/direct/DataMaskingPolicy.cs b/Microsoft.Azure.Cosmos/src/direct/DataMaskingPolicy.cs index 8cd2d34b90..7468a946ad 100644 --- a/Microsoft.Azure.Cosmos/src/direct/DataMaskingPolicy.cs +++ b/Microsoft.Azure.Cosmos/src/direct/DataMaskingPolicy.cs @@ -64,19 +64,23 @@ public Boolean IsPolicyEnabled { get { +#pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' if (this.isPolicyEnabled == null) { this.isPolicyEnabled = base.GetValue(Constants.Properties.IsPolicyEnabled, true); } +#pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' return this.isPolicyEnabled; } set { +#pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' if (value == null) { throw new ArgumentNullException(string.Format(CultureInfo.CurrentCulture, RMResources.PropertyCannotBeNull, nameof(IsPolicyEnabled))); } +#pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' this.isPolicyEnabled = value; base.SetValue(Constants.Properties.IsPolicyEnabled, this.IsPolicyEnabled); diff --git a/Microsoft.Azure.Cosmos/src/direct/DefaultTraceEx.cs b/Microsoft.Azure.Cosmos/src/direct/DefaultTraceEx.cs index 8b633463a7..62c831585c 100644 --- a/Microsoft.Azure.Cosmos/src/direct/DefaultTraceEx.cs +++ b/Microsoft.Azure.Cosmos/src/direct/DefaultTraceEx.cs @@ -41,21 +41,19 @@ private static void TraceExceptionInternal(Exception e) if (socketException != null) { DefaultTrace.TraceWarning( - "Exception {0}: RequesteUri: {1}, SocketErrorCode: {2}, {3}, {4}", - e.GetType(), + "Exception {0}: RequesteUri: {1}, SocketErrorCode: {2}, {3}", + e?.GetType(), requestUri, socketException.SocketErrorCode, - e.Message, - e.StackTrace); + e?.Message); } else { DefaultTrace.TraceWarning( - "Exception {0}: RequestUri: {1}, {2}, {3}", - e.GetType(), + "Exception {0}: RequestUri: {1}, {2}", + e?.GetType(), requestUri, - e.Message, - e.StackTrace); + e?.Message); } e = e.InnerException; diff --git a/Microsoft.Azure.Cosmos/src/direct/DictionaryNameValueCollection.cs b/Microsoft.Azure.Cosmos/src/direct/DictionaryNameValueCollection.cs index a594d2fc4f..547cc08510 100644 --- a/Microsoft.Azure.Cosmos/src/direct/DictionaryNameValueCollection.cs +++ b/Microsoft.Azure.Cosmos/src/direct/DictionaryNameValueCollection.cs @@ -11,7 +11,9 @@ namespace Microsoft.Azure.Documents.Collections internal sealed class DictionaryNameValueCollection: INameValueCollection { +#pragma warning disable IDE0044 // Add readonly modifier private static StringComparer defaultStringComparer = StringComparer.OrdinalIgnoreCase; +#pragma warning restore IDE0044 // Add readonly modifier private readonly Dictionary dictionary; private CompositeValue nullValue; @@ -321,7 +323,9 @@ public NameValueCollection ToNameValueCollection() /// private class CompositeValue { +#pragma warning disable IDE0044 // Add readonly modifier private List values; +#pragma warning restore IDE0044 // Add readonly modifier internal CompositeValue() { diff --git a/Microsoft.Azure.Cosmos/src/direct/Dispatcher.cs b/Microsoft.Azure.Cosmos/src/direct/Dispatcher.cs index 5bdb5e43ca..47da54184f 100644 --- a/Microsoft.Azure.Cosmos/src/direct/Dispatcher.cs +++ b/Microsoft.Azure.Cosmos/src/direct/Dispatcher.cs @@ -30,7 +30,7 @@ internal sealed class Dispatcher : IDisposable // Receiving is done only from the receive loop. // Initialization and disposal are not thread safe. Guard these // operations with connectionLock. - private readonly Connection connection; + private readonly IConnection connection; private readonly UserAgentContainer userAgent; private readonly Uri serverUri; private readonly IConnectionStateListener connectionStateListener; @@ -108,7 +108,7 @@ internal Dispatcher( TimerPool idleTimerPool, bool enableChannelMultiplexing, IChaosInterceptor chaosInterceptor, - Connection connection) + IConnection connection) { this.connection = connection ?? throw new ArgumentNullException(nameof(connection)); this.userAgent = userAgent; @@ -228,7 +228,7 @@ async delegate DefaultTrace.TraceWarning( "[RNTBD Dispatcher {0}] Dispatcher.ReceiveLoopAsync failed. Consuming the task " + "exception asynchronously. Dispatcher: {1}. Exception: {2}", - this.ConnectionCorrelationId, this, completedTask.Exception?.InnerException); + this.ConnectionCorrelationId, this, completedTask.Exception?.InnerException?.Message); }, default(CancellationToken), TaskContinuationOptions.OnlyOnFaulted, @@ -571,14 +571,16 @@ private void ScheduleIdleTimer(TimeSpan timeToIdle) Debug.Assert(Monitor.IsEntered(this.connectionLock)); this.idleTimer = this.idleTimerPool.GetPooledTimer((int)timeToIdle.TotalSeconds); this.idleTimerTask = this.idleTimer.StartTimerAsync().ContinueWith(this.OnIdleTimer, TaskContinuationOptions.OnlyOnRanToCompletion); +#pragma warning disable SA1137 this.idleTimerTask.ContinueWith( failedTask => { DefaultTrace.TraceWarning( "[RNTBD Dispatcher {0}][{1}] Idle timer callback failed: {2}", - this.ConnectionCorrelationId, this, failedTask.Exception?.InnerException); + this.ConnectionCorrelationId, this, failedTask.Exception?.InnerException?.Message); }, TaskContinuationOptions.OnlyOnFaulted); +#pragma warning restore SA1137 } // this.connectionLock must be held. @@ -603,7 +605,7 @@ private void StartConnectionShutdown() { DefaultTrace.TraceWarning( "[RNTBD Dispatcher {0}][{1}] Registered cancellation callbacks failed: {2}", - this.ConnectionCorrelationId, this, e); + this.ConnectionCorrelationId, this, e.Message); // Deliberately ignoring the exception. } } @@ -665,7 +667,7 @@ private void WaitTask(Task t, string description) { DefaultTrace.TraceWarning( "[RNTBD Dispatcher {0}][{1}] Parallel task failed: {2}. Exception: {3}", - this.ConnectionCorrelationId, this, description, e); + this.ConnectionCorrelationId, this, description, e.Message); // Intentionally swallowing the exception. The caller can't // do anything useful with it. } @@ -902,7 +904,7 @@ private void DispatchChannelFailureException(Exception ex) // In other cases, it may be reasonable to handle additional exception types here. DefaultTrace.TraceWarning( "[RNTBD Dispatcher {0}] Not a TransportException. Will not raise the connection state change event: {1}", - this.ConnectionCorrelationId, ex); + this.ConnectionCorrelationId, ex?.Message); return; } @@ -934,7 +936,7 @@ private void DispatchChannelFailureException(Exception ex) t.ContinueWith(static (failedTask, connectionIdObject) => { - DefaultTrace.TraceError("[RNTBD Dispatcher {0}] OnConnectionEventAsync callback failed: {1}", connectionIdObject, failedTask.Exception?.InnerException); + DefaultTrace.TraceError("[RNTBD Dispatcher {0}] OnConnectionEventAsync callback failed: {1}", connectionIdObject, failedTask.Exception?.InnerException?.Message); }, this.ConnectionCorrelationId, TaskContinuationOptions.OnlyOnFaulted); } @@ -1149,7 +1151,7 @@ private void RunAsynchronously(Action action) DefaultTrace.TraceError( "[RNTBD Dispatcher.CallInfo {0}] Unexpected: Rntbd asynchronous completion " + "call failed. Consuming the task exception asynchronously. " + - "Exception: {1}", connectionIdObject, failedTask.Exception?.InnerException); + "Exception: {1}", connectionIdObject, failedTask.Exception?.InnerException?.Message); }, this.connectionCorrelationId, TaskContinuationOptions.OnlyOnFaulted); @@ -1167,7 +1169,7 @@ private void RunAsynchronously(Func action) DefaultTrace.TraceError( "[RNTBD Dispatcher.CallInfo {0}] Unexpected: Rntbd asynchronous completion " + "call failed. Consuming the task exception asynchronously. " + - "Exception: {1}", connectionIdObject, failedTask.Exception?.InnerException); + "Exception: {1}", connectionIdObject, failedTask.Exception?.InnerException?.Message); }, this.connectionCorrelationId, TaskContinuationOptions.OnlyOnFaulted); diff --git a/Microsoft.Azure.Cosmos/src/direct/DocumentCollection.cs b/Microsoft.Azure.Cosmos/src/direct/DocumentCollection.cs index 313cc77528..1110388c25 100644 --- a/Microsoft.Azure.Cosmos/src/direct/DocumentCollection.cs +++ b/Microsoft.Azure.Cosmos/src/direct/DocumentCollection.cs @@ -326,10 +326,12 @@ internal byte UniqueIndexNameEncodingMode } set { +#pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' if(value == null) { throw new ArgumentNullException(string.Format(CultureInfo.CurrentCulture, RMResources.PropertyCannotBeNull, "UniqueIndexNameEncodingMode")); } +#pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' this.uniqueIndexNameEncodingMode = value; this.SetValue(Constants.Properties.UniqueIndexNameEncodingMode, value); } @@ -1266,7 +1268,7 @@ internal override void OnSave() { base.SetObject(Constants.Properties.SchemaDiscoveryPolicy, this.schemaDiscoveryPolicy); } - + if (this.changeFeedPolicy != null) { base.SetObject(Constants.Properties.ChangeFeedPolicy, this.changeFeedPolicy); @@ -1287,7 +1289,7 @@ internal override void OnSave() base.SetObject(Constants.Properties.GeospatialConfig, this.geospatialConfig); } - if(this.byokConfig != null) + if (this.byokConfig != null) { base.SetObject(Constants.Properties.ByokConfig, this.byokConfig); } @@ -1330,8 +1332,8 @@ internal override void OnSave() base.SetObject(Constants.EncryptionScopeProperties.EncryptionScope, this.encryptionScopeMetadata); } - if(this.uniqueIndexNameEncodingMode != 0) - { + if (this.uniqueIndexNameEncodingMode != 0) + { base.SetValue(Constants.Properties.UniqueIndexNameEncodingMode, this.uniqueIndexNameEncodingMode); } diff --git a/Microsoft.Azure.Cosmos/src/direct/DocumentResponse.cs b/Microsoft.Azure.Cosmos/src/direct/DocumentResponse.cs index 86081cca9e..562bf41505 100644 --- a/Microsoft.Azure.Cosmos/src/direct/DocumentResponse.cs +++ b/Microsoft.Azure.Cosmos/src/direct/DocumentResponse.cs @@ -35,7 +35,9 @@ namespace Microsoft.Azure.Documents.Client sealed class DocumentResponse : ResourceResponseBase, IDocumentResponse { private TDocument document; +#pragma warning disable IDE0044 // Add readonly modifier private JsonSerializerSettings settings; +#pragma warning restore IDE0044 // Add readonly modifier /// /// Constructor exposed for mocking purposes for the Azure Cosmos DB service. diff --git a/Microsoft.Azure.Cosmos/src/direct/DocumentServiceRequest.cs b/Microsoft.Azure.Cosmos/src/direct/DocumentServiceRequest.cs index d1e6444a48..bc302f03b3 100644 --- a/Microsoft.Azure.Cosmos/src/direct/DocumentServiceRequest.cs +++ b/Microsoft.Azure.Cosmos/src/direct/DocumentServiceRequest.cs @@ -19,6 +19,8 @@ namespace Microsoft.Azure.Documents //we can open this up to public. internal sealed class DocumentServiceRequest : IDisposable { + internal static bool DefaultUseStatusCodeFor4041002 = false; + private bool isDisposed = false; // The lock is used for locking request body operations like sending request or changing stream position. @@ -242,6 +244,13 @@ internal DocumentServiceRequest( // Gone exception with ArchivalPartitionNotFound occurs. public bool DisableArchivalPartitionNotFoundRetry { get; set; } + /// + /// This is a flag that indicates whether the DocumentClient internally + /// throws exceptions for 404-1002(SessionNotFound) status code + /// the status codes as part of the result for failures. + /// + public bool UseStatusCodeFor4041002 { get; set; } = DefaultUseStatusCodeFor4041002; + /// /// This is a flag that indicates whether the DocumentClient internally /// throws exceptions for 429 status codes @@ -380,7 +389,7 @@ public bool IsBodySeekableClonableAndCountable } } - public OperationType OperationType { get; private set; } + public OperationType OperationType { get; set; } public ResourceType ResourceType { get; private set; } @@ -407,6 +416,14 @@ internal string ApiVersion } } + internal bool IsAnyExceptionLessEnabled() + { + return this.UseStatusCodeFor403 + || this.UseStatusCodeFor4041002 + || this.UseStatusCodeFor429 + || this.UseStatusCodeForFailures; + } + /// /// StoreModel vs GatewayStoreModel contract for friends. /// TODO: SDK V3 start using this contract. - https://msdata.visualstudio.com/CosmosDB/_workitems/edit/2470799 @@ -618,6 +635,7 @@ public string HttpMethod case OperationType.GetUnwrappedDek: case OperationType.GetDekProperties: case OperationType.GetFederationConfigurations: + case OperationType.GetRegionalConfigurations: case OperationType.GetDatabaseAccountConfigurations: case OperationType.GetStorageServiceConfigurations: case OperationType.GetDatabaseAccountArtifactPermissions: @@ -823,15 +841,26 @@ public void AddPreferHeader(string preferHeaderName, string preferHeaderValue) public static DocumentServiceRequest CreateFromResource( DocumentServiceRequest request, Resource modifiedResource) + { + return CreateFromResourceWithModifiedOperationType( + request, + modifiedResource, + request.OperationType); + } + + public static DocumentServiceRequest CreateFromResourceWithModifiedOperationType( + DocumentServiceRequest request, + Resource modifiedResource, + OperationType operationType) { DocumentServiceRequest modifiedRequest; if (!request.IsNameBased) { - modifiedRequest = DocumentServiceRequest.Create(request.OperationType, modifiedResource, request.ResourceType, request.RequestAuthorizationTokenType, request.Headers, request.ResourceId); + modifiedRequest = DocumentServiceRequest.Create(operationType, modifiedResource, request.ResourceType, request.RequestAuthorizationTokenType, request.Headers, request.ResourceId); } else { - modifiedRequest = DocumentServiceRequest.CreateFromName(request.OperationType, modifiedResource, request.ResourceType, request.Headers, request.ResourceAddress, request.RequestAuthorizationTokenType); + modifiedRequest = DocumentServiceRequest.CreateFromName(operationType, modifiedResource, request.ResourceType, request.Headers, request.ResourceAddress, request.RequestAuthorizationTokenType); } return modifiedRequest; @@ -1139,13 +1168,15 @@ public void ClearRoutingHints() this.RequestContext.ResolvedPartitionKeyRange = null; } - public DocumentServiceRequest Clone() + public DocumentServiceRequest Clone(bool ignoreCloneableBody = false) { if (!this.IsBodySeekableClonableAndCountable) { throw new InvalidOperationException(); } +#pragma warning disable SA1500 // Braces for multi-line statements should not share line +#pragma warning disable IDE0031 // Use null propagation return new DocumentServiceRequest{ OperationType = this.OperationType, ForceNameCacheRefresh = this.ForceNameCacheRefresh, @@ -1153,7 +1184,7 @@ public DocumentServiceRequest Clone() ServiceIdentity = this.ServiceIdentity, SystemAuthorizationParams = this.SystemAuthorizationParams == null ? null : this.SystemAuthorizationParams.Clone(), // Body = this.Body, // intentionally don't clone body, as it is not cloneable. - CloneableBody = this.CloneableBody != null ? this.CloneableBody.Clone() : null, + CloneableBody = !ignoreCloneableBody && this.CloneableBody != null ? this.CloneableBody.Clone() : null, Headers = (INameValueCollection)this.Headers.Clone(), IsFeed = this.IsFeed, IsNameBased = this.IsNameBased, @@ -1163,7 +1194,7 @@ public DocumentServiceRequest Clone() RequestContext = this.RequestContext.Clone(), PartitionKeyRangeIdentity = this.PartitionKeyRangeIdentity, UseGatewayMode = this.UseGatewayMode, - QueryString = this.QueryString, + QueryString = this.QueryString, Continuation = this.Continuation, ForcePartitionKeyRangeRefresh = this.ForcePartitionKeyRangeRefresh, LastCollectionRoutingMapHashCode = this.LastCollectionRoutingMapHashCode, @@ -1176,7 +1207,11 @@ public DocumentServiceRequest Clone() DatabaseName = this.DatabaseName, CollectionName = this.CollectionName, DisableArchivalPartitionNotFoundRetry = this.DisableArchivalPartitionNotFoundRetry, + UseStatusCodeFor403 = this.UseStatusCodeFor403, + UseStatusCodeFor4041002 = this.UseStatusCodeFor4041002, }; +#pragma warning restore IDE0031 // Use null propagation +#pragma warning restore SA1500 // Braces for multi-line statements should not share line } private void InitializeWithDataParsedFromUri( diff --git a/Microsoft.Azure.Cosmos/src/direct/DocumentServiceRequestContext.cs b/Microsoft.Azure.Cosmos/src/direct/DocumentServiceRequestContext.cs index 327783918d..c18fa00f85 100644 --- a/Microsoft.Azure.Cosmos/src/direct/DocumentServiceRequestContext.cs +++ b/Microsoft.Azure.Cosmos/src/direct/DocumentServiceRequestContext.cs @@ -5,6 +5,7 @@ namespace Microsoft.Azure.Documents { using System; + using System.Collections.Concurrent; using System.Collections.Generic; using System.Net; using Microsoft.Azure.Documents.Routing; @@ -119,11 +120,11 @@ public IClientSideRequestStatistics ClientRequestStatistics /// /// Set of all failed enpoints for a DSR. Used for prioritizing replica selection /// - public Lazy> FailedEndpoints { get; private set; } + public Lazy> FailedEndpoints { get; private set; } public DocumentServiceRequestContext() { - this.FailedEndpoints = new Lazy>(); + this.FailedEndpoints = new Lazy>(); } /// @@ -156,7 +157,7 @@ public void AddToFailedEndpoints(Exception storeException, TransportAddressUri t dce.StatusCode == HttpStatusCode.RequestTimeout || (int)dce.StatusCode >= 500) { - this.FailedEndpoints.Value.Add(targetUri); + this.FailedEndpoints.Value.TryAdd(targetUri, true); } } } diff --git a/Microsoft.Azure.Cosmos/src/direct/DocumentServiceRequestExtensions.cs b/Microsoft.Azure.Cosmos/src/direct/DocumentServiceRequestExtensions.cs index 5b306711b1..4eef99b00f 100644 --- a/Microsoft.Azure.Cosmos/src/direct/DocumentServiceRequestExtensions.cs +++ b/Microsoft.Azure.Cosmos/src/direct/DocumentServiceRequestExtensions.cs @@ -35,6 +35,14 @@ public static bool IsValidStatusCodeForExceptionlessRetry( return true; } + // 404/1002 - Only for non-master resources + // Limiting to non-master resources is a scoping decision to safe-fly + if (request.IsValidRequestFor4041002() + && (statusCode == (int)System.Net.HttpStatusCode.NotFound && subStatusCode == SubStatusCodes.ReadSessionNotAvailable)) + { + return true; + } + // Only for 429 if (request.UseStatusCodeFor429 && statusCode == (int)StatusCodes.TooManyRequests) @@ -51,5 +59,11 @@ public static bool IsValidStatusCodeForExceptionlessRetry( return false; } + + public static bool IsValidRequestFor4041002(this DocumentServiceRequest request) + { + return request.UseStatusCodeFor4041002 + && !ReplicatedResourceClient.IsMasterResource(request.ResourceType); + } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/direct/ExceptionExtensions.cs b/Microsoft.Azure.Cosmos/src/direct/ExceptionExtensions.cs index f1eab7d50f..56865456e0 100644 --- a/Microsoft.Azure.Cosmos/src/direct/ExceptionExtensions.cs +++ b/Microsoft.Azure.Cosmos/src/direct/ExceptionExtensions.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.Documents /// internal static class ExceptionExtensions { +#if !COSMOSCLIENT // Iterates through the top level properties of the exception object and // converts them to a string so output to logging can be more meaningful. public static string ToLoggingString(this Exception exception) @@ -36,13 +37,13 @@ public static string ToLoggingString(this Exception exception) return string.Concat(exception.GetType(), " : ", string.Join(",", fields)); } - +#endif // System.Exception.ToString() does not inject information from Exception.Data to the exception string. // This extension method allows us to pump additional useful information into the exception data // and display it. public static string ToStringWithData(this Exception exception) { - StringBuilder sb = new StringBuilder(exception.ToString()); + StringBuilder sb = new StringBuilder(exception?.Message); List exceptionData = new List(); ExceptionExtensions.CaptureExceptionData(exception, exceptionData); @@ -168,7 +169,7 @@ private static void CaptureExceptionData(Exception exception, List excep { foreach (object key in exception.Data.Keys) { - exceptionData.Add(string.Format(CultureInfo.InvariantCulture, "{0}: {1}", key.ToString(), exception.Data[key].ToString())); + exceptionData.Add(string.Format(CultureInfo.InvariantCulture, "{0}: {1}", key?.ToString(), exception.Data[key]?.ToString())); } } diff --git a/Microsoft.Azure.Cosmos/src/direct/FaultInjection/IChaosInterceptor.cs b/Microsoft.Azure.Cosmos/src/direct/FaultInjection/IChaosInterceptor.cs index 402b1107e7..e6439d8985 100644 --- a/Microsoft.Azure.Cosmos/src/direct/FaultInjection/IChaosInterceptor.cs +++ b/Microsoft.Azure.Cosmos/src/direct/FaultInjection/IChaosInterceptor.cs @@ -3,10 +3,13 @@ //------------------------------------------------------------ namespace Microsoft.Azure.Documents.FaultInjection { + using Microsoft.Azure.Documents.Rntbd; using System; - using System.Net.Http; +#pragma warning disable SA1210 using System.Threading.Tasks; - using Microsoft.Azure.Documents.Rntbd; +#pragma warning restore SA1210 + using System.Net.Http; + using System.Threading; /// /// Interface for Chaos Interceptor @@ -20,11 +23,20 @@ internal interface IChaosInterceptor /// public Task<(bool, StoreResponse)> OnRequestCallAsync(ChannelCallArguments args); +#pragma warning disable CS1572 // XML comment has a param tag, but there is no parameter by that name +#pragma warning disable SA1612 // Element parameter documentation should match element parameters +#pragma warning disable CS1573 +#pragma warning disable SA1616 /// /// Used to inject faults on request call for GatewayCalls /// - /// - public Task<(bool, HttpResponseMessage)> OnHttpRequestCallAsync(DocumentServiceRequest request); + /// + /// + public Task<(bool, HttpResponseMessage)> OnHttpRequestCallAsync(DocumentServiceRequest request, CancellationToken token = default); +#pragma warning restore SA1612 // Element parameter documentation should match element parameters +#pragma warning restore CS1572 // XML comment has a param tag, but there is no parameter by that name +#pragma warning disable CS1573 +#pragma warning disable SA1616 /// /// Used to inject faults on channel open @@ -47,24 +59,42 @@ internal interface IChaosInterceptor /// /// public Task OnBeforeConnectionWriteAsync(ChannelCallArguments args); +#pragma warning disable SA1507 // Code should not contain multiple blank lines in a row + +#pragma warning disable CS1572 // XML comment has a param tag, but there is no parameter by that name +#pragma warning disable SA1612 // Element parameter documentation should match element parameters +#pragma warning disable CS1573 /// /// Used to inject faults before connection writes for gateway /// - /// - public Task OnBeforeHttpSendAsync(DocumentServiceRequest request); + /// + public Task OnBeforeHttpSendAsync(DocumentServiceRequest request, CancellationToken token = default); +#pragma warning restore SA1507 // Code should not contain multiple blank lines in a row +#pragma warning restore SA1612 // Element parameter documentation should match element parameters +#pragma warning restore CS1572 // XML comment has a param tag, but there is no parameter by that name +#pragma warning disable CS1573 /// /// Used to inject faults after connection writes /// /// public Task OnAfterConnectionWriteAsync(ChannelCallArguments args); +#pragma warning disable SA1507 // Code should not contain multiple blank lines in a row + +#pragma warning disable CS1572 // XML comment has a param tag, but there is no parameter by that name +#pragma warning disable SA1612 // Element parameter documentation should match element parameters +#pragma warning disable CS1573 /// /// Used to inject faults after connection writes for gateway /// - /// - public Task OnAfterHttpSendAsync(DocumentServiceRequest request); + /// + public Task OnAfterHttpSendAsync(DocumentServiceRequest request, CancellationToken token = default); +#pragma warning restore SA1507 // Code should not contain multiple blank lines in a row +#pragma warning restore SA1612 // Element parameter documentation should match element parameters +#pragma warning restore CS1572 // XML comment has a param tag, but there is no parameter by that name +#pragma warning disable CS1573 /// /// Gets the fault injection rule id for the given activity id diff --git a/Microsoft.Azure.Cosmos/src/direct/FullTextPolicy.cs b/Microsoft.Azure.Cosmos/src/direct/FullTextPolicy.cs index 0b9aa43ac0..cb2ef9cd04 100644 --- a/Microsoft.Azure.Cosmos/src/direct/FullTextPolicy.cs +++ b/Microsoft.Azure.Cosmos/src/direct/FullTextPolicy.cs @@ -72,7 +72,7 @@ public Collection FullTextPaths internal override void OnSave() { - this.SetValue(Constants.Properties.Path, this.DefaultLanguage); + this.SetValue(Constants.Properties.DefaultLanguage, this.DefaultLanguage); if (this.fullTextPaths != null) { diff --git a/Microsoft.Azure.Cosmos/src/direct/GoneAndRetryWithRequestRetryPolicy.cs b/Microsoft.Azure.Cosmos/src/direct/GoneAndRetryWithRequestRetryPolicy.cs index 05262bc616..dcbe7f92fe 100644 --- a/Microsoft.Azure.Cosmos/src/direct/GoneAndRetryWithRequestRetryPolicy.cs +++ b/Microsoft.Azure.Cosmos/src/direct/GoneAndRetryWithRequestRetryPolicy.cs @@ -21,8 +21,12 @@ internal sealed class GoneAndRetryWithRequestRetryPolicy : { struct ErrorOrResponse { +#pragma warning disable IDE0044 // Add readonly modifier private Exception exception; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private int statusCode; +#pragma warning restore IDE0044 // Add readonly modifier public ErrorOrResponse(Exception ex, TResponse response) { @@ -67,7 +71,9 @@ private string ExceptionToString() private readonly int? randomSaltForRetryWithMilliseconds; +#pragma warning disable IDE0044 // Add readonly modifier private Stopwatch durationTimer = new Stopwatch(); +#pragma warning restore IDE0044 // Add readonly modifier private TimeSpan minBackoffForRegionReroute; private int attemptCount = 1; private int attemptCountInvalidPartition = 1; diff --git a/Microsoft.Azure.Cosmos/src/direct/GoneAndRetryWithRetryPolicy.cs b/Microsoft.Azure.Cosmos/src/direct/GoneAndRetryWithRetryPolicy.cs index 98c6ff6f6e..b813c26635 100644 --- a/Microsoft.Azure.Cosmos/src/direct/GoneAndRetryWithRetryPolicy.cs +++ b/Microsoft.Azure.Cosmos/src/direct/GoneAndRetryWithRetryPolicy.cs @@ -28,7 +28,9 @@ internal sealed class GoneAndRetryWithRetryPolicy : private const int minFailedReplicaCountToConsiderConnectivityIssue = 3; +#pragma warning disable IDE0044 // Add readonly modifier private Stopwatch durationTimer = new Stopwatch(); +#pragma warning restore IDE0044 // Add readonly modifier private int attemptCount = 1; private int attemptCountInvalidPartition = 1; private int regionRerouteAttemptCount = 0; @@ -44,7 +46,9 @@ internal sealed class GoneAndRetryWithRetryPolicy : // Don't penalise first retry with delay. private int currentBackoffSeconds = GoneAndRetryWithRetryPolicy.initialBackoffSeconds; +#pragma warning disable IDE0044 // Add readonly modifier private DocumentServiceRequest request; +#pragma warning restore IDE0044 // Add readonly modifier public GoneAndRetryWithRetryPolicy( DocumentServiceRequest request = null, @@ -217,7 +221,9 @@ exception is PartitionKeyRangeGoneException || else if (this.detectConnectivityIssues && this.request.RequestContext.ClientRequestStatistics != null && this.request.RequestContext.ClientRequestStatistics.FailedReplicas.Count >= GoneAndRetryWithRetryPolicy.minFailedReplicaCountToConsiderConnectivityIssue) +#pragma warning disable SA1505 // Opening braces should not be followed by blank line { + exceptionToThrow = new ServiceUnavailableException( string.Format( RMResources.ClientUnavailable, @@ -227,6 +233,7 @@ exception is PartitionKeyRangeGoneException || exception, exceptionSubStatus); } +#pragma warning restore SA1505 // Opening braces should not be followed by blank line else { exceptionToThrow = ServiceUnavailableException.Create(exceptionSubStatus, innerException: exception); diff --git a/Microsoft.Azure.Cosmos/src/direct/GoneOnlyRequestRetryPolicy.cs b/Microsoft.Azure.Cosmos/src/direct/GoneOnlyRequestRetryPolicy.cs index cc28e1979e..8904765a89 100644 --- a/Microsoft.Azure.Cosmos/src/direct/GoneOnlyRequestRetryPolicy.cs +++ b/Microsoft.Azure.Cosmos/src/direct/GoneOnlyRequestRetryPolicy.cs @@ -17,7 +17,9 @@ internal class GoneOnlyRequestRetryPolicy : private const int backoffMultiplier = 2; private const int initialBackoffTimeInSeconds = 1; +#pragma warning disable IDE0044 // Add readonly modifier private Stopwatch durationTimer = new Stopwatch(); +#pragma warning restore IDE0044 // Add readonly modifier private readonly TimeSpan retryTimeout; private int currentBackoffTimeInSeconds; diff --git a/Microsoft.Azure.Cosmos/src/direct/Helpers.cs b/Microsoft.Azure.Cosmos/src/direct/Helpers.cs index 67eb4a4196..364209ea82 100644 --- a/Microsoft.Azure.Cosmos/src/direct/Helpers.cs +++ b/Microsoft.Azure.Cosmos/src/direct/Helpers.cs @@ -52,7 +52,9 @@ public static string RemoveSigInSASTokenForTracingPayload(string sASToken) try { string pattern = "sig=.*?[&|\"]"; - string replacement = string.Empty; +#pragma warning disable SA1122 // Use string.Empty for empty strings + string replacement = ""; +#pragma warning restore SA1122 // Use string.Empty for empty strings string result = Regex.Replace(sASToken, pattern, replacement, RegexOptions.IgnoreCase); return result; diff --git a/Microsoft.Azure.Cosmos/src/direct/HexStringUtility.cs b/Microsoft.Azure.Cosmos/src/direct/HexStringUtility.cs new file mode 100644 index 0000000000..6ac0532bec --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/direct/HexStringUtility.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Documents +{ + using System; + + internal static class HexStringUtility + { + internal static byte[] HexStringToBytes(string hexString) + { + if (hexString == null) + { + return null; + } + + byte[] bytes = new byte[hexString.Length / 2]; + for (int i = 0; i < hexString.Length; i += 2) + { + bytes[i / 2] = Convert.ToByte(hexString.Substring(i, 2), 16); + } + + return bytes; + } + } +} diff --git a/Microsoft.Azure.Cosmos/src/direct/HttpConstants.cs b/Microsoft.Azure.Cosmos/src/direct/HttpConstants.cs index a9b8d82b7c..ba8102c8fc 100644 Binary files a/Microsoft.Azure.Cosmos/src/direct/HttpConstants.cs and b/Microsoft.Azure.Cosmos/src/direct/HttpConstants.cs differ diff --git a/Microsoft.Azure.Cosmos/src/direct/HttpException.cs b/Microsoft.Azure.Cosmos/src/direct/HttpException.cs index 1f9f913abf..9f696cabb9 100644 --- a/Microsoft.Azure.Cosmos/src/direct/HttpException.cs +++ b/Microsoft.Azure.Cosmos/src/direct/HttpException.cs @@ -27,13 +27,44 @@ namespace Microsoft.Azure.Documents public #endif class DocumentClientException : Exception +#if COSMOSCLIENT +#pragma warning disable SA1001 // Commas should be spaced correctly + , ICloneable +#pragma warning restore SA1001 // Commas should be spaced correctly +#endif { private Error error; private SubStatusCodes? substatus = null; +#pragma warning disable IDE0044 // Add readonly modifier private INameValueCollection responseHeaders; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private string rawErrorMessage; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private Boolean rawErrorMessageOnly; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private bool skippingStackTraceCapture = false; +#pragma warning restore IDE0044 // Add readonly modifier + + private readonly static HashSet SensitiveHeaders = new HashSet(StringComparer.OrdinalIgnoreCase) + { + HttpConstants.HttpHeaders.Authorization, + HttpConstants.HttpHeaders.FabricS2SToken, + HttpConstants.HttpHeaders.OriginalAadToken, + HttpConstants.HttpHeaders.GatewaySignature, + HttpConstants.HttpHeaders.SignedOboToken, + HttpConstants.HttpHeaders.ProxyAuthenticate, + HttpConstants.HttpHeaders.ProxyAuthorization, + }; + + private readonly static List SensitiveWordsInHeader = new List + { + "authorization", + "token", + "signature" + }; internal DocumentClientException(Error errorResource, HttpResponseHeaders responseHeaders, @@ -89,7 +120,7 @@ internal DocumentClientException(string message, HttpStatusCode? statusCode, Uri requestUri = null, SubStatusCodes? substatusCode = null, - bool traceCallStack = true, + bool traceCallStack = false, bool rawErrorMessageOnly = false) : base(DocumentClientException.MessageWithActivityId(message, responseHeaders), innerException) { @@ -160,8 +191,7 @@ internal DocumentClientException(string message, "DocumentClientException with status code {0}, message: {1}, inner exception: {2}, and response headers: {3}", this.StatusCode ?? 0, message, - innerException != null ? - (traceCallStack ? innerException.ToString() : innerException.ToStringWithMessageAndData()) : "null", + innerException != null ? innerException.ToStringWithMessageAndData() : "null", SerializeHTTPResponseHeaders(responseHeaders)); } } @@ -225,7 +255,7 @@ internal DocumentClientException(string message, "DocumentClientException with status code {0}, message: {1}, inner exception: {2}, and response headers: {3}", this.StatusCode ?? 0, message, - innerException != null ? innerException.ToString() : "null", + innerException != null ? innerException?.Message : "null", SerializeHTTPResponseHeaders(responseHeaders)); } } @@ -558,7 +588,7 @@ private static string MessageWithActivityId(string message, string activityIdFro // If we're making this exception on the client side using the message from the Gateway, // the message may already have activityId stamped in it. If so, just use the message as-is - if (message.Contains(activityId)) + if (message == null || message.Contains(activityId)) { return message; } @@ -578,6 +608,11 @@ private static string SerializeHTTPResponseHeaders(HttpResponseHeaders responseH foreach (KeyValuePair> pair in responseHeaders) { + if (IsSensitiveHeader(pair.Key)) + { + continue; + } + foreach (string value in pair.Value) { result.Append(string.Format(CultureInfo.InvariantCulture, @@ -654,6 +689,11 @@ private static string SerializeHTTPResponseHeaders(INameValueCollection response foreach (Tuple item in items) { + if (IsSensitiveHeader(item.Item1)) + { + continue; + } + result.Append(string.Format(CultureInfo.InvariantCulture, "\"{0}\": \"{1}\",{2}", item.Item1, @@ -664,5 +704,27 @@ private static string SerializeHTTPResponseHeaders(INameValueCollection response result.Append("}"); return result.ToString(); } + + private static bool IsSensitiveHeader(string headerName) + { + if (string.IsNullOrEmpty(headerName)) + { + return false; + } + + if (SensitiveHeaders.Contains(headerName)) + { + return true; + } + + return SensitiveWordsInHeader.Any(keyword => headerName.IndexOf(keyword, StringComparison.OrdinalIgnoreCase) >= 0); + } + +#if COSMOSCLIENT + public object Clone() + { + return this.MemberwiseClone(); + } +#endif } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/direct/HttpTransportClient.cs b/Microsoft.Azure.Cosmos/src/direct/HttpTransportClient.cs index c120bfa32e..6924cf9291 100644 --- a/Microsoft.Azure.Cosmos/src/direct/HttpTransportClient.cs +++ b/Microsoft.Azure.Cosmos/src/direct/HttpTransportClient.cs @@ -184,7 +184,7 @@ internal override async Task InvokeStoreAsync( DefaultTrace.TraceInformation("Received retriable exception {0} " + "sending the request to {1}, will reresolve the address " + "send time UTC: {2}", - exception, + exception?.Message, physicalAddress, sendTimeUtc); @@ -204,7 +204,7 @@ internal override async Task InvokeStoreAsync( DefaultTrace.TraceInformation("Received exception {0} on readonly request" + "sending the request to {1}, will reresolve the address " + "send time UTC: {2}", - exception, + exception?.Message, physicalAddress, sendTimeUtc); @@ -516,6 +516,10 @@ private HttpRequestMessage PrepareHttpMessage( HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.PopulateThroughputPoolInfo, request); HttpTransportClient.AddHeader(httpRequestMessage.Headers, WFConstants.BackendHeaders.RetrieveUserStrings, request); HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.PopulateVectorIndexAggregateProgress, request); + HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.AllowTopologyUpsertWithoutIntent, request); + HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.ReadGlobalCommittedData, request); + HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.IsSoftDeletionOperation, request); + HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.WorkloadId, request); // Set the CollectionOperation TransactionId if present // Currently only being done for SharedThroughputTransactionHandler in the collection create path @@ -1122,12 +1126,9 @@ public static Task ProcessHttpResponse(string resourceAddress, st { InternalServerErrorException exception = new InternalServerErrorException( - string.Format(CultureInfo.CurrentUICulture, - RMResources.ExceptionMessage, - RMResources.InvalidBackendResponse), + string.Format(CultureInfo.CurrentUICulture, RMResources.ExceptionMessage, RMResources.InvalidBackendResponse), physicalAddress); - exception.Headers.Set(HttpConstants.HttpHeaders.ActivityId, - activityId); + exception.Headers.Set(HttpConstants.HttpHeaders.ActivityId, activityId); exception.Headers.Add(HttpConstants.HttpHeaders.RequestValidationFailure, "1"); throw exception; } diff --git a/Microsoft.Azure.Cosmos/src/direct/HttpUtility.cs b/Microsoft.Azure.Cosmos/src/direct/HttpUtility.cs index e67d6511ca..7a1b33dd9d 100644 --- a/Microsoft.Azure.Cosmos/src/direct/HttpUtility.cs +++ b/Microsoft.Azure.Cosmos/src/direct/HttpUtility.cs @@ -14,7 +14,9 @@ namespace Microsoft.Azure.Documents internal sealed class HttpUtility { // Fields +#pragma warning disable IDE0044 // Add readonly modifier private static char[] s_entityEndingChars = new char[] { ';', '&' }; +#pragma warning restore IDE0044 // Add readonly modifier // Methods internal static string AspCompatUrlEncode(string s) @@ -755,10 +757,16 @@ public static string UrlPathEncode(string str) private class UrlDecoder { // Fields +#pragma warning disable IDE0044 // Add readonly modifier private int _bufferSize; +#pragma warning restore IDE0044 // Add readonly modifier private byte[] _byteBuffer; +#pragma warning disable IDE0044 // Add readonly modifier private char[] _charBuffer; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private Encoding _encoding; +#pragma warning restore IDE0044 // Add readonly modifier private int _numBytes; private int _numChars; diff --git a/Microsoft.Azure.Cosmos/src/direct/IAddressEnumerator.cs b/Microsoft.Azure.Cosmos/src/direct/IAddressEnumerator.cs index df653ba093..5cb08167fa 100644 --- a/Microsoft.Azure.Cosmos/src/direct/IAddressEnumerator.cs +++ b/Microsoft.Azure.Cosmos/src/direct/IAddressEnumerator.cs @@ -4,6 +4,7 @@ namespace Microsoft.Azure.Documents { using System; + using System.Collections.Concurrent; using System.Collections.Generic; /// @@ -12,7 +13,7 @@ namespace Microsoft.Azure.Documents internal interface IAddressEnumerator { IEnumerable GetTransportAddresses(IReadOnlyList transportAddressUris, - Lazy> failedEndpoints, + Lazy> failedEndpoints, bool replicaAddressValidationEnabled); } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/direct/IClientSideRequestStatistics.cs b/Microsoft.Azure.Cosmos/src/direct/IClientSideRequestStatistics.cs index f5b1315868..c3b5895918 100644 --- a/Microsoft.Azure.Cosmos/src/direct/IClientSideRequestStatistics.cs +++ b/Microsoft.Azure.Cosmos/src/direct/IClientSideRequestStatistics.cs @@ -1,5 +1,4 @@ //------------------------------------------------------------ - // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ namespace Microsoft.Azure.Documents @@ -54,4 +53,8 @@ void RecordHttpException(HttpRequestMessage request, ResourceType resourceType, DateTime requestStartTimeUtc); } -} \ No newline at end of file +#pragma warning disable SA1518 // Use line endings correctly at end of file +} + + +#pragma warning restore SA1518 // Use line endings correctly at end of file \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/direct/IConnection.cs b/Microsoft.Azure.Cosmos/src/direct/IConnection.cs new file mode 100644 index 0000000000..af2c3d46fa --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/direct/IConnection.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Documents.Rntbd +{ + using System; + using System.IO; + using System.Threading.Tasks; + using static Microsoft.Azure.Documents.Rntbd.Connection; + internal interface IConnection : IDisposable + { + // Properties + Uri ServerUri { get; } + BufferProvider BufferProvider { get; } + bool Healthy { get; } + bool Disposed { get; } + Guid ConnectionCorrelationId { get; } + + // Methods + Task OpenAsync(ChannelOpenArguments args); + + Task WriteRequestAsync( + ChannelCommonArguments args, + TransportSerialization.SerializedRequest messagePayload, + TransportRequestStats transportRequestStats); + + Task ReadResponseMetadataAsync(ChannelCommonArguments args); + + Task ReadResponseBodyAsync(ChannelCommonArguments args); + + bool IsActive(out TimeSpan timeToIdle); + + void NotifyConnectionStatus(bool isCompleted, bool isReadRequest = false); + + } +} diff --git a/Microsoft.Azure.Cosmos/src/direct/IRetryPolicy.cs b/Microsoft.Azure.Cosmos/src/direct/IRetryPolicy.cs index 8a867bf517..c7e94b34b2 100644 --- a/Microsoft.Azure.Cosmos/src/direct/IRetryPolicy.cs +++ b/Microsoft.Azure.Cosmos/src/direct/IRetryPolicy.cs @@ -19,6 +19,8 @@ protected ShouldRetryResult() public bool ShouldRetry { get; protected set; } + public bool? ShouldIgnoreException { get; protected set; } + /// /// How long to wait before next retry. 0 indicates retry immediately. /// @@ -39,6 +41,7 @@ public void ThrowIfDoneTrying(ExceptionDispatchInfo capturedException) { capturedException.Throw(); } +#pragma warning disable CDX1000 // DontConvertExceptionToObject if (capturedException != null && object.ReferenceEquals( this.ExceptionToThrow, capturedException.SourceException)) { @@ -48,6 +51,7 @@ public void ThrowIfDoneTrying(ExceptionDispatchInfo capturedException) { throw this.ExceptionToThrow; } +#pragma warning restore CDX1000 // DontConvertExceptionToObject } public static ShouldRetryResult NoRetry(Exception exception = null) @@ -64,6 +68,11 @@ public static ShouldRetryResult RetryAfter(TimeSpan backoffTime) { return new ShouldRetryResult { ShouldRetry = true, BackoffTime = backoffTime }; } + + public static ShouldRetryResult NoRetryIgnoreException() + { + return new ShouldRetryResult { ShouldRetry = false, ShouldIgnoreException = true }; + } } internal class ShouldRetryResult : ShouldRetryResult diff --git a/Microsoft.Azure.Cosmos/src/direct/IServiceConfigurationReaderExtension.cs b/Microsoft.Azure.Cosmos/src/direct/IServiceConfigurationReaderExtension.cs index c947dedb9a..fab63075cf 100644 --- a/Microsoft.Azure.Cosmos/src/direct/IServiceConfigurationReaderExtension.cs +++ b/Microsoft.Azure.Cosmos/src/direct/IServiceConfigurationReaderExtension.cs @@ -12,5 +12,7 @@ namespace Microsoft.Azure.Documents internal interface IServiceConfigurationReaderExtension : IServiceConfigurationReader { IServiceRetryParams TryGetServiceRetryParams(DocumentServiceRequest documentServiceRequest); + + bool TryGetConsistencyLevel(DocumentServiceRequest documentServiceRequest, out ConsistencyLevel consistencyLevel); } } diff --git a/Microsoft.Azure.Cosmos/src/direct/ISessionRetryOptions.cs b/Microsoft.Azure.Cosmos/src/direct/ISessionRetryOptions.cs new file mode 100644 index 0000000000..7ea1a0a5a0 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/direct/ISessionRetryOptions.cs @@ -0,0 +1,31 @@ +namespace Microsoft.Azure.Documents +{ + using System; + + internal interface ISessionRetryOptions +#pragma warning disable SA1505 // Opening braces should not be followed by blank line + { +#pragma warning restore SA1505 // Opening braces should not be followed by blank line + + /// + /// Sets the minimum retry time for 404/1002 retries within each region for read and write operations. + /// The minimum value is 100ms - this minimum is enforced to provide a way for the local region to catch-up on replication lag. The default value is 500ms - as a recommendation ensure that this value is higher than the steady-state + /// replication latency between the regions you chose + /// + TimeSpan MinInRegionRetryTime { get; } + + /// + /// Sets the maximum number of retries within each region for read and write operations. The minimum value is 1 - the backoff time for the last in-region retry will ensure that the total retry time within the + /// region is at least the min. in-region retry time. + /// + int MaxInRegionRetryCount { get; } +#pragma warning disable SA1507 // Code should not contain multiple blank lines in a row + + + /// + /// hints which guide SDK-internal retry policies on how early to switch retries to a different region. + /// + Boolean RemoteRegionPreferred { get; } +#pragma warning restore SA1507 // Code should not contain multiple blank lines in a row + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/direct/IStoreClientFactory.cs b/Microsoft.Azure.Cosmos/src/direct/IStoreClientFactory.cs index 4481a6d92d..9e2eede3f3 100644 --- a/Microsoft.Azure.Cosmos/src/direct/IStoreClientFactory.cs +++ b/Microsoft.Azure.Cosmos/src/direct/IStoreClientFactory.cs @@ -19,7 +19,8 @@ StoreClient CreateStoreClient( bool useMultipleWriteLocations = false, bool detectClientConnectivityIssues = false, bool enableReplicaValidation = false, - AccountConfigurationProperties accountConfigurationProperties = null); + AccountConfigurationProperties accountConfigurationProperties = null, + ISessionRetryOptions sessionRetryOptions = null); IConnectionStateListener GetConnectionStateListener(); } diff --git a/Microsoft.Azure.Cosmos/src/direct/LinuxSystemUtilizationReader.cs b/Microsoft.Azure.Cosmos/src/direct/LinuxSystemUtilizationReader.cs index 91b651e022..2308d82206 100644 --- a/Microsoft.Azure.Cosmos/src/direct/LinuxSystemUtilizationReader.cs +++ b/Microsoft.Azure.Cosmos/src/direct/LinuxSystemUtilizationReader.cs @@ -233,17 +233,13 @@ private class ProcMemInfoFileParser public ProcMemInfoFileParser() : this(DefaultProcMemInfoFilePath) { } - -#pragma warning disable CS1572 // XML comment has a param tag, but there is no parameter by that name -/// + + /// /// Allows customization of the proc stat file path to allow testing this on Non-Linux machines /// - /// + /// /// -#pragma warning disable CS1573 // Parameter has no matching param tag in the XML comment (but other parameters do) internal ProcMemInfoFileParser(string procMemInfoFilePath) -#pragma warning restore CS1573 // Parameter has no matching param tag in the XML comment (but other parameters do) -#pragma warning restore CS1572 // XML comment has a param tag, but there is no parameter by that name { if (String.IsNullOrWhiteSpace(procMemInfoFilePath)) { diff --git a/Microsoft.Azure.Cosmos/src/direct/LocationNames.cs b/Microsoft.Azure.Cosmos/src/direct/LocationNames.cs index 1f4413bb5f..2fa5cafeca 100644 --- a/Microsoft.Azure.Cosmos/src/direct/LocationNames.cs +++ b/Microsoft.Azure.Cosmos/src/direct/LocationNames.cs @@ -478,5 +478,18 @@ static class LocationNames /// Name of the Azure Southeast US 5 region in the Azure Cosmos DB service. /// public const string SoutheastUS5 = "Southeast US 5"; + + /// + /// Name of the Azure East US 3 region in the Azure Cosmos DB service. + /// + public const string EastUS3 = "East US 3"; } -} \ No newline at end of file +#pragma warning disable SA1518 // Use line endings correctly at end of file +} + + + + + + +#pragma warning restore SA1518 // Use line endings correctly at end of file \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/direct/OfferContentV2.cs b/Microsoft.Azure.Cosmos/src/direct/OfferContentV2.cs index 53f8077659..9a61b76804 100644 --- a/Microsoft.Azure.Cosmos/src/direct/OfferContentV2.cs +++ b/Microsoft.Azure.Cosmos/src/direct/OfferContentV2.cs @@ -4,8 +4,9 @@ namespace Microsoft.Azure.Documents { - using System.Collections.ObjectModel; using Newtonsoft.Json; + using System; + using System.Collections.ObjectModel; /// /// Represents content properties tied to the Standard pricing tier for the Azure Cosmos DB service. @@ -24,6 +25,7 @@ sealed class OfferContentV2 : JsonSerializable private ThroughputDistributionPolicyType? throughputDistributionPolicy; private Collection throughputBuckets; private int? offerTargetThroughput; + private int? partitionCount; #endif /// @@ -98,6 +100,12 @@ internal OfferContentV2( { this.OfferTargetThroughput = offerTargetThroughput.Value; } + + int? partitionCount = content.PartitionCount; + if (partitionCount.HasValue) + { + this.PartitionCount = partitionCount.Value; + } } #endif } @@ -142,6 +150,12 @@ internal OfferContentV2( { this.OfferTargetThroughput = offerTargetThroughput.Value; } + + int? partitionCount = content.PartitionCount; + if (partitionCount.HasValue) + { + this.PartitionCount = partitionCount.Value; + } } #endif } @@ -294,11 +308,53 @@ internal OfferContentV2( { this.OfferTargetThroughput = offerTargetThroughput.Value; } + + int? partitionCount = contentV2.PartitionCount; + if (partitionCount.HasValue) + { + this.PartitionCount = partitionCount.Value; + } + } + + /// + /// Copy constructor with optional overrides for all properties except OfferThroughput. + /// + internal OfferContentV2( + OfferContentV2 source, + bool? offerIsRUPerMinuteThroughputEnabled = null, + bool? offerIsAutoScaleEnabled = null, + AutopilotSettings offerAutopilotSettings = null, + OfferMinimumThroughputParameters offerMinimumThroughputParameters = null, + double? backgroundTaskMaxAllowedThroughputPercent = null, + ThroughputDistributionPolicyType? throughputDistributionPolicy = null, + Collection throughputBuckets = null, + Collection physicalPartitionThroughputInfo = null, + int? offerTargetThroughput = null, + int? partitionCount = null) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + // Throughput is always copied from source + this.OfferThroughput = source.OfferThroughput; + + this.OfferIsRUPerMinuteThroughputEnabled = offerIsRUPerMinuteThroughputEnabled ?? source.OfferIsRUPerMinuteThroughputEnabled; + this.OfferIsAutoScaleEnabled = offerIsAutoScaleEnabled ?? source.OfferIsAutoScaleEnabled; + this.OfferAutopilotSettings = offerAutopilotSettings != null ? new AutopilotSettings(offerAutopilotSettings) : (source.OfferAutopilotSettings != null ? new AutopilotSettings(source.OfferAutopilotSettings) : null); + this.OfferMinimumThroughputParameters = offerMinimumThroughputParameters != null ? new OfferMinimumThroughputParameters(offerMinimumThroughputParameters) : (source.OfferMinimumThroughputParameters != null ? new OfferMinimumThroughputParameters(source.OfferMinimumThroughputParameters) : null); + this.BackgroundTaskMaxAllowedThroughputPercent = backgroundTaskMaxAllowedThroughputPercent ?? source.BackgroundTaskMaxAllowedThroughputPercent; + this.ThroughputDistributionPolicy = throughputDistributionPolicy ?? source.ThroughputDistributionPolicy; + this.ThroughputBuckets = throughputBuckets ?? source.ThroughputBuckets; + this.PhysicalPartitionThroughputInfo = physicalPartitionThroughputInfo ?? source.PhysicalPartitionThroughputInfo; + this.OfferTargetThroughput = offerTargetThroughput ?? source.OfferTargetThroughput; + this.PartitionCount = partitionCount ?? source.PartitionCount; } /// /// Internal constructor accepting offer throughput, autopilot settings, minimum throughput parameters, bg task throughput percent, - /// throughput distribution policy, throughput buckets, and target throughput + /// throughput distribution policy, throughput buckets, target throughput, and partition count. /// internal OfferContentV2( int offerThroughput, @@ -309,7 +365,8 @@ internal OfferContentV2( double? bgTaskMaxAllowedThroughputPercent, ThroughputDistributionPolicyType? throughputDistributionPolicy, Collection throughputBuckets, - int? offerTargetThroughput = null) + int? offerTargetThroughput = null, + int? partitionCount = null) { this.OfferThroughput = offerThroughput; this.OfferIsRUPerMinuteThroughputEnabled = offerEnableRUPerMinuteThroughput; @@ -344,6 +401,11 @@ internal OfferContentV2( { this.OfferTargetThroughput = offerTargetThroughput.Value; } + + if (partitionCount.HasValue) + { + this.PartitionCount = partitionCount.Value; + } } internal OfferContentV2( @@ -373,6 +435,13 @@ internal OfferContentV2( { this.OfferTargetThroughput = offerTargetThroughput.Value; } + + int? partitionCount = content.PartitionCount; + if (partitionCount.HasValue) + { + this.PartitionCount = partitionCount.Value; + } + } } #endif @@ -633,6 +702,29 @@ private set } } + /// + /// Represents partition count. + /// + [JsonProperty(PropertyName = Constants.Properties.PartitionCount, DefaultValueHandling = DefaultValueHandling.Ignore)] + internal int? PartitionCount + { + get + { + if (this.partitionCount == null) + { + this.partitionCount = base.GetValue(Constants.Properties.PartitionCount); + } + + return this.partitionCount; + } + private set + { + this.partitionCount = value; + base.SetValue(Constants.Properties.PartitionCount, this.partitionCount); + } + } + + internal override void OnSave() { base.OnSave(); diff --git a/Microsoft.Azure.Cosmos/src/direct/OfferV2.cs b/Microsoft.Azure.Cosmos/src/direct/OfferV2.cs index 902cc6f5ad..51e7406943 100644 --- a/Microsoft.Azure.Cosmos/src/direct/OfferV2.cs +++ b/Microsoft.Azure.Cosmos/src/direct/OfferV2.cs @@ -235,7 +235,8 @@ internal OfferV2( double? bgTaskMaxAllowedThroughputPercent, ThroughputDistributionPolicyType? throughputDistributionPolicy, Collection throughputBuckets, - int? offerTargetThroughput = null) + int? offerTargetThroughput = null, + int? partitionCount = null) : base(offer) { this.OfferType = string.Empty; @@ -250,7 +251,8 @@ internal OfferV2( bgTaskMaxAllowedThroughputPercent, throughputDistributionPolicy, throughputBuckets, - offerTargetThroughput); + offerTargetThroughput, + partitionCount); } #endif diff --git a/Microsoft.Azure.Cosmos/src/direct/OperationType.cs b/Microsoft.Azure.Cosmos/src/direct/OperationType.cs index ea7af81e23..9855f3185a 100644 --- a/Microsoft.Azure.Cosmos/src/direct/OperationType.cs +++ b/Microsoft.Azure.Cosmos/src/direct/OperationType.cs @@ -149,6 +149,7 @@ internal enum OperationType ControllerBatchGetOutputV2 = -27, ControllerBatchWatchdogHealthCheckPing = -28, GetDatabaseAccountArtifactPermissions = -29, + GetRegionalConfigurations = -30, #endif } diff --git a/Microsoft.Azure.Cosmos/src/direct/PartitionKeyInternal.cs b/Microsoft.Azure.Cosmos/src/direct/PartitionKeyInternal.cs index aea6583573..d8910fdcea 100644 --- a/Microsoft.Azure.Cosmos/src/direct/PartitionKeyInternal.cs +++ b/Microsoft.Azure.Cosmos/src/direct/PartitionKeyInternal.cs @@ -811,7 +811,9 @@ private static IReadOnlyList GetHashValueFromEPKForMultiHash(string epkV hashes.Add(new Int128(maxBytes)); } } - else +#pragma warning disable SA1108 + else // The EPK has less values than Paths.Count in the PkDef, this is empty partitionkey. +#pragma warning restore SA1108 { hashes.Add(0); } diff --git a/Microsoft.Azure.Cosmos/src/direct/Paths.cs b/Microsoft.Azure.Cosmos/src/direct/Paths.cs index b47723c7cc..06e57ee27c 100644 --- a/Microsoft.Azure.Cosmos/src/direct/Paths.cs +++ b/Microsoft.Azure.Cosmos/src/direct/Paths.cs @@ -19,6 +19,9 @@ internal static class Paths public const string ReplicaOperations_ReportThroughputUtilization = "reportthroughpututilization"; public const string ReplicaOperations_BatchReportThroughputUtilization = "batchreportthroughpututilization"; public const string Operations_GetFederationConfigurations = "getfederationconfigurations"; +#pragma warning disable SA1310 // Field names should not contain underscore + public const string Operations_GetRegionalConfigurations = "getregionalconfigurations"; +#pragma warning restore SA1310 // Field names should not contain underscore public const string Operations_GetConfiguration = "getconfiguration"; public const string Operations_GetDatabaseAccountConfigurations = "getdatabaseaccountconfigurations"; public const string Operations_GetMicrosoftFabricDatabaseAccountArtifactPermissions = "getdatabaseaccountartifactpermissions"; diff --git a/Microsoft.Azure.Cosmos/src/direct/PathsHelper.cs b/Microsoft.Azure.Cosmos/src/direct/PathsHelper.cs index 27a032b7d0..6f4303bc65 100644 --- a/Microsoft.Azure.Cosmos/src/direct/PathsHelper.cs +++ b/Microsoft.Azure.Cosmos/src/direct/PathsHelper.cs @@ -1467,6 +1467,8 @@ public static string GenerateRootOperationPath(OperationType operationType) return Paths.OperationsPathSegment + "/" + Paths.Operations_GetConfiguration; case OperationType.GetFederationConfigurations: return Paths.OperationsPathSegment + "/" + Paths.Operations_GetFederationConfigurations; + case OperationType.GetRegionalConfigurations: + return Paths.OperationsPathSegment + "/" + Paths.Operations_GetRegionalConfigurations; case OperationType.GetDatabaseAccountConfigurations: return Paths.OperationsPathSegment + "/" + Paths.Operations_GetDatabaseAccountConfigurations; case OperationType.GetDatabaseAccountArtifactPermissions: @@ -1582,6 +1584,7 @@ private static bool IsRootOperation(in StringSegment operationSegment, in String operationTypeSegment.Equals(Paths.ControllerOperations_BatchReportChargesV2, StringComparison.OrdinalIgnoreCase) || operationTypeSegment.Equals(Paths.ControllerOperations_HeartBeatPingWatchdog, StringComparison.OrdinalIgnoreCase) || operationTypeSegment.Equals(Paths.Operations_GetFederationConfigurations, StringComparison.OrdinalIgnoreCase) || + operationTypeSegment.Equals(Paths.Operations_GetRegionalConfigurations, StringComparison.OrdinalIgnoreCase) || operationTypeSegment.Equals(Paths.Operations_GetStorageServiceConfigurations, StringComparison.OrdinalIgnoreCase) || operationTypeSegment.Equals(Paths.Operations_GetConfiguration, StringComparison.OrdinalIgnoreCase) || operationTypeSegment.Equals(Paths.Operations_GetStorageAccountKey, StringComparison.OrdinalIgnoreCase) || diff --git a/Microsoft.Azure.Cosmos/src/direct/PerfCounters.cs b/Microsoft.Azure.Cosmos/src/direct/PerfCounters.cs deleted file mode 100644 index 438e2a688b..0000000000 --- a/Microsoft.Azure.Cosmos/src/direct/PerfCounters.cs +++ /dev/null @@ -1,429 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ -namespace Microsoft.Azure.Documents -{ - using System; - using System.Diagnostics; - using Microsoft.Azure.Cosmos.ServiceFramework.Core; - - internal sealed class PerfCounters : IDisposable - { - private readonly string performanceCategory; - - private readonly string performanceCategoryHelp; - - private PerformanceCounter frontendRequestsPerSec; - - private PerformanceCounter frontendActiveRequests; - - private PerformanceCounter admissionControlledRequestsPerSec; - - private PerformanceCounter admissionControlledRequests; - - private PerformanceCounter backendRequestsPerSec; - - private PerformanceCounter backendActiveRequests; - - private PerformanceCounter currentFrontendConnections; - - private PerformanceCounter queryRequestsPerSec; - - private PerformanceCounter triggerRequestsPerSec; - - private PerformanceCounter procedureRequestsPerSec; - - private PerformanceCounter averageProcedureRequestsDuration; - - private PerformanceCounter averageProcedureRequestsDurationBase; - - private PerformanceCounter averageQueryRequestsDuration; - - private PerformanceCounter averageQueryRequestsDurationBase; - - private PerformanceCounter backendConnectionOpenAverageLatency; - - private PerformanceCounter backendConnectionOpenAverageLatencyBase; - - private PerformanceCounter routingFailures; - - private PerformanceCounter backendConnectionOpenFailuresDueToSynRetransmitPerSecond; - - private PerfCounters(string category, string categoryHelp) - { - this.performanceCategory = category; - this.performanceCategoryHelp = categoryHelp; - } - - // Currently these counters objects instantiation is happening via static compile directive - // rework to find a suitable entry point for the same during runtime - public static PerfCounters Counters { get; } = new PerfCounters("DocDB Gateway", "Counters for DocDB Gateway"); - - // Counter set for CosmosControllerService daemon - public static PerfCounters CountersCosmosControllerService { get; } = new PerfCounters( - "Cosmos ControllerService", - "Counters for Cosmos ControllerService"); - - public PerformanceCounter FrontendRequestsPerSec - { - get - { - return this.frontendRequestsPerSec; - } - } - - public PerformanceCounter FrontendActiveRequests - { - get - { - return this.frontendActiveRequests; - } - } - - public PerformanceCounter BackendRequestsPerSec - { - get - { - return this.backendRequestsPerSec; - } - } - - public PerformanceCounter BackendActiveRequests - { - get - { - return this.backendActiveRequests; - } - } - - public PerformanceCounter AdmissionControlledRequestsPerSec - { - get - { - return this.admissionControlledRequestsPerSec; - } - } - - public PerformanceCounter AdmissionControlledRequests - { - get - { - return this.admissionControlledRequests; - } - } - - public PerformanceCounter CurrentFrontendConnections - { - get - { - return this.currentFrontendConnections; - } - } - - public PerformanceCounter QueryRequestsPerSec - { - get - { - return this.queryRequestsPerSec; - } - } - - public PerformanceCounter TriggerRequestsPerSec - { - get - { - return this.triggerRequestsPerSec; - } - } - - public PerformanceCounter ProcedureRequestsPerSec - { - get - { - return this.procedureRequestsPerSec; - } - } - - public PerformanceCounter AverageProcedureRequestsDuration - { - get - { - return this.averageProcedureRequestsDuration; - } - } - - public PerformanceCounter AverageProcedureRequestsDurationBase - { - get - { - return this.averageProcedureRequestsDurationBase; - } - } - - public PerformanceCounter AverageQueryRequestsDuration - { - get - { - return this.averageQueryRequestsDuration; - } - } - - public PerformanceCounter AverageQueryRequestsDurationBase - { - get - { - return this.averageQueryRequestsDurationBase; - } - } - - public PerformanceCounter BackendConnectionOpenAverageLatency - { - get - { - return this.backendConnectionOpenAverageLatency; - } - } - - public PerformanceCounter BackendConnectionOpenAverageLatencyBase - { - get - { - return this.backendConnectionOpenAverageLatencyBase; - } - } - - public PerformanceCounter RoutingFailures - { - get - { - return this.routingFailures; - } - } - - public PerformanceCounter BackendConnectionOpenFailuresDueToSynRetransmitPerSecond - { - get - { - return this.backendConnectionOpenFailuresDueToSynRetransmitPerSecond; - } - } - - /// - /// Creates the given performance counter category. - /// - /// Name of the category. - /// Help description. - /// Category type. - /// Counters in the category. - /// - /// Indicates whether machine-wide synchronization should be used to avoid races between different entry-points attempting to create the same category. - /// - /// If the category already exists then it is checked to ensure that the given counters are present. If not, the category is recreated. - internal static void CreatePerfCounterCategory(string category, - string categoryHelp, - PerformanceCounterCategoryType categoryType, - CounterCreationDataCollection counters, - bool useSystemMutex = true) - { - SystemSynchronizationScope syncScope = useSystemMutex ? SystemSynchronizationScope.CreateSynchronizationScope($"CDBPerfCategory-{category}") : default; - - try - { - // If the performance counter category already exists, check if any counters have changed. - if (PerformanceCounterCategory.Exists(category)) - { - PerformanceCounterCategory perfCategory = new PerformanceCounterCategory(category); - bool shouldReturn = true; - foreach (CounterCreationData counter in counters) - { - try - { - if (!perfCategory.CounterExists(counter.CounterName)) - { - shouldReturn = false; - break; - } - } - catch - { - shouldReturn = false; - break; - } - } - - if (shouldReturn) - { - return; - } - else - { - PerformanceCounterCategory.Delete(category); - } - } - - // Create the category. - PerformanceCounterCategory.Create(category, categoryHelp, categoryType, counters); - } - finally - { - syncScope?.Dispose(); - } - } - - /// - /// Creating performance counter category is a privileged operation and - /// hence done in the WinFab service setup entrypoint that is invoked before - /// the service is actually started. - /// - public void InstallCounters() - { - CounterCreationDataCollection counters = new CounterCreationDataCollection(); - - counters.Add(new CounterCreationData("Frontend Requests/sec", "Frontend Requests per second", PerformanceCounterType.RateOfCountsPerSecond32)); - - counters.Add(new CounterCreationData("Frontend Active Requests", "Frontend Active Requests", PerformanceCounterType.NumberOfItems32)); - - counters.Add(new CounterCreationData("Admission Controlled Requests/sec", "Admission controlled requests per second", PerformanceCounterType.RateOfCountsPerSecond32)); - - counters.Add(new CounterCreationData("Admission Controlled Requests", "Admission controlled requests", PerformanceCounterType.CounterDelta32)); - - counters.Add(new CounterCreationData("Backend Requests/sec", "Backend Requests per second", PerformanceCounterType.RateOfCountsPerSecond32)); - - counters.Add(new CounterCreationData("Backend Active Requests", "Backend Active Requests", PerformanceCounterType.NumberOfItems32)); - - counters.Add(new CounterCreationData("Current Frontend Connections", "Current Connections from Frontend to backend", PerformanceCounterType.NumberOfItems32)); - - counters.Add(new CounterCreationData("Fabric Resolve Service Failures", "Number of failures for resolving a fabric service", PerformanceCounterType.CounterDelta32)); - - counters.Add(new CounterCreationData("Query Requests/sec", "Query Requests per second", PerformanceCounterType.RateOfCountsPerSecond32)); - - counters.Add(new CounterCreationData("Trigger Requests/sec", "Trigger Requests per second", PerformanceCounterType.RateOfCountsPerSecond32)); - - counters.Add(new CounterCreationData("Procedure Requests/sec", "Procedure Requests per second", PerformanceCounterType.RateOfCountsPerSecond32)); - - counters.Add(new CounterCreationData("Average Procedure Requests Duration", "Average Duration of a Procedure Request", PerformanceCounterType.AverageTimer32)); - - counters.Add(new CounterCreationData("Average Procedure Requests Duration Base", "Average Duration of a Procedure Request Base", PerformanceCounterType.AverageBase)); - - counters.Add(new CounterCreationData("Average Query Requests Duration", "Average Duration of a Query Request", PerformanceCounterType.AverageTimer32)); - - counters.Add(new CounterCreationData("Average Query Requests Duration Base", "Average Duration of a Query Request Base", PerformanceCounterType.AverageBase)); - - counters.Add(new CounterCreationData("Backend Connection Open Average Latency", "Average time to open a connection to the backend", PerformanceCounterType.AverageTimer32)); - - counters.Add(new CounterCreationData("Backend Connection Open Average Latency Base", "Average time to open a connection to the backend Base", PerformanceCounterType.AverageBase)); - - counters.Add(new CounterCreationData("Fabric Resolve Service Average Latency", "Average time to resolve a fabric service", PerformanceCounterType.AverageTimer32)); - - counters.Add(new CounterCreationData("Fabric Resolve Service Average Latency Base", "Average time to resolve a fabric service Base", PerformanceCounterType.AverageBase)); - - counters.Add(new CounterCreationData("Routing Failures", "Number of failures for connecting to a stale replica", PerformanceCounterType.CounterDelta32)); - - counters.Add(new CounterCreationData("Backend Connection Open Failures Due To Syn Retransmit Timeout/sec", "Number of failures per second when connecting to a backend node which failed with WSAETIMEDOUT", PerformanceCounterType.RateOfCountsPerSecond32)); - - PerfCounters.CreatePerfCounterCategory(this.performanceCategory, this.performanceCategoryHelp, PerformanceCounterCategoryType.SingleInstance, counters); - } - - public void InitializePerfCounters() - { - this.frontendRequestsPerSec = new PerformanceCounter(this.performanceCategory, "Frontend Requests/sec", false); - this.frontendRequestsPerSec.RawValue = 0; - - this.frontendActiveRequests = new PerformanceCounter(this.performanceCategory, "Frontend Active Requests", false); - this.frontendActiveRequests.RawValue = 0; - - this.admissionControlledRequestsPerSec = new PerformanceCounter(this.performanceCategory, "Admission Controlled Requests/sec", false); - this.admissionControlledRequestsPerSec.RawValue = 0; - - this.admissionControlledRequests = new PerformanceCounter(this.performanceCategory, "Admission Controlled Requests", false); - this.admissionControlledRequests.RawValue = 0; - - this.backendRequestsPerSec = new PerformanceCounter(this.performanceCategory, "Backend Requests/sec", false); - this.backendRequestsPerSec.RawValue = 0; - - this.backendActiveRequests = new PerformanceCounter(this.performanceCategory, "Backend Active Requests", false); - this.backendActiveRequests.RawValue = 0; - - this.currentFrontendConnections = new PerformanceCounter(this.performanceCategory, "Current Frontend Connections", false); - this.currentFrontendConnections.RawValue = 0; - - this.queryRequestsPerSec = new PerformanceCounter(this.performanceCategory, "Query Requests/sec", false); - this.queryRequestsPerSec.RawValue = 0; - - this.triggerRequestsPerSec = new PerformanceCounter(this.performanceCategory, "Trigger Requests/sec", false); - this.triggerRequestsPerSec.RawValue = 0; - - this.procedureRequestsPerSec = new PerformanceCounter(this.performanceCategory, "Procedure Requests/sec", false); - this.procedureRequestsPerSec.RawValue = 0; - - this.averageProcedureRequestsDuration = new PerformanceCounter(this.performanceCategory, "Average Procedure Requests Duration", false); - this.averageProcedureRequestsDuration.RawValue = 0; - - this.averageProcedureRequestsDurationBase = new PerformanceCounter(this.performanceCategory, "Average Procedure Requests Duration Base", false); - this.averageProcedureRequestsDurationBase.RawValue = 0; - - this.averageQueryRequestsDuration = new PerformanceCounter(this.performanceCategory, "Average Query Requests Duration", false); - this.averageQueryRequestsDuration.RawValue = 0; - - this.averageQueryRequestsDurationBase = new PerformanceCounter(this.performanceCategory, "Average Query Requests Duration Base", false); - this.averageQueryRequestsDurationBase.RawValue = 0; - - this.backendConnectionOpenAverageLatency = new PerformanceCounter(this.performanceCategory, "Backend Connection Open Average Latency", false); - this.backendConnectionOpenAverageLatency.RawValue = 0; - - this.backendConnectionOpenAverageLatencyBase = new PerformanceCounter(this.performanceCategory, "Backend Connection Open Average Latency Base", false); - this.backendConnectionOpenAverageLatencyBase.RawValue = 0; - - this.routingFailures = new PerformanceCounter(this.performanceCategory, "Routing Failures", false); - this.routingFailures.RawValue = 0; - - this.backendConnectionOpenFailuresDueToSynRetransmitPerSecond = new PerformanceCounter(this.performanceCategory, "Backend Connection Open Failures Due To Syn Retransmit Timeout/sec", false); - this.backendConnectionOpenFailuresDueToSynRetransmitPerSecond.RawValue = 0; - } - - #region IDisposable Members - - public void Dispose() - { -#pragma warning disable SA1501 - using (this.frontendActiveRequests) { } - - using (this.frontendRequestsPerSec) { } - - using (this.admissionControlledRequests) { } - - using (this.admissionControlledRequestsPerSec) { } - - using (this.backendActiveRequests) { } - - using (this.backendRequestsPerSec) { } - - using (this.currentFrontendConnections) { } - - using (this.queryRequestsPerSec) { } - - using (this.triggerRequestsPerSec) { } - - using (this.procedureRequestsPerSec) { } - - using (this.averageProcedureRequestsDuration) { } - - using (this.averageProcedureRequestsDurationBase) { } - - using (this.averageQueryRequestsDuration) { } - - using (this.averageQueryRequestsDurationBase) { } - - using (this.backendConnectionOpenAverageLatency) { } - - using (this.backendConnectionOpenAverageLatencyBase) { } - - using (this.routingFailures) { } - - using (this.backendConnectionOpenFailuresDueToSynRetransmitPerSecond) { } -#pragma warning restore SA1501 - } - - #endregion - } -} diff --git a/Microsoft.Azure.Cosmos/src/direct/PerformanceActivities.cs b/Microsoft.Azure.Cosmos/src/direct/PerformanceActivities.cs deleted file mode 100644 index bbf9dda82b..0000000000 --- a/Microsoft.Azure.Cosmos/src/direct/PerformanceActivities.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ -namespace Microsoft.Azure.Documents -{ - internal sealed class OpenConnectionPerformanceActivity : PerformanceActivity - { - public OpenConnectionPerformanceActivity() - : base(null, null, null, PerfCounters.Counters.BackendConnectionOpenAverageLatency, PerfCounters.Counters.BackendConnectionOpenAverageLatencyBase, "OpenConnection") - { } - } - - internal sealed class QueryRequestPerformanceActivity : PerformanceActivity - { - public QueryRequestPerformanceActivity() - : base(PerfCounters.Counters.QueryRequestsPerSec, null, null, PerfCounters.Counters.AverageQueryRequestsDuration, PerfCounters.Counters.AverageQueryRequestsDurationBase, null) - { } - } - - internal sealed class ProcedureRequestPerformanceActivity : PerformanceActivity - { - public ProcedureRequestPerformanceActivity() - : base(PerfCounters.Counters.ProcedureRequestsPerSec, null, null, PerfCounters.Counters.AverageProcedureRequestsDuration, PerfCounters.Counters.AverageProcedureRequestsDurationBase, null) - { } - } -} diff --git a/Microsoft.Azure.Cosmos/src/direct/PerformanceActivity.cs b/Microsoft.Azure.Cosmos/src/direct/PerformanceActivity.cs deleted file mode 100644 index 2b6b4b2340..0000000000 --- a/Microsoft.Azure.Cosmos/src/direct/PerformanceActivity.cs +++ /dev/null @@ -1,143 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ -namespace Microsoft.Azure.Documents -{ - using System; - using System.Diagnostics; - - internal class PerformanceActivity - { - private bool callCompleted; - private static readonly long MaxTicks = TimeSpan.FromHours(6).Ticks; - private Stopwatch stopWatch; - - private readonly PerformanceCounter requestsCounter; - private readonly PerformanceCounter currentRequestsCounter; - private readonly PerformanceCounter failuresCounter; - - private readonly PerformanceCounter averageTimeCounter; - private readonly PerformanceCounter averageTimeBaseCounter; - - private string operationName; - - public delegate void OperationDurationDelegate(Guid ActivityId, string operation, double milliseconds); - -#pragma warning disable 0649 - /// - /// The delegate is populated by the assembly that desires to trace the . - /// Hence ignore the warning "CS0649: field is never assigned to, and will always have its default value null" - /// - internal static OperationDurationDelegate OperationDuration; -#pragma warning restore 0649 - - protected PerformanceActivity( - PerformanceCounter requestsCounter, - PerformanceCounter currentRequestsCounter, - PerformanceCounter failuresCounter, - PerformanceCounter averageTimeCounter, - PerformanceCounter averageTimeBaseCounter, - string operation - ) - { - this.callCompleted = false; - this.requestsCounter = requestsCounter; - this.currentRequestsCounter = currentRequestsCounter; - this.failuresCounter = failuresCounter; - - this.averageTimeCounter = averageTimeCounter; - this.averageTimeBaseCounter = averageTimeBaseCounter; - this.operationName = operation; - - this.stopWatch = new Stopwatch(); - } - - - protected string OperationName - { - get { return this.operationName; } - set { this.operationName = value; } - } - - public long ElapsedTicks - { - get - { - return stopWatch.ElapsedTicks; - } - } - - public double ElapsedMilliseconds - { - get - { - return stopWatch.Elapsed.TotalMilliseconds; - } - } - - protected Stopwatch StopWatch - { - get - { - return this.stopWatch; - } - } - - public void ActivityStart() - { - stopWatch.Start(); - - if (this.requestsCounter != null) - { - this.requestsCounter.Increment(); - } - - if (this.currentRequestsCounter != null) - { - this.currentRequestsCounter.Increment(); - } - } - - public virtual void ActivityComplete(bool success = true) - { - if (this.callCompleted == true) - { - return; - } - - this.callCompleted = true; - - stopWatch.Stop(); - - long ticks = stopWatch.ElapsedTicks; - - if (this.averageTimeCounter != null && ticks < PerformanceActivity.MaxTicks) - { - this.averageTimeCounter.IncrementBy(ticks); - this.averageTimeBaseCounter.Increment(); - } - - if (this.operationName != null && PerformanceActivity.OperationDuration != null && ticks < PerformanceActivity.MaxTicks) - { - PerformanceActivity.OperationDuration(Trace.CorrelationManager.ActivityId, this.operationName, stopWatch.ElapsedMilliseconds); - } - - if (this.currentRequestsCounter != null) - { - this.currentRequestsCounter.Decrement(); - } - - if (success == false && this.failuresCounter != null) - { - this.failuresCounter.Increment(); - } - } - } - - internal sealed class RequestPerformanceActivity : PerformanceActivity - { - public RequestPerformanceActivity() - : base(null, null, null, null, null, null) - { } - } -} diff --git a/Microsoft.Azure.Cosmos/src/direct/PooledTimer.cs b/Microsoft.Azure.Cosmos/src/direct/PooledTimer.cs index 2a50378fe6..0f0272dd89 100644 --- a/Microsoft.Azure.Cosmos/src/direct/PooledTimer.cs +++ b/Microsoft.Azure.Cosmos/src/direct/PooledTimer.cs @@ -23,7 +23,9 @@ internal sealed class PooledTimer /// /// PooledTimer subscribes to the TimerPool to get notified when the timeout has expired /// +#pragma warning disable IDE0044 // Add readonly modifier private TimerPool timerPool; +#pragma warning restore IDE0044 // Add readonly modifier /// /// tcs is set to completed state if the timeout occurs else its set to cancelled state diff --git a/Microsoft.Azure.Cosmos/src/direct/Protocol.cs b/Microsoft.Azure.Cosmos/src/direct/Protocol.cs index 13a5a3d47d..6dcb2fb250 100644 --- a/Microsoft.Azure.Cosmos/src/direct/Protocol.cs +++ b/Microsoft.Azure.Cosmos/src/direct/Protocol.cs @@ -3,11 +3,9 @@ //------------------------------------------------------------ namespace Microsoft.Azure.Documents.Client { - -#pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved -#pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved -#pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved -/// + using Microsoft.Azure.Cosmos; + + /// /// Specifies the protocol to be used by DocumentClient for communicating to the Azure Cosmos DB service. /// /// @@ -26,9 +24,6 @@ namespace Microsoft.Azure.Documents.Client /// #if COSMOSCLIENT internal -#pragma warning restore CS1574 // XML comment has cref attribute that could not be resolved -#pragma warning restore CS1574 // XML comment has cref attribute that could not be resolved -#pragma warning restore CS1574 // XML comment has cref attribute that could not be resolved #else public #endif diff --git a/Microsoft.Azure.Cosmos/src/direct/ProxyRequest.cs b/Microsoft.Azure.Cosmos/src/direct/ProxyRequest.cs index ac6435f4a1..9ca39a5a3b 100644 --- a/Microsoft.Azure.Cosmos/src/direct/ProxyRequest.cs +++ b/Microsoft.Azure.Cosmos/src/direct/ProxyRequest.cs @@ -29,6 +29,7 @@ static ProxyRequest() RntbdConstants.RequestIdentifiers.StartEpkHash, RntbdConstants.RequestIdentifiers.EndEpkHash, RntbdConstants.RequestIdentifiers.GlobalDatabaseAccountName, + RntbdConstants.RequestIdentifiers.RegionalDatabaseAccountName, RntbdConstants.RequestIdentifiers.DatabaseName, RntbdConstants.RequestIdentifiers.CollectionName, RntbdConstants.RequestIdentifiers.CollectionRid, diff --git a/Microsoft.Azure.Cosmos/src/direct/QueryResult.cs b/Microsoft.Azure.Cosmos/src/direct/QueryResult.cs index c5877f3223..d1db4a2f06 100644 --- a/Microsoft.Azure.Cosmos/src/direct/QueryResult.cs +++ b/Microsoft.Azure.Cosmos/src/direct/QueryResult.cs @@ -21,7 +21,9 @@ internal sealed class QueryResult : IDynamicMetaObjectProvider { private readonly JContainer jObject; private readonly string ownerFullName; +#pragma warning disable IDE0044 // Add readonly modifier private JsonSerializer jsonSerializer; +#pragma warning restore IDE0044 // Add readonly modifier public QueryResult(JContainer jObject, string ownerFullName, JsonSerializer jsonSerializer) { diff --git a/Microsoft.Azure.Cosmos/src/direct/QuorumReader.cs b/Microsoft.Azure.Cosmos/src/direct/QuorumReader.cs index 5a0d9b5bf9..d8d163be5d 100644 --- a/Microsoft.Azure.Cosmos/src/direct/QuorumReader.cs +++ b/Microsoft.Azure.Cosmos/src/direct/QuorumReader.cs @@ -122,12 +122,14 @@ public async Task ReadStrongAsync( } DefaultTrace.TraceWarning( - "QuorumSelected: Could not converge on the LSN {0} GlobalCommittedLSN {3} ReadMode {4} after primary read barrier with read quorum {1} for strong read, Responses: {2}", + "QuorumSelected: Could not converge on the LSN {0} GlobalCommittedLSN {3} ReadMode {4} after primary read barrier with read quorum {1} for strong read, Responses: {2}, resourceType: {5}, operationType: {6}", secondaryQuorumReadResult.SelectedLsn, readQuorumValue, secondaryQuorumReadResult, secondaryQuorumReadResult.GlobalCommittedSelectedLsn, - readMode); + readMode, + entity.ResourceType, + entity.OperationType); entity.RequestContext.UpdateQuorumSelectedStoreResponse(secondaryQuorumReadResult.GetSelectedResponseAndSkipStoreResultDispose()); entity.RequestContext.QuorumSelectedLSN = secondaryQuorumReadResult.SelectedLsn; @@ -140,31 +142,48 @@ public async Task ReadStrongAsync( { if (hasPerformedReadFromPrimary) { - DefaultTrace.TraceWarning("QuorumNotSelected: Primary read already attempted. Quorum could not be selected after retrying on secondaries. ReadStoreResponses: {0}", secondaryQuorumReadResult.ToString()); + DefaultTrace.TraceWarning("QuorumNotSelected: Primary read already attempted. Quorum could not be selected after retrying on secondaries. ReadStoreResponses: {0}, resourceType: {1}, operationType: {2}", + secondaryQuorumReadResult.ToString(), + entity.ResourceType, + entity.OperationType); throw new GoneException(RMResources.ReadQuorumNotMet + $", partitionId: {entity.PartitionKeyRangeIdentity}", SubStatusCodes.Server_ReadQuorumNotMet); } - DefaultTrace.TraceWarning("QuorumNotSelected: Quorum could not be selected with read quorum of {0}", readQuorumValue); + DefaultTrace.TraceWarning("QuorumNotSelected: Quorum could not be selected with read quorum of {0}, resourceType: {1}, operationType: {2}", + readQuorumValue, + entity.ResourceType, + entity.OperationType); + using ReadPrimaryResult response = await this.ReadPrimaryAsync(entity, readQuorumValue, false); if (response.IsSuccessful && response.ShouldRetryOnSecondary) { Debug.Assert(false, "QuorumNotSelected: PrimaryResult has both Successful and ShouldRetryOnSecondary flags set"); - DefaultTrace.TraceCritical("PrimaryResult has both Successful and ShouldRetryOnSecondary flags set. ReadQuorumResult StoreResponses: {0}", secondaryQuorumReadResult.ToString()); + DefaultTrace.TraceCritical("PrimaryResult has both Successful and ShouldRetryOnSecondary flags set. ReadQuorumResult StoreResponses: {0}, resourceType: {1}, operationType: {2}", + secondaryQuorumReadResult.ToString(), + entity.ResourceType, + entity.OperationType); } else if (response.IsSuccessful) { - DefaultTrace.TraceInformation("QuorumNotSelected: ReadPrimary successful"); + DefaultTrace.TraceInformation("QuorumNotSelected: ReadPrimary successful, resourceType: {0}, operationType: {1}", + entity.ResourceType, + entity.OperationType); + return response.GetResponseAndSkipStoreResultDispose(); } else if (response.ShouldRetryOnSecondary) { shouldRetryOnSecondary = true; - DefaultTrace.TraceWarning("QuorumNotSelected: ReadPrimary did not succeed. Will retry on secondary. ReadQuorumResult StoreResponses: {0}", secondaryQuorumReadResult.ToString()); + DefaultTrace.TraceWarning("QuorumNotSelected: ReadPrimary did not succeed. Will retry on secondary. ReadQuorumResult StoreResponses: {0}, resourceType: {1}, operationType: {2}", + secondaryQuorumReadResult.ToString(), + entity.ResourceType, + entity.OperationType); + hasPerformedReadFromPrimary = true; // We have failed to select a quorum before - could very well happen again @@ -176,7 +195,10 @@ public async Task ReadStrongAsync( } else { - DefaultTrace.TraceWarning("QuorumNotSelected: Could not get successful response from ReadPrimary"); + DefaultTrace.TraceWarning("QuorumNotSelected: Could not get successful response from ReadPrimary, resourceType: {0}, operationType: {1}", + entity.ResourceType, + entity.OperationType); + throw new GoneException(RMResources.ReadQuorumNotMet, SubStatusCodes.Server_ReadQuorumNotMet); } } @@ -184,12 +206,19 @@ public async Task ReadStrongAsync( break; default: - DefaultTrace.TraceCritical("Unknown ReadQuorum result {0}", secondaryQuorumReadResult.QuorumResult.ToString()); + DefaultTrace.TraceCritical("Unknown ReadQuorum result {0}, resourceType: {1}, operationType: {2}", + secondaryQuorumReadResult.QuorumResult.ToString(), + entity.ResourceType, + entity.OperationType); + throw new InternalServerErrorException(RMResources.InternalServerError); } } while (--readQuorumRetry > 0 && shouldRetryOnSecondary); - DefaultTrace.TraceWarning("Could not complete read quorum with read quorum value of {0}", readQuorumValue); + DefaultTrace.TraceWarning("Could not complete read quorum with read quorum value of {0}, resourceType: {1}, operationType: {2}", + readQuorumValue, + entity.ResourceType, + entity.OperationType); throw new GoneException( string.Format(CultureInfo.CurrentUICulture, @@ -502,8 +531,9 @@ private async Task WaitForReadBarrierOldAsync( int readBarrierRetryCountMultiRegion = QuorumReader.maxBarrierRetriesForMultiRegion; long maxGlobalCommittedLsn = 0; - - while (readBarrierRetryCount-- > 0) +#pragma warning disable SA1108 + while (readBarrierRetryCount-- > 0) // Retry loop +#pragma warning restore SA1108 { barrierRequest.RequestContext.TimeoutHelper.ThrowGoneIfElapsed(); using StoreResultList disposableResponses = new(await this.storeReader.ReadMultipleReplicaAsync( @@ -606,8 +636,10 @@ private async Task WaitForReadBarrierNewAsync( long maxGlobalCommittedLsn = 0; bool hasConvergedOnLSN = false; int readBarrierRetryCount = 0; - while(readBarrierRetryCount < defaultBarrierRequestDelays.Length && remainingDelay >= TimeSpan.Zero) +#pragma warning disable SA1108 + while (readBarrierRetryCount < defaultBarrierRequestDelays.Length && remainingDelay >= TimeSpan.Zero) // Retry loop { +#pragma warning restore SA1108 barrierRequest.RequestContext.TimeoutHelper.ThrowGoneIfElapsed(); ValueStopwatch barrierRequestStopWatch = ValueStopwatch.StartNew(); using StoreResultList disposableResponses = new(await this.storeReader.ReadMultipleReplicaAsync( diff --git a/Microsoft.Azure.Cosmos/src/direct/RegionProximityUtil.cs b/Microsoft.Azure.Cosmos/src/direct/RegionProximityUtil.cs index 3a692b7158..48eac2a5bb 100644 --- a/Microsoft.Azure.Cosmos/src/direct/RegionProximityUtil.cs +++ b/Microsoft.Azure.Cosmos/src/direct/RegionProximityUtil.cs @@ -127,6 +127,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 120 }, { LocationNames.EastUS, 205 }, { LocationNames.EastUS2, 200 }, + { LocationNames.EastUS3, 192 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 242 }, @@ -226,6 +227,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 120 }, { LocationNames.EastUS, 205 }, { LocationNames.EastUS2, 200 }, + { LocationNames.EastUS3, 192 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 242 }, @@ -325,6 +327,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 116 }, { LocationNames.EastUS, 200 }, { LocationNames.EastUS2, 196 }, + { LocationNames.EastUS3, 187 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 238 }, @@ -424,6 +427,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 118 }, { LocationNames.EastUS, 212 }, { LocationNames.EastUS2, 206 }, + { LocationNames.EastUS3, 198 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 235 }, @@ -523,6 +527,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 182 }, { LocationNames.EastUS, 92 }, { LocationNames.EastUS2, 94 }, + { LocationNames.EastUS3, 110 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 14 }, @@ -622,6 +627,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 188 }, { LocationNames.EastUS, 86 }, { LocationNames.EastUS2, 90 }, + { LocationNames.EastUS3, 106 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 10 }, @@ -701,7 +707,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.AustriaEast, long.MaxValue }, { LocationNames.BelgiumCentral, long.MaxValue }, { LocationNames.BleuFranceCentral, 0 }, - { LocationNames.BleuFranceSouth, 255 }, + { LocationNames.BleuFranceSouth, 11 }, { LocationNames.BrazilSouth, long.MaxValue }, { LocationNames.BrazilSoutheast, long.MaxValue }, { LocationNames.CanadaCentral, long.MaxValue }, @@ -721,6 +727,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -799,7 +806,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.AustraliaSoutheast, long.MaxValue }, { LocationNames.AustriaEast, long.MaxValue }, { LocationNames.BelgiumCentral, long.MaxValue }, - { LocationNames.BleuFranceCentral, 255 }, + { LocationNames.BleuFranceCentral, 11 }, { LocationNames.BleuFranceSouth, 0 }, { LocationNames.BrazilSouth, long.MaxValue }, { LocationNames.BrazilSoutheast, long.MaxValue }, @@ -820,6 +827,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -919,6 +927,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 320 }, { LocationNames.EastUS, 118 }, { LocationNames.EastUS2, 122 }, + { LocationNames.EastUS3, 138 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 186 }, @@ -1018,6 +1027,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 320 }, { LocationNames.EastUS, 118 }, { LocationNames.EastUS2, 122 }, + { LocationNames.EastUS3, 138 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 186 }, @@ -1117,6 +1127,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 196 }, { LocationNames.EastUS, 25 }, { LocationNames.EastUS2, 28 }, + { LocationNames.EastUS3, 14 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 92 }, @@ -1216,6 +1227,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 206 }, { LocationNames.EastUS, 34 }, { LocationNames.EastUS2, 38 }, + { LocationNames.EastUS3, 24 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 102 }, @@ -1315,6 +1327,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 86 }, { LocationNames.EastUS, 196 }, { LocationNames.EastUS2, 198 }, + { LocationNames.EastUS3, 216 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 116 }, @@ -1414,6 +1427,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 176 }, { LocationNames.EastUS, 23 }, { LocationNames.EastUS2, 26 }, + { LocationNames.EastUS3, 8 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 101 }, @@ -1513,6 +1527,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 320 }, { LocationNames.EastUS, 118 }, { LocationNames.EastUS2, 122 }, + { LocationNames.EastUS3, 138 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 186 }, @@ -1612,6 +1627,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -1711,6 +1727,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -1810,6 +1827,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -1909,6 +1927,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -2008,6 +2027,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -2107,6 +2127,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -2201,11 +2222,12 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.ChinaNorth2, long.MaxValue }, { LocationNames.ChinaNorth3, long.MaxValue }, { LocationNames.DelosCloudGermanyCentral, 0 }, - { LocationNames.DelosCloudGermanyNorth, 255 }, + { LocationNames.DelosCloudGermanyNorth, 11 }, { LocationNames.DenmarkEast, long.MaxValue }, { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -2299,12 +2321,13 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.ChinaNorth, long.MaxValue }, { LocationNames.ChinaNorth2, long.MaxValue }, { LocationNames.ChinaNorth3, long.MaxValue }, - { LocationNames.DelosCloudGermanyCentral, 255 }, + { LocationNames.DelosCloudGermanyCentral, 11 }, { LocationNames.DelosCloudGermanyNorth, 0 }, { LocationNames.DenmarkEast, long.MaxValue }, { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -2404,6 +2427,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 193 }, { LocationNames.EastUS, 81 }, { LocationNames.EastUS2, 86 }, + { LocationNames.EastUS3, 102 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 10 }, @@ -2503,6 +2527,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 0 }, { LocationNames.EastUS, 199 }, { LocationNames.EastUS2, 210 }, + { LocationNames.EastUS3, 184 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 184 }, @@ -2602,6 +2627,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 199 }, { LocationNames.EastUS, 0 }, { LocationNames.EastUS2, 6 }, + { LocationNames.EastUS3, 19 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, 0 }, { LocationNames.FranceCentral, 80 }, @@ -2701,6 +2727,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 210 }, { LocationNames.EastUS, 6 }, { LocationNames.EastUS2, 0 }, + { LocationNames.EastUS3, 22 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, 6 }, { LocationNames.FranceCentral, 80 }, @@ -2769,6 +2796,106 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastUS2EUAP, long.MaxValue }, } }, + { + LocationNames.EastUS3, + new Dictionary() + { + { LocationNames.AustraliaCentral, 192 }, + { LocationNames.AustraliaCentral2, 192 }, + { LocationNames.AustraliaEast, 187 }, + { LocationNames.AustraliaSoutheast, 198 }, + { LocationNames.AustriaEast, 110 }, + { LocationNames.BelgiumCentral, 106 }, + { LocationNames.BleuFranceCentral, long.MaxValue }, + { LocationNames.BleuFranceSouth, long.MaxValue }, + { LocationNames.BrazilSouth, 138 }, + { LocationNames.BrazilSoutheast, 138 }, + { LocationNames.CanadaCentral, 14 }, + { LocationNames.CanadaEast, 24 }, + { LocationNames.CentralIndia, 216 }, + { LocationNames.CentralUS, 8 }, + { LocationNames.ChileCentral, 138 }, + { LocationNames.ChinaEast, long.MaxValue }, + { LocationNames.ChinaEast2, long.MaxValue }, + { LocationNames.ChinaEast3, long.MaxValue }, + { LocationNames.ChinaNorth, long.MaxValue }, + { LocationNames.ChinaNorth2, long.MaxValue }, + { LocationNames.ChinaNorth3, long.MaxValue }, + { LocationNames.DelosCloudGermanyCentral, long.MaxValue }, + { LocationNames.DelosCloudGermanyNorth, long.MaxValue }, + { LocationNames.DenmarkEast, 102 }, + { LocationNames.EastAsia, 184 }, + { LocationNames.EastUS, 19 }, + { LocationNames.EastUS2, 22 }, + { LocationNames.EastUS3, 0 }, + { LocationNames.EastUSSLV, long.MaxValue }, + { LocationNames.EastUSSTG, 19 }, + { LocationNames.FranceCentral, 96 }, + { LocationNames.FranceSouth, 104 }, + { LocationNames.GermanyNorth, 112 }, + { LocationNames.GermanyWestCentral, 106 }, + { LocationNames.IndonesiaCentral, 202 }, + { LocationNames.IsraelCentral, 209 }, + { LocationNames.IsraelNorthwest, 209 }, + { LocationNames.ItalyNorth, 110 }, + { LocationNames.JapanEast, 148 }, + { LocationNames.JapanWest, 152 }, + { LocationNames.JioIndiaCentral, 216 }, + { LocationNames.JioIndiaWest, 216 }, + { LocationNames.KoreaCentral, 165 }, + { LocationNames.KoreaSouth, 170 }, + { LocationNames.MalaysiaSouth, 202 }, + { LocationNames.MalaysiaWest, 202 }, + { LocationNames.MexicoCentral, 44 }, + { LocationNames.NewZealandNorth, 192 }, + { LocationNames.NorthCentralUS, 100 }, + { LocationNames.NorthEurope, 90 }, + { LocationNames.NorwayEast, 122 }, + { LocationNames.NorwayWest, 114 }, + { LocationNames.PolandCentral, 102 }, + { LocationNames.QatarCentral, 209 }, + { LocationNames.SouthAfricaNorth, 253 }, + { LocationNames.SouthAfricaWest, 236 }, + { LocationNames.SouthCentralUS, 30 }, + { LocationNames.SouthCentralUS2, 30 }, + { LocationNames.SouthCentralUSSTG, 30 }, + { LocationNames.SoutheastAsia, 202 }, + { LocationNames.SoutheastUS, 44 }, + { LocationNames.SoutheastUS3, 44 }, + { LocationNames.SoutheastUS5, 8 }, + { LocationNames.SouthIndia, 228 }, + { LocationNames.SouthwestUS, 50 }, + { LocationNames.SpainCentral, 96 }, + { LocationNames.SwedenCentral, 122 }, + { LocationNames.SwedenSouth, 122 }, + { LocationNames.SwitzerlandNorth, 110 }, + { LocationNames.SwitzerlandWest, 106 }, + { LocationNames.TaiwanNorth, 184 }, + { LocationNames.TaiwanNorthwest, 184 }, + { LocationNames.UAECentral, 209 }, + { LocationNames.UAENorth, 212 }, + { LocationNames.UKSouth, 90 }, + { LocationNames.UKWest, 92 }, + { LocationNames.USDoDCentral, long.MaxValue }, + { LocationNames.USDoDEast, long.MaxValue }, + { LocationNames.USGovArizona, long.MaxValue }, + { LocationNames.USGovTexas, long.MaxValue }, + { LocationNames.USGovVirginia, long.MaxValue }, + { LocationNames.USNatEast, long.MaxValue }, + { LocationNames.USNatWest, long.MaxValue }, + { LocationNames.USSecEast, long.MaxValue }, + { LocationNames.USSecWest, long.MaxValue }, + { LocationNames.USSecWestCentral, long.MaxValue }, + { LocationNames.WestCentralUS, 22 }, + { LocationNames.WestEurope, 102 }, + { LocationNames.WestIndia, 218 }, + { LocationNames.WestUS, 50 }, + { LocationNames.WestUS2, 44 }, + { LocationNames.WestUS3, 44 }, + { LocationNames.CentralUSEUAP, long.MaxValue }, + { LocationNames.EastUS2EUAP, long.MaxValue }, + } + }, { LocationNames.EastUSSLV, new Dictionary() @@ -2800,6 +2927,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, 0 }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -2899,6 +3027,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, 0 }, { LocationNames.EastUS2, 6 }, + { LocationNames.EastUS3, 19 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, 0 }, { LocationNames.FranceCentral, long.MaxValue }, @@ -2998,6 +3127,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 184 }, { LocationNames.EastUS, 80 }, { LocationNames.EastUS2, 80 }, + { LocationNames.EastUS3, 96 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 0 }, @@ -3097,6 +3227,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 172 }, { LocationNames.EastUS, 90 }, { LocationNames.EastUS2, 90 }, + { LocationNames.EastUS3, 104 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 11 }, @@ -3196,6 +3327,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 196 }, { LocationNames.EastUS, 91 }, { LocationNames.EastUS2, 94 }, + { LocationNames.EastUS3, 112 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 20 }, @@ -3295,6 +3427,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 188 }, { LocationNames.EastUS, 86 }, { LocationNames.EastUS2, 90 }, + { LocationNames.EastUS3, 106 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 10 }, @@ -3394,6 +3527,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 33 }, { LocationNames.EastUS, 218 }, { LocationNames.EastUS2, 226 }, + { LocationNames.EastUS3, 202 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, 218 }, { LocationNames.FranceCentral, 150 }, @@ -3493,6 +3627,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 110 }, { LocationNames.EastUS, 189 }, { LocationNames.EastUS2, 190 }, + { LocationNames.EastUS3, 209 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 108 }, @@ -3592,6 +3727,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 110 }, { LocationNames.EastUS, 189 }, { LocationNames.EastUS2, 190 }, + { LocationNames.EastUS3, 209 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 108 }, @@ -3691,6 +3827,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 182 }, { LocationNames.EastUS, 92 }, { LocationNames.EastUS2, 94 }, + { LocationNames.EastUS3, 110 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 14 }, @@ -3790,6 +3927,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 50 }, { LocationNames.EastUS, 162 }, { LocationNames.EastUS2, 164 }, + { LocationNames.EastUS3, 148 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 218 }, @@ -3889,6 +4027,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 50 }, { LocationNames.EastUS, 168 }, { LocationNames.EastUS2, 164 }, + { LocationNames.EastUS3, 152 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 218 }, @@ -3988,6 +4127,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 86 }, { LocationNames.EastUS, 196 }, { LocationNames.EastUS2, 198 }, + { LocationNames.EastUS3, 216 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 116 }, @@ -4087,6 +4227,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 86 }, { LocationNames.EastUS, 196 }, { LocationNames.EastUS2, 198 }, + { LocationNames.EastUS3, 216 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 116 }, @@ -4186,6 +4327,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 56 }, { LocationNames.EastUS, 182 }, { LocationNames.EastUS2, 176 }, + { LocationNames.EastUS3, 165 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 212 }, @@ -4285,6 +4427,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 60 }, { LocationNames.EastUS, 186 }, { LocationNames.EastUS2, 182 }, + { LocationNames.EastUS3, 170 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 206 }, @@ -4384,6 +4527,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 33 }, { LocationNames.EastUS, 218 }, { LocationNames.EastUS2, 226 }, + { LocationNames.EastUS3, 202 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 150 }, @@ -4483,6 +4627,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 33 }, { LocationNames.EastUS, 218 }, { LocationNames.EastUS2, 226 }, + { LocationNames.EastUS3, 202 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, 218 }, { LocationNames.FranceCentral, 150 }, @@ -4582,6 +4727,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 140 }, { LocationNames.EastUS, 58 }, { LocationNames.EastUS2, 68 }, + { LocationNames.EastUS3, 44 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 140 }, @@ -4681,6 +4827,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 120 }, { LocationNames.EastUS, 205 }, { LocationNames.EastUS2, 200 }, + { LocationNames.EastUS3, 192 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 242 }, @@ -4780,6 +4927,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 184 }, { LocationNames.EastUS, 19 }, { LocationNames.EastUS2, 22 }, + { LocationNames.EastUS3, 100 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, 19 }, { LocationNames.FranceCentral, 96 }, @@ -4879,6 +5027,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 205 }, { LocationNames.EastUS, 76 }, { LocationNames.EastUS2, 75 }, + { LocationNames.EastUS3, 90 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 27 }, @@ -4978,6 +5127,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 214 }, { LocationNames.EastUS, 101 }, { LocationNames.EastUS2, 104 }, + { LocationNames.EastUS3, 122 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 30 }, @@ -5077,6 +5227,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 206 }, { LocationNames.EastUS, 94 }, { LocationNames.EastUS2, 98 }, + { LocationNames.EastUS3, 114 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 24 }, @@ -5176,6 +5327,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 193 }, { LocationNames.EastUS, 81 }, { LocationNames.EastUS2, 86 }, + { LocationNames.EastUS3, 102 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 10 }, @@ -5275,6 +5427,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 110 }, { LocationNames.EastUS, 189 }, { LocationNames.EastUS2, 190 }, + { LocationNames.EastUS3, 209 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 108 }, @@ -5374,6 +5527,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 332 }, { LocationNames.EastUS, 234 }, { LocationNames.EastUS2, 240 }, + { LocationNames.EastUS3, 253 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 166 }, @@ -5473,6 +5627,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 336 }, { LocationNames.EastUS, 218 }, { LocationNames.EastUS2, 222 }, + { LocationNames.EastUS3, 236 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 150 }, @@ -5572,6 +5727,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 182 }, { LocationNames.EastUS, 32 }, { LocationNames.EastUS2, 26 }, + { LocationNames.EastUS3, 30 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 106 }, @@ -5671,6 +5827,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 182 }, { LocationNames.EastUS, 32 }, { LocationNames.EastUS2, 26 }, + { LocationNames.EastUS3, 30 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 106 }, @@ -5770,6 +5927,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, 26 }, + { LocationNames.EastUS3, 30 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, 32 }, { LocationNames.FranceCentral, long.MaxValue }, @@ -5869,6 +6027,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 33 }, { LocationNames.EastUS, 218 }, { LocationNames.EastUS2, 226 }, + { LocationNames.EastUS3, 202 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, 218 }, { LocationNames.FranceCentral, 150 }, @@ -5968,6 +6127,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 140 }, { LocationNames.EastUS, 58 }, { LocationNames.EastUS2, 68 }, + { LocationNames.EastUS3, 44 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 140 }, @@ -6067,6 +6227,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 140 }, { LocationNames.EastUS, 58 }, { LocationNames.EastUS2, 68 }, + { LocationNames.EastUS3, 44 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 140 }, @@ -6166,6 +6327,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 176 }, { LocationNames.EastUS, 23 }, { LocationNames.EastUS2, 26 }, + { LocationNames.EastUS3, 8 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 101 }, @@ -6265,6 +6427,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 66 }, { LocationNames.EastUS, 208 }, { LocationNames.EastUS2, 210 }, + { LocationNames.EastUS3, 228 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 128 }, @@ -6364,6 +6527,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 148 }, { LocationNames.EastUS, 64 }, { LocationNames.EastUS2, 58 }, + { LocationNames.EastUS3, 50 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 138 }, @@ -6463,6 +6627,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 184 }, { LocationNames.EastUS, 80 }, { LocationNames.EastUS2, 80 }, + { LocationNames.EastUS3, 96 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 100 }, @@ -6562,6 +6727,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 214 }, { LocationNames.EastUS, 101 }, { LocationNames.EastUS2, 104 }, + { LocationNames.EastUS3, 122 }, { LocationNames.EastUSSLV, 255 }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 30 }, @@ -6661,6 +6827,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 214 }, { LocationNames.EastUS, 101 }, { LocationNames.EastUS2, 104 }, + { LocationNames.EastUS3, 122 }, { LocationNames.EastUSSLV, 255 }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 30 }, @@ -6760,6 +6927,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 182 }, { LocationNames.EastUS, 92 }, { LocationNames.EastUS2, 94 }, + { LocationNames.EastUS3, 110 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 14 }, @@ -6859,6 +7027,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 178 }, { LocationNames.EastUS, 88 }, { LocationNames.EastUS2, 88 }, + { LocationNames.EastUS3, 106 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 10 }, @@ -6958,6 +7127,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 100 }, { LocationNames.EastUS, 199 }, { LocationNames.EastUS2, 210 }, + { LocationNames.EastUS3, 184 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 184 }, @@ -7057,6 +7227,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 100 }, { LocationNames.EastUS, 199 }, { LocationNames.EastUS2, 210 }, + { LocationNames.EastUS3, 184 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 184 }, @@ -7156,6 +7327,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 110 }, { LocationNames.EastUS, 189 }, { LocationNames.EastUS2, 190 }, + { LocationNames.EastUS3, 209 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 108 }, @@ -7255,6 +7427,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 109 }, { LocationNames.EastUS, 192 }, { LocationNames.EastUS2, 194 }, + { LocationNames.EastUS3, 212 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 112 }, @@ -7354,6 +7527,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 192 }, { LocationNames.EastUS, 74 }, { LocationNames.EastUS2, 78 }, + { LocationNames.EastUS3, 90 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 7 }, @@ -7453,6 +7627,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 194 }, { LocationNames.EastUS, 76 }, { LocationNames.EastUS2, 80 }, + { LocationNames.EastUS3, 92 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 8 }, @@ -7552,6 +7727,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -7651,6 +7827,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -7750,6 +7927,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -7849,6 +8027,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -7948,6 +8127,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -8047,6 +8227,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -8146,6 +8327,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -8245,6 +8427,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -8344,6 +8527,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -8443,6 +8627,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -8542,6 +8727,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 162 }, { LocationNames.EastUS, 38 }, { LocationNames.EastUS2, 47 }, + { LocationNames.EastUS3, 22 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 119 }, @@ -8641,6 +8827,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 193 }, { LocationNames.EastUS, 81 }, { LocationNames.EastUS2, 86 }, + { LocationNames.EastUS3, 102 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 10 }, @@ -8740,6 +8927,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 84 }, { LocationNames.EastUS, 198 }, { LocationNames.EastUS2, 200 }, + { LocationNames.EastUS3, 218 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 118 }, @@ -8839,6 +9027,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 148 }, { LocationNames.EastUS, 64 }, { LocationNames.EastUS2, 58 }, + { LocationNames.EastUS3, 50 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 138 }, @@ -8938,6 +9127,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 140 }, { LocationNames.EastUS, 58 }, { LocationNames.EastUS2, 68 }, + { LocationNames.EastUS3, 44 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, 58 }, { LocationNames.FranceCentral, 140 }, @@ -9037,6 +9227,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, 140 }, { LocationNames.EastUS, 58 }, { LocationNames.EastUS2, 68 }, + { LocationNames.EastUS3, 44 }, { LocationNames.EastUSSLV, long.MaxValue }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, 140 }, @@ -9136,6 +9327,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, 255 }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, @@ -9235,6 +9427,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.EastAsia, long.MaxValue }, { LocationNames.EastUS, long.MaxValue }, { LocationNames.EastUS2, long.MaxValue }, + { LocationNames.EastUS3, long.MaxValue }, { LocationNames.EastUSSLV, 255 }, { LocationNames.EastUSSTG, long.MaxValue }, { LocationNames.FranceCentral, long.MaxValue }, diff --git a/Microsoft.Azure.Cosmos/src/direct/ReplicatedResourceClient.cs b/Microsoft.Azure.Cosmos/src/direct/ReplicatedResourceClient.cs index 2ee768596d..c34ab1c06d 100644 --- a/Microsoft.Azure.Cosmos/src/direct/ReplicatedResourceClient.cs +++ b/Microsoft.Azure.Cosmos/src/direct/ReplicatedResourceClient.cs @@ -71,7 +71,8 @@ public ReplicatedResourceClient( bool disableRetryWithRetryPolicy, bool enableReplicaValidation, AccountConfigurationProperties accountConfigurationProperties, - RetryWithConfiguration retryWithConfiguration = null) + RetryWithConfiguration retryWithConfiguration = null, + ISessionRetryOptions sessionRetryOptions = null) { this.addressResolver = addressResolver; this.addressSelector = new AddressSelector(addressResolver, protocol); @@ -91,7 +92,8 @@ public ReplicatedResourceClient( transportClient, serviceConfigReader, authorizationTokenProvider, - enableReplicaValidation); + enableReplicaValidation, + sessionRetryOptions); this.consistencyWriter = new ConsistencyWriter( this.addressSelector, sessionContainer, @@ -100,7 +102,8 @@ public ReplicatedResourceClient( authorizationTokenProvider, useMultipleWriteLocations, enableReplicaValidation, - accountConfigurationProperties); + accountConfigurationProperties, + sessionRetryOptions); this.enableReadRequestsFallback = enableReadRequestsFallback; this.useMultipleWriteLocations = useMultipleWriteLocations; this.detectClientConnectivityIssues = detectClientConnectivityIssues; diff --git a/Microsoft.Azure.Cosmos/src/direct/RequestNameValueCollection.cs b/Microsoft.Azure.Cosmos/src/direct/RequestNameValueCollection.cs index 7852e28c56..629a239321 100644 --- a/Microsoft.Azure.Cosmos/src/direct/RequestNameValueCollection.cs +++ b/Microsoft.Azure.Cosmos/src/direct/RequestNameValueCollection.cs @@ -42,6 +42,7 @@ internal class RequestNameValueCollection : INameValueCollection public string AllowDocumentReadsInOfflineRegion { get; set; } public string AllowRestoreParamsUpdate { get; set; } public string AllowTentativeWrites { get; set; } + public string AllowTopologyUpsertWithoutIntent { get; set; } public string AllowUpdatingIsPhysicalMigrationInProgress { get; set; } public string Authorization { get; set; } public string BinaryId { get; set; } @@ -116,6 +117,7 @@ internal class RequestNameValueCollection : INameValueCollection public string IsRetriedWriteRequest { get; set; } public string IsRUPerGBEnforcementRequest { get; set; } public string IsServerlessStorageRefreshRequest { get; set; } + public string IsSoftDeletionOperation { get; set; } public string IsThroughputCapRequest { get; set; } public string IsUserRequest { get; set; } public string MaxPollingIntervalMilliseconds { get; set; } @@ -127,6 +129,7 @@ internal class RequestNameValueCollection : INameValueCollection public string NoRetryOn449StatusCode { get; set; } public string OfferReplaceRURedistribution { get; set; } public string OptimisticDirectExecute { get; set; } + public string OriginalAuthTokenType { get; set; } public string PageSize { get; set; } public string ParallelizeCrossPartitionQuery { get; set; } public string PartitionCount { get; set; } @@ -173,6 +176,7 @@ internal class RequestNameValueCollection : INameValueCollection public string RbacResource { get; set; } public string RbacUserId { get; set; } public string ReadFeedKeyType { get; set; } + public string ReadGlobalCommittedData { get; set; } public string RemainingTimeInMsOnClientRequest { get; set; } public string RemoteStorageType { get; set; } public string RequestedCollectionType { get; set; } @@ -231,6 +235,7 @@ internal class RequestNameValueCollection : INameValueCollection public string UseSystemBudget { get; set; } public string UseUserBackgroundBudget { get; set; } public string Version { get; set; } + public string WorkloadId { get; set; } public string XDate { get; set; } public RequestNameValueCollection() @@ -475,6 +480,11 @@ public static RequestNameValueCollection BuildRequestNameValueCollectionWithKnow requestNameValueCollection.PopulateThroughputPoolInfo = nameValueCollection[HttpConstants.HttpHeaders.PopulateThroughputPoolInfo]; requestNameValueCollection.RetrieveUserStrings = nameValueCollection[WFConstants.BackendHeaders.RetrieveUserStrings]; requestNameValueCollection.PopulateVectorIndexAggregateProgress = nameValueCollection[HttpConstants.HttpHeaders.PopulateVectorIndexAggregateProgress]; + requestNameValueCollection.AllowTopologyUpsertWithoutIntent = nameValueCollection[HttpConstants.HttpHeaders.AllowTopologyUpsertWithoutIntent]; + requestNameValueCollection.ReadGlobalCommittedData = nameValueCollection[HttpConstants.HttpHeaders.ReadGlobalCommittedData]; + requestNameValueCollection.IsSoftDeletionOperation = nameValueCollection[HttpConstants.HttpHeaders.IsSoftDeletionOperation]; + requestNameValueCollection.WorkloadId = nameValueCollection[HttpConstants.HttpHeaders.WorkloadId]; + requestNameValueCollection.OriginalAuthTokenType = nameValueCollection[WFConstants.BackendHeaders.OriginalAuthTokenType]; requestNameValueCollection.IfMatch = nameValueCollection[HttpConstants.HttpHeaders.IfMatch]; requestNameValueCollection.NoRetryOn449StatusCode = nameValueCollection[HttpConstants.HttpHeaders.NoRetryOn449StatusCode]; requestNameValueCollection.SkipAdjustThroughputFractionsForOfferReplace = nameValueCollection[HttpConstants.HttpHeaders.SkipAdjustThroughputFractionsForOfferReplace]; @@ -527,6 +537,7 @@ public void Clear() this.AllowDocumentReadsInOfflineRegion = null; this.AllowRestoreParamsUpdate = null; this.AllowTentativeWrites = null; + this.AllowTopologyUpsertWithoutIntent = null; this.AllowUpdatingIsPhysicalMigrationInProgress = null; this.Authorization = null; this.BinaryId = null; @@ -601,6 +612,7 @@ public void Clear() this.IsRetriedWriteRequest = null; this.IsRUPerGBEnforcementRequest = null; this.IsServerlessStorageRefreshRequest = null; + this.IsSoftDeletionOperation = null; this.IsThroughputCapRequest = null; this.IsUserRequest = null; this.MaxPollingIntervalMilliseconds = null; @@ -612,6 +624,7 @@ public void Clear() this.NoRetryOn449StatusCode = null; this.OfferReplaceRURedistribution = null; this.OptimisticDirectExecute = null; + this.OriginalAuthTokenType = null; this.PageSize = null; this.ParallelizeCrossPartitionQuery = null; this.PartitionCount = null; @@ -658,6 +671,7 @@ public void Clear() this.RbacResource = null; this.RbacUserId = null; this.ReadFeedKeyType = null; + this.ReadGlobalCommittedData = null; this.RemainingTimeInMsOnClientRequest = null; this.RemoteStorageType = null; this.RequestedCollectionType = null; @@ -716,6 +730,7 @@ public void Clear() this.UseSystemBudget = null; this.UseUserBackgroundBudget = null; this.Version = null; + this.WorkloadId = null; this.XDate = null; } @@ -730,6 +745,7 @@ public INameValueCollection Clone() AllowDocumentReadsInOfflineRegion = this.AllowDocumentReadsInOfflineRegion, AllowRestoreParamsUpdate = this.AllowRestoreParamsUpdate, AllowTentativeWrites = this.AllowTentativeWrites, + AllowTopologyUpsertWithoutIntent = this.AllowTopologyUpsertWithoutIntent, AllowUpdatingIsPhysicalMigrationInProgress = this.AllowUpdatingIsPhysicalMigrationInProgress, Authorization = this.Authorization, BinaryId = this.BinaryId, @@ -804,6 +820,7 @@ public INameValueCollection Clone() IsRetriedWriteRequest = this.IsRetriedWriteRequest, IsRUPerGBEnforcementRequest = this.IsRUPerGBEnforcementRequest, IsServerlessStorageRefreshRequest = this.IsServerlessStorageRefreshRequest, + IsSoftDeletionOperation = this.IsSoftDeletionOperation, IsThroughputCapRequest = this.IsThroughputCapRequest, IsUserRequest = this.IsUserRequest, MaxPollingIntervalMilliseconds = this.MaxPollingIntervalMilliseconds, @@ -815,6 +832,7 @@ public INameValueCollection Clone() NoRetryOn449StatusCode = this.NoRetryOn449StatusCode, OfferReplaceRURedistribution = this.OfferReplaceRURedistribution, OptimisticDirectExecute = this.OptimisticDirectExecute, + OriginalAuthTokenType = this.OriginalAuthTokenType, PageSize = this.PageSize, ParallelizeCrossPartitionQuery = this.ParallelizeCrossPartitionQuery, PartitionCount = this.PartitionCount, @@ -861,6 +879,7 @@ public INameValueCollection Clone() RbacResource = this.RbacResource, RbacUserId = this.RbacUserId, ReadFeedKeyType = this.ReadFeedKeyType, + ReadGlobalCommittedData = this.ReadGlobalCommittedData, RemainingTimeInMsOnClientRequest = this.RemainingTimeInMsOnClientRequest, RemoteStorageType = this.RemoteStorageType, RequestedCollectionType = this.RequestedCollectionType, @@ -919,6 +938,7 @@ public INameValueCollection Clone() UseSystemBudget = this.UseSystemBudget, UseUserBackgroundBudget = this.UseUserBackgroundBudget, Version = this.Version, + WorkloadId = this.WorkloadId, XDate = this.XDate, }; @@ -1697,6 +1717,26 @@ public IEnumerable Keys() { yield return HttpConstants.HttpHeaders.PopulateVectorIndexAggregateProgress; } + if (this.AllowTopologyUpsertWithoutIntent != null) + { + yield return HttpConstants.HttpHeaders.AllowTopologyUpsertWithoutIntent; + } + if (this.ReadGlobalCommittedData != null) + { + yield return HttpConstants.HttpHeaders.ReadGlobalCommittedData; + } + if (this.IsSoftDeletionOperation != null) + { + yield return HttpConstants.HttpHeaders.IsSoftDeletionOperation; + } + if (this.WorkloadId != null) + { + yield return HttpConstants.HttpHeaders.WorkloadId; + } + if (this.OriginalAuthTokenType != null) + { + yield return WFConstants.BackendHeaders.OriginalAuthTokenType; + } if (this.IfMatch != null) { yield return HttpConstants.HttpHeaders.IfMatch; @@ -2503,6 +2543,26 @@ public NameValueCollection ToNameValueCollection() { this.nameValueCollection.Add(HttpConstants.HttpHeaders.PopulateVectorIndexAggregateProgress, this.PopulateVectorIndexAggregateProgress); } + if (this.AllowTopologyUpsertWithoutIntent != null) + { + this.nameValueCollection.Add(HttpConstants.HttpHeaders.AllowTopologyUpsertWithoutIntent, this.AllowTopologyUpsertWithoutIntent); + } + if (this.ReadGlobalCommittedData != null) + { + this.nameValueCollection.Add(HttpConstants.HttpHeaders.ReadGlobalCommittedData, this.ReadGlobalCommittedData); + } + if (this.IsSoftDeletionOperation != null) + { + this.nameValueCollection.Add(HttpConstants.HttpHeaders.IsSoftDeletionOperation, this.IsSoftDeletionOperation); + } + if (this.WorkloadId != null) + { + this.nameValueCollection.Add(HttpConstants.HttpHeaders.WorkloadId, this.WorkloadId); + } + if (this.OriginalAuthTokenType != null) + { + this.nameValueCollection.Add(WFConstants.BackendHeaders.OriginalAuthTokenType, this.OriginalAuthTokenType); + } if (this.IfMatch != null) { this.nameValueCollection.Add(HttpConstants.HttpHeaders.IfMatch, this.IfMatch); @@ -2922,11 +2982,24 @@ public string Get(string key) break; case 20: + if (object.ReferenceEquals(HttpConstants.HttpHeaders.ProfileRequest, key)) + { + return this.ProfileRequest; + } + if (object.ReferenceEquals(WFConstants.BackendHeaders.OriginalAuthTokenType, key)) + { + return this.OriginalAuthTokenType; + } if (string.Equals(HttpConstants.HttpHeaders.ProfileRequest, key, StringComparison.OrdinalIgnoreCase)) { return this.ProfileRequest; } + if (string.Equals(WFConstants.BackendHeaders.OriginalAuthTokenType, key, StringComparison.OrdinalIgnoreCase)) + { + return this.OriginalAuthTokenType; + } + break; case 21: if (object.ReferenceEquals(WFConstants.BackendHeaders.ShareThroughput, key)) @@ -2999,6 +3072,10 @@ public string Get(string key) { return this.IsReadOnlyScript; } + if (object.ReferenceEquals(HttpConstants.HttpHeaders.WorkloadId, key)) + { + return this.WorkloadId; + } if (string.Equals(HttpConstants.HttpHeaders.IndexingDirective, key, StringComparison.OrdinalIgnoreCase)) { return this.IndexingDirective; @@ -3014,6 +3091,11 @@ public string Get(string key) return this.IsReadOnlyScript; } + if (string.Equals(HttpConstants.HttpHeaders.WorkloadId, key, StringComparison.OrdinalIgnoreCase)) + { + return this.WorkloadId; + } + break; case 24: if (object.ReferenceEquals(WFConstants.BackendHeaders.CollectionServiceIndex, key)) @@ -3744,6 +3826,10 @@ public string Get(string key) { return this.UseUserBackgroundBudget; } + if (object.ReferenceEquals(HttpConstants.HttpHeaders.ReadGlobalCommittedData, key)) + { + return this.ReadGlobalCommittedData; + } if (string.Equals(HttpConstants.HttpHeaders.MigrateOfferToAutopilot, key, StringComparison.OrdinalIgnoreCase)) { return this.MigrateOfferToAutopilot; @@ -3764,6 +3850,11 @@ public string Get(string key) return this.UseUserBackgroundBudget; } + if (string.Equals(HttpConstants.HttpHeaders.ReadGlobalCommittedData, key, StringComparison.OrdinalIgnoreCase)) + { + return this.ReadGlobalCommittedData; + } + break; case 39: if (object.ReferenceEquals(HttpConstants.HttpHeaders.TruncateMergeLogRequest, key)) @@ -4026,6 +4117,10 @@ public string Get(string key) { return this.IsMigratedFixedCollection; } + if (object.ReferenceEquals(HttpConstants.HttpHeaders.IsSoftDeletionOperation, key)) + { + return this.IsSoftDeletionOperation; + } if (string.Equals(HttpConstants.HttpHeaders.MigrateOfferToManualThroughput, key, StringComparison.OrdinalIgnoreCase)) { return this.MigrateOfferToManualThroughput; @@ -4041,6 +4136,11 @@ public string Get(string key) return this.IsMigratedFixedCollection; } + if (string.Equals(HttpConstants.HttpHeaders.IsSoftDeletionOperation, key, StringComparison.OrdinalIgnoreCase)) + { + return this.IsSoftDeletionOperation; + } + break; case 47: if (object.ReferenceEquals(HttpConstants.HttpHeaders.SupportSpatialLegacyCoordinates, key)) @@ -4316,11 +4416,24 @@ public string Get(string key) break; case 57: + if (object.ReferenceEquals(WFConstants.BackendHeaders.PopulateUnflushedMergeEntryCount, key)) + { + return this.PopulateUnflushedMergeEntryCount; + } + if (object.ReferenceEquals(HttpConstants.HttpHeaders.AllowTopologyUpsertWithoutIntent, key)) + { + return this.AllowTopologyUpsertWithoutIntent; + } if (string.Equals(WFConstants.BackendHeaders.PopulateUnflushedMergeEntryCount, key, StringComparison.OrdinalIgnoreCase)) { return this.PopulateUnflushedMergeEntryCount; } + if (string.Equals(HttpConstants.HttpHeaders.AllowTopologyUpsertWithoutIntent, key, StringComparison.OrdinalIgnoreCase)) + { + return this.AllowTopologyUpsertWithoutIntent; + } + break; case 58: if (object.ReferenceEquals(HttpConstants.HttpHeaders.IgnoreSystemLoweringMaxThroughput, key)) @@ -5186,6 +5299,26 @@ public void UpdateHelper( } break; case 20: + if (object.ReferenceEquals(HttpConstants.HttpHeaders.ProfileRequest, key)) + { + if (throwIfAlreadyExists && this.ProfileRequest != null) + { + throw new ArgumentException($"The {key} already exists in the collection"); + } + + this.ProfileRequest = value; + return; + } + if (object.ReferenceEquals(WFConstants.BackendHeaders.OriginalAuthTokenType, key)) + { + if (throwIfAlreadyExists && this.OriginalAuthTokenType != null) + { + throw new ArgumentException($"The {key} already exists in the collection"); + } + + this.OriginalAuthTokenType = value; + return; + } if (string.Equals(HttpConstants.HttpHeaders.ProfileRequest, key, StringComparison.OrdinalIgnoreCase)) { if (throwIfAlreadyExists && this.ProfileRequest != null) @@ -5196,6 +5329,16 @@ public void UpdateHelper( this.ProfileRequest = value; return; } + if (string.Equals(WFConstants.BackendHeaders.OriginalAuthTokenType, key, StringComparison.OrdinalIgnoreCase)) + { + if (throwIfAlreadyExists && this.OriginalAuthTokenType != null) + { + throw new ArgumentException($"The {key} already exists in the collection"); + } + + this.OriginalAuthTokenType = value; + return; + } break; case 21: if (object.ReferenceEquals(WFConstants.BackendHeaders.ShareThroughput, key)) @@ -5352,6 +5495,16 @@ public void UpdateHelper( this.IsReadOnlyScript = value; return; } + if (object.ReferenceEquals(HttpConstants.HttpHeaders.WorkloadId, key)) + { + if (throwIfAlreadyExists && this.WorkloadId != null) + { + throw new ArgumentException($"The {key} already exists in the collection"); + } + + this.WorkloadId = value; + return; + } if (string.Equals(HttpConstants.HttpHeaders.IndexingDirective, key, StringComparison.OrdinalIgnoreCase)) { if (throwIfAlreadyExists && this.IndexingDirective != null) @@ -5382,6 +5535,16 @@ public void UpdateHelper( this.IsReadOnlyScript = value; return; } + if (string.Equals(HttpConstants.HttpHeaders.WorkloadId, key, StringComparison.OrdinalIgnoreCase)) + { + if (throwIfAlreadyExists && this.WorkloadId != null) + { + throw new ArgumentException($"The {key} already exists in the collection"); + } + + this.WorkloadId = value; + return; + } break; case 24: if (object.ReferenceEquals(WFConstants.BackendHeaders.CollectionServiceIndex, key)) @@ -6972,6 +7135,16 @@ public void UpdateHelper( this.UseUserBackgroundBudget = value; return; } + if (object.ReferenceEquals(HttpConstants.HttpHeaders.ReadGlobalCommittedData, key)) + { + if (throwIfAlreadyExists && this.ReadGlobalCommittedData != null) + { + throw new ArgumentException($"The {key} already exists in the collection"); + } + + this.ReadGlobalCommittedData = value; + return; + } if (string.Equals(HttpConstants.HttpHeaders.MigrateOfferToAutopilot, key, StringComparison.OrdinalIgnoreCase)) { if (throwIfAlreadyExists && this.MigrateOfferToAutopilot != null) @@ -7012,6 +7185,16 @@ public void UpdateHelper( this.UseUserBackgroundBudget = value; return; } + if (string.Equals(HttpConstants.HttpHeaders.ReadGlobalCommittedData, key, StringComparison.OrdinalIgnoreCase)) + { + if (throwIfAlreadyExists && this.ReadGlobalCommittedData != null) + { + throw new ArgumentException($"The {key} already exists in the collection"); + } + + this.ReadGlobalCommittedData = value; + return; + } break; case 39: if (object.ReferenceEquals(HttpConstants.HttpHeaders.TruncateMergeLogRequest, key)) @@ -7578,6 +7761,16 @@ public void UpdateHelper( this.IsMigratedFixedCollection = value; return; } + if (object.ReferenceEquals(HttpConstants.HttpHeaders.IsSoftDeletionOperation, key)) + { + if (throwIfAlreadyExists && this.IsSoftDeletionOperation != null) + { + throw new ArgumentException($"The {key} already exists in the collection"); + } + + this.IsSoftDeletionOperation = value; + return; + } if (string.Equals(HttpConstants.HttpHeaders.MigrateOfferToManualThroughput, key, StringComparison.OrdinalIgnoreCase)) { if (throwIfAlreadyExists && this.MigrateOfferToManualThroughput != null) @@ -7608,6 +7801,16 @@ public void UpdateHelper( this.IsMigratedFixedCollection = value; return; } + if (string.Equals(HttpConstants.HttpHeaders.IsSoftDeletionOperation, key, StringComparison.OrdinalIgnoreCase)) + { + if (throwIfAlreadyExists && this.IsSoftDeletionOperation != null) + { + throw new ArgumentException($"The {key} already exists in the collection"); + } + + this.IsSoftDeletionOperation = value; + return; + } break; case 47: if (object.ReferenceEquals(HttpConstants.HttpHeaders.SupportSpatialLegacyCoordinates, key)) @@ -8190,6 +8393,26 @@ public void UpdateHelper( } break; case 57: + if (object.ReferenceEquals(WFConstants.BackendHeaders.PopulateUnflushedMergeEntryCount, key)) + { + if (throwIfAlreadyExists && this.PopulateUnflushedMergeEntryCount != null) + { + throw new ArgumentException($"The {key} already exists in the collection"); + } + + this.PopulateUnflushedMergeEntryCount = value; + return; + } + if (object.ReferenceEquals(HttpConstants.HttpHeaders.AllowTopologyUpsertWithoutIntent, key)) + { + if (throwIfAlreadyExists && this.AllowTopologyUpsertWithoutIntent != null) + { + throw new ArgumentException($"The {key} already exists in the collection"); + } + + this.AllowTopologyUpsertWithoutIntent = value; + return; + } if (string.Equals(WFConstants.BackendHeaders.PopulateUnflushedMergeEntryCount, key, StringComparison.OrdinalIgnoreCase)) { if (throwIfAlreadyExists && this.PopulateUnflushedMergeEntryCount != null) @@ -8200,6 +8423,16 @@ public void UpdateHelper( this.PopulateUnflushedMergeEntryCount = value; return; } + if (string.Equals(HttpConstants.HttpHeaders.AllowTopologyUpsertWithoutIntent, key, StringComparison.OrdinalIgnoreCase)) + { + if (throwIfAlreadyExists && this.AllowTopologyUpsertWithoutIntent != null) + { + throw new ArgumentException($"The {key} already exists in the collection"); + } + + this.AllowTopologyUpsertWithoutIntent = value; + return; + } break; case 58: if (object.ReferenceEquals(HttpConstants.HttpHeaders.IgnoreSystemLoweringMaxThroughput, key)) diff --git a/Microsoft.Azure.Cosmos/src/direct/RequestOptions.cs b/Microsoft.Azure.Cosmos/src/direct/RequestOptions.cs index 557693eb56..fcec508c1c 100644 --- a/Microsoft.Azure.Cosmos/src/direct/RequestOptions.cs +++ b/Microsoft.Azure.Cosmos/src/direct/RequestOptions.cs @@ -543,6 +543,17 @@ sealed class RequestOptions /// internal bool AllowUpdatingIsPhysicalMigrationInProgress { get; set; } + /// + /// Gets or sets the flag for a topology resource upsert to bypass the use + /// of intent on an account with per-partition automatic failover (PPAF) enabled. + /// + internal bool AllowTopologyUpsertWithoutIntent { get; set; } + + /// + /// Gets or sets the , Inidicates whether the operation is a soft deletion operation. + /// + internal bool IsSoftDeletionOperation { get; set; } + #pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved /// diff --git a/Microsoft.Azure.Cosmos/src/direct/RequestRetryUtility.cs b/Microsoft.Azure.Cosmos/src/direct/RequestRetryUtility.cs index af664471d8..c8ada8e375 100644 --- a/Microsoft.Azure.Cosmos/src/direct/RequestRetryUtility.cs +++ b/Microsoft.Azure.Cosmos/src/direct/RequestRetryUtility.cs @@ -139,7 +139,7 @@ public static async Task ProcessRequestAsync stopwatch.Elapsed ? shouldRetry.BackoffTime - stopwatch.Elapsed : TimeSpan.Zero; diff --git a/Microsoft.Azure.Cosmos/src/direct/ResourceResponse.cs b/Microsoft.Azure.Cosmos/src/direct/ResourceResponse.cs index 129f6e2269..5d7b4206ab 100644 --- a/Microsoft.Azure.Cosmos/src/direct/ResourceResponse.cs +++ b/Microsoft.Azure.Cosmos/src/direct/ResourceResponse.cs @@ -36,7 +36,9 @@ namespace Microsoft.Azure.Documents.Client class ResourceResponse : ResourceResponseBase, IResourceResponse where TResource : Resource, new() { private TResource resource; +#pragma warning disable IDE0044 // Add readonly modifier private ITypeResolver typeResolver; +#pragma warning restore IDE0044 // Add readonly modifier /// /// Constructor exposed for mocking purposes for the Azure Cosmos DB service. diff --git a/Microsoft.Azure.Cosmos/src/direct/ResourceResponseBase.cs b/Microsoft.Azure.Cosmos/src/direct/ResourceResponseBase.cs index f149890bef..21dbe28b04 100644 --- a/Microsoft.Azure.Cosmos/src/direct/ResourceResponseBase.cs +++ b/Microsoft.Azure.Cosmos/src/direct/ResourceResponseBase.cs @@ -25,8 +25,12 @@ abstract class ResourceResponseBase : IResourceResponseBase // Ideally response was intended to be marked as protected(to be accessed by sub-classes) but since DocumentServiceResponse class is marked internal, // it gives Inconsistent accessibility error saying DocumentServiceResponse is less accessible than field ServiceResponse.response if I mark it as protected. internal DocumentServiceResponse response; +#pragma warning disable IDE0044 // Add readonly modifier private Dictionary usageHeaders; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private Dictionary quotaHeaders; +#pragma warning restore IDE0044 // Add readonly modifier /// /// Constructor exposed for mocking purposes for the Azure Cosmos DB service. diff --git a/Microsoft.Azure.Cosmos/src/direct/ResourceType.cs b/Microsoft.Azure.Cosmos/src/direct/ResourceType.cs index c8c2c2d133..026a9165d4 100644 --- a/Microsoft.Azure.Cosmos/src/direct/ResourceType.cs +++ b/Microsoft.Azure.Cosmos/src/direct/ResourceType.cs @@ -95,7 +95,9 @@ internal enum ResourceType : int internal static class ResourceTypeExtensions { +#pragma warning disable IDE0044 // Add readonly modifier private static Dictionary resourceTypeNames = new Dictionary(); +#pragma warning restore IDE0044 // Add readonly modifier static ResourceTypeExtensions() { diff --git a/Microsoft.Azure.Cosmos/src/direct/RntbdConstants.cs b/Microsoft.Azure.Cosmos/src/direct/RntbdConstants.cs index 7b9c7ee9db..80de1d7ccf 100644 --- a/Microsoft.Azure.Cosmos/src/direct/RntbdConstants.cs +++ b/Microsoft.Azure.Cosmos/src/direct/RntbdConstants.cs @@ -528,6 +528,12 @@ public enum RequestIdentifiers : ushort PopulateThroughputPoolInfo = 0x00E1, RetrieveUserStrings = 0x00E2, PopulateVectorIndexAggregateProgress = 0x00E3, + AllowTopologyUpsertWithoutIntent = 0x00E4, + ReadGlobalCommittedData = 0x00E5, + IsSoftDeletionOperation = 0x00E6, + WorkloadId = 0x00E7, + RegionalDatabaseAccountName = 0x00E8, + OriginalAuthTokenType = 0x00E9, } public sealed class Request : RntbdTokenStream @@ -745,6 +751,12 @@ public sealed class Request : RntbdTokenStream public RntbdToken populateThroughputPoolInfo; public RntbdToken retrieveUserStrings; public RntbdToken populateVectorIndexAggregateProgress; + public RntbdToken allowTopologyUpsertWithoutIntent; + public RntbdToken readGlobalCommittedData; + public RntbdToken isSoftDeletionOperation; + public RntbdToken workloadId; + public RntbdToken regionalDatabaseAccountName; + public RntbdToken originalAuthTokenType; public Request() { @@ -959,6 +971,12 @@ public Request() this.populateThroughputPoolInfo = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)RequestIdentifiers.PopulateThroughputPoolInfo); this.retrieveUserStrings = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)RequestIdentifiers.RetrieveUserStrings); this.populateVectorIndexAggregateProgress = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)RequestIdentifiers.PopulateVectorIndexAggregateProgress); + this.allowTopologyUpsertWithoutIntent = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)RequestIdentifiers.AllowTopologyUpsertWithoutIntent); + this.readGlobalCommittedData = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)RequestIdentifiers.ReadGlobalCommittedData); + this.isSoftDeletionOperation = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)RequestIdentifiers.IsSoftDeletionOperation); + this.workloadId = new RntbdToken(false, RntbdTokenTypes.UShort, (ushort)RequestIdentifiers.WorkloadId); + this.regionalDatabaseAccountName = new RntbdToken(false, RntbdTokenTypes.String, (ushort)RequestIdentifiers.RegionalDatabaseAccountName); + this.originalAuthTokenType = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)RequestIdentifiers.OriginalAuthTokenType); this.tokens = new RntbdToken[] { @@ -1190,6 +1208,12 @@ public Request() this.populateThroughputPoolInfo, this.retrieveUserStrings, this.populateVectorIndexAggregateProgress, + this.allowTopologyUpsertWithoutIntent, + this.readGlobalCommittedData, + this.isSoftDeletionOperation, + this.workloadId, + this.regionalDatabaseAccountName, + this.originalAuthTokenType, }; } } @@ -1291,8 +1315,9 @@ public enum ResponseIdentifiers : ushort CollectionVectorIndexProgress = 0x0079, ThroughputpoolMaxConsumableRUs = 0x0080, ThroughputpoolDedicatedRUs = 0x0081, - ResourceIdentityPrincipalId = 0x0082, VectorIndexAggregateProgress = 0x0083, + MergeProgressBlockedReason = 0x0084, + ThroughputBucketApplied = 0x0085, } // diff --git a/Microsoft.Azure.Cosmos/src/direct/RntbdOpenConnectionHandler.cs b/Microsoft.Azure.Cosmos/src/direct/RntbdOpenConnectionHandler.cs index 2b9e39f811..9203519b01 100644 --- a/Microsoft.Azure.Cosmos/src/direct/RntbdOpenConnectionHandler.cs +++ b/Microsoft.Azure.Cosmos/src/direct/RntbdOpenConnectionHandler.cs @@ -94,7 +94,7 @@ await this.transportClient.OpenConnectionAsync( { DefaultTrace.TraceWarning("Failed to open Rntbd connection to backend uri: {0} with exception: {1}. '{2}'", address.Uri, - ex, + ex.Message, Trace.CorrelationManager.ActivityId); address.SetUnhealthy(); } diff --git a/Microsoft.Azure.Cosmos/src/direct/RntbdToken.cs b/Microsoft.Azure.Cosmos/src/direct/RntbdToken.cs index e2da4ecf2e..b18e45764d 100644 --- a/Microsoft.Azure.Cosmos/src/direct/RntbdToken.cs +++ b/Microsoft.Azure.Cosmos/src/direct/RntbdToken.cs @@ -84,9 +84,15 @@ internal struct RntbdTokenValue internal sealed class RntbdToken { +#pragma warning disable IDE0044 // Add readonly modifier private ushort identifier; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private RntbdTokenTypes type; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private bool isRequired; +#pragma warning restore IDE0044 // Add readonly modifier public bool isPresent; public RntbdTokenValue value; diff --git a/Microsoft.Azure.Cosmos/src/direct/RntbdTokenStream.cs b/Microsoft.Azure.Cosmos/src/direct/RntbdTokenStream.cs index dc8ee36635..b4852849a8 100644 --- a/Microsoft.Azure.Cosmos/src/direct/RntbdTokenStream.cs +++ b/Microsoft.Azure.Cosmos/src/direct/RntbdTokenStream.cs @@ -25,8 +25,12 @@ internal abstract class RntbdTokenStream // System.Text.Encoding and Write/Read for stream don't take Memory<> in NetStandard // so we have to use ArrayPool instead. #if COSMOSCLIENT +#pragma warning disable IDE0044 // Add readonly modifier private ArrayPool arrayPool = ArrayPool.Create(); +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private List borrowedBytes = new List(); +#pragma warning restore IDE0044 // Add readonly modifier #endif public abstract int RequiredTokenCount { get; } diff --git a/Microsoft.Azure.Cosmos/src/direct/SDKSupportedCapabilities.cs b/Microsoft.Azure.Cosmos/src/direct/SDKSupportedCapabilities.cs index aebc7bd5d2..557aba0032 100644 --- a/Microsoft.Azure.Cosmos/src/direct/SDKSupportedCapabilities.cs +++ b/Microsoft.Azure.Cosmos/src/direct/SDKSupportedCapabilities.cs @@ -11,6 +11,7 @@ internal enum SDKSupportedCapabilities : ulong None = 0, PartitionMerge = 1 << 0, ChangeFeedWithStartTimePostMerge = 1 << 1, - ThroughputBucketing = 1 << 2 + ThroughputBucketing = 1 << 2, + IgnoreUnknownRntbdTokens = 1 << 3 } } diff --git a/Microsoft.Azure.Cosmos/src/direct/SDKSupportedCapabilitiesHelpers.cs b/Microsoft.Azure.Cosmos/src/direct/SDKSupportedCapabilitiesHelpers.cs index 18b54239fc..5bfe69f205 100644 --- a/Microsoft.Azure.Cosmos/src/direct/SDKSupportedCapabilitiesHelpers.cs +++ b/Microsoft.Azure.Cosmos/src/direct/SDKSupportedCapabilitiesHelpers.cs @@ -11,6 +11,7 @@ static SDKSupportedCapabilitiesHelpers() { SDKSupportedCapabilities capabilities = SDKSupportedCapabilities.None; capabilities |= SDKSupportedCapabilities.PartitionMerge; + capabilities |= SDKSupportedCapabilities.IgnoreUnknownRntbdTokens; SDKSupportedCapabilitiesHelpers.sdkSupportedCapabilities = (ulong)capabilities; } diff --git a/Microsoft.Azure.Cosmos/src/direct/SerializableNameValueCollection.cs b/Microsoft.Azure.Cosmos/src/direct/SerializableNameValueCollection.cs index cb44ddd5b0..6730c27a1d 100644 --- a/Microsoft.Azure.Cosmos/src/direct/SerializableNameValueCollection.cs +++ b/Microsoft.Azure.Cosmos/src/direct/SerializableNameValueCollection.cs @@ -13,7 +13,9 @@ namespace Microsoft.Azure.Documents internal sealed class SerializableNameValueCollection : JsonSerializable { +#pragma warning disable IDE0044 // Add readonly modifier private Lazy lazyCollection; +#pragma warning restore IDE0044 // Add readonly modifier public SerializableNameValueCollection() { diff --git a/Microsoft.Azure.Cosmos/src/direct/ServerStoreModel.cs b/Microsoft.Azure.Cosmos/src/direct/ServerStoreModel.cs index 9c04efa004..615e8b42bf 100644 --- a/Microsoft.Azure.Cosmos/src/direct/ServerStoreModel.cs +++ b/Microsoft.Azure.Cosmos/src/direct/ServerStoreModel.cs @@ -11,7 +11,9 @@ namespace Microsoft.Azure.Documents internal sealed class ServerStoreModel : IStoreModelExtension { private readonly StoreClient storeClient; +#pragma warning disable IDE0044 // Add readonly modifier private EventHandler sendingRequest; +#pragma warning restore IDE0044 // Add readonly modifier private readonly EventHandler receivedResponse; public ServerStoreModel(StoreClient storeClient) diff --git a/Microsoft.Azure.Cosmos/src/direct/ServiceIdentity.cs b/Microsoft.Azure.Cosmos/src/direct/ServiceIdentity.cs index e37992d7d9..4fe68c876a 100644 --- a/Microsoft.Azure.Cosmos/src/direct/ServiceIdentity.cs +++ b/Microsoft.Azure.Cosmos/src/direct/ServiceIdentity.cs @@ -17,10 +17,15 @@ internal interface IServiceIdentity internal sealed class ServiceIdentity : IServiceIdentity { +#pragma warning disable CS1587 [JsonConstructor] + /// + /// Needed for TestForWhiteListedPersistedTypes to succeed + /// private ServiceIdentity() { } +#pragma warning restore CS1587 public ServiceIdentity(string federationId, Uri serviceName, bool isMasterService) { diff --git a/Microsoft.Azure.Cosmos/src/direct/ServiceInteropWrapper.cs b/Microsoft.Azure.Cosmos/src/direct/ServiceInteropWrapper.cs index 9844ef6050..895a9996bd 100644 --- a/Microsoft.Azure.Cosmos/src/direct/ServiceInteropWrapper.cs +++ b/Microsoft.Azure.Cosmos/src/direct/ServiceInteropWrapper.cs @@ -112,7 +112,7 @@ internal static bool CheckIfAssembliesExist(out string validationMessage) { // There has been certain environments where attempting to find the ServiceInterop has resulted in an exception. // Instead of failing the SDK trace the exception and fall back to gateway mode. - DefaultTrace.TraceWarning($"ServiceInteropWrapper: Falling back to gateway. Finding ServiceInterop dll threw an exception {e}"); + DefaultTrace.TraceWarning($"ServiceInteropWrapper: Falling back to gateway. Finding ServiceInterop dll threw an exception {e.Message}"); } if (string.IsNullOrEmpty(validationMessage)) @@ -192,8 +192,10 @@ public struct PartitionKeyRangesApiOptions public Int32 eGeospatialType; - // Reserve additional 32 bytes to match size with native PartitionKeyRangesApiOptions. - public Int64 unusedReserved1; + public Int32 bHybridSearchSkipOrderByRewrite; + + // Reserve additional 28 bytes to match size with native PartitionKeyRangesApiOptions. + public Int32 unusedReserved1; public Int64 unusedReserved2; public Int64 unusedReserved3; public Int64 unusedReserved4; diff --git a/Microsoft.Azure.Cosmos/src/direct/SessionTokenMismatchRetryPolicy.cs b/Microsoft.Azure.Cosmos/src/direct/SessionTokenMismatchRetryPolicy.cs index 3316c10791..951b9730c1 100644 --- a/Microsoft.Azure.Cosmos/src/direct/SessionTokenMismatchRetryPolicy.cs +++ b/Microsoft.Azure.Cosmos/src/direct/SessionTokenMismatchRetryPolicy.cs @@ -10,7 +10,7 @@ namespace Microsoft.Azure.Documents using System.Threading.Tasks; using Microsoft.Azure.Cosmos.Core.Trace; - internal sealed class SessionTokenMismatchRetryPolicy : IRetryPolicy + internal sealed class SessionTokenMismatchRetryPolicy : IRetryPolicy, IRequestRetryPolicy { private const string sessionRetryInitialBackoff = "AZURE_COSMOS_SESSION_RETRY_INITIAL_BACKOFF"; private const string sessionRetryMaximumBackoff = "AZURE_COSMOS_SESSION_RETRY_MAXIMUM_BACKOFF"; @@ -18,14 +18,20 @@ internal sealed class SessionTokenMismatchRetryPolicy : IRetryPolicy private const int defaultWaitTimeInMilliSeconds = 5000; private const int defaultInitialBackoffTimeInMilliseconds = 5; private const int defaultMaximumBackoffTimeInMilliseconds = 500; - private const int backoffMultiplier = 2; + private const int backoffMultiplier = 5; // before it was very aggressive + private readonly ISessionRetryOptions sessionRetryOptions; + private readonly DateTimeOffset startTime = DateTime.UtcNow; private static readonly Lazy sessionRetryInitialBackoffConfig; private static readonly Lazy sessionRetryMaximumBackoffConfig; private int retryCount; +#pragma warning disable IDE0044 // Add readonly modifier private Stopwatch durationTimer = new Stopwatch(); +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private int waitTimeInMilliSeconds; +#pragma warning restore IDE0044 // Add readonly modifier private int? currentBackoffInMilliSeconds; @@ -69,12 +75,14 @@ static SessionTokenMismatchRetryPolicy() }); } - public SessionTokenMismatchRetryPolicy(int waitTimeInMilliSeconds = defaultWaitTimeInMilliSeconds) + public SessionTokenMismatchRetryPolicy(int waitTimeInMilliSeconds = defaultWaitTimeInMilliSeconds, + ISessionRetryOptions sessionRetryOptions = null) { this.durationTimer.Start(); this.retryCount = 0; this.waitTimeInMilliSeconds = waitTimeInMilliSeconds; this.currentBackoffInMilliSeconds = null; + this.sessionRetryOptions = sessionRetryOptions; } public Task ShouldRetryAsync(Exception exception, CancellationToken cancellationToken) @@ -84,30 +92,79 @@ public Task ShouldRetryAsync(Exception exception, Cancellatio if (exception is DocumentClientException dce) { result = this.ShouldRetryInternalAsync( + null, dce?.StatusCode, - dce?.GetSubStatus()); + dce?.GetSubStatus(), + dce?.LSN); } return Task.FromResult(result); } - private ShouldRetryResult ShouldRetryInternalAsync( + // IRequestRetryPolicy + public void OnBeforeSendRequest(DocumentServiceRequest request) + { + } + + // IRequestRetryPolicy + public Task ShouldRetryAsync(DocumentServiceRequest request, + StoreResponse response, + Exception exception, + CancellationToken cancellationToken) + { + throw new NotImplementedException(); + } + + // IRequestRetryPolicy + public bool TryHandleResponseSynchronously(DocumentServiceRequest request, + StoreResponse response, + Exception exception, + out ShouldRetryResult shouldRetryResult) + { + HttpStatusCode? httpStatusCode = response?.StatusCode ?? (exception as DocumentClientException)?.StatusCode; + SubStatusCodes? httpSubStatusCode = response?.SubStatusCode ?? (exception as DocumentClientException)?.GetSubStatus(); + + shouldRetryResult = this.ShouldRetryInternalAsync(request, httpStatusCode, httpSubStatusCode, response?.LSN); + return true; + } + +#pragma warning disable VSTHRD200 // Use "Async" suffix for async methods + private ShouldRetryResult ShouldRetryInternalAsync(DocumentServiceRequest request, +#pragma warning restore VSTHRD200 // Use "Async" suffix for async methods HttpStatusCode? statusCode, - SubStatusCodes? subStatusCode) + SubStatusCodes? subStatusCode, + long? responseLSN) { + ISessionToken requestSessionToken = request?.RequestContext?.SessionToken; + if (statusCode.HasValue && statusCode.Value == HttpStatusCode.NotFound && subStatusCode.HasValue && subStatusCode.Value == SubStatusCodes.ReadSessionNotAvailable) +#pragma warning disable SA1505 // Opening braces should not be followed by blank line { + int remainingTimeInMilliSeconds = this.waitTimeInMilliSeconds - Convert.ToInt32(this.durationTimer.Elapsed.TotalMilliseconds); if (remainingTimeInMilliSeconds <= 0) { this.durationTimer.Stop(); - DefaultTrace.TraceInformation("SessionTokenMismatchRetryPolicy not retrying because it has exceeded the time limit. Retry count = {0}", this.retryCount); + +#pragma warning disable SA1003 // Symbols should be spaced correctly + DefaultTrace.TraceInformation("SessionTokenMismatchRetryPolicy not retrying because it has exceeded the time limit. Retry count = {0} request-session-token = {1} response-session-token = {2}", + this.retryCount, + requestSessionToken == null ? "" : requestSessionToken.ConvertToString(), + responseLSN.HasValue? responseLSN : ""); +#pragma warning restore SA1003 // Symbols should be spaced correctly return ShouldRetryResult.NoRetry(); } + if (!this.shouldRetryLocally()) + { + DefaultTrace.TraceInformation("SessionTokenMismatchRetryPolicy not retrying because it a retry attempt for the current region and " + + "fallback to a different region is preferred "); + return ShouldRetryResult.NoRetry(); + } + TimeSpan backoffTime = TimeSpan.Zero; // Don't penalize first retry with delay @@ -130,14 +187,61 @@ private ShouldRetryResult ShouldRetryInternalAsync( } this.retryCount++; - DefaultTrace.TraceInformation("SessionTokenMismatchRetryPolicy will retry. Retry count = {0}. Backoff time = {1} ms", this.retryCount, backoffTime.TotalMilliseconds); + // For remote region preference ensure that the last retry is long enough (even when exceeding max backoff time) + // to consume the entire minRetryTimeInLocalRegion + if (this.sessionRetryOptions != null && this.sessionRetryOptions.RemoteRegionPreferred && + this.retryCount >= (this.sessionRetryOptions.MaxInRegionRetryCount - 1)) + { + TimeSpan elapsed = DateTimeOffset.Now - this.startTime; + TimeSpan remainingMinRetryTimeInLocalRegion = TimeSpan.FromMilliseconds(this.sessionRetryOptions.MinInRegionRetryTime.TotalMilliseconds - elapsed.TotalMilliseconds); + + if (remainingMinRetryTimeInLocalRegion.CompareTo(backoffTime) > 0) + { + backoffTime = remainingMinRetryTimeInLocalRegion; + } + } + + DefaultTrace.TraceInformation("SessionTokenMismatchRetryPolicy will retry. Retry count = {0}. Backoff time = {1} ms request-session-token = {2} response-session-token = {3}", + this.retryCount, + backoffTime.TotalMilliseconds, + requestSessionToken == null ? "" : requestSessionToken.ConvertToString(), + responseLSN.HasValue ? responseLSN : ""); return ShouldRetryResult.RetryAfter(backoffTime); } +#pragma warning restore SA1505 // Opening braces should not be followed by blank line this.durationTimer.Stop(); return ShouldRetryResult.NoRetry(); } + + private bool shouldRetryLocally() + { + // If no options, allow retry (legacy behavior) + if (this.sessionRetryOptions == null) + { + return true; + } + + // If remote region is not preferred, use legacy retry logic + if (!this.sessionRetryOptions.RemoteRegionPreferred) + { + return true; + } + + // If retries are disabled, do not retry + if (this.sessionRetryOptions.MaxInRegionRetryCount <= 0) + { + return false; + } + + // SessionTokenMismatchRetryPolicy is invoked after 1 attempt on a region + // sessionTokenMismatchRetryAttempts increments only after shouldRetry triggers + // another attempt on the same region + // hence to curb the retry attempts on a region, + // compare sessionTokenMismatchRetryAttempts with max retry attempts allowed on the region - 1 + return this.retryCount <= (this.sessionRetryOptions.MaxInRegionRetryCount - 1); + } } } diff --git a/Microsoft.Azure.Cosmos/src/direct/Snapshot.cs b/Microsoft.Azure.Cosmos/src/direct/Snapshot.cs index 76e79140e7..2091f92341 100644 --- a/Microsoft.Azure.Cosmos/src/direct/Snapshot.cs +++ b/Microsoft.Azure.Cosmos/src/direct/Snapshot.cs @@ -41,7 +41,11 @@ namespace Microsoft.Azure.Documents #endif class Snapshot : Resource { - private new static readonly DateTime UnixStartTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); +#pragma warning disable CS0108 // Member hides inherited member; missing new keyword +#pragma warning disable IDE0044 // Add readonly modifier + private static DateTime UnixStartTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning restore CS0108 // Member hides inherited member; missing new keyword private SnapshotContent snapshotContent; diff --git a/Microsoft.Azure.Cosmos/src/direct/SoftDeletionMetadata.cs b/Microsoft.Azure.Cosmos/src/direct/SoftDeletionMetadata.cs index 3a87e8369d..b292f41242 100644 --- a/Microsoft.Azure.Cosmos/src/direct/SoftDeletionMetadata.cs +++ b/Microsoft.Azure.Cosmos/src/direct/SoftDeletionMetadata.cs @@ -34,37 +34,44 @@ public bool IsSoftDeleted } /// - /// Property to indicate Database Account Soft Deletion Start Timestamp. + /// Property to indicate Database Account Soft Deletion Start Timestamp in epoch format. /// - [JsonConverter(typeof(IsoDateTimeConverter))] - [JsonProperty(PropertyName = Constants.SoftDeletionMetadataProperties.SoftDeletionStartTimestampUtc)] - public DateTime SoftDeletionStartTimestampUtc + [JsonProperty(PropertyName = Constants.SoftDeletionMetadataProperties.SoftDeletionStartTimestamp)] + public long SoftDeletionStartTimestamp { get { - return base.GetValue(Constants.SoftDeletionMetadataProperties.SoftDeletionStartTimestampUtc).ToUniversalTime(); + return base.GetValue(Constants.SoftDeletionMetadataProperties.SoftDeletionStartTimestamp); } set { - this.SetValue(Constants.SoftDeletionMetadataProperties.SoftDeletionStartTimestampUtc, value.ToUniversalTime()); + this.SetValue(Constants.SoftDeletionMetadataProperties.SoftDeletionStartTimestamp, value); } } /// - /// Property to indicate Database Account Soft Deletion Expiration Timestamp. + /// Property to indicate Database Account Soft Deletion Expiration Timestamp in epoch format. /// - [JsonConverter(typeof(IsoDateTimeConverter))] - [JsonProperty(PropertyName = Constants.SoftDeletionMetadataProperties.SoftDeletionResourceExpirationTimestampUtc)] - public DateTime SoftDeletionResourceExpirationTimestampUtc + [JsonProperty(PropertyName = Constants.SoftDeletionMetadataProperties.SoftDeletionResourceExpirationTimestamp)] + public long SoftDeletionResourceExpirationTimestamp { get { - return base.GetValue(Constants.SoftDeletionMetadataProperties.SoftDeletionResourceExpirationTimestampUtc).ToUniversalTime(); + return base.GetValue(Constants.SoftDeletionMetadataProperties.SoftDeletionResourceExpirationTimestamp); } set { - this.SetValue(Constants.SoftDeletionMetadataProperties.SoftDeletionResourceExpirationTimestampUtc, value.ToUniversalTime()); + this.SetValue(Constants.SoftDeletionMetadataProperties.SoftDeletionResourceExpirationTimestamp, value); } } + + public override string ToString() + { + return string.Format( + "IsSoftDeleted: {0}, SoftDeletionStartTimestamp: {1}, SoftDeletionResourceExpirationTimestamp: {2}", + this.IsSoftDeleted, + this.SoftDeletionStartTimestamp, + this.SoftDeletionResourceExpirationTimestamp); + } } } diff --git a/Microsoft.Azure.Cosmos/src/direct/StatusCodes.cs b/Microsoft.Azure.Cosmos/src/direct/StatusCodes.cs index d6c2071a87..fcd261e6de 100644 --- a/Microsoft.Azure.Cosmos/src/direct/StatusCodes.cs +++ b/Microsoft.Azure.Cosmos/src/direct/StatusCodes.cs @@ -78,6 +78,8 @@ internal enum SubStatusCodes ThinClientPublicEndpointDisabled = 1040, // Used for ThinProxy MissingRequiredRntbdToken = 1041, // Used for ThinProxy InvalidRntbdToken = 1042, // Used for ThinProxy + DefaultConsistencyLevelIsNull = 1043, // Used for ThinProxy + InvalidRequestLevelConsistency = 1044, // Used for ThinProxy // 410: StatusCodeType_Gone: substatus NameCacheIsStale = 1000, @@ -110,6 +112,7 @@ internal enum SubStatusCodes RedundantCollectionPut = 1009, SharedThroughputDatabaseQuotaExceeded = 1010, SharedThroughputOfferGrowNotNeeded = 1011, + RedundantDatabasePut = 1012, PartitionKeyQuotaOverLimit = 1014, SharedThroughputDatabaseCollectionCountExceeded = 1019, SharedThroughputDatabaseCountExceeded = 1020, @@ -126,6 +129,7 @@ internal enum SubStatusCodes // 409: Partition migration Count mismatch conflict sub status codes PartitionMigrationDocumentCountMismatchBetweenSourceAndTargetPartition = 3050, PartitionMigrationDocumentCountMismatchBetweenTargetPartitionReplicas = 3051, + PartitionMigrationDocumentCountMismatchWithinPartitionReplicas = 3052, // 503: Service Unavailable due to region being out of capacity for bindable partitions InsufficientBindablePartitions = 1007, @@ -210,7 +214,7 @@ internal enum SubStatusCodes PartitionMigrationIsDisabledAtTheCurrentArmLocation = 2054, PartitionMigrationFailedToAcquirePartitionMigrationLocks = 2055, PartitionMigrationIsDisabledOnTheRegionalAccount = 2056, - PartitionMigrationWaitForCatchupTimedOut = 2057, + PartitionMigrationWaitForLSNCatchupTimedOut = 2057, PartitionMigrationFailureMitigationWrongServiceType = 2058, PartitionMigrationWaitForTargetReplicaResourceCreationTimedOut = 2059, PartitionMigrationIsDisabledOnTheService = 2060, @@ -225,9 +229,22 @@ internal enum SubStatusCodes PartitionMigrationCanNotProceedDuringBlockedWindow = 2069, RevokedPartitionMigrationCanNotProceedForMultimasterAccount = 2070, RevokedPartitionMigrationCanNotProceedForNonRevokedAccount = 2071, - PartitionMigrationWaitForCatchupGotCancelledBeforeTimeout = 2072, + PartitionMigrationWaitForLSNCatchupGotCancelledBeforeTimeout = 2072, PartitionMigrationWaitForLocalCatchupTimedOut = 2073, PartitionMigrationFailureMitigationInvalidResumeStep = 2074, + PartitionMigrationResetConfigsAfterWaitForFullSyncTookTooLong = 2075, + PartitionMigrationResetConfigsAfterWaitForFullSyncReceivedException = 2076, + PartitionMigrationAccountConsistencyLevelIsBoundedStaleness = 2077, + PartitionMigrationWaitForVectorIndexCatchupTimedOut = 2078, + PartitionMigrationWaitForVectorIndexingCatchupGotCancelledBeforeTimeout = 2079, + PartitionMigrationWaitForCatchupFailedWithException = 2080, + PartitionMigrationListingMasterServicePartitionsFailed = 2081, + PartitionMigrationListingServerPartitionsFromMasterFailed = 2082, + PartitionMigrationCanNotAcquireRegionalPartitionMigrationLock = 2083, + PartitionMigrationDidNotCompleteValidateDocumentCountAcrossReplicasInTenRetries = 2084, + PartitionMigrationCanNotProceedForFailoverFailedRegionalDatabaseAccount = 2085, + PartitionMigrationFailedWithExceptionInjection = 2086, + PartitionMigrationTargetInFederationsToAvoid = 2087, // 500: InternalServerError ConfigurationNameNotEmpty = 3001, @@ -272,6 +289,16 @@ internal enum SubStatusCodes KeyDisabledOrExpired = 4018, // Indicates that the Key Vault key has been disabled. MasterServiceUnavailable = 4019, // Indicates that the master service is unavailable. + // Fabric codes + // Fabric codes are in the range of 6050-6999 + InsufficientFabricPermissions = 6050, + FabricAuthorizationFailed = 6051, + FabricOperationUnsupported = 6052, + FabricTokenValidatonFailed = 6053, + InvalidFabricAppId = 6054, + InvalidFabricTenantId = 6055, + InvalidFabricAritfactId = 6056, + // Keep in sync with Microsoft.Azure.Cosmos.ServiceFramework.Security.AadAuthentication.AadSubStatusCodes // 401 : Unauthorized Exception (User-side errors start with 50) MissingAuthHeader = 5000, @@ -328,6 +355,7 @@ internal enum SubStatusCodes PartitionMigrationWaitForFullSyncReceivedInternalServerErrorDuringCompleteMigrationFromBackend = 6001, PartitionMigrationWaitForFullSyncReceivedInternalServerErrorDuringAbortMigrationFromBackend = 6002, PartitionMigrationFinalizeMigrationsDidNotCompleteInTenRetries = 6003, + PartitionMigrationFinalizeMigrationsRetryTimeExceededLimit = 6004, // 412: PreConditionFailed AZ Migration substatus codes AZMigrationCancelledForPendingUserOperation = 7001, @@ -336,6 +364,8 @@ internal enum SubStatusCodes RevokeGlobalWritesTopologyUpsertIntentNotApplied = 8001, GrantGlobalWritesTopologyUpsertIntentNotApplied = 8002, IncrementGlobalConfigurationNumberTopologyUpsertIntentNotApplied = 8003, + AddRegionUpsertIntentNotApplied = 8004, + RemoveReadRegionUpsertIntentNotApplied = 8005, // SDK Codes (Client) // IMPORTANT - keep these consistent with Java SDK as well @@ -374,7 +404,10 @@ internal enum SubStatusCodes // Data Transfer Application related MissingPartitionKeyInDataTransfer = 22001, - InvalidPartitionKeyInDataTransfer = 22002 + InvalidPartitionKeyInDataTransfer = 22002, + + // Failover Priority Change Rollback Failed + FailoverPriorityChangeRollbackFailed = 23001, } internal static class StatusCodesExtensions diff --git a/Microsoft.Azure.Cosmos/src/direct/StoreClient.cs b/Microsoft.Azure.Cosmos/src/direct/StoreClient.cs index 6faa62b489..5c8e0054ea 100644 --- a/Microsoft.Azure.Cosmos/src/direct/StoreClient.cs +++ b/Microsoft.Azure.Cosmos/src/direct/StoreClient.cs @@ -43,7 +43,8 @@ public StoreClient( bool disableRetryWithRetryPolicy = false, bool enableReplicaValidation = false, AccountConfigurationProperties accountConfigurationProperties = null, - RetryWithConfiguration retryWithConfiguration = null) + RetryWithConfiguration retryWithConfiguration = null, + ISessionRetryOptions sessionRetryOptions = null) { this.transportClient = transportClient; this.serviceConfigurationReader = serviceConfigurationReader; @@ -72,7 +73,8 @@ public StoreClient( disableRetryWithRetryPolicy: disableRetryWithRetryPolicy, retryWithConfiguration: retryWithConfiguration, enableReplicaValidation: enableReplicaValidation, - accountConfigurationProperties: accountConfigurationProperties); + accountConfigurationProperties: accountConfigurationProperties, + sessionRetryOptions: sessionRetryOptions); } internal JsonSerializerSettings SerializerSettings { get; set; } diff --git a/Microsoft.Azure.Cosmos/src/direct/StoreClientFactory.cs b/Microsoft.Azure.Cosmos/src/direct/StoreClientFactory.cs index 7fc073c25a..1612f7969c 100644 --- a/Microsoft.Azure.Cosmos/src/direct/StoreClientFactory.cs +++ b/Microsoft.Azure.Cosmos/src/direct/StoreClientFactory.cs @@ -21,7 +21,9 @@ internal sealed class StoreClientFactory : IStoreClientFactory private readonly bool disableRetryWithRetryPolicy; private TransportClient transportClient; private TransportClient fallbackTransportClient; +#pragma warning disable IDE0044 // Add readonly modifier private IConnectionStateListener connectionStateListener; +#pragma warning restore IDE0044 // Add readonly modifier public StoreClientFactory( Protocol protocol, @@ -314,7 +316,8 @@ public StoreClient CreateStoreClient( bool useMultipleWriteLocations = false, bool detectClientConnectivityIssues = false, bool enableReplicaValidation = false, - AccountConfigurationProperties accountConfigurationProperties = null) + AccountConfigurationProperties accountConfigurationProperties = null, + ISessionRetryOptions sessionRetryOptions = null) { this.ThrowIfDisposed(); if (useFallbackClient && this.fallbackTransportClient != null) @@ -334,7 +337,8 @@ public StoreClient CreateStoreClient( disableRetryWithRetryPolicy: this.disableRetryWithRetryPolicy, retryWithConfiguration: this.retryWithConfiguration, enableReplicaValidation: enableReplicaValidation, - accountConfigurationProperties: accountConfigurationProperties); + accountConfigurationProperties: accountConfigurationProperties, + sessionRetryOptions: sessionRetryOptions); } return new StoreClient( @@ -351,7 +355,8 @@ public StoreClient CreateStoreClient( detectClientConnectivityIssues: detectClientConnectivityIssues, disableRetryWithRetryPolicy: this.disableRetryWithRetryPolicy, retryWithConfiguration: this.retryWithConfiguration, - enableReplicaValidation: enableReplicaValidation); + enableReplicaValidation: enableReplicaValidation, + sessionRetryOptions: sessionRetryOptions); } #region IDisposable diff --git a/Microsoft.Azure.Cosmos/src/direct/StoreReader.cs b/Microsoft.Azure.Cosmos/src/direct/StoreReader.cs index f41745b239..53906b6e04 100644 --- a/Microsoft.Azure.Cosmos/src/direct/StoreReader.cs +++ b/Microsoft.Azure.Cosmos/src/direct/StoreReader.cs @@ -171,6 +171,7 @@ private async Task ReadMultipleReplicasInternalAsync(Document entity.RequestContext.TimeoutHelper.ThrowGoneIfElapsed(); using StoreResultList storeResultList = new(new List>(replicaCountToRead)); + ReferenceCountedDisposable sessionNotFoundStoreResult = null; // For 404/1002 exceptionless scenario string requestedCollectionRid = entity.RequestContext.ResolvedCollectionRid; @@ -268,8 +269,7 @@ private async Task ReadMultipleReplicasInternalAsync(Document } else { - // Include the full exception for other scenarios for troubleshooting - DefaultTrace.TraceInformation("StoreReader.ReadMultipleReplicasInternalAsync exception thrown: Exception: {0}", exception); + DefaultTrace.TraceInformation("StoreReader.ReadMultipleReplicasInternalAsync exception thrown: Exception: {0}", exception.Message); } } @@ -331,11 +331,21 @@ private async Task ReadMultipleReplicasInternalAsync(Document && (!entity.IsValidStatusCodeForExceptionlessRetry((int)storeResult.StatusCode, storeResult.SubStatusCode) || !requiresValidLsn || storeResult.LSN > 0)) { if (requestSessionToken == null - || (storeResult.SessionToken != null && requestSessionToken.IsValid(storeResult.SessionToken)) - || (!enforceSessionCheck && storeResult.StatusCode != StatusCodes.NotFound)) + || (storeResult.SessionToken != null && requestSessionToken.IsValid(storeResult.SessionToken)) + || (!enforceSessionCheck && storeResult.StatusCode != StatusCodes.NotFound)) { storeResultList.Add(disposableStoreResult.TryAddReference()); } + + // Exceptionless: Capture the 404/1002 + // Will be used later once all the replicas enumration is complete + if (storeResultList.Count == 0 + && sessionNotFoundStoreResult == null + && entity.IsValidRequestFor4041002() + && storeResult.StatusCode == StatusCodes.NotFound && storeResult.SubStatusCode == SubStatusCodes.ReadSessionNotAvailable) + { + sessionNotFoundStoreResult = disposableStoreResult.TryAddReference(); + } } hasGoneException |= storeResult.StatusCode == StatusCodes.Gone && storeResult.SubStatusCode != SubStatusCodes.NameCacheIsStale; @@ -385,6 +395,13 @@ private async Task ReadMultipleReplicasInternalAsync(Document // The latter case can happen when Task.IsCanceled = true. throw cancellationException ?? new OperationCanceledException(); } + else if (sessionNotFoundStoreResult != null) + { + using (sessionNotFoundStoreResult) + { + storeResultList.Add(sessionNotFoundStoreResult.TryAddReference()); + } + } } return new ReadReplicaResult(false, storeResultList.GetValueAndDereference()); @@ -475,7 +492,7 @@ private async Task> GetResult(DocumentSe } catch (Exception exception) { - DefaultTrace.TraceInformation("Exception {0} is thrown while doing Read Primary", exception); + DefaultTrace.TraceInformation("Exception {0} is thrown while doing Read Primary", exception.Message); storeResult = StoreResult.CreateStoreResult( null, exception, diff --git a/Microsoft.Azure.Cosmos/src/direct/StoreResponse.cs b/Microsoft.Azure.Cosmos/src/direct/StoreResponse.cs index 65335f6970..da0158df68 100644 --- a/Microsoft.Azure.Cosmos/src/direct/StoreResponse.cs +++ b/Microsoft.Azure.Cosmos/src/direct/StoreResponse.cs @@ -101,6 +101,20 @@ public string Continuation } } + public string BackendActivityId + { + get + { + string value; + if (this.TryGetHeaderValue(WFConstants.BackendHeaders.ActivityId, out value)) + { + return value; + } + + return null; + } + } + private SubStatusCodes? subStatusCode; public SubStatusCodes SubStatusCode diff --git a/Microsoft.Azure.Cosmos/src/direct/StoreResponseNameValueCollection.cs b/Microsoft.Azure.Cosmos/src/direct/StoreResponseNameValueCollection.cs index 3d8184aad9..f53334f851 100644 --- a/Microsoft.Azure.Cosmos/src/direct/StoreResponseNameValueCollection.cs +++ b/Microsoft.Azure.Cosmos/src/direct/StoreResponseNameValueCollection.cs @@ -86,6 +86,7 @@ internal class StoreResponseNameValueCollection : INameValueCollection, IEnumera public string MaxContentLength { get; set; } public string MaxResourceQuota { get; set; } public string MergeProgressBlocked { get; set; } + public string MergeProgressBlockedReason { get; set; } public string MinGLSNForDocumentOperations { get; set; } public string MinGLSNForTombstoneOperations { get; set; } public string MinimumRUsForOffer { get; set; } @@ -113,7 +114,6 @@ internal class StoreResponseNameValueCollection : INameValueCollection, IEnumera public string RequestValidationFailure { get; set; } public string RequiresDistribution { get; set; } public string ResourceId { get; set; } - public string ResourceIdentityPrincipalId { get; set; } public string RestoreState { get; set; } public string RetryAfterInMilliseconds { get; set; } public string SchemaVersion { get; set; } @@ -123,6 +123,7 @@ internal class StoreResponseNameValueCollection : INameValueCollection, IEnumera public string SoftMaxAllowedThroughput { get; set; } public string SubStatus { get; set; } public string TentativeStoreChecksum { get; set; } + public string ThroughputBucketApplied { get; set; } public string ThroughputpoolDedicatedRUs { get; set; } public string ThroughputpoolMaxConsumableRUs { get; set; } public string TimeToLiveInSeconds { get; set; } @@ -223,6 +224,7 @@ public void Clear() this.MaxContentLength = null; this.MaxResourceQuota = null; this.MergeProgressBlocked = null; + this.MergeProgressBlockedReason = null; this.MinGLSNForDocumentOperations = null; this.MinGLSNForTombstoneOperations = null; this.MinimumRUsForOffer = null; @@ -250,7 +252,6 @@ public void Clear() this.RequestValidationFailure = null; this.RequiresDistribution = null; this.ResourceId = null; - this.ResourceIdentityPrincipalId = null; this.RestoreState = null; this.RetryAfterInMilliseconds = null; this.SchemaVersion = null; @@ -260,6 +261,7 @@ public void Clear() this.SoftMaxAllowedThroughput = null; this.SubStatus = null; this.TentativeStoreChecksum = null; + this.ThroughputBucketApplied = null; this.ThroughputpoolDedicatedRUs = null; this.ThroughputpoolMaxConsumableRUs = null; this.TimeToLiveInSeconds = null; @@ -332,6 +334,7 @@ public INameValueCollection Clone() MaxContentLength = this.MaxContentLength, MaxResourceQuota = this.MaxResourceQuota, MergeProgressBlocked = this.MergeProgressBlocked, + MergeProgressBlockedReason = this.MergeProgressBlockedReason, MinGLSNForDocumentOperations = this.MinGLSNForDocumentOperations, MinGLSNForTombstoneOperations = this.MinGLSNForTombstoneOperations, MinimumRUsForOffer = this.MinimumRUsForOffer, @@ -359,7 +362,6 @@ public INameValueCollection Clone() RequestValidationFailure = this.RequestValidationFailure, RequiresDistribution = this.RequiresDistribution, ResourceId = this.ResourceId, - ResourceIdentityPrincipalId = this.ResourceIdentityPrincipalId, RestoreState = this.RestoreState, RetryAfterInMilliseconds = this.RetryAfterInMilliseconds, SchemaVersion = this.SchemaVersion, @@ -369,6 +371,7 @@ public INameValueCollection Clone() SoftMaxAllowedThroughput = this.SoftMaxAllowedThroughput, SubStatus = this.SubStatus, TentativeStoreChecksum = this.TentativeStoreChecksum, + ThroughputBucketApplied = this.ThroughputBucketApplied, ThroughputpoolDedicatedRUs = this.ThroughputpoolDedicatedRUs, ThroughputpoolMaxConsumableRUs = this.ThroughputpoolMaxConsumableRUs, TimeToLiveInSeconds = this.TimeToLiveInSeconds, @@ -778,9 +781,13 @@ IEnumerator> IEnumerable(WFConstants.BackendHeaders.VectorIndexAggregateProgress, this.VectorIndexAggregateProgress); } - if (this.ResourceIdentityPrincipalId != null) + if (this.MergeProgressBlockedReason != null) { - yield return new KeyValuePair(HttpConstants.HttpHeaders.ResourceIdentityPrincipalId, this.ResourceIdentityPrincipalId); + yield return new KeyValuePair(WFConstants.BackendHeaders.MergeProgressBlockedReason, this.MergeProgressBlockedReason); + } + if (this.ThroughputBucketApplied != null) + { + yield return new KeyValuePair(HttpConstants.HttpHeaders.ThroughputBucketApplied, this.ThroughputBucketApplied); } if (this.lazyNotCommonHeaders != null) @@ -1185,9 +1192,13 @@ public IEnumerable Keys() { yield return WFConstants.BackendHeaders.VectorIndexAggregateProgress; } - if (this.ResourceIdentityPrincipalId != null) + if (this.MergeProgressBlockedReason != null) + { + yield return WFConstants.BackendHeaders.MergeProgressBlockedReason; + } + if (this.ThroughputBucketApplied != null) { - yield return HttpConstants.HttpHeaders.ResourceIdentityPrincipalId; + yield return HttpConstants.HttpHeaders.ThroughputBucketApplied; } if (this.lazyNotCommonHeaders != null) @@ -1591,9 +1602,13 @@ public NameValueCollection ToNameValueCollection() { this.nameValueCollection.Add(WFConstants.BackendHeaders.VectorIndexAggregateProgress, this.VectorIndexAggregateProgress); } - if (this.ResourceIdentityPrincipalId != null) + if (this.MergeProgressBlockedReason != null) { - this.nameValueCollection.Add(HttpConstants.HttpHeaders.ResourceIdentityPrincipalId, this.ResourceIdentityPrincipalId); + this.nameValueCollection.Add(WFConstants.BackendHeaders.MergeProgressBlockedReason, this.MergeProgressBlockedReason); + } + if (this.ThroughputBucketApplied != null) + { + this.nameValueCollection.Add(HttpConstants.HttpHeaders.ThroughputBucketApplied, this.ThroughputBucketApplied); } if(this.lazyNotCommonHeaders != null) { @@ -1960,10 +1975,6 @@ public string Get(string key) { return this.IsOfferRestorePending; } - if (object.ReferenceEquals(HttpConstants.HttpHeaders.ResourceIdentityPrincipalId, key)) - { - return this.ResourceIdentityPrincipalId; - } if (string.Equals(HttpConstants.HttpHeaders.LastStateChangeUtc, key, StringComparison.OrdinalIgnoreCase)) { return this.LastStateChangeUtc; @@ -1994,11 +2005,6 @@ public string Get(string key) return this.IsOfferRestorePending; } - if (string.Equals(HttpConstants.HttpHeaders.ResourceIdentityPrincipalId, key, StringComparison.OrdinalIgnoreCase)) - { - return this.ResourceIdentityPrincipalId; - } - break; case 27: if (object.ReferenceEquals(WFConstants.BackendHeaders.NumberOfReadRegions, key)) @@ -2275,6 +2281,10 @@ public string Get(string key) { return this.OfferReplacePendingForMerge; } + if (object.ReferenceEquals(HttpConstants.HttpHeaders.ThroughputBucketApplied, key)) + { + return this.ThroughputBucketApplied; + } if (string.Equals(HttpConstants.HttpHeaders.TotalAccountThroughput, key, StringComparison.OrdinalIgnoreCase)) { return this.TotalAccountThroughput; @@ -2290,6 +2300,11 @@ public string Get(string key) return this.OfferReplacePendingForMerge; } + if (string.Equals(HttpConstants.HttpHeaders.ThroughputBucketApplied, key, StringComparison.OrdinalIgnoreCase)) + { + return this.ThroughputBucketApplied; + } + break; case 37: if (object.ReferenceEquals(WFConstants.BackendHeaders.IsRUPerMinuteUsed, key)) @@ -2414,6 +2429,10 @@ public string Get(string key) { return this.GlobalNRegionCommittedGLSN; } + if (object.ReferenceEquals(WFConstants.BackendHeaders.MergeProgressBlockedReason, key)) + { + return this.MergeProgressBlockedReason; + } if (string.Equals(WFConstants.BackendHeaders.AnalyticalMigrationProgress, key, StringComparison.OrdinalIgnoreCase)) { return this.AnalyticalMigrationProgress; @@ -2424,6 +2443,11 @@ public string Get(string key) return this.GlobalNRegionCommittedGLSN; } + if (string.Equals(WFConstants.BackendHeaders.MergeProgressBlockedReason, key, StringComparison.OrdinalIgnoreCase)) + { + return this.MergeProgressBlockedReason; + } + break; case 42: if (string.Equals(WFConstants.BackendHeaders.XPConfigurationSessionsCount, key, StringComparison.OrdinalIgnoreCase)) @@ -3258,16 +3282,6 @@ public void UpdateHelper( this.IsOfferRestorePending = value; return; } - if (object.ReferenceEquals(HttpConstants.HttpHeaders.ResourceIdentityPrincipalId, key)) - { - if (throwIfAlreadyExists && this.ResourceIdentityPrincipalId != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.ResourceIdentityPrincipalId = value; - return; - } if (string.Equals(HttpConstants.HttpHeaders.LastStateChangeUtc, key, StringComparison.OrdinalIgnoreCase)) { if (throwIfAlreadyExists && this.LastStateChangeUtc != null) @@ -3328,16 +3342,6 @@ public void UpdateHelper( this.IsOfferRestorePending = value; return; } - if (string.Equals(HttpConstants.HttpHeaders.ResourceIdentityPrincipalId, key, StringComparison.OrdinalIgnoreCase)) - { - if (throwIfAlreadyExists && this.ResourceIdentityPrincipalId != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.ResourceIdentityPrincipalId = value; - return; - } break; case 27: if (object.ReferenceEquals(WFConstants.BackendHeaders.NumberOfReadRegions, key)) @@ -3928,6 +3932,16 @@ public void UpdateHelper( this.OfferReplacePendingForMerge = value; return; } + if (object.ReferenceEquals(HttpConstants.HttpHeaders.ThroughputBucketApplied, key)) + { + if (throwIfAlreadyExists && this.ThroughputBucketApplied != null) + { + throw new ArgumentException($"The {key} already exists in the collection"); + } + + this.ThroughputBucketApplied = value; + return; + } if (string.Equals(HttpConstants.HttpHeaders.TotalAccountThroughput, key, StringComparison.OrdinalIgnoreCase)) { if (throwIfAlreadyExists && this.TotalAccountThroughput != null) @@ -3958,6 +3972,16 @@ public void UpdateHelper( this.OfferReplacePendingForMerge = value; return; } + if (string.Equals(HttpConstants.HttpHeaders.ThroughputBucketApplied, key, StringComparison.OrdinalIgnoreCase)) + { + if (throwIfAlreadyExists && this.ThroughputBucketApplied != null) + { + throw new ArgumentException($"The {key} already exists in the collection"); + } + + this.ThroughputBucketApplied = value; + return; + } break; case 37: if (object.ReferenceEquals(WFConstants.BackendHeaders.IsRUPerMinuteUsed, key)) @@ -4226,6 +4250,16 @@ public void UpdateHelper( this.GlobalNRegionCommittedGLSN = value; return; } + if (object.ReferenceEquals(WFConstants.BackendHeaders.MergeProgressBlockedReason, key)) + { + if (throwIfAlreadyExists && this.MergeProgressBlockedReason != null) + { + throw new ArgumentException($"The {key} already exists in the collection"); + } + + this.MergeProgressBlockedReason = value; + return; + } if (string.Equals(WFConstants.BackendHeaders.AnalyticalMigrationProgress, key, StringComparison.OrdinalIgnoreCase)) { if (throwIfAlreadyExists && this.AnalyticalMigrationProgress != null) @@ -4246,6 +4280,16 @@ public void UpdateHelper( this.GlobalNRegionCommittedGLSN = value; return; } + if (string.Equals(WFConstants.BackendHeaders.MergeProgressBlockedReason, key, StringComparison.OrdinalIgnoreCase)) + { + if (throwIfAlreadyExists && this.MergeProgressBlockedReason != null) + { + throw new ArgumentException($"The {key} already exists in the collection"); + } + + this.MergeProgressBlockedReason = value; + return; + } break; case 42: if (string.Equals(WFConstants.BackendHeaders.XPConfigurationSessionsCount, key, StringComparison.OrdinalIgnoreCase)) diff --git a/Microsoft.Azure.Cosmos/src/direct/StoreResult.cs b/Microsoft.Azure.Cosmos/src/direct/StoreResult.cs index b57b5ea330..39148c788e 100644 --- a/Microsoft.Azure.Cosmos/src/direct/StoreResult.cs +++ b/Microsoft.Azure.Cosmos/src/direct/StoreResult.cs @@ -18,7 +18,9 @@ internal sealed class StoreResult : IDisposable { private readonly StoreResponse storeResponse; +#pragma warning disable IDE0044 // Add readonly modifier private static bool UseSessionTokenHeader = VersionUtility.IsLaterThan(HttpConstants.Versions.CurrentVersion, HttpConstants.VersionDates.v2018_06_18); +#pragma warning restore IDE0044 // Add readonly modifier public static ReferenceCountedDisposable CreateStoreResult( StoreResponse storeResponse, @@ -239,7 +241,7 @@ public static ReferenceCountedDisposable CreateStoreResult( } else { - DefaultTrace.TraceCritical("Unexpected exception {0} received while reading from store.", responseException); + DefaultTrace.TraceCritical("Unexpected exception {0} received while reading from store.", responseException?.Message); return new ReferenceCountedDisposable(new StoreResult( storeResponse: null, exception: new InternalServerErrorException(RMResources.InternalServerError, responseException), @@ -265,12 +267,12 @@ public static ReferenceCountedDisposable CreateStoreResult( } } - public static ReferenceCountedDisposable CreateForTesting(StoreResponse storeResponse) + public static ReferenceCountedDisposable CreateForTesting(StoreResponse storeResponse, int numberOfReadRegions = 0) { return new ReferenceCountedDisposable( new StoreResult( storeResponse, exception: null, null, default, default, default, default, default, default, - default, default, default, default, default, default, default, default, default, default, default)); + default, default, numberOfReadRegions, default, default, default, default, default, default, default, default)); } public static ReferenceCountedDisposable CreateForTesting(TransportRequestStats transportRequestStats) diff --git a/Microsoft.Azure.Cosmos/src/direct/StringSyntaxAttribute.cs b/Microsoft.Azure.Cosmos/src/direct/StringSyntaxAttribute.cs index 1136658a05..637856f8e4 100644 --- a/Microsoft.Azure.Cosmos/src/direct/StringSyntaxAttribute.cs +++ b/Microsoft.Azure.Cosmos/src/direct/StringSyntaxAttribute.cs @@ -8,10 +8,13 @@ namespace System.Diagnostics.CodeAnalysis #pragma warning restore NamespaceMatchesFolderStructure { - /// +#pragma warning disable CS1584 // XML comment has syntactically incorrect cref attribute +/// /// Partial copy of NET7's StringSyntaxAttribute. /// + /// [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = false)] +#pragma warning restore CS1584 // XML comment has syntactically incorrect cref attribute #if DOCDBCLIENT // We don't want to update the public API in the client internal #else diff --git a/Microsoft.Azure.Cosmos/src/direct/SystemSynchronizationScope.cs b/Microsoft.Azure.Cosmos/src/direct/SystemSynchronizationScope.cs index c3bd8438d8..e112ac8434 100644 --- a/Microsoft.Azure.Cosmos/src/direct/SystemSynchronizationScope.cs +++ b/Microsoft.Azure.Cosmos/src/direct/SystemSynchronizationScope.cs @@ -49,7 +49,9 @@ public SystemSynchronizationScope(string name, TimeSpan timeout = default) } catch (AbandonedMutexException amEx) { +#pragma warning disable CDX1001 DefaultTrace.TraceWarning($"{this.TraceId}: {nameof(AbandonedMutexException)} waiting for mutex '{this.MutexName}': {amEx}"); +#pragma warning restore CDX1001 this.isOwned = true; } } @@ -144,13 +146,16 @@ private void ReleaseAndDisposeMutexSave(Mutex mutex) } catch (AbandonedMutexException amEx) { +#pragma warning disable CDX1001 DefaultTrace.TraceWarning($"{this.TraceId}: {nameof(AbandonedMutexException)} waiting for mutex '{this.MutexName}': {amEx}"); +#pragma warning restore CDX1001 } catch (ApplicationException appEx) { +#pragma warning disable CDX1001 DefaultTrace.TraceWarning($"{this.TraceId}: Exception releasing system mutex '{this.MutexName}': {appEx}"); +#pragma warning restore CDX1001 } - mutex.Dispose(); } } diff --git a/Microsoft.Azure.Cosmos/src/direct/SystemUsageMonitor.cs b/Microsoft.Azure.Cosmos/src/direct/SystemUsageMonitor.cs index 628b4d7858..371b32dceb 100644 --- a/Microsoft.Azure.Cosmos/src/direct/SystemUsageMonitor.cs +++ b/Microsoft.Azure.Cosmos/src/direct/SystemUsageMonitor.cs @@ -23,7 +23,9 @@ internal sealed class SystemUsageMonitor : IDisposable private readonly IDictionary recorders = new Dictionary(); private readonly Stopwatch watch = new Stopwatch(); +#pragma warning disable IDE0044 // Add readonly modifier private int pollDelayInMilliSeconds; +#pragma warning restore IDE0044 // Add readonly modifier private CancellationTokenSource cancellation; private Task periodicTask { set; get; } @@ -94,7 +96,7 @@ private void Start() { DefaultTrace.TraceError( "The CPU and Memory usage monitoring refresh task failed. Exception: {0}", - t.Exception); + t.Exception?.Message); }, TaskContinuationOptions.OnlyOnFaulted); diff --git a/Microsoft.Azure.Cosmos/src/direct/SystemUtilizationReaderBase.cs b/Microsoft.Azure.Cosmos/src/direct/SystemUtilizationReaderBase.cs index e1c533b937..f0dd992a0f 100644 --- a/Microsoft.Azure.Cosmos/src/direct/SystemUtilizationReaderBase.cs +++ b/Microsoft.Azure.Cosmos/src/direct/SystemUtilizationReaderBase.cs @@ -88,7 +88,7 @@ public float GetSystemWideCpuUsage() { DefaultTrace.TraceError( "Reading the system-wide CPU usage failed. Exception: {0}", - exception); + exception.Message); return Single.NaN; } @@ -104,7 +104,7 @@ public float GetSystemWideCpuUsage() { DefaultTrace.TraceError( "Reading the system-wide Memory availability failed. Exception: {0}", - exception); + exception.Message); return null; } diff --git a/Microsoft.Azure.Cosmos/src/direct/Telemetry/OpenTelemetryRecorder.cs b/Microsoft.Azure.Cosmos/src/direct/Telemetry/OpenTelemetryRecorder.cs index d215ea8bdd..75067a31f1 100644 --- a/Microsoft.Azure.Cosmos/src/direct/Telemetry/OpenTelemetryRecorder.cs +++ b/Microsoft.Azure.Cosmos/src/direct/Telemetry/OpenTelemetryRecorder.cs @@ -17,8 +17,12 @@ internal class OpenTelemetryRecorder : IDisposable { private const string DateTimeFormat = "yyyy-MM-dd'T'HH:mm:ssZZ"; private readonly DiagnosticScope scope; +#pragma warning disable IDE0044 // Add readonly modifier private DistributedTracingOptions options; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private DocumentServiceRequest request; +#pragma warning restore IDE0044 // Add readonly modifier public OpenTelemetryRecorder(DiagnosticScope scope, DocumentServiceRequest request, DistributedTracingOptions options) { @@ -58,7 +62,11 @@ public void Record(Uri addressUri, } catch (Exception ex) { +#pragma warning disable CDX1003 +#pragma warning disable CDX1006 DefaultTrace.TraceWarning("Error with distributed tracing {0}", ex.ToString()); +#pragma warning restore CDX1003 +#pragma warning restore CDX1006 } } public void Dispose() @@ -69,7 +77,11 @@ public void Dispose() } catch (Exception ex) { +#pragma warning disable CDX1003 +#pragma warning disable CDX1006 DefaultTrace.TraceWarning("Error with diagnostic scope dispose {0}", ex.ToString()); +#pragma warning restore CDX1003 +#pragma warning restore CDX1006 } } } diff --git a/Microsoft.Azure.Cosmos/src/direct/Telemetry/OpenTelemetryRecorderFactory.cs b/Microsoft.Azure.Cosmos/src/direct/Telemetry/OpenTelemetryRecorderFactory.cs index c8864e41db..a614dbc10e 100644 --- a/Microsoft.Azure.Cosmos/src/direct/Telemetry/OpenTelemetryRecorderFactory.cs +++ b/Microsoft.Azure.Cosmos/src/direct/Telemetry/OpenTelemetryRecorderFactory.cs @@ -55,7 +55,11 @@ public static OpenTelemetryRecorder CreateRecorder(DistributedTracingOptions opt } catch(Exception ex) { +#pragma warning disable CDX1003 +#pragma warning disable CDX1006 DefaultTrace.TraceWarning("Error with distributed tracing {0}", ex.ToString()); +#pragma warning restore CDX1003 +#pragma warning restore CDX1006 } } diff --git a/Microsoft.Azure.Cosmos/src/direct/ThreadInformation.cs b/Microsoft.Azure.Cosmos/src/direct/ThreadInformation.cs index 4600d3db96..a85a108aec 100644 --- a/Microsoft.Azure.Cosmos/src/direct/ThreadInformation.cs +++ b/Microsoft.Azure.Cosmos/src/direct/ThreadInformation.cs @@ -60,7 +60,7 @@ public static ThreadInformation Get() // If task is faulted, stop the watch manually. otherwise keep it running if(ThreadInformation.task.IsFaulted && ThreadInformation.watch.IsRunning) { - DefaultTrace.TraceError("Thread Starvation detection task failed. Exception: {0}", ThreadInformation.task.Exception); + DefaultTrace.TraceError("Thread Starvation detection task failed. Exception: {0}", ThreadInformation.task.Exception?.Message); ThreadInformation.watch.Stop(); } } diff --git a/Microsoft.Azure.Cosmos/src/direct/TimerPool.cs b/Microsoft.Azure.Cosmos/src/direct/TimerPool.cs index 7e2667a24e..65a9cf523a 100644 --- a/Microsoft.Azure.Cosmos/src/direct/TimerPool.cs +++ b/Microsoft.Azure.Cosmos/src/direct/TimerPool.cs @@ -166,7 +166,7 @@ private void OnTimer(Object stateInfo) } catch(Exception ex) { - DefaultTrace.TraceCritical("Hit exception ex: {0}\n, stack: {1}", ex.Message, ex.StackTrace); + DefaultTrace.TraceCritical("Hit exception ex: {0}", ex.Message); } finally { @@ -195,7 +195,7 @@ public PooledTimer GetPooledTimer(int timeoutInSeconds) this.ThrowIfDisposed(); return new PooledTimer(timeoutInSeconds, this); } - + #pragma warning disable CS1572 // XML comment has a param tag, but there is no parameter by that name /// /// get a timer with timeout specified as a TimeSpan diff --git a/Microsoft.Azure.Cosmos/src/direct/TransportClient.cs b/Microsoft.Azure.Cosmos/src/direct/TransportClient.cs index 5c8ac5059b..f66942e5b2 100644 --- a/Microsoft.Azure.Cosmos/src/direct/TransportClient.cs +++ b/Microsoft.Azure.Cosmos/src/direct/TransportClient.cs @@ -1199,6 +1199,7 @@ protected static string GetErrorResponse(StoreResponse storeResponse, string def protected static string GetErrorFromStream(Stream responseStream) { + //$ISSUE-Review-mayapainter-2025/06/16 We cannot always assume that responseStream will be text. using (responseStream) { return new StreamReader(responseStream).ReadToEnd(); diff --git a/Microsoft.Azure.Cosmos/src/direct/TransportSerialization.cs b/Microsoft.Azure.Cosmos/src/direct/TransportSerialization.cs index 0749613470..01d1ef0533 100644 --- a/Microsoft.Azure.Cosmos/src/direct/TransportSerialization.cs +++ b/Microsoft.Azure.Cosmos/src/direct/TransportSerialization.cs @@ -109,6 +109,7 @@ internal static SerializedRequest BuildRequestForProxy( Guid activityId, BufferProvider bufferProvider, string globalDatabaseAccountName, + string regionalDatabaseAccountName, out int headerSize, out int? bodySize) { @@ -124,6 +125,13 @@ internal static SerializedRequest BuildRequestForProxy( rntbdRequest.globalDatabaseAccountName.value.valueBytes = BytesSerializer.GetBytesForString(globalDatabaseAccountName, rntbdRequest); rntbdRequest.globalDatabaseAccountName.isPresent = true; + if (!string.IsNullOrEmpty(regionalDatabaseAccountName)) + { + // Set RegionalDatabaseAccountName + rntbdRequest.regionalDatabaseAccountName.value.valueBytes = BytesSerializer.GetBytesForString(regionalDatabaseAccountName, rntbdRequest); + rntbdRequest.regionalDatabaseAccountName.isPresent = true; + } + return BuildRequestCore( request, ref rntbdRequest, @@ -274,6 +282,7 @@ private static SerializedRequest BuildRequestCore( TransportSerialization.AddEnableConflictResolutionPolicyUpdate(requestHeaders, rntbdRequest); TransportSerialization.AddAllowDocumentReadsInOfflineRegion(requestHeaders, rntbdRequest); TransportSerialization.AddCosmosGatewayTransactionId(requestHeaders, rntbdRequest); + TransportSerialization.AddPopulateThroughputPoolInfo(requestHeaders, rntbdRequest); TransportSerialization.FillTokenFromHeader(request, HttpConstants.HttpHeaders.Authorization, requestHeaders.Authorization, rntbdRequest.authorizationToken, rntbdRequest); TransportSerialization.FillTokenFromHeader(request, HttpConstants.HttpHeaders.SessionToken, requestHeaders.SessionToken, rntbdRequest.sessionToken, rntbdRequest); @@ -373,6 +382,12 @@ private static SerializedRequest BuildRequestCore( TransportSerialization.FillTokenFromHeader(request, HttpConstants.HttpHeaders.PopulateThroughputPoolInfo, requestHeaders.PopulateThroughputPoolInfo, rntbdRequest.populateThroughputPoolInfo, rntbdRequest); TransportSerialization.FillTokenFromHeader(request, WFConstants.BackendHeaders.RetrieveUserStrings, requestHeaders.RetrieveUserStrings, rntbdRequest.retrieveUserStrings, rntbdRequest); TransportSerialization.FillTokenFromHeader(request, HttpConstants.HttpHeaders.PopulateVectorIndexAggregateProgress, requestHeaders.PopulateVectorIndexAggregateProgress, rntbdRequest.populateVectorIndexAggregateProgress, rntbdRequest); + TransportSerialization.FillTokenFromHeader(request, HttpConstants.HttpHeaders.AllowTopologyUpsertWithoutIntent, requestHeaders.AllowTopologyUpsertWithoutIntent, rntbdRequest.allowTopologyUpsertWithoutIntent, rntbdRequest); + TransportSerialization.FillTokenFromHeader(request, HttpConstants.HttpHeaders.ReadGlobalCommittedData, requestHeaders.ReadGlobalCommittedData, rntbdRequest.readGlobalCommittedData, rntbdRequest); + TransportSerialization.FillTokenFromHeader(request, HttpConstants.HttpHeaders.IsSoftDeletionOperation, requestHeaders.IsSoftDeletionOperation, rntbdRequest.isSoftDeletionOperation, rntbdRequest); + TransportSerialization.FillTokenFromHeader(request, HttpConstants.HttpHeaders.WorkloadId, requestHeaders.WorkloadId, rntbdRequest.workloadId, rntbdRequest); + TransportSerialization.FillTokenFromHeader(request, HttpConstants.HttpHeaders.OriginalAuthorizationTokenType, requestHeaders.OriginalAuthTokenType, rntbdRequest.originalAuthTokenType, rntbdRequest); + // will be null in case of direct, which is fine - BE will use the value from the connection context message. // When this is used in Gateway, the header value will be populated with the proxied HTTP request's header, and // BE will respect the per-request value. @@ -2219,6 +2234,27 @@ private static void FillTokenFromHeader( token.value.valueULong = valueULong; break; + case RntbdTokenTypes.UShort: + ushort valueUShort; + if (headerStringValue != null) + { + if (!ushort.TryParse(headerStringValue, NumberStyles.Integer, CultureInfo.InvariantCulture, out valueUShort)) + { + throw new BadRequestException(String.Format(CultureInfo.CurrentUICulture, RMResources.InvalidHeaderValue, headerStringValue, headerName)); + } + } + else + { + if (!(headerValue is ushort ushortValue)) + { + throw new BadRequestException(String.Format(CultureInfo.CurrentUICulture, RMResources.InvalidHeaderValue, headerValue, headerName)); + } + + valueUShort = ushortValue; + } + + token.value.valueUShort = valueUShort; + break; case RntbdTokenTypes.Long: int valueLong; if (headerStringValue != null) diff --git a/Microsoft.Azure.Cosmos/src/direct/UnixDateTimeConverter.cs b/Microsoft.Azure.Cosmos/src/direct/UnixDateTimeConverter.cs index be6bdc96a2..0a8f455efb 100644 --- a/Microsoft.Azure.Cosmos/src/direct/UnixDateTimeConverter.cs +++ b/Microsoft.Azure.Cosmos/src/direct/UnixDateTimeConverter.cs @@ -21,7 +21,9 @@ namespace Microsoft.Azure.Documents #endif sealed class UnixDateTimeConverter : DateTimeConverterBase { +#pragma warning disable IDE0044 // Add readonly modifier private static DateTime UnixStartTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); +#pragma warning restore IDE0044 // Add readonly modifier /// /// Writes the JSON representation of the DateTime object. diff --git a/Microsoft.Azure.Cosmos/src/direct/ValueStopwatch.cs b/Microsoft.Azure.Cosmos/src/direct/ValueStopwatch.cs index d849cefdc5..a13b9ebf02 100644 --- a/Microsoft.Azure.Cosmos/src/direct/ValueStopwatch.cs +++ b/Microsoft.Azure.Cosmos/src/direct/ValueStopwatch.cs @@ -26,7 +26,7 @@ internal struct ValueStopwatch public static readonly long Frequency = Stopwatch.Frequency; /// public static readonly bool IsHighResolution = Stopwatch.IsHighResolution; - + #pragma warning disable CS1570 // XML comment has badly formed XML #pragma warning disable CS1570 // XML comment has badly formed XML /// diff --git a/Microsoft.Azure.Cosmos/src/direct/VectorSessionToken.cs b/Microsoft.Azure.Cosmos/src/direct/VectorSessionToken.cs index a420e2607b..96f76360c1 100644 --- a/Microsoft.Azure.Cosmos/src/direct/VectorSessionToken.cs +++ b/Microsoft.Azure.Cosmos/src/direct/VectorSessionToken.cs @@ -25,7 +25,10 @@ namespace Microsoft.Azure.Documents /// internal sealed class VectorSessionToken : ISessionToken { + private static readonly IReadOnlyDictionary DefaultLocalLsnByRegion = new Dictionary(0); +#pragma warning disable SA1203 private const string SessionTokenFalseProgressMergeDisabled = "AZURE_COSMOS_SESSION_TOKEN_FALSE_PROGRESS_MERGE_DISABLED"; +#pragma warning restore SA1203 private const char SegmentSeparator = '#'; private const string SegmentSeparatorString = "#"; private const char RegionProgressSeparator = '='; @@ -35,8 +38,9 @@ internal sealed class VectorSessionToken : ISessionToken private readonly long globalLsn; #pragma warning restore IDE0032 // Use auto property private readonly IReadOnlyDictionary localLsnByRegion; - private static readonly IReadOnlyDictionary DefaultLocalLsnByRegion = new Dictionary(0); +#pragma warning disable IDE0044 // Add readonly modifier private static bool isFalseProgressMergeDisabled = string.Equals(Environment.GetEnvironmentVariable(SessionTokenFalseProgressMergeDisabled), "true", +#pragma warning restore IDE0044 // Add readonly modifier StringComparison.OrdinalIgnoreCase); private VectorSessionToken(long version, long globalLsn, IReadOnlyDictionary localLsnByRegion, string sessionToken = null) diff --git a/Microsoft.Azure.Cosmos/src/direct/WFConstants.cs b/Microsoft.Azure.Cosmos/src/direct/WFConstants.cs index 8e2a595f89..dab73fba52 100644 Binary files a/Microsoft.Azure.Cosmos/src/direct/WFConstants.cs and b/Microsoft.Azure.Cosmos/src/direct/WFConstants.cs differ diff --git a/Microsoft.Azure.Cosmos/src/direct/WindowsSystemUtilizationReader.cs b/Microsoft.Azure.Cosmos/src/direct/WindowsSystemUtilizationReader.cs index c59fa0ea9c..a9c409b9d8 100644 --- a/Microsoft.Azure.Cosmos/src/direct/WindowsSystemUtilizationReader.cs +++ b/Microsoft.Azure.Cosmos/src/direct/WindowsSystemUtilizationReader.cs @@ -81,11 +81,11 @@ private static class NativeMethods /// [DllImport("kernel32.dll", SetLastError = true)] internal static extern bool GetSystemTimes(out long idle, out long kernel, out long user); - -#pragma warning disable CS1572 // XML comment has a param tag, but there is no parameter by that name -#pragma warning disable CS1572 // XML comment has a param tag, but there is no parameter by that name +#pragma warning disable SA1507 // Code should not contain multiple blank lines in a row + + #pragma warning disable CS1572 // XML comment has a param tag, but there is no parameter by that name -/// + /// /// https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-globalmemorystatusex /// /// @@ -93,8 +93,7 @@ private static class NativeMethods /// /// [DllImport("kernel32.dll", SetLastError = true)] -#pragma warning restore CS1572 // XML comment has a param tag, but there is no parameter by that name -#pragma warning restore CS1572 // XML comment has a param tag, but there is no parameter by that name +#pragma warning restore SA1507 // Code should not contain multiple blank lines in a row #pragma warning restore CS1572 // XML comment has a param tag, but there is no parameter by that name #pragma warning disable CS1573 // Parameter has no matching param tag in the XML comment (but other parameters do) internal static extern bool GlobalMemoryStatusEx(out MemoryInfo memInfo); diff --git a/Microsoft.Azure.Cosmos/src/direct/msdata_sync.ps1 b/Microsoft.Azure.Cosmos/src/direct/msdata_sync.ps1 index 84c4e9e1c5..dc54c2883a 100644 --- a/Microsoft.Azure.Cosmos/src/direct/msdata_sync.ps1 +++ b/Microsoft.Azure.Cosmos/src/direct/msdata_sync.ps1 @@ -1,4 +1,4 @@ -$baseDir = "C:\src\CosmosDB" +$baseDir = "Q:\src\CosmosDB" $sourceDir = @( "\Product\SDK\.net\Microsoft.Azure.Cosmos.Direct\src\", diff --git a/Microsoft.Azure.Cosmos/src/direct/rntbd2/TransportClient.cs b/Microsoft.Azure.Cosmos/src/direct/rntbd2/TransportClient.cs index 753724c3c6..d68bfeb2f0 100644 --- a/Microsoft.Azure.Cosmos/src/direct/rntbd2/TransportClient.cs +++ b/Microsoft.Azure.Cosmos/src/direct/rntbd2/TransportClient.cs @@ -189,7 +189,7 @@ internal override async Task InvokeStoreAsync( "{0} failed: RID: {1}, Resource Type: {2}, Op: {3}, Address: {4}, " + "Exception: {5}", operation, request.ResourceAddress, request.ResourceType, - resourceOperation, physicalAddress, ex); + resourceOperation, physicalAddress, ex.Message); if (request.IsReadOnlyRequest) { DefaultTrace.TraceInformation("Converting to Gone (read-only request)"); @@ -234,7 +234,7 @@ internal override async Task InvokeStoreAsync( transportResponseStatusCode = (int)TransportResponseStatusCode.DocumentClientException; DefaultTrace.TraceInformation("{0} failed: RID: {1}, Resource Type: {2}, Op: {3}, Address: {4}, " + "Exception: {5}", operation, request.ResourceAddress, request.ResourceType, resourceOperation, - physicalAddress, ex); + physicalAddress, ex.Message); transportRequestStats.RecordState(TransportRequestStats.RequestStage.Failed); ex.TransportRequestStats = transportRequestStats; #if NETSTANDARD2_0_OR_GREATER @@ -247,7 +247,7 @@ internal override async Task InvokeStoreAsync( transportResponseStatusCode = (int)TransportResponseStatusCode.UnknownException; DefaultTrace.TraceInformation("{0} failed: RID: {1}, Resource Type: {2}, Op: {3}, Address: {4}, " + "Exception: {5}", operation, request.ResourceAddress, request.ResourceType, resourceOperation, - physicalAddress, ex); + physicalAddress, ex.Message); #if NETSTANDARD2_0_OR_GREATER recorder?.Record(physicalAddress.Uri, exception: ex); #endif @@ -354,6 +354,17 @@ internal override Task OpenConnectionAsync( public event Action OnDisableRntbdChannel; + public Func IsDisableRntbdChannelActionRegistered + { + get + { + return () => + { + return (this.OnDisableRntbdChannel != null); + }; + } + } + // Examines storeResponse and raises an event if this is the first time // this transport client sees the "disable RNTBD channel" header set to // true by the back-end. @@ -401,7 +412,7 @@ private void RaiseProtocolDowngradeRequest(StoreResponse storeResponse) { DefaultTrace.TraceError( "RNTBD channel callback failed: {0}", - failedTask.Exception); + failedTask.Exception?.Message); }, default(CancellationToken), TaskContinuationOptions.OnlyOnFaulted, diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/BaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/BaselineTests.cs index 62f20f1fe4..efa998bf40 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/BaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/BaselineTests.cs @@ -226,7 +226,9 @@ public void SerializeAsXml(XmlWriter xmlWriter) public class CustomJsonSerializer : CosmosSerializer { private static readonly Encoding DefaultEncoding = new UTF8Encoding(false, true); +#pragma warning disable IDE0044 // Add readonly modifier private JsonSerializer serializer; +#pragma warning restore IDE0044 // Add readonly modifier public CustomJsonSerializer(JsonSerializerSettings jsonSerializerSettings) { this.serializer = JsonSerializer.Create(jsonSerializerSettings); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/IndexMetricsParserBaselineTest.IndexUtilizationClientSideExistenceTest.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/IndexMetricsParserBaselineTest.IndexUtilizationClientSideExistenceTest.xml index d32df438f3..27f4d505bd 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/IndexMetricsParserBaselineTest.IndexUtilizationClientSideExistenceTest.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/IndexMetricsParserBaselineTest.IndexUtilizationClientSideExistenceTest.xml @@ -158,7 +158,7 @@ - + @@ -167,7 +167,7 @@ "Abc" GROUP BY c.id]]> - + @@ -176,7 +176,7 @@ "1" and c.name > "Abc" GROUP BY c.id]]> - + diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/IndexMetricsParserBaselineTest.IndexUtilizationHeaderLengthTest.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/IndexMetricsParserBaselineTest.IndexUtilizationHeaderLengthTest.xml index 6c293000ca..cd6d33ae1d 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/IndexMetricsParserBaselineTest.IndexUtilizationHeaderLengthTest.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/IndexMetricsParserBaselineTest.IndexUtilizationHeaderLengthTest.xml @@ -14,7 +14,7 @@ 0 AND r.bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb > 0]]> - + @@ -23,7 +23,7 @@ 0]]> - + @@ -32,7 +32,7 @@ 0 AND r.cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc > 0]]> - + \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqGeneralBaselineTests.TestOrderByTranslation.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqGeneralBaselineTests.TestOrderByTranslation.xml index 8b8e7e9e54..ae6a5a4d77 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqGeneralBaselineTests.TestOrderByTranslation.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqGeneralBaselineTests.TestOrderByTranslation.xml @@ -121,6 +121,19 @@ FROM root ORDER BY root["FamilyId"] ASC]]> + + + Skip]]> + f.FamilyId).Skip(1)]]> + + + + + order by]]> diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestFullTextScoreOrderByRankFunction.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestFullTextScoreOrderByRankFunction.xml new file mode 100644 index 0000000000..9a9e5dc372 --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestFullTextScoreOrderByRankFunction.xml @@ -0,0 +1,118 @@ + + + + + doc.StringField.FullTextScore(new [] {"test1"})).Select(doc => doc.Pk)]]> + + + + + + + + + + doc.StringField.FullTextScore(new [] {"test1", "test2", "test3"})).Select(doc => doc.Pk)]]> + + + + + + + + + + doc.StringField.FullTextScore(new [] {"test1"})).Select(doc => doc.Pk)]]> + + + + + + + + + + doc.StringField.FullTextScore(new [] {"test1", "test2", "test3"})).Select(doc => doc.Pk)]]> + + + + + + + + + + (doc.StringField.FullTextScore(new [] {"test1"}) != 123))]]> + + + + + + + + + + (doc.StringField.FullTextScore(new [] {"test1", "test2", "test3"}) != 123))]]> + + + + + + + + + + (doc.StringField.FullTextScore(new [] {"test1"}) != 123))]]> + + + + + + + + + + (doc.StringField.FullTextScore(new [] {"test1", "test2", "test3"}) != 123))]]> + + + + + + + \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestOrderByRankFunctionComposeWithOtherFunctions.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestOrderByRankFunctionComposeWithOtherFunctions.xml new file mode 100644 index 0000000000..b0126fc23c --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestOrderByRankFunctionComposeWithOtherFunctions.xml @@ -0,0 +1,233 @@ + + + + + doc.Pk).OrderByRank(doc => doc.FullTextScore(new [] {"test1"}))]]> + + + + + + + + + + doc.StringField.FullTextScore(new [] {"test1"})).Select(doc => doc.Pk)]]> + + + + + + + + + + new AnonymousType(stringField = doc.StringField, PartitionKey = doc.Pk)).OrderByRank(doc => doc.stringField.FullTextScore(new [] {"test1"})).Select(doc => doc.PartitionKey)]]> + + + + + + + + + + doc.ArrayField).OrderByRank(doc => doc.ToString().FullTextScore(new [] {"test1"}))]]> + + + + + + + + + + doc.StringField.FullTextScore(new [] {"test1"})).SelectMany(doc => doc.ArrayField)]]> + + + + + + + + + + doc.StringField.FullTextScore(new [] {"test1"}))]]> + + + + + + + + + + doc.StringField.FullTextScore(new [] {"test1"})).Skip(1).Select(doc => doc.Pk)]]> + + + + + + + + + + doc.StringField.FullTextScore(new [] {"test1"}))]]> + + + + + + + + + + doc.StringField.FullTextScore(new [] {"test1"})).Take(1).Select(doc => doc.Pk)]]> + + + + + + + + + + doc.StringField, (key, values) => values.Count()).OrderByRank(doc => doc.ToString().FullTextScore(new [] {"test1"}))]]> + + + + + + + + + + doc.StringField.FullTextScore(new [] {"test1"})).GroupBy(doc => doc.Pk, (key, values) => values.Count())]]> + + + + + + + + + + doc.NumericField).OrderByRank(doc => doc.StringField.FullTextScore(new [] {"test1"})).Select(doc => doc.Pk)]]> + + + + + + + + + + doc.StringField.FullTextScore(new [] {"test1"})).OrderBy(doc => doc.NumericField).Select(doc => doc.Pk)]]> + + + + + + + + + + (doc.NumericField > 0)).OrderByRank(doc => doc.StringField.FullTextScore(new [] {"test1"})).Select(doc => doc.Pk)]]> + + + 0) +ORDER BY RANK FullTextScore(root["StringField"], "test1")]]> + + + + + + + doc.StringField.FullTextScore(new [] {"test1"})).Where(doc => (doc.NumericField > 0)).Select(doc => doc.Pk)]]> + + + 0) +ORDER BY RANK FullTextScore(root["StringField"], "test1")]]> + + + + \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestRRFOrderByRankFunction.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestRRFOrderByRankFunction.xml new file mode 100644 index 0000000000..f13d85d4ed --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestRRFOrderByRankFunction.xml @@ -0,0 +1,123 @@ + + + + + RRF(new [] {doc.StringField.FullTextScore(new [] {"test1"}), doc.StringField2.FullTextScore(new [] {"test1", "test2", "test3"})})).Select(doc => doc.Pk)]]> + + + + + + + + + + RRF(new [] {doc.StringField.FullTextScore(new [] {"test1"}), doc.StringField.FullTextScore(new [] {"test1", "text2"}), doc.StringField2.FullTextScore(new [] {"test1", "test2", "test3"})})).Select(doc => doc.Pk)]]> + + + + + + + + + + RRF(new [] {doc.StringField.FullTextScore(new [] {"test1"})})).Select(doc => doc.Pk)]]> + + + + + + + + + + (RRF(new [] {doc.StringField.FullTextScore(new [] {"test1"})}) != 123))]]> + + + + + + + + + + (RRF(new [] {doc.StringField.FullTextScore(new [] {"test1"}), doc.StringField2.FullTextScore(new [] {"test1", "test2", "test3"})}) != 123))]]> + + + + + + + + + + RRF(new [] {doc.StringField.FullTextScore(new [] {"test1"}), 123}))]]> + + + + + + + + + + RRF(new [] {doc.StringField.FullTextScore(new [] {"test1"}), (doc.IntField * 1)}))]]> + + + + + + + + + + RRF(new [] {doc.StringField.FullTextScore(new [] {"test1"}), Convert(doc.StringField2.Length, Double)}))]]> + + + + + + + + + + RRF(new [] {doc.StringField.FullTextScore(new [] {"test1"}), Convert(doc.ArrayField.Count(), Double)}))]]> + + + + + + + + + + RRF(new [] {doc.StringField.FullTextScore(new [] {"test1"}), RRF(new [] {doc.StringField2.FullTextScore(new [] {"test1", "test2", "test3"}), doc.StringField.FullTextScore(new [] {"test1", "test2"})})}))]]> + + + + + + + \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestVectorDistanceFunction.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestVectorDistanceFunction.xml new file mode 100644 index 0000000000..52b349202c --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestVectorDistanceFunction.xml @@ -0,0 +1,605 @@ + + + + + doc.VectorFloatField.VectorDistance(new [] {2, 3, 4}, False, null)).Select(doc => doc.Pk)]]> + + + + + + + + + + doc.VectorFloatField.VectorDistance(new [] {2, 3, 4}, False, null)).Select(doc => doc.Pk)]]> + + + + + + + + + + doc.VectorFloatField.VectorDistance(new [] {2, 3, 4}, False, null))]]> + + + + + + + + + + (doc.VectorFloatField.VectorDistance(new [] {2, 3, 4}, False, null) > 0)).Select(doc => doc.Pk)]]> + + + 0)]]> + + + + + + + doc.VectorFloatField.VectorDistance(new [] {2, 3, 4}, False, null), (key, values) => key)]]> + + + + + + + + + + doc.VectorFloatField.VectorDistance(new [] {2, 3, 4}, True, new VectorDistanceOptions() {DistanceFunction = Convert(Cosine, Nullable`1), DataType = Convert(Float32, Nullable`1), SearchListSizeMultiplier = Convert(20, Nullable`1)}))]]> + + + + + + + + + + doc.VectorFloatField.VectorDistance(new [] {2, 3, 4}, True, new VectorDistanceOptions() {DistanceFunction = Convert(Cosine, Nullable`1), DataType = Convert(Float32, Nullable`1)}))]]> + + + + + + + + + + doc.VectorFloatField.VectorDistance(new [] {2, 3, 4}, True, new VectorDistanceOptions() {DistanceFunction = Convert(Cosine, Nullable`1), SearchListSizeMultiplier = Convert(10, Nullable`1)}))]]> + + + + + + + + + + doc.VectorFloatField.VectorDistance(new [] {2, 3, 4}, True, new VectorDistanceOptions() {DataType = Convert(Float32, Nullable`1), SearchListSizeMultiplier = Convert(10, Nullable`1)}))]]> + + + + + + + + + + doc.VectorFloatField.VectorDistance(new [] {2, 3, 4}, True, new VectorDistanceOptions()))]]> + + + + + + + + + + RRF(new [] {doc.VectorFloatField.VectorDistance(new [] {2, 3, 4}, False, null), doc.VectorFloatField.VectorDistance(new [] {3, 4, 5}, False, null)})).Select(doc => doc.Pk)]]> + + + + + + + + + + RRF(new [] {doc.VectorFloatField.VectorDistance(new [] {2, 3, 4}, False, null), doc.VectorFloatField.FullTextScore(new [] {"string", "name"})})).Select(doc => doc.Pk)]]> + + + + + + + + + + doc.VectorUInt8Field.VectorDistance(new [] {2, 3, 4}, False, null)).Select(doc => doc.Pk)]]> + + + + + + + + + + doc.VectorUInt8Field.VectorDistance(new [] {2, 3, 4}, False, null)).Select(doc => doc.Pk)]]> + + + + + + + + + + doc.VectorUInt8Field.VectorDistance(new [] {2, 3, 4}, False, null))]]> + + + + + + + + + + (doc.VectorUInt8Field.VectorDistance(new [] {2, 3, 4}, False, null) > 0)).Select(doc => doc.Pk)]]> + + + 0)]]> + + + + + + + doc.VectorUInt8Field.VectorDistance(new [] {2, 3, 4}, False, null), (key, values) => key)]]> + + + + + + + + + + doc.VectorUInt8Field.VectorDistance(new [] {2, 3, 4}, True, new VectorDistanceOptions() {DistanceFunction = Convert(DotProduct, Nullable`1), DataType = Convert(Uint8, Nullable`1), SearchListSizeMultiplier = Convert(20, Nullable`1)}))]]> + + + + + + + + + + doc.VectorUInt8Field.VectorDistance(new [] {2, 3, 4}, True, new VectorDistanceOptions() {DataType = Convert(Uint8, Nullable`1), SearchListSizeMultiplier = Convert(20, Nullable`1)}))]]> + + + + + + + + + + doc.VectorUInt8Field.VectorDistance(new [] {2, 3, 4}, True, new VectorDistanceOptions() {DistanceFunction = Convert(DotProduct, Nullable`1), DataType = Convert(Uint8, Nullable`1)}))]]> + + + + + + + + + + doc.VectorUInt8Field.VectorDistance(new [] {2, 3, 4}, True, new VectorDistanceOptions() {DataType = Convert(Uint8, Nullable`1)}))]]> + + + + + + + + + + RRF(new [] {doc.VectorUInt8Field.VectorDistance(new [] {2, 3, 4}, False, null), doc.VectorUInt8Field.VectorDistance(new [] {3, 4, 5}, False, null)})).Select(doc => doc.Pk)]]> + + + + + + + + + + RRF(new [] {doc.VectorUInt8Field.VectorDistance(new [] {2, 3, 4}, False, null), doc.VectorUInt8Field.VectorDistance(new [] {3, 4, 5}, False, new VectorDistanceOptions() {DistanceFunction = Convert(DotProduct, Nullable`1), DataType = Convert(Uint8, Nullable`1)})})).Select(doc => doc.Pk)]]> + + + + + + + + + + RRF(new [] {doc.VectorUInt8Field.VectorDistance(new [] {2, 3, 4}, False, null), doc.VectorUInt8Field.FullTextScore(new [] {"string", "name"})})).Select(doc => doc.Pk)]]> + + + + + + + + + + RRF(new [] {doc.VectorUInt8Field.VectorDistance(new [] {2, 3, 4}, False, new VectorDistanceOptions() {DataType = Convert(Uint8, Nullable`1), SearchListSizeMultiplier = Convert(20, Nullable`1)}), doc.VectorUInt8Field.FullTextScore(new [] {"string", "name"})})).Select(doc => doc.Pk)]]> + + + + + + + + + + doc.VectorInt8Field.VectorDistance(new [] {2, 3, 4}, False, null)).Select(doc => doc.Pk)]]> + + + + + + + + + + doc.VectorInt8Field.VectorDistance(new [] {2, 3, 4}, False, null)).Select(doc => doc.Pk)]]> + + + + + + + + + + doc.VectorInt8Field.VectorDistance(new [] {2, 3, 4}, False, null))]]> + + + + + + + + + + (doc.VectorInt8Field.VectorDistance(new [] {2, 3, 4}, False, null) > 0)).Select(doc => doc.Pk)]]> + + + 0)]]> + + + + + + + doc.VectorInt8Field.VectorDistance(new [] {2, 3, 4}, False, null), (key, values) => key)]]> + + + + + + + + + + doc.VectorInt8Field.VectorDistance(new [] {2, 3, 4}, True, new VectorDistanceOptions() {DistanceFunction = Convert(Euclidean, Nullable`1), DataType = Convert(Int8, Nullable`1)}))]]> + + + + + + + + + + RRF(new [] {doc.VectorInt8Field.VectorDistance(new [] {2, 3, 4}, False, null), doc.VectorInt8Field.VectorDistance(new [] {3, 4, 5}, False, null)})).Select(doc => doc.Pk)]]> + + + + + + + + + + RRF(new [] {doc.VectorInt8Field.VectorDistance(new [] {2, 3, 4}, False, null), doc.VectorInt8Field.FullTextScore(new [] {"string", "name"})})).Select(doc => doc.Pk)]]> + + + + + + + + + + doc.VectorFloatField.VectorDistance(new [] {2, 3, 4}, True, new VectorDistanceOptions() {}))]]> + + + + + + + + + + doc.VectorFloatField.VectorDistance(new [] {2, 3, 4}, True, null))]]> + + + + + + + + + + doc.VectorFloatField.VectorDistance(new [] {2, 3, 4}, True, new VectorDistanceOptions() {DataType = Convert(Float32, Nullable`1), DistanceFunction = Convert(Euclidean, Nullable`1), SearchListSizeMultiplier = Convert(10, Nullable`1)}))]]> + + + + + + + + + + doc.VectorFloatField.VectorDistance(new [] {2, 3, 4}, True, new VectorDistanceOptions() {DataType = null, DistanceFunction = null, SearchListSizeMultiplier = null}))]]> + + + + + + + + + + doc.VectorFloatField.VectorDistance(new [] {2, 3, 4}, True, new VectorDistanceOptions() {DistanceFunction = Convert(Euclidean, Nullable`1)}))]]> + + + + + + + + + + doc.VectorFloatField.VectorDistance(new [] {2, 3, 4}, True, new VectorDistanceOptions() {SearchListSizeMultiplier = Convert(1, Nullable`1)}))]]> + + + + + + + + + + doc.VectorFloatField.VectorDistance(new [] {2, 3, 4}, True, new VectorDistanceOptions() {SearchListSizeMultiplier = Convert(-100, Nullable`1)}))]]> + + + + + + + \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientConfigurationDiagnosticTest.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientConfigurationDiagnosticTest.cs index 742d6df4ab..ef7efd9f16 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientConfigurationDiagnosticTest.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientConfigurationDiagnosticTest.cs @@ -154,10 +154,9 @@ public async Task VerifyDiagnosticsOrderTest() } catch (CosmosOperationCanceledException oce) { - IReadOnlyList children = ((CosmosTraceDiagnostics)oce.Diagnostics).Value.Children; - ITrace exceptionChild = children[^1]; - Assert.AreEqual("CosmosOperationCanceledException", exceptionChild.Name); - Assert.IsNotNull(exceptionChild.Data["Operation Cancelled Exception"]); + //check that the exception child exists in the trace diagnostics + Assert.IsTrue(oce.Diagnostics.ToString().Contains("CosmosOperationCanceledException")); + Assert.IsTrue(oce.Diagnostics.ToString().Contains("Operation Cancelled Exception")); } } } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTests.cs index 21521a8cd0..1ec82e86cc 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTests.cs @@ -402,7 +402,7 @@ public async Task TestHeadersPassedinByClient() string sdkSupportedCapability = sdkSupportedCapabilities.Single(); ulong capability = ulong.Parse(sdkSupportedCapability); - Assert.AreEqual((ulong)SDKSupportedCapabilities.PartitionMerge, capability & (ulong)SDKSupportedCapabilities.PartitionMerge,$" received header value as {sdkSupportedCapability}"); + Assert.AreEqual((ulong)(SDKSupportedCapabilities.PartitionMerge | SDKSupportedCapabilities.IgnoreUnknownRntbdTokens), capability & (ulong)(SDKSupportedCapabilities.PartitionMerge | SDKSupportedCapabilities.IgnoreUnknownRntbdTokens), $"received header value as {sdkSupportedCapability}"); } [TestMethod] @@ -939,6 +939,75 @@ public async Task MultiRegionAccountTest() Assert.IsNotNull(properties); } + [DataTestMethod] + [DataRow(true)] + [DataRow(false)] + [Owner("amudumba")] + public async Task ValidateAsyncExceptionNoSharing(bool asyncCacheExceptionNoSharing) + { + TimeoutException exception = new TimeoutException("HTTP Timeout exception", new TimeoutException("Inner exception message")); + TaskCompletionSource blockSendingHandlers = new(TaskCreationOptions.RunContinuationsAsynchronously); + + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConsistencyLevel = Cosmos.ConsistencyLevel.Session, + SendingRequestEventArgs = (sender, e) => + { + if (e.IsHttpRequest()) + { + string endWith = "partitionKeyRangeIds=0"; + if (e.HttpRequest.Method == HttpMethod.Get && + e.HttpRequest.RequestUri.OriginalString.EndsWith(endWith)) + { + blockSendingHandlers.Task.Wait(); // block here until all enter + throw exception; + } + } + }, + EnableAsyncCacheExceptionNoSharing = asyncCacheExceptionNoSharing + }; + + Cosmos.Database db = null; + try + { + CosmosClient cosmosClient = TestCommon.CreateCosmosClient(clientOptions: cosmosClientOptions); + + db = await cosmosClient.CreateDatabaseIfNotExistsAsync("TimeoutFaultTest"); + Container container = await db.CreateContainerIfNotExistsAsync("TimeoutFaultContainer", "/pk"); + + int iterations = 3; + List createTasks = new(); + + for (int i = 0; i < iterations; i++) + { + ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity(); + createTasks.Add(container.CreateItemAsync(testItem) + .ContinueWith(t => { + Assert.IsTrue(t.IsFaulted); + if (asyncCacheExceptionNoSharing) + { + //asyncCacheExceptionNoSharing feature is enabled. Shallow copies of the exception will be thrown. + Assert.IsFalse(Object.ReferenceEquals(t.Exception, exception), "Exception should not be the same"); + } + else + { + //asyncCacheExceptionNoSharing feature is disabled. Exceptions will be thrown as is. + Assert.IsTrue(Object.ReferenceEquals(t.Exception.InnerException, exception), "Exception should be the same"); + } + })); + } + + blockSendingHandlers.SetResult(null); + + // Wait for all tasks to complete (they should all fail) + await Task.WhenAll(createTasks); + } + finally + { + if (db != null) await db.DeleteAsync(); + } + } + [TestMethod] [Owner("amudumba")] public async Task CreateItemDuringTimeoutTest() @@ -958,7 +1027,7 @@ public async Task CreateItemDuringTimeoutTest() .Build(), result: FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.SendDelay) - .WithDelay(TimeSpan.FromSeconds(100)) + .WithDelay(TimeSpan.FromSeconds(20)) .Build()) .Build(); @@ -970,7 +1039,7 @@ public async Task CreateItemDuringTimeoutTest() { ConsistencyLevel = Cosmos.ConsistencyLevel.Session, FaultInjector = faultInjector, - RequestTimeout = TimeSpan.FromSeconds(2) + RequestTimeout = TimeSpan.FromSeconds(1) }; @@ -982,9 +1051,11 @@ public async Task CreateItemDuringTimeoutTest() db = await cosmosClient.CreateDatabaseIfNotExistsAsync("TimeoutFaultTest"); Container container = await db.CreateContainerIfNotExistsAsync("TimeoutFaultContainer", "/pk"); + bool isTimeoutExceptionThrown = false; + // Act. // Simulate a aggressive timeout scenario by performing 3 writes which will all timeout due to fault injection rule. - for (int i = 0; i < 3; i++) + for (int i = 0; i < 2; i++) { try { @@ -994,72 +1065,68 @@ public async Task CreateItemDuringTimeoutTest() catch (CosmosException exx) { Assert.AreEqual(HttpStatusCode.RequestTimeout, exx.StatusCode); + isTimeoutExceptionThrown = true; } } - //Assert that the old channel that is now made unhealthy by the timeouts and a new healthy channel is available for next requests. + Assert.IsTrue(isTimeoutExceptionThrown, "Timeout exception should be thrown for all the 3 writes due to fault injection rule."); + //Assert that the old channel that is now made unhealthy by the timeouts and a new healthy channel is available for next requests. // Get all the channels that are under TransportClient -> ChannelDictionary -> Channels. - IStoreClientFactory factory = (IStoreClientFactory)cosmosClient.DocumentClient.GetType() + IStoreClientFactory storeClientFactAbstract = (IStoreClientFactory)cosmosClient.DocumentClient.GetType() .GetField("storeClientFactory", BindingFlags.NonPublic | BindingFlags.Instance) .GetValue(cosmosClient.DocumentClient); - StoreClientFactory storeClientFactory = (StoreClientFactory)factory; + StoreClientFactory storeClientFactory = (StoreClientFactory)storeClientFactAbstract; - TransportClient client = (TransportClient)storeClientFactory.GetType() + TransportClient transportClient = (TransportClient)storeClientFactory.GetType() .GetField("transportClient", BindingFlags.NonPublic | BindingFlags.Instance) .GetValue(storeClientFactory); - Documents.Rntbd.TransportClient transportClient = (Documents.Rntbd.TransportClient)client; - Documents.Rntbd.ChannelDictionary channelDict = (Documents.Rntbd.ChannelDictionary)transportClient.GetType() + Documents.Rntbd.TransportClient rntbdTransportClient = (Documents.Rntbd.TransportClient)transportClient; + + Documents.Rntbd.ChannelDictionary channelDict = (Documents.Rntbd.ChannelDictionary)rntbdTransportClient.GetType() .GetField("channelDictionary", BindingFlags.NonPublic | BindingFlags.Instance) - .GetValue(transportClient); + .GetValue(rntbdTransportClient); ConcurrentDictionary allChannels = (ConcurrentDictionary)channelDict.GetType() .GetField("channels", BindingFlags.NonPublic | BindingFlags.Instance) .GetValue(channelDict); - //Assert that the old channel that is now made unhealthy by the timeouts. - //Get the channel by channelDict -> LoadBalancingChannel -> LoadBalancingPartition -> LbChannelState -> IChannel. - Documents.Rntbd.LoadBalancingChannel loadBalancingUnhealthyChannel = (Documents.Rntbd.LoadBalancingChannel)allChannels[allChannels.Keys.ElementAt(1)]; - Documents.Rntbd.LoadBalancingPartition loadBalancingPartitionUnHealthy = (Documents.Rntbd.LoadBalancingPartition)loadBalancingUnhealthyChannel.GetType() - .GetField("singlePartition", BindingFlags.NonPublic | BindingFlags.Instance) - .GetValue(loadBalancingUnhealthyChannel); + Assert.IsTrue(allChannels.Count > 1, "There should be at least 2 channels, one healthy and one unhealthy channel."); - Assert.IsNotNull(loadBalancingPartitionUnHealthy); - - List openChannelsUnhealthy = (List)loadBalancingPartitionUnHealthy.GetType() - .GetField("openChannels", BindingFlags.NonPublic | BindingFlags.Instance) - .GetValue(loadBalancingPartitionUnHealthy); - Assert.AreEqual(1, openChannelsUnhealthy.Count); - - foreach (Documents.Rntbd.LbChannelState channelState in openChannelsUnhealthy) + bool unHealthyChannelFound = false; + bool healthyChannelFound = false; + foreach (Documents.Rntbd.ServerKey ch in allChannels.Keys) { - Documents.Rntbd.IChannel channel = (Documents.Rntbd.IChannel)openChannelsUnhealthy[0].GetType() - .GetField("channel", BindingFlags.NonPublic | BindingFlags.Instance) - .GetValue(channelState); - Assert.IsFalse(channel.Healthy); - } + Documents.Rntbd.LoadBalancingChannel lbChannel = (Documents.Rntbd.LoadBalancingChannel)allChannels[ch]; - //Assert that the new channel which is healthy. Picking the first channel from the allChannels dictionary as the new channel. - Documents.Rntbd.LoadBalancingChannel loadBalancingChannel = (Documents.Rntbd.LoadBalancingChannel)allChannels[allChannels.Keys.First()]; - Documents.Rntbd.LoadBalancingPartition loadBalancingPartition = (Documents.Rntbd.LoadBalancingPartition)loadBalancingChannel.GetType() - .GetField("singlePartition", BindingFlags.NonPublic | BindingFlags.Instance) - .GetValue(loadBalancingChannel); + Documents.Rntbd.LoadBalancingPartition lbPartition = (Documents.Rntbd.LoadBalancingPartition)lbChannel.GetType() + .GetField("singlePartition", BindingFlags.NonPublic | BindingFlags.Instance) + .GetValue(lbChannel); - Assert.IsNotNull(loadBalancingPartition); + Assert.IsNotNull(lbPartition); + List openChs = (List)lbPartition.GetType() + .GetField("openChannels", BindingFlags.NonPublic | BindingFlags.Instance) + .GetValue(lbPartition); - List openChannels = (List)loadBalancingPartition.GetType() - .GetField("openChannels", BindingFlags.NonPublic | BindingFlags.Instance) - .GetValue(loadBalancingPartition); - Assert.AreEqual(1, openChannels.Count); - - foreach (Documents.Rntbd.LbChannelState channelState in openChannels) - { - Documents.Rntbd.IChannel channel = (Documents.Rntbd.IChannel)openChannels[0].GetType() - .GetField("channel", BindingFlags.NonPublic | BindingFlags.Instance) - .GetValue(channelState); - Assert.IsTrue(channel.Healthy); + foreach (Documents.Rntbd.LbChannelState channelState in openChs) + { + Documents.Rntbd.IChannel channel = (Documents.Rntbd.IChannel)channelState.GetType() + .GetField("channel", BindingFlags.NonPublic | BindingFlags.Instance) + .GetValue(channelState); + if (!channelState.DeepHealthy) + { + unHealthyChannelFound = true; + } else + { + healthyChannelFound = true; + } + } } + + + Assert.IsTrue(unHealthyChannelFound, "An unhealthy Channel/Connection should have been found due to the repeated timeouts plus aggressive connection timeout policy"); + Assert.IsTrue(healthyChannelFound, "A healthy Channel/Connection should have been found due to the timeouts causing the the old channel to be closed and new one created for future use"); } finally { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosAadTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosAadTests.cs index 01ffcdc674..60602f82f1 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosAadTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosAadTests.cs @@ -38,7 +38,7 @@ public async Task AadMockTest(ConnectionMode connectionMode) try { (string endpoint, string authKey) = TestCommon.GetAccountInfo(); - LocalEmulatorTokenCredential simpleEmulatorTokenCredential = new LocalEmulatorTokenCredential(authKey); + LocalEmulatorTokenCredential simpleEmulatorTokenCredential = new LocalEmulatorTokenCredential(expectedScope: "https://127.0.0.1/.default", masterKey: authKey); CosmosClientOptions clientOptions = new CosmosClientOptions() { ConnectionMode = connectionMode, @@ -140,8 +140,9 @@ void GetAadTokenCallBack( (string endpoint, string authKey) = TestCommon.GetAccountInfo(); LocalEmulatorTokenCredential simpleEmulatorTokenCredential = new LocalEmulatorTokenCredential( - authKey, - GetAadTokenCallBack); + expectedScope: "https://127.0.0.1/.default", + masterKey: authKey, + getTokenCallback: GetAadTokenCallBack); CosmosClientOptions clientOptions = new CosmosClientOptions() { @@ -191,8 +192,9 @@ void GetAadTokenCallBack( (string endpoint, string authKey) = TestCommon.GetAccountInfo(); LocalEmulatorTokenCredential simpleEmulatorTokenCredential = new LocalEmulatorTokenCredential( - authKey, - GetAadTokenCallBack); + expectedScope: "https://127.0.0.1/.default", + masterKey: authKey, + getTokenCallback: GetAadTokenCallBack); CosmosClientOptions clientOptions = new CosmosClientOptions() { @@ -232,8 +234,9 @@ void GetAadTokenCallBack( (string endpoint, string authKey) = TestCommon.GetAccountInfo(); LocalEmulatorTokenCredential simpleEmulatorTokenCredential = new LocalEmulatorTokenCredential( - authKey, - GetAadTokenCallBack); + expectedScope: "https://127.0.0.1/.default", + masterKey: authKey, + getTokenCallback: GetAadTokenCallBack); CosmosClientOptions clientOptions = new CosmosClientOptions() { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosAvailabilityStrategyTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosAvailabilityStrategyTests.cs index c95073aa69..b3b6b7aaaa 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosAvailabilityStrategyTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosAvailabilityStrategyTests.cs @@ -255,35 +255,27 @@ public async Task AvailabilityStrategyNoTriggerTest(bool isPreferredLocationsEmp Database database = faultInjectionClient.GetDatabase(MultiRegionSetupHelpers.dbName); Container container = database.GetContainer(MultiRegionSetupHelpers.containerName); + //warm up connections read + ItemResponse _ = await container.ReadItemAsync("testId", new PartitionKey("pk")); + responseDelay.Enable(); ItemResponse ir = await container.ReadItemAsync("testId", new PartitionKey("pk")); CosmosTraceDiagnostics traceDiagnostic = ir.Diagnostics as CosmosTraceDiagnostics; Assert.IsNotNull(traceDiagnostic); - traceDiagnostic.Value.Data.TryGetValue("Response Region", out object responseRegion); - Assert.IsNotNull(responseRegion); - Assert.AreEqual(region1, (string)responseRegion); - - //Should send out hedge request but original should be returned - traceDiagnostic.Value.Data.TryGetValue("Hedge Context", out object hedgeContext); - Assert.IsNotNull(hedgeContext); - IReadOnlyCollection hedgeContextList; - hedgeContextList = hedgeContext as IReadOnlyCollection; if (isPreferredLocationsEmpty) { - Assert.AreEqual(3, hedgeContextList.Count); - Assert.IsTrue(hedgeContextList.Contains(region1)); - Assert.IsTrue(hedgeContextList.Contains(region2)); - Assert.IsTrue(hedgeContextList.Contains(region3)); + Assert.IsTrue(traceDiagnostic.ToString() + .Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\",\"{region3}\"]")); } else { - Assert.AreEqual(2, hedgeContextList.Count); - Assert.IsTrue(hedgeContextList.Contains(region1)); - Assert.IsTrue(hedgeContextList.Contains(region2)); + Assert.IsTrue(traceDiagnostic.ToString() + .Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\"]")); } - }; + } + ; } [TestMethod] @@ -325,6 +317,9 @@ public async Task AvailabilityStrategyRequestOptionsTriggerTest(bool isPreferred Database database = faultInjectionClient.GetDatabase(MultiRegionSetupHelpers.dbName); Container container = database.GetContainer(MultiRegionSetupHelpers.containerName); + //warm up connections read + ItemResponse _ = await container.ReadItemAsync("testId", new PartitionKey("pk")); + responseDelay.Enable(); ItemRequestOptions requestOptions = new ItemRequestOptions @@ -340,9 +335,8 @@ public async Task AvailabilityStrategyRequestOptionsTriggerTest(bool isPreferred CosmosTraceDiagnostics traceDiagnostic = ir.Diagnostics as CosmosTraceDiagnostics; Assert.IsNotNull(traceDiagnostic); - traceDiagnostic.Value.Data.TryGetValue("Response Region", out object hedgeContext); - Assert.IsNotNull(hedgeContext); - Assert.AreEqual(region2, (string)hedgeContext); + Assert.IsTrue(traceDiagnostic.ToString() + .Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\"")); } } @@ -389,6 +383,9 @@ public async Task AvailabilityStrategyDisableOverideTest(bool isPreferredLocatio Database database = faultInjectionClient.GetDatabase(MultiRegionSetupHelpers.dbName); Container container = database.GetContainer(MultiRegionSetupHelpers.containerName); + //warm up connections read + ItemResponse _ = await container.ReadItemAsync("testId", new PartitionKey("pk")); + responseDelay.Enable(); ItemRequestOptions requestOptions = new ItemRequestOptions { @@ -403,7 +400,7 @@ public async Task AvailabilityStrategyDisableOverideTest(bool isPreferredLocatio CosmosTraceDiagnostics traceDiagnostic = ir.Diagnostics as CosmosTraceDiagnostics; Assert.IsNotNull(traceDiagnostic); - Assert.IsFalse(traceDiagnostic.Value.Data.TryGetValue("Hedge Context", out _)); + Assert.IsFalse(traceDiagnostic.Value.Data.TryGetValue("Hedge Context", out object _)); } } @@ -533,8 +530,10 @@ public async Task AvailabilityStrategyAllFaultsTests(string operation, string co Database database = faultInjectionClient.GetDatabase(MultiRegionSetupHelpers.dbName); Container container = database.GetContainer(MultiRegionSetupHelpers.containerName); + //warm up connections read + ItemResponse _ = await container.ReadItemAsync("testId", new PartitionKey("pk")); + CosmosTraceDiagnostics traceDiagnostic; - object hedgeContext; switch (operation) { @@ -556,9 +555,9 @@ public async Task AvailabilityStrategyAllFaultsTests(string operation, string co Assert.IsTrue(rule.GetHitCount() > 0); traceDiagnostic = ir.Diagnostics as CosmosTraceDiagnostics; Assert.IsNotNull(traceDiagnostic); - traceDiagnostic.Value.Data.TryGetValue("Response Region", out hedgeContext); - Assert.IsNotNull(hedgeContext); - Assert.AreEqual(region2, (string)hedgeContext); + Assert.IsTrue(traceDiagnostic.ToString() + .Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\"]")); + break; @@ -588,9 +587,8 @@ public async Task AvailabilityStrategyAllFaultsTests(string operation, string co Assert.IsTrue(rule.GetHitCount() > 0); traceDiagnostic = feedResponse.Diagnostics as CosmosTraceDiagnostics; Assert.IsNotNull(traceDiagnostic); - traceDiagnostic.Value.Data.TryGetValue("Response Region", out hedgeContext); - Assert.IsNotNull(hedgeContext); - Assert.AreEqual(region2, (string)hedgeContext); + Assert.IsTrue(traceDiagnostic.ToString() + .Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\"]")); } break; @@ -619,9 +617,8 @@ public async Task AvailabilityStrategyAllFaultsTests(string operation, string co Assert.IsTrue(rule.GetHitCount() > 0); traceDiagnostic = feedResponse.Diagnostics as CosmosTraceDiagnostics; Assert.IsNotNull(traceDiagnostic); - traceDiagnostic.Value.Data.TryGetValue("Response Region", out hedgeContext); - Assert.IsNotNull(hedgeContext); - Assert.AreEqual(region2, (string)hedgeContext); + Assert.IsTrue(traceDiagnostic.ToString() + .Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\"]")); } break; @@ -649,9 +646,8 @@ public async Task AvailabilityStrategyAllFaultsTests(string operation, string co Assert.IsTrue(rule.GetHitCount() > 0); traceDiagnostic = readManyResponse.Diagnostics as CosmosTraceDiagnostics; Assert.IsNotNull(traceDiagnostic); - traceDiagnostic.Value.Data.TryGetValue("Response Region", out hedgeContext); - Assert.IsNotNull(hedgeContext); - Assert.AreEqual(region2, (string)hedgeContext); + Assert.IsTrue(traceDiagnostic.ToString() + .Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\"]")); break; @@ -750,8 +746,10 @@ public async Task AvailabilityStrategyStepTests(string operation, string condito Database database = faultInjectionClient.GetDatabase(MultiRegionSetupHelpers.dbName); Container container = database.GetContainer(MultiRegionSetupHelpers.containerName); + //warm up connections read + ItemResponse _ = await container.ReadItemAsync("testId", new PartitionKey("pk")); + CosmosTraceDiagnostics traceDiagnostic; - object hedgeContext; switch (operation) { @@ -765,9 +763,8 @@ public async Task AvailabilityStrategyStepTests(string operation, string condito traceDiagnostic = ir.Diagnostics as CosmosTraceDiagnostics; Assert.IsNotNull(traceDiagnostic); - traceDiagnostic.Value.Data.TryGetValue("Response Region", out hedgeContext); - Assert.IsNotNull(hedgeContext); - Assert.AreEqual(region3, (string)hedgeContext); + Assert.IsTrue(traceDiagnostic.ToString() + .Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\",\"{region3}\"]")); break; @@ -792,9 +789,8 @@ public async Task AvailabilityStrategyStepTests(string operation, string condito traceDiagnostic = feedResponse.Diagnostics as CosmosTraceDiagnostics; Assert.IsNotNull(traceDiagnostic); - traceDiagnostic.Value.Data.TryGetValue("Response Region", out hedgeContext); - Assert.IsNotNull(hedgeContext); - Assert.AreEqual(region3, (string)hedgeContext); + Assert.IsTrue(traceDiagnostic.ToString() + .Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\",\"{region3}\"]")); } break; @@ -813,9 +809,8 @@ public async Task AvailabilityStrategyStepTests(string operation, string condito traceDiagnostic = feedResponse.Diagnostics as CosmosTraceDiagnostics; Assert.IsNotNull(traceDiagnostic); - traceDiagnostic.Value.Data.TryGetValue("Response Region", out hedgeContext); - Assert.IsNotNull(hedgeContext); - Assert.AreEqual(region3, (string)hedgeContext); + Assert.IsTrue(traceDiagnostic.ToString() + .Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\",\"{region3}\"]")); } break; @@ -835,9 +830,8 @@ public async Task AvailabilityStrategyStepTests(string operation, string condito traceDiagnostic = readManyResponse.Diagnostics as CosmosTraceDiagnostics; Assert.IsNotNull(traceDiagnostic); - traceDiagnostic.Value.Data.TryGetValue("Response Region", out hedgeContext); - Assert.IsNotNull(hedgeContext); - Assert.AreEqual(region3, (string)hedgeContext); + Assert.IsTrue(traceDiagnostic.ToString() + .Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\",\"{region3}\"]")); break; @@ -919,6 +913,9 @@ public async Task AvailabilityStrategyMultiMasterWriteBeforeTest() Database database = faultInjectionClient.GetDatabase(MultiRegionSetupHelpers.dbName); Container container = database.GetContainer(MultiRegionSetupHelpers.containerName); + //warm up connections read + ItemResponse _ = await container.ReadItemAsync("testId", new PartitionKey("pk")); + sendDelay.Enable(); ItemRequestOptions requestOptions = new ItemRequestOptions @@ -944,9 +941,8 @@ public async Task AvailabilityStrategyMultiMasterWriteBeforeTest() CosmosTraceDiagnostics traceDiagnostic = ir.Diagnostics as CosmosTraceDiagnostics; Assert.IsNotNull(traceDiagnostic); - traceDiagnostic.Value.Data.TryGetValue("Response Region", out object hedgeContext); - Assert.IsNotNull(hedgeContext); - Assert.AreEqual(region2, (string)hedgeContext); + Assert.IsTrue(traceDiagnostic.ToString() + .Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\"]")); } } @@ -987,6 +983,9 @@ public async Task AvailabilityStrategyMultiMasterWriteAfterTest() Database database = faultInjectionClient.GetDatabase(MultiRegionSetupHelpers.dbName); Container container = database.GetContainer(MultiRegionSetupHelpers.containerName); + //warm up connections read + ItemResponse _ = await container.ReadItemAsync("testId", new PartitionKey("pk")); + responseDelay.Enable(); ItemRequestOptions requestOptions = new ItemRequestOptions @@ -1016,9 +1015,8 @@ public async Task AvailabilityStrategyMultiMasterWriteAfterTest() CosmosTraceDiagnostics traceDiagnostic = ex.Diagnostics as CosmosTraceDiagnostics; Assert.IsNotNull(traceDiagnostic); - traceDiagnostic.Value.Data.TryGetValue("Response Region", out object hedgeContext); - Assert.IsNotNull(hedgeContext); - Assert.AreEqual(region2, (string)hedgeContext); + Assert.IsTrue(traceDiagnostic.ToString() + .Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\"]")); } finally { @@ -1079,7 +1077,8 @@ public async Task AvailabilityStrategyMultiMasterWriteBeforeStepTest() Database database = faultInjectionClient.GetDatabase(MultiRegionSetupHelpers.dbName); Container container = database.GetContainer(MultiRegionSetupHelpers.containerName); - + //warm up connections read + ItemResponse _ = await container.ReadItemAsync("testId", new PartitionKey("pk")); ItemRequestOptions requestOptions = new ItemRequestOptions { @@ -1119,9 +1118,8 @@ await this.container.DeleteItemAsync( CosmosTraceDiagnostics traceDiagnostic = ir.Diagnostics as CosmosTraceDiagnostics; Assert.IsNotNull(traceDiagnostic); - traceDiagnostic.Value.Data.TryGetValue("Response Region", out object hedgeContext); - Assert.IsNotNull(hedgeContext); - Assert.AreEqual(region3, (string)hedgeContext); + Assert.IsTrue(traceDiagnostic.ToString() + .Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\",\"{region3}\"]")); } } @@ -1177,6 +1175,9 @@ public async Task AvailabilityStrategyMultiMasterWriteAfterStepTest() Database database = faultInjectionClient.GetDatabase(MultiRegionSetupHelpers.dbName); Container container = database.GetContainer(MultiRegionSetupHelpers.containerName); + //warm up connections read + ItemResponse _ = await container.ReadItemAsync("testId", new PartitionKey("pk")); + ItemRequestOptions requestOptions = new ItemRequestOptions { AvailabilityStrategy = new CrossRegionHedgingAvailabilityStrategy( @@ -1218,9 +1219,8 @@ await this.container.DeleteItemAsync( CosmosTraceDiagnostics traceDiagnostic = ex.Diagnostics as CosmosTraceDiagnostics; Assert.IsNotNull(traceDiagnostic); - traceDiagnostic.Value.Data.TryGetValue("Response Region", out object hedgeContext); - Assert.IsNotNull(hedgeContext); - Assert.AreEqual(region3, (string)hedgeContext); + Assert.IsTrue(traceDiagnostic.ToString() + .Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\",\"{region3}\"]")); } finally { @@ -1274,14 +1274,113 @@ public async Task AvailabilityStrategyWithCancellationTokenThrowsExceptionTest() Database database = faultInjectionClient.GetDatabase(MultiRegionSetupHelpers.dbName); Container container = database.GetContainer(MultiRegionSetupHelpers.containerName); + //warm up connections read + ItemResponse _ = await container.ReadItemAsync("testId", new PartitionKey("pk")); + CosmosOperationCanceledException cancelledException = await Assert.ThrowsExceptionAsync(() => container.ReadItemAsync( "testId", new PartitionKey("pk"), cancellationToken: cts.Token )); + } + } + + [TestMethod] + [TestCategory("MultiMaster")] + public async Task HedgingCancellationTokenHandling() + { + List feedRanges = (List)await this.container.GetFeedRangesAsync(); + Assert.IsTrue(feedRanges.Any()); + try + { + await this.container.DeleteItemAsync("deleteMe", new PartitionKey("MMWrite")); } + catch (Exception) { } + + + FaultInjectionRule sendDelay = new FaultInjectionRuleBuilder( + id: "sendDelay", + condition: + new FaultInjectionConditionBuilder() + .WithRegion(region1) + .WithConnectionType(FaultInjectionConnectionType.Gateway) + .WithEndpoint( + new FaultInjectionEndpointBuilder( + MultiRegionSetupHelpers.dbName, + MultiRegionSetupHelpers.containerName, + feedRanges[0]) + .WithIncludePrimary(true) + .WithReplicaCount(4) + .Build()) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.SendDelay) + .WithDelay(TimeSpan.FromMilliseconds(8000)) + .Build()) + .WithDuration(TimeSpan.FromMinutes(90)) + .Build(); + + List rules = new List() { sendDelay }; + FaultInjector faultInjector = new FaultInjector(rules); + + sendDelay.Disable(); + + CosmosClientOptions clientOptions = new CosmosClientOptions() + { + ConnectionMode = ConnectionMode.Direct, + ApplicationPreferredRegions = new List() { region1, region2 }, + Serializer = this.cosmosSystemTextJsonSerializer, + RequestTimeout = TimeSpan.FromMilliseconds(5000) + }; + + using (CosmosClient faultInjectionClient = new CosmosClient( + connectionString: this.connectionString, + clientOptions: faultInjector.GetFaultInjectionClientOptions(clientOptions))) + { + Database database = faultInjectionClient.GetDatabase(MultiRegionSetupHelpers.dbName); + Container container = database.GetContainer(MultiRegionSetupHelpers.containerName); + + sendDelay.Enable(); + + CancellationTokenSource cts = new CancellationTokenSource(); + cts.CancelAfter(TimeSpan.FromSeconds(5)); // Cancellation token expiry time is 5 seconds. + + ItemRequestOptions requestOptions = new ItemRequestOptions + { + AvailabilityStrategy = new CrossRegionHedgingAvailabilityStrategy( + threshold: TimeSpan.FromMilliseconds(100), + thresholdStep: TimeSpan.FromMilliseconds(50), + enableMultiWriteRegionHedge: true) + }; + + CosmosIntegrationTestObject CosmosIntegrationTestObject = new CosmosIntegrationTestObject + { + Id = "deleteMe", + Pk = "MMWrite", + Other = "test" + }; + + try + { + ItemResponse ir = await container.CreateItemAsync( + CosmosIntegrationTestObject, + requestOptions: requestOptions, + cancellationToken: cts.Token); + CosmosTraceDiagnostics traceDiagnostic = ir.Diagnostics as CosmosTraceDiagnostics; + Assert.IsNotNull(traceDiagnostic); + Assert.IsTrue(traceDiagnostic.ToString() + .Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\"]")); + } + catch (CosmosException ex) + { + Assert.Fail(ex.Message); + } + + + sendDelay.Disable(); + } } private static async Task HandleChangesAsync( @@ -1296,9 +1395,8 @@ private static async Task HandleChangesAsync( CosmosTraceDiagnostics traceDiagnostic = context.Diagnostics as CosmosTraceDiagnostics; Assert.IsNotNull(traceDiagnostic); - traceDiagnostic.Value.Data.TryGetValue("Response Region", out object hedgeContext); - Assert.IsNotNull(hedgeContext); - Assert.AreNotEqual(region1, (string)hedgeContext); + Assert.IsTrue(traceDiagnostic.ToString() + .Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\"]")); await Task.Delay(1); } @@ -1314,10 +1412,8 @@ private static async Task HandleChangesStepAsync( CosmosTraceDiagnostics traceDiagnostic = context.Diagnostics as CosmosTraceDiagnostics; Assert.IsNotNull(traceDiagnostic); - traceDiagnostic.Value.Data.TryGetValue("Response Region", out object hedgeContext); - Assert.IsNotNull(hedgeContext); - Assert.AreNotEqual(region1, (string)hedgeContext); - Assert.AreNotEqual(region2, (string)hedgeContext); + Assert.IsTrue(traceDiagnostic.ToString() + .Contains($"\"Hedge Context\":[\"{region1}\",\"{region2}\",\"{region3}\"]")); await Task.Delay(1); } } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosContainerTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosContainerTests.cs index cc3f3071cc..ecdf4c1205 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosContainerTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosContainerTests.cs @@ -1760,6 +1760,74 @@ public async Task ClientEncryptionPolicyFailureTest() { Assert.IsTrue(ex.Message.Contains("Path: /users which is part of the partition key has to be encrypted with Deterministic type Encryption."), ex.Message); } + } + + [TestMethod] + [DataRow(true, DisplayName = "Container creation and deletion with binary encoding enabled.")] + [DataRow(false, DisplayName = "Container creation and deletion with binary encoding disabled.")] + public async Task ContainerCreationDeletionWithBinaryEncodingTest(bool binaryEncodingEnabled) + { + string containerId = Guid.NewGuid().ToString(); + string originalBinaryEncodingValue = Environment.GetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled); + + try + { + if (binaryEncodingEnabled) + { + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, "True"); + } + else + { + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, null); + } + + string partitionKeyPath = "/pk"; + ContainerProperties containerProperties = new ContainerProperties(containerId, partitionKeyPath); + ContainerResponse createResponse = await this.cosmosDatabase.CreateContainerAsync(containerProperties); + Assert.AreEqual(HttpStatusCode.Created, createResponse.StatusCode); + Assert.IsNotNull(createResponse.Container); + + // Validate the container was created + Container readContainer = this.cosmosDatabase.GetContainer(containerId); + ContainerResponse readResponse = await readContainer.ReadContainerAsync(); + Assert.AreEqual(HttpStatusCode.OK, readResponse.StatusCode); + Assert.IsNotNull(readResponse.Resource); + Assert.AreEqual(containerId, readResponse.Resource.Id); + + ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity(); + ItemResponse itemResponse = await readContainer.CreateItemAsync(testItem, new Cosmos.PartitionKey(testItem.pk)); + Assert.AreEqual(HttpStatusCode.Created, itemResponse.StatusCode); + + // Delete the container + ContainerResponse deleteResponse = await readContainer.DeleteContainerAsync(); + Assert.AreEqual(HttpStatusCode.NoContent, deleteResponse.StatusCode); + + // Attempt to read the container again to ensure it was deleted + try + { + await readContainer.ReadContainerAsync(); + Assert.Fail("Expected a NotFound exception after deleting the container."); + } + catch (CosmosException ex) when (ex.StatusCode == HttpStatusCode.NotFound) + { + // exception + } + } + finally + { + // Restore the original binary encoding environment variable + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, originalBinaryEncodingValue); + + try + { + Container container = this.cosmosDatabase.GetContainer(containerId); + await container.DeleteContainerAsync(); + } + catch + { + // Ignore exceptions during cleanup + } + } } private void ValidateCreateContainerResponseContract(ContainerResponse containerResponse) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemIntegrationTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemIntegrationTests.cs index 5d825d0948..06e7e4a872 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemIntegrationTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemIntegrationTests.cs @@ -2,13 +2,20 @@ { using System; using System.Collections.Generic; + using System.IO; using System.Linq; using System.Net; + using System.Net.Http; + using System.Text; using System.Text.Json; using System.Text.Json.Serialization; + using System.Threading; using System.Threading.Tasks; + using Microsoft.Azure.Cosmos.Diagnostics; using Microsoft.Azure.Cosmos.FaultInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; + using Newtonsoft.Json.Linq; + using static Microsoft.Azure.Cosmos.Routing.GlobalPartitionEndpointManagerCore; using static Microsoft.Azure.Cosmos.SDK.EmulatorTests.MultiRegionSetupHelpers; [TestClass] @@ -23,6 +30,7 @@ public class CosmosItemIntegrationTests private static string region1; private static string region2; private static string region3; + private IDictionary readRegionsMapping; private CosmosSystemTextJsonSerializer cosmosSystemTextJsonSerializer; [TestInitialize] @@ -34,7 +42,7 @@ public async Task TestInitAsync() { DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull }; - this.cosmosSystemTextJsonSerializer = new CosmosSystemTextJsonSerializer(jsonSerializerOptions); + this.cosmosSystemTextJsonSerializer = new MultiRegionSetupHelpers.CosmosSystemTextJsonSerializer(jsonSerializerOptions); if (string.IsNullOrEmpty(this.connectionString)) { @@ -49,12 +57,12 @@ public async Task TestInitAsync() (this.database, this.container, this.changeFeedContainer) = await MultiRegionSetupHelpers.GetOrCreateMultiRegionDatabaseAndContainers(this.client); - IDictionary readRegions = this.client.DocumentClient.GlobalEndpointManager.GetAvailableReadEndpointsByLocation(); - Assert.IsTrue(readRegions.Count() >= 3); + this.readRegionsMapping = this.client.DocumentClient.GlobalEndpointManager.GetAvailableReadEndpointsByLocation(); + Assert.IsTrue(this.readRegionsMapping.Count() >= 3); - region1 = readRegions.Keys.ElementAt(0); - region2 = readRegions.Keys.ElementAt(1); - region3 = readRegions.Keys.ElementAt(2); + region1 = this.readRegionsMapping.Keys.ElementAt(0); + region2 = this.readRegionsMapping.Keys.ElementAt(1); + region3 = this.readRegionsMapping.Keys.ElementAt(2); } [TestCleanup] @@ -111,7 +119,7 @@ public async Task ReadMany2UnreachablePartitionsTest() { ConnectionMode = ConnectionMode.Direct, ConsistencyLevel = ConsistencyLevel.Strong, - //Serializer = this.cosmosSystemTextJsonSerializer, + Serializer = this.cosmosSystemTextJsonSerializer, FaultInjector = injector, }; @@ -147,6 +155,229 @@ public async Task ReadMany2UnreachablePartitionsTest() } [TestMethod] + [Timeout(70000)] + [TestCategory("MultiRegion")] + public async Task DateTimeArrayRoundtrip_BinaryEncoding_CompareExtraDates_IntegrationTest() + { + string binaryEncodingEnabled = "binaryEncodingEnabled" + Guid.NewGuid().ToString("N"); + string binaryEncodingDisabled = "binaryEncodingDisabled" + Guid.NewGuid().ToString("N"); + string pk = "pk"; + string testId = Guid.NewGuid().ToString(); + + string[] dateStrings = + { + "12/25/2023","2023-12-25","12-25-2023","25.12.2023","25/12/2023", + "Dec 25, 2023","Dec 25 2023","2023-12-25T10:00:00","2023-12-25T10:00:00.123", + "12/25/2023 10:00 AM","12/25/2023 10:00:00 AM","12/25/2023 10:00:00.123 AM","9999-12-31T23:59:59", + "2023-12-25T10:00:00.1","2023-12-25T10:00:00.12", + "2023-12-25T10:00:00.1234","2023-12-25T10:00:00.1234567" + }; + string[] formats = + { + "MM/dd/yyyy","yyyy-MM-dd","MM-dd-yyyy","dd.MM.yyyy","dd/MM/yyyy", + "MMM dd, yyyy","MMM dd yyyy","yyyy-MM-ddTHH:mm:ss","yyyy-MM-ddTHH:mm:ss.fff", + "yyyy-MM-ddTHH:mm:ss.f","yyyy-MM-ddTHH:mm:ss.ff","yyyy-MM-ddTHH:mm:ss.ffff", + "yyyy-MM-ddTHH:mm:ss.fffffff","MM/dd/yyyy hh:mm tt","MM/dd/yyyy hh:mm:ss tt", + "MM/dd/yyyy hh:mm:ss.fff tt" + }; + DateTime[] parsedDates = dateStrings + .Select(s => DateTime.ParseExact(s, formats, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None)) + .ToArray(); + + TestCosmosItem testItem = new TestCosmosItem( + id: testId, + pk: pk, + title: "title", + email: "test@example.com", + body: "Binary encoding test document.", + createdUtc: DateTime.UtcNow, + modifiedUtc: DateTime.Parse("2025-03-26T20:22:20Z", null, System.Globalization.DateTimeStyles.AdjustToUniversal), + extraDates: parsedDates); + + Database db = this.database; + ContainerResponse containerBEEnabledResponse = await db.CreateContainerAsync(binaryEncodingEnabled, "/pk"); + ContainerResponse containerBEDisabledResponse = await db.CreateContainerAsync(binaryEncodingDisabled, "/pk"); + + try + { + // BinaryEncodingEnabled = True + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, "True"); + string rawJsonBEEnabled; + string rawJsonBEDisabled; + using (CosmosClient clientBinaryEncodingEnabled = new CosmosClient(this.connectionString)) + { + Container containerBinaryEncodingEnabled = clientBinaryEncodingEnabled.GetDatabase(db.Id).GetContainer(binaryEncodingEnabled); + await containerBinaryEncodingEnabled.CreateItemAsync(testItem, new Microsoft.Azure.Cosmos.PartitionKey(pk)); + using ResponseMessage response = await containerBinaryEncodingEnabled.ReadItemStreamAsync(testId, new Microsoft.Azure.Cosmos.PartitionKey(pk)); + using StreamReader reader = new StreamReader(response.Content, Encoding.UTF8); + rawJsonBEEnabled = await reader.ReadToEndAsync(); + + } + + // BinaryEncodingEnabled = False + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, "False"); + using (CosmosClient clientBinaryEncodingDisabled = new CosmosClient(this.connectionString)) + { + Container containerBinaryEncodingDisabled = clientBinaryEncodingDisabled.GetDatabase(db.Id).GetContainer(binaryEncodingDisabled); + await containerBinaryEncodingDisabled.CreateItemAsync(testItem, new Microsoft.Azure.Cosmos.PartitionKey(pk)); + using ResponseMessage response = await containerBinaryEncodingDisabled.ReadItemStreamAsync(testId, new Microsoft.Azure.Cosmos.PartitionKey(pk)); + using StreamReader reader = new StreamReader(response.Content, Encoding.UTF8); + rawJsonBEDisabled = await reader.ReadToEndAsync(); + } + + using JsonDocument docTrue = JsonDocument.Parse(rawJsonBEEnabled); + using JsonDocument docFalse = JsonDocument.Parse(rawJsonBEDisabled); + + string extraDatesTrue = docTrue.RootElement.GetProperty("ExtraDates").GetRawText(); + string extraDatesFalse = docFalse.RootElement.GetProperty("ExtraDates").GetRawText(); + + Assert.AreEqual(extraDatesTrue, extraDatesFalse, $"ExtraDates JSON mismatch:\nTrue: {extraDatesTrue}\nFalse: {extraDatesFalse}"); + } + finally + { + await containerBEEnabledResponse.Container.DeleteContainerAsync(); + await containerBEDisabledResponse.Container.DeleteContainerAsync(); + } + } + + [TestMethod] + [TestCategory("MultiRegion")] + [DataRow(FaultInjectionServerErrorType.ServiceUnavailable)] + [DataRow(FaultInjectionServerErrorType.InternalServerError)] + [DataRow(FaultInjectionServerErrorType.DatabaseAccountNotFound)] + [DataRow(FaultInjectionServerErrorType.LeaseNotFound)] + public async Task MetadataEndpointUnavailableCrossRegionalRetryTest(FaultInjectionServerErrorType serverErrorType) + { + FaultInjectionRule collReadBad = new FaultInjectionRuleBuilder( + id: "collread", + condition: new FaultInjectionConditionBuilder() + .WithOperationType(FaultInjectionOperationType.MetadataContainer) + .WithRegion(region1) + .Build(), + result: new FaultInjectionServerErrorResultBuilder(serverErrorType) + .Build()) + .Build(); + + FaultInjectionRule pkRangeBad = new FaultInjectionRuleBuilder( + id: "pkrange", + condition: new FaultInjectionConditionBuilder() + .WithOperationType(FaultInjectionOperationType.MetadataPartitionKeyRange) + .WithRegion(region1) + .Build(), + result: new FaultInjectionServerErrorResultBuilder(serverErrorType) + .Build()) + .Build(); + + collReadBad.Disable(); + pkRangeBad.Disable(); + + FaultInjector faultInjector = new FaultInjector(new List { pkRangeBad, collReadBad }); + + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConsistencyLevel = ConsistencyLevel.Session, + ConnectionMode = ConnectionMode.Direct, + Serializer = this.cosmosSystemTextJsonSerializer, + FaultInjector = faultInjector, + ApplicationPreferredRegions = new List { region1, region2, region3 } + }; + + using (CosmosClient fiClient = new CosmosClient( + connectionString: this.connectionString, + clientOptions: cosmosClientOptions)) + { + Database fidb = fiClient.GetDatabase(MultiRegionSetupHelpers.dbName); + Container fic = fidb.GetContainer(MultiRegionSetupHelpers.containerName); + + pkRangeBad.Enable(); + collReadBad.Enable(); + + try + { + FeedIterator frTest = fic.GetItemQueryIterator("SELECT * FROM c"); + while (frTest.HasMoreResults) + { + FeedResponse feedres = await frTest.ReadNextAsync(); + + Assert.AreEqual(HttpStatusCode.OK, feedres.StatusCode); + } + } + catch (CosmosException ex) + { + Assert.Fail(ex.Message); + } + finally + { + //Cross regional retry needs to ocur (could trigger for other metadata call to try on secondary region so rule would not trigger) + Assert.IsTrue(pkRangeBad.GetHitCount() + collReadBad.GetHitCount() >= 1); + + pkRangeBad.Disable(); + collReadBad.Disable(); + + fiClient.Dispose(); + } + } + } + + [TestMethod] + [TestCategory("MultiRegion")] + public async Task AddressRefreshTimeoutTest() + { + FaultInjectionRule gatewayRule = new FaultInjectionRuleBuilder( + id: "gatewayRule", + condition: new FaultInjectionConditionBuilder() + .WithOperationType(FaultInjectionOperationType.MetadataRefreshAddresses) + .WithRegion(region1) + .Build(), + result: new FaultInjectionServerErrorResultBuilder(FaultInjectionServerErrorType.SendDelay) + .WithDelay(TimeSpan.FromSeconds(65)) + .Build()) + .Build(); + + gatewayRule.Disable(); + + FaultInjector faultInjector = new FaultInjector(new List { gatewayRule }); + + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConsistencyLevel = ConsistencyLevel.Session, + ConnectionMode = ConnectionMode.Direct, + Serializer = this.cosmosSystemTextJsonSerializer, + FaultInjector = faultInjector, + RequestTimeout = TimeSpan.FromSeconds(1), + + }; + + using (CosmosClient fiClient = new CosmosClient( + connectionString: this.connectionString, + clientOptions: cosmosClientOptions)) + { + Database fidb = fiClient.GetDatabase(MultiRegionSetupHelpers.dbName); + Container fic = fidb.GetContainer(MultiRegionSetupHelpers.containerName); + + gatewayRule.Enable(); + + try + { + ItemResponse o = await fic.ReadItemAsync( + "testId", + new PartitionKey("pk")); + Assert.IsTrue(o.StatusCode == HttpStatusCode.OK); + } + catch (Exception ex) + { + Assert.Fail(ex.ToString()); + } + finally + { + gatewayRule.Disable(); + Assert.IsTrue(gatewayRule.GetHitCount() >= 3); + + fiClient.Dispose(); + } + } + } + [Owner("dkunda")] [TestCategory("MultiRegion")] [DataRow(true, DisplayName = "Test scenario when binary encoding is enabled at client level.")] @@ -211,14 +442,14 @@ public async Task ExecuteTransactionalBatch_WhenBinaryEncodingEnabled_ShouldComp Assert.AreEqual(2, transactionResponse.Count); TransactionalBatchOperationResult createOperationResult = transactionResponse.GetOperationResultAtIndex(0); - + Assert.IsNotNull(createOperationResult); Assert.IsNotNull(createOperationResult.Resource); Assert.AreEqual(testItem.Id, createOperationResult.Resource.Id); Assert.AreEqual(testItem.Pk, createOperationResult.Resource.Pk); TransactionalBatchOperationResult readOperationResult = transactionResponse.GetOperationResultAtIndex(1); - + Assert.IsNotNull(readOperationResult); Assert.IsNotNull(readOperationResult.Resource); Assert.AreEqual(testItem.Id, readOperationResult.Resource.Id); @@ -233,5 +464,1117 @@ await this.container.DeleteItemAsync( new PartitionKey(testItem.Pk)); } } + + [TestMethod] + [TestCategory("MultiRegion")] + [DataRow(ConnectionMode.Direct, "15", "10", DisplayName = "Direct Mode - Scenario when the total iteration count is 15 and circuit breaker consecutive failure threshold is set to 10.")] + [DataRow(ConnectionMode.Direct, "25", "20", DisplayName = "Direct Mode - Scenario when the total iteration count is 25 and circuit breaker consecutive failure threshold is set to 20.")] + [DataRow(ConnectionMode.Direct, "35", "30", DisplayName = "Direct Mode - Scenario when the total iteration count is 35 and circuit breaker consecutive failure threshold is set to 30.")] + [DataRow(ConnectionMode.Gateway, "15", "10", DisplayName = "Gateway Mode - Scenario when the total iteration count is 15 and circuit breaker consecutive failure threshold is set to 10.")] + [DataRow(ConnectionMode.Gateway, "25", "20", DisplayName = "Gateway Mode - Scenario when the total iteration count is 25 and circuit breaker consecutive failure threshold is set to 20.")] + [DataRow(ConnectionMode.Gateway, "35", "30", DisplayName = "Gateway Mode - Scenario when the total iteration count is 35 and circuit breaker consecutive failure threshold is set to 30.")] + [Owner("dkunda")] + [Timeout(70000)] + public async Task ReadItemAsync_WithCircuitBreakerEnabledAndSingleMasterAccountAndServiceUnavailableReceived_ShouldApplyPartitionLevelOverride( + ConnectionMode connectionMode, + string iterationCount, + string circuitBreakerConsecutiveFailureCount) + { + // Arrange. + Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelCircuitBreakerEnabled, "True"); + Environment.SetEnvironmentVariable(ConfigurationManager.CircuitBreakerConsecutiveFailureCountForReads, circuitBreakerConsecutiveFailureCount); + + // Enabling fault injection rule to simulate a 503 service unavailable scenario. + string serviceUnavailableRuleId = "503-rule-" + Guid.NewGuid().ToString(); + FaultInjectionRule serviceUnavailableRule = new FaultInjectionRuleBuilder( + id: serviceUnavailableRuleId, + condition: + new FaultInjectionConditionBuilder() + .WithOperationType(FaultInjectionOperationType.ReadItem) + .WithRegion(region1) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.ServiceUnavailable) + .WithDelay(TimeSpan.FromMilliseconds(10)) + .Build()) + .Build(); + + List rules = new List { serviceUnavailableRule }; + FaultInjector faultInjector = new FaultInjector(rules); + + List preferredRegions = new List { region1, region2, region3 }; + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConnectionMode = connectionMode, + ConsistencyLevel = ConsistencyLevel.Session, + FaultInjector = faultInjector, + RequestTimeout = TimeSpan.FromSeconds(5), + ApplicationPreferredRegions = preferredRegions, + }; + + List itemsList = new () + { + new() { Id = "smTestId1", Pk = "smpk1" }, + }; + + try + { + using CosmosClient cosmosClient = new(connectionString: this.connectionString, clientOptions: cosmosClientOptions); + Database database = cosmosClient.GetDatabase(MultiRegionSetupHelpers.dbName); + Container container = database.GetContainer(MultiRegionSetupHelpers.containerName); + + // Act and Assert. + await this.TryCreateItems(itemsList); + + //Must Ensure the data is replicated to all regions + await Task.Delay(3000); + + int consecutiveFailureCount = int.Parse(circuitBreakerConsecutiveFailureCount); + int totalIterations = int.Parse(iterationCount); + + for (int attemptCount = 1; attemptCount <= totalIterations; attemptCount++) + { + try + { + ItemResponse readResponse = await container.ReadItemAsync( + id: itemsList[0].Id, + partitionKey: new PartitionKey(itemsList[0].Pk)); + + IReadOnlyList<(string regionName, Uri uri)> contactedRegionMapping = readResponse.Diagnostics.GetContactedRegions(); + HashSet contactedRegions = new(contactedRegionMapping.Select(r => r.regionName)); + + Assert.AreEqual( + expected: HttpStatusCode.OK, + actual: readResponse.StatusCode); + + Assert.IsNotNull(contactedRegions); + + PartitionKeyRangeFailoverInfo failoverInfo = TestCommon.GetFailoverInfoForFirstPartitionUsingReflection( + globalPartitionEndpointManager: cosmosClient.ClientContext.DocumentClient.PartitionKeyRangeLocation, + isReadOnlyOrMultiMaster: true); + + if (attemptCount > consecutiveFailureCount + 1) + { + if (connectionMode == ConnectionMode.Direct) + { + Assert.IsTrue(contactedRegions.Count == 1, "Asserting that when the consecutive failure count reaches the threshold, the partition was failed over to the next region, and the subsequent read request/s were successful on the next region."); + Assert.IsTrue(contactedRegions.Contains(region2)); + } + + Assert.AreEqual(this.readRegionsMapping[region2], failoverInfo.Current); + } + else + { + if (connectionMode == ConnectionMode.Direct) + { + Assert.IsTrue(contactedRegions.Count == 2, "Asserting that when the read request succeeds before the consecutive failure count reaches the threshold, the partition didn't over to the next region, and the request was retried on the next region."); + Assert.IsTrue(contactedRegions.Contains(region1) && contactedRegions.Contains(region2)); + } + + if (attemptCount > consecutiveFailureCount) + { + Assert.AreEqual(this.readRegionsMapping[region2], failoverInfo.Current); + } + else + { + Assert.AreEqual(this.readRegionsMapping[region1], failoverInfo.Current); + } + } + } + catch (CosmosException) + { + Assert.Fail("Read Item operation should succeed."); + } + catch (Exception ex) + { + Assert.Fail($"Unhandled Exception was thrown during ReadItemAsync call. Message: {ex.Message}"); + } + } + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelCircuitBreakerEnabled, null); + Environment.SetEnvironmentVariable(ConfigurationManager.CircuitBreakerConsecutiveFailureCountForReads, null); + + await this.TryDeleteItems(itemsList); + } + } + + [TestMethod] + [TestCategory("MultiRegion")] + [Owner("dkunda")] + [Timeout(70000)] + public async Task ReadItemAsync_WithCircuitBreakerEnabledAndSingleMasterAccountAndServiceUnavailableReceivedFromTwoRegions_ShouldApplyPartitionLevelOverrideToThridRegion() + { + // Arrange. + Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelCircuitBreakerEnabled, "True"); + Environment.SetEnvironmentVariable(ConfigurationManager.CircuitBreakerConsecutiveFailureCountForReads, "10"); + + // Enabling fault injection rule to simulate a 503 service unavailable scenario. + string serviceUnavailableRuleId1 = "503-rule-" + Guid.NewGuid().ToString(); + FaultInjectionRule serviceUnavailableRule1 = new FaultInjectionRuleBuilder( + id: serviceUnavailableRuleId1, + condition: + new FaultInjectionConditionBuilder() + .WithOperationType(FaultInjectionOperationType.ReadItem) + .WithRegion(region1) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.ServiceUnavailable) + .WithDelay(TimeSpan.FromMilliseconds(10)) + .Build()) + .Build(); + + string serviceUnavailableRuleId2 = "503-rule-" + Guid.NewGuid().ToString(); + FaultInjectionRule serviceUnavailableRule2 = new FaultInjectionRuleBuilder( + id: serviceUnavailableRuleId2, + condition: + new FaultInjectionConditionBuilder() + .WithOperationType(FaultInjectionOperationType.ReadItem) + .WithRegion(region2) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.ServiceUnavailable) + .WithDelay(TimeSpan.FromMilliseconds(10)) + .Build()) + .Build(); + + serviceUnavailableRule1.Disable(); + serviceUnavailableRule2.Disable(); + + List rules = new List { serviceUnavailableRule1, serviceUnavailableRule2 }; + FaultInjector faultInjector = new FaultInjector(rules); + + List preferredRegions = new List { region1, region2, region3 }; + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConsistencyLevel = ConsistencyLevel.Session, + FaultInjector = faultInjector, + RequestTimeout = TimeSpan.FromSeconds(5), + ApplicationPreferredRegions = preferredRegions, + }; + + List itemsList = new() + { + new() { Id = "smTestId1", Pk = "smpk1" }, + }; + + try + { + using CosmosClient cosmosClient = new (connectionString: this.connectionString, clientOptions: cosmosClientOptions); + Database database = cosmosClient.GetDatabase(MultiRegionSetupHelpers.dbName); + Container container = database.GetContainer(MultiRegionSetupHelpers.containerName); + + // Act and Assert. + await this.TryCreateItems(itemsList); + + //Must Ensure the data is replicated to all regions + await Task.Delay(3000); + + bool isRegion1Available = true; + bool isRegion2Available = true; + + int thresholdCounter = 0; + int totalIterations = 40; + int ppcbDefaultThreshold = 10; + int firstRegionServiceUnavailableAttempt = 3; + int secondRegionServiceUnavailableAttempt = 28; + + for (int attemptCount = 1; attemptCount <= totalIterations; attemptCount++) + { + try + { + ItemResponse readResponse = await container.ReadItemAsync( + id: itemsList[0].Id, + partitionKey: new PartitionKey(itemsList[0].Pk)); + + IReadOnlyList<(string regionName, Uri uri)> contactedRegionMapping = readResponse.Diagnostics.GetContactedRegions(); + HashSet contactedRegions = new(contactedRegionMapping.Select(r => r.regionName)); + + Assert.AreEqual( + expected: HttpStatusCode.OK, + actual: readResponse.StatusCode); + + Assert.IsNotNull(contactedRegions); + + if (isRegion1Available && isRegion2Available) + { + Assert.IsTrue(contactedRegions.Count == 1, "Assert that, when no failure happened, the read request is being served from region 1."); + Assert.IsTrue(contactedRegions.Contains(region1)); + + // Simulating service unavailable on region 1. + if (attemptCount == firstRegionServiceUnavailableAttempt) + { + isRegion1Available = false; + serviceUnavailableRule1.Enable(); + } + } + else if (isRegion2Available) + { + if (thresholdCounter <= ppcbDefaultThreshold) + { + Assert.IsTrue(contactedRegions.Count == 2, "Asserting that when the read request succeeds before the consecutive failure count reaches the threshold, the partition didn't fail over to the next region, and the request was retried."); + Assert.IsTrue(contactedRegions.Contains(region1) && contactedRegions.Contains(region2)); + thresholdCounter++; + } + else + { + Assert.IsTrue(contactedRegions.Count == 1, "Asserting that when the consecutive failure count reaches the threshold, the partition was failed over to the next region, and the subsequent read request/s were successful on the next region."); + Assert.IsTrue(contactedRegions.Contains(region2)); + } + + // Simulating service unavailable on region 2. + if (attemptCount == secondRegionServiceUnavailableAttempt) + { + isRegion2Available = false; + serviceUnavailableRule2.Enable(); + } + } + else + { + if (thresholdCounter <= ppcbDefaultThreshold + 1) + { + Assert.IsTrue(contactedRegions.Count == 2, "Asserting that when the read request fails on the second region, the partition did over to the next region, and the request was retried on the next region."); + Assert.IsTrue(contactedRegions.Contains(region2) && contactedRegions.Contains(region3)); + thresholdCounter++; + } + else + { + Assert.IsTrue(contactedRegions.Count == 1, "Asserting that when the consecutive failure count reaches the threshold, the partition was failed over to the third region, and the subsequent read request/s were successful on the third region."); + Assert.IsTrue(contactedRegions.Contains(region3)); + } + } + } + catch (CosmosException) + { + Assert.Fail("Read Item operation should succeed."); + } + catch (Exception ex) + { + Assert.Fail($"Unhandled Exception was thrown during ReadItemAsync call. Message: {ex.Message}"); + } + } + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelCircuitBreakerEnabled, null); + Environment.SetEnvironmentVariable(ConfigurationManager.CircuitBreakerConsecutiveFailureCountForReads, null); + + await this.TryDeleteItems(itemsList); + } + } + + [TestMethod] + [TestCategory("MultiRegion")] + [Owner("dkunda")] + [Timeout(70000)] + public async Task ReadItemAsync_WithNoPreferredRegionsAndCircuitBreakerEnabledAndSingleMasterAccountAndServiceUnavailableReceived_ShouldApplyPartitionLevelOverride() + { + // Arrange. + Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelCircuitBreakerEnabled, "True"); + Environment.SetEnvironmentVariable(ConfigurationManager.CircuitBreakerConsecutiveFailureCountForReads, "10"); + + // Enabling fault injection rule to simulate a 503 service unavailable scenario. + string serviceUnavailableRuleId = "503-rule-" + Guid.NewGuid().ToString(); + FaultInjectionRule serviceUnavailableRule = new FaultInjectionRuleBuilder( + id: serviceUnavailableRuleId, + condition: + new FaultInjectionConditionBuilder() + .WithOperationType(FaultInjectionOperationType.ReadItem) + .WithRegion(region1) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.ServiceUnavailable) + .WithDelay(TimeSpan.FromMilliseconds(10)) + .Build()) + .Build(); + + List rules = new List { serviceUnavailableRule }; + FaultInjector faultInjector = new FaultInjector(rules); + + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConnectionMode = ConnectionMode.Direct, + ConsistencyLevel = ConsistencyLevel.Session, + FaultInjector = faultInjector, + RequestTimeout = TimeSpan.FromSeconds(5), + }; + + List itemsList = new() + { + new() { Id = "smTestId1", Pk = "smpk1" }, + }; + + try + { + using CosmosClient cosmosClient = new(connectionString: this.connectionString, clientOptions: cosmosClientOptions); + Database database = cosmosClient.GetDatabase(MultiRegionSetupHelpers.dbName); + Container container = database.GetContainer(MultiRegionSetupHelpers.containerName); + + // Act and Assert. + await this.TryCreateItems(itemsList); + + //Must Ensure the data is replicated to all regions + await Task.Delay(3000); + + int consecutiveFailureCount = 10; + int totalIterations = 15; + + for (int attemptCount = 1; attemptCount <= totalIterations; attemptCount++) + { + try + { + ItemResponse readResponse = await container.ReadItemAsync( + id: itemsList[0].Id, + partitionKey: new PartitionKey(itemsList[0].Pk)); + + IReadOnlyList<(string regionName, Uri uri)> contactedRegionMapping = readResponse.Diagnostics.GetContactedRegions(); + HashSet contactedRegions = new(contactedRegionMapping.Select(r => r.regionName)); + + Assert.AreEqual( + expected: HttpStatusCode.OK, + actual: readResponse.StatusCode); + + Assert.IsNotNull(contactedRegions); + + PartitionKeyRangeFailoverInfo failoverInfo = TestCommon.GetFailoverInfoForFirstPartitionUsingReflection( + globalPartitionEndpointManager: cosmosClient.ClientContext.DocumentClient.PartitionKeyRangeLocation, + isReadOnlyOrMultiMaster: true); + + if (attemptCount > consecutiveFailureCount + 1) + { + Assert.IsTrue(contactedRegions.Count == 1, "Asserting that when the consecutive failure count reaches the threshold, the partition was failed over to the next region, and the subsequent read request/s were successful on the next region."); + Assert.IsTrue(contactedRegions.Contains(region2)); + Assert.AreEqual(this.readRegionsMapping[region2], failoverInfo.Current); + } + else + { + Assert.IsTrue(contactedRegions.Count == 2, "Asserting that when the read request succeeds before the consecutive failure count reaches the threshold, the partition didn't over to the next region, and the request was retried on the next region."); + Assert.IsTrue(contactedRegions.Contains(region1) && contactedRegions.Contains(region2)); + + if (attemptCount > consecutiveFailureCount) + { + Assert.AreEqual(this.readRegionsMapping[region2], failoverInfo.Current); + } + else + { + Assert.AreEqual(this.readRegionsMapping[region1], failoverInfo.Current); + } + } + } + catch (CosmosException) + { + Assert.Fail("Read Item operation should succeed."); + } + catch (Exception ex) + { + Assert.Fail($"Unhandled Exception was thrown during ReadItemAsync call. Message: {ex.Message}"); + } + } + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelCircuitBreakerEnabled, null); + Environment.SetEnvironmentVariable(ConfigurationManager.CircuitBreakerConsecutiveFailureCountForReads, null); + + await this.TryDeleteItems(itemsList); + } + } + + [TestMethod] + [Owner("dkunda")] + [TestCategory("MultiRegion")] + [Timeout(70000)] + public async Task ReadItemAsync_WithCircuitBreakerDisabledAndSingleMasterAccountAndServiceUnavailableReceived_ShouldNotApplyPartitionLevelOverride() + { + // Arrange. + Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelCircuitBreakerEnabled, "False"); + + // Enabling fault injection rule to simulate a 503 service unavailable scenario. + string serviceUnavailableRuleId = "503-rule-" + Guid.NewGuid().ToString(); + FaultInjectionRule serviceUnavailableRule = new FaultInjectionRuleBuilder( + id: serviceUnavailableRuleId, + condition: + new FaultInjectionConditionBuilder() + .WithOperationType(FaultInjectionOperationType.ReadItem) + .WithRegion(region1) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.ServiceUnavailable) + .WithDelay(TimeSpan.FromMilliseconds(10)) + .Build()) + .Build(); + + List rules = new List { serviceUnavailableRule }; + FaultInjector faultInjector = new FaultInjector(rules); + + List preferredRegions = new List { region1, region2, region3 }; + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConsistencyLevel = ConsistencyLevel.Session, + FaultInjector = faultInjector, + RequestTimeout = TimeSpan.FromSeconds(5), + ApplicationPreferredRegions = preferredRegions, + }; + + List itemsList = new() + { + new() { Id = "smTestId1", Pk = "smpk1" }, + }; + + try + { + using CosmosClient cosmosClient = new(connectionString: this.connectionString, clientOptions: cosmosClientOptions); + Database database = cosmosClient.GetDatabase(MultiRegionSetupHelpers.dbName); + Container container = database.GetContainer(MultiRegionSetupHelpers.containerName); + + // Act and Assert. + await this.TryCreateItems(itemsList); + + //Must Ensure the data is replicated to all regions + await Task.Delay(3000); + + int consecutiveFailureCount = 10; + for (int attemptCount = 1; attemptCount <= consecutiveFailureCount; attemptCount++) + { + try + { + ItemResponse readResponse = await container.ReadItemAsync( + id: itemsList[0].Id, + partitionKey: new PartitionKey(itemsList[0].Pk)); + + IReadOnlyList<(string regionName, Uri uri)> contactedRegionMapping = readResponse.Diagnostics.GetContactedRegions(); + HashSet contactedRegions = new(contactedRegionMapping.Select(r => r.regionName)); + + Assert.AreEqual( + expected: HttpStatusCode.OK, + actual: readResponse.StatusCode); + + Assert.IsNotNull(contactedRegions); + Assert.IsTrue(contactedRegions.Count == 2, "Asserting that when the read request succeeds after failover, the partition was failed over to the next region, after the failures reaches the threshold."); + Assert.IsTrue(contactedRegions.Contains(region1) && contactedRegions.Contains(region2)); + } + catch (CosmosException) + { + Assert.Fail("Read Item operation should succeed."); + } + catch (Exception ex) + { + Assert.Fail($"Unhandled Exception was thrown during ReadItemAsync call. Message: {ex.Message}"); + } + } + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelCircuitBreakerEnabled, null); + Environment.SetEnvironmentVariable(ConfigurationManager.CircuitBreakerConsecutiveFailureCountForReads, null); + + await this.TryDeleteItems(itemsList); + } + } + + [TestMethod] + [Owner("dkunda")] + [TestCategory("MultiRegion")] + [Timeout(70000)] + public async Task CreateItemAsync_WithCircuitBreakerEnabledAndSingleMasterAccountAndServiceUnavailableReceived_ShouldNotApplyPartitionLevelOverride() + { + // Arrange. + int circuitBreakerConsecutiveFailureCount = 10; + Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelCircuitBreakerEnabled, "True"); + Environment.SetEnvironmentVariable(ConfigurationManager.CircuitBreakerConsecutiveFailureCountForReads, $"{circuitBreakerConsecutiveFailureCount}"); + + // Enabling fault injection rule to simulate a 503 service unavailable scenario. + string serviceUnavailableRuleId = "503-rule-" + Guid.NewGuid().ToString(); + FaultInjectionRule serviceUnavailableRule = new FaultInjectionRuleBuilder( + id: serviceUnavailableRuleId, + condition: + new FaultInjectionConditionBuilder() + .WithOperationType(FaultInjectionOperationType.CreateItem) + .WithRegion(region1) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.ServiceUnavailable) + .WithDelay(TimeSpan.FromMilliseconds(10)) + .Build()) + .Build(); + + List rules = new List { serviceUnavailableRule }; + FaultInjector faultInjector = new FaultInjector(rules); + + List preferredRegions = new List { region1, region2, region3 }; + CosmosClientOptions cosmosClientOptions = new() + { + ConsistencyLevel = ConsistencyLevel.Session, + FaultInjector = faultInjector, + RequestTimeout = TimeSpan.FromSeconds(5), + ApplicationPreferredRegions = preferredRegions, + }; + + using CosmosClient cosmosClient = new(connectionString: this.connectionString, clientOptions: cosmosClientOptions); + + Database database = cosmosClient.GetDatabase(MultiRegionSetupHelpers.dbName); + Container container = database.GetContainer(MultiRegionSetupHelpers.containerName); + + try + { + // Act and Assert. + for (int attemptCount = 1; attemptCount <= circuitBreakerConsecutiveFailureCount; attemptCount++) + { + try + { + CosmosIntegrationTestObject testItem = new() { Id = "testId5", Pk = "pk5" }; + ItemResponse createResponse = await container.CreateItemAsync(testItem); + Assert.Fail("Create Item operation should not succeed."); + } + catch (CosmosException ex) + { + Assert.AreEqual( + expected: HttpStatusCode.ServiceUnavailable, + actual: ex.StatusCode); + + IReadOnlyList<(string regionName, Uri uri)> contactedRegionMapping = ex.Diagnostics.GetContactedRegions(); + HashSet contactedRegions = new(contactedRegionMapping.Select(r => r.regionName)); + + Assert.IsTrue(contactedRegions.Count == 1, "Asserting that when a 503 Service Unavailable happens, the partition was not failed over to the next region, since writes are not supported in a single master account, when circuit breaker is enabled."); + Assert.IsTrue(contactedRegions.Contains(region1)); + } + catch (Exception ex) + { + Assert.Fail($"Unhandled Exception was thrown during ReadItemAsync call. Message: {ex.Message}"); + } + } + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelCircuitBreakerEnabled, null); + Environment.SetEnvironmentVariable(ConfigurationManager.CircuitBreakerConsecutiveFailureCountForReads, null); + } + } + + [TestMethod] + [Owner("dkunda")] + [TestCategory("MultiMaster")] + [DataRow(ConnectionMode.Direct, "15", "10", DisplayName = "Direct Mode - Scenario whtn the total iteration count is 15 and circuit breaker consecutive failure threshold is set to 10.")] + [DataRow(ConnectionMode.Direct, "25", "20", DisplayName = "Direct Mode - Scenario whtn the total iteration count is 25 and circuit breaker consecutive failure threshold is set to 20.")] + [DataRow(ConnectionMode.Direct, "35", "30", DisplayName = "Direct Mode - Scenario whtn the total iteration count is 35 and circuit breaker consecutive failure threshold is set to 30.")] + [DataRow(ConnectionMode.Gateway, "15", "10", DisplayName = "Gateway Mode - Scenario when the total iteration count is 15 and circuit breaker consecutive failure threshold is set to 10.")] + [DataRow(ConnectionMode.Gateway, "25", "20", DisplayName = "Gateway Mode - Scenario when the total iteration count is 25 and circuit breaker consecutive failure threshold is set to 20.")] + [DataRow(ConnectionMode.Gateway, "35", "30", DisplayName = "Gateway Mode - Scenario when the total iteration count is 35 and circuit breaker consecutive failure threshold is set to 30.")] + [Timeout(70000)] + public async Task CreateItemAsync_WithCircuitBreakerEnabledAndMultiMasterAccountAndServiceUnavailableReceived_ShouldApplyPartitionLevelOverride( + ConnectionMode connectionMode, + string iterationCount, + string circuitBreakerConsecutiveFailureCount) + { + // Arrange. + Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelCircuitBreakerEnabled, "True"); + Environment.SetEnvironmentVariable(ConfigurationManager.CircuitBreakerConsecutiveFailureCountForWrites, circuitBreakerConsecutiveFailureCount); + + // Enabling fault injection rule to simulate a 503 service unavailable scenario. + string serviceUnavailableRuleId = "503-rule-" + Guid.NewGuid().ToString(); + FaultInjectionRule serviceUnavailableRule = new FaultInjectionRuleBuilder( + id: serviceUnavailableRuleId, + condition: + new FaultInjectionConditionBuilder() + .WithOperationType(FaultInjectionOperationType.CreateItem) + .WithRegion(region1) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.ServiceUnavailable) + .WithDelay(TimeSpan.FromMilliseconds(10)) + .Build()) + .Build(); + + List rules = new List { serviceUnavailableRule }; + FaultInjector faultInjector = new FaultInjector(rules); + + Random random = new (); + List itemsCleanupList = new(); + List preferredRegions = new List { region1, region2, region3 }; + CosmosClientOptions cosmosClientOptions = new() + { + ConsistencyLevel = ConsistencyLevel.Session, + FaultInjector = faultInjector, + RequestTimeout = TimeSpan.FromSeconds(5), + ApplicationPreferredRegions = preferredRegions, + Serializer = this.cosmosSystemTextJsonSerializer, + ConnectionMode = connectionMode, + }; + + try + { + // Act and Assert. + int totalIterations = int.Parse(iterationCount); + int consecutiveFailureCount = int.Parse(circuitBreakerConsecutiveFailureCount); + + using CosmosClient cosmosClient = new(connectionString: this.connectionString, clientOptions: cosmosClientOptions); + Database database = cosmosClient.GetDatabase(MultiRegionSetupHelpers.dbName); + Container container = database.GetContainer(MultiRegionSetupHelpers.containerName); + + for (int attemptCount = 1; attemptCount <= totalIterations; attemptCount++) + { + try + { + CosmosIntegrationTestObject testItem = new() + { + Id = $"mmTestId{random.Next()}", + Pk = $"mmpk{random.Next()}" + }; + + ItemResponse createResponse = await container.CreateItemAsync(testItem); + itemsCleanupList.Add(testItem); + + Assert.AreEqual( + expected: HttpStatusCode.Created, + actual: createResponse.StatusCode); + + PartitionKeyRangeFailoverInfo failoverInfo = TestCommon.GetFailoverInfoForFirstPartitionUsingReflection( + globalPartitionEndpointManager: cosmosClient.ClientContext.DocumentClient.PartitionKeyRangeLocation, + isReadOnlyOrMultiMaster: true); + + IReadOnlyList<(string regionName, Uri uri)> contactedRegionMapping = createResponse.Diagnostics.GetContactedRegions(); + HashSet contactedRegions = new(contactedRegionMapping.Select(r => r.regionName)); + Assert.IsNotNull(contactedRegions); + + if (attemptCount > consecutiveFailureCount + 1) + { + if (connectionMode == ConnectionMode.Direct) + { + Assert.IsTrue(contactedRegions.Count == 1, "Asserting that when the consecutive failure count reaches the threshold, the partition was failed over to the next region, and the subsequent write request/s were successful on the next region."); + Assert.IsTrue(contactedRegions.Contains(region2)); + } + + Assert.AreEqual(this.readRegionsMapping[region2], failoverInfo.Current); + } + else + { + if (connectionMode == ConnectionMode.Direct) + { + Assert.IsTrue(contactedRegions.Count == 2, "Asserting that when the write requests succeeds before the consecutive failure count reaches the threshold, the partition didn't over to the next region, and the request was retried on the next region."); + Assert.IsTrue(contactedRegions.Contains(region1) && contactedRegions.Contains(region2)); + } + if (attemptCount > consecutiveFailureCount) + { + Assert.AreEqual(this.readRegionsMapping[region2], failoverInfo.Current); + } + else + { + Assert.AreEqual(this.readRegionsMapping[region1], failoverInfo.Current); + } + } + } + catch (CosmosException) + { + Assert.Fail("Create Item operation should succeed."); + } + catch (Exception ex) + { + Assert.Fail($"Unhandled Exception was thrown during CreateItemAsync call. Message: {ex.Message}"); + } + } + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelCircuitBreakerEnabled, null); + Environment.SetEnvironmentVariable(ConfigurationManager.CircuitBreakerConsecutiveFailureCountForWrites, null); + + foreach (CosmosIntegrationTestObject item in itemsCleanupList) + { + await this.container.DeleteItemAsync(item.Id, new PartitionKey(item.Pk)); + } + } + } + + [TestMethod] + [Owner("dkunda")] + [TestCategory("MultiMaster")] + [Timeout(70000)] + public async Task CreateAndReadItemAsync_WithCircuitBreakerEnabledAndMultiMasterAccountAndDefaultThresholdServiceUnavailableReceived_ShouldApplyPartitionLevelOverride() + { + // Arrange. + Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelCircuitBreakerEnabled, "True"); + + // Enabling fault injection rule to simulate a 503 service unavailable scenario. + string serviceUnavailableRuleId1 = "503-rule-" + Guid.NewGuid().ToString(); + FaultInjectionRule serviceUnavailableRule1 = new FaultInjectionRuleBuilder( + id: serviceUnavailableRuleId1, + condition: + new FaultInjectionConditionBuilder() + .WithOperationType(FaultInjectionOperationType.CreateItem) + .WithRegion(region1) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.ServiceUnavailable) + .WithDelay(TimeSpan.FromMilliseconds(2)) + .Build()) + .Build(); + + string serviceUnavailableRuleId2 = "503-rule-" + Guid.NewGuid().ToString(); + FaultInjectionRule serviceUnavailableRule2 = new FaultInjectionRuleBuilder( + id: serviceUnavailableRuleId2, + condition: + new FaultInjectionConditionBuilder() + .WithOperationType(FaultInjectionOperationType.ReadItem) + .WithRegion(region1) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.ServiceUnavailable) + .WithDelay(TimeSpan.FromMilliseconds(2)) + .Build()) + .Build(); + + List rules = new List { serviceUnavailableRule1, serviceUnavailableRule2 }; + FaultInjector faultInjector = new FaultInjector(rules); + + List itemsCleanupList = new(); + List preferredRegions = new List { region1, region2, region3 }; + CosmosClientOptions cosmosClientOptions = new() + { + ConsistencyLevel = ConsistencyLevel.Session, + FaultInjector = faultInjector, + RequestTimeout = TimeSpan.FromSeconds(5), + ApplicationPreferredRegions = preferredRegions, + Serializer = this.cosmosSystemTextJsonSerializer + }; + + try + { + // Act and Assert. + Random random = new (); + int totalIterations = 20; + int consecutiveFailureCountForReads = 10; + int consecutiveFailureCountForWrites = 5; + + using CosmosClient cosmosClient = new(connectionString: this.connectionString, clientOptions: cosmosClientOptions); + Database database = cosmosClient.GetDatabase(MultiRegionSetupHelpers.dbName); + Container container = database.GetContainer(MultiRegionSetupHelpers.containerName); + + for (int attemptCount = 1; attemptCount <= totalIterations; attemptCount++) + { + try + { + CosmosIntegrationTestObject testItem = new() + { + Id = $"mmTestId{random.Next()}", + Pk = $"mmpk{random.Next()}" + }; + + ItemResponse createResponse = await container.CreateItemAsync(testItem); + itemsCleanupList.Add(testItem); + + Assert.AreEqual( + expected: HttpStatusCode.Created, + actual: createResponse.StatusCode); + + IReadOnlyList<(string regionName, Uri uri)> contactedRegionMappingForWrites = createResponse.Diagnostics.GetContactedRegions(); + HashSet contactedRegionsForWrite = new(contactedRegionMappingForWrites.Select(r => r.regionName)); + Assert.IsNotNull(contactedRegionsForWrite); + + if (attemptCount > consecutiveFailureCountForWrites + 1) + { + Assert.IsTrue(contactedRegionsForWrite.Count == 1, "Asserting that when the consecutive failure count reaches the write threshold, the partition was failed over to the next region, and the subsequent write request/s were successful on the next region."); + Assert.IsTrue(contactedRegionsForWrite.Contains(region2)); + } + else + { + Assert.IsTrue(contactedRegionsForWrite.Count == 2, "Asserting that when the write requests succeeds before the consecutive failure count reaches the write threshold, the partition didn't over to the next region, and the request was retried on the next region."); + Assert.IsTrue(contactedRegionsForWrite.Contains(region1) && contactedRegionsForWrite.Contains(region2)); + } + + ItemResponse readResponse = await container.ReadItemAsync( + id: testItem.Id, + partitionKey: new PartitionKey(testItem.Pk)); + + IReadOnlyList<(string regionName, Uri uri)> contactedRegionMappingForReads = readResponse.Diagnostics.GetContactedRegions(); + HashSet contactedRegionsForReads = new(contactedRegionMappingForReads.Select(r => r.regionName)); + + Assert.AreEqual( + expected: HttpStatusCode.OK, + actual: readResponse.StatusCode); + + Assert.IsNotNull(contactedRegionsForReads); + + if (attemptCount > consecutiveFailureCountForReads + 1) + { + Assert.IsTrue(contactedRegionsForReads.Count == 1, "Asserting that when the consecutive failure count reaches the read threshold, the partition was failed over to the next region, and the subsequent read request/s were successful on the next region."); + Assert.IsTrue(contactedRegionsForReads.Contains(region2)); + } + else + { + Assert.IsTrue(contactedRegionsForReads.Count == 2, "Asserting that when the read request succeeds before the consecutive failure count reaches the read threshold, the partition didn't over to the next region, and the request was retried on the next region."); + Assert.IsTrue(contactedRegionsForReads.Contains(region1) && contactedRegionsForReads.Contains(region2)); + } + } + catch (CosmosException ex) + { + Assert.Fail($"Create and Read Item operations should succeed. Message: { ex.Message}"); + } + catch (Exception ex) + { + Assert.Fail($"Unhandled Exception was thrown during CreateItemAsync call. Message: {ex.Message}"); + } + } + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelCircuitBreakerEnabled, null); + + foreach (CosmosIntegrationTestObject item in itemsCleanupList) + { + await this.container.DeleteItemAsync(item.Id, new PartitionKey(item.Pk)); + } + } + } + + [TestMethod] + [Owner("dkunda")] + [TestCategory("MultiRegion")] + [Timeout(70000)] + [DataRow(true, DisplayName = "Test scenario when PPAF is enabled at client level.")] + [DataRow(false, DisplayName = "Test scenario when PPAF is disabled at client level.")] + public async Task ReadItemAsync_WithPPAFEnabledAndSingleMasterAccountWithResponseDelay_ShouldHedgeRequestToMultipleRegions( + bool enablePartitionLevelFailover) + { + // Arrange. + // Enabling fault injection rule to simulate a 503 service unavailable scenario. + string serviceUnavailableRuleId = "503-rule-" + Guid.NewGuid().ToString(); + FaultInjectionRule serviceUnavailableRule = new FaultInjectionRuleBuilder( + id: serviceUnavailableRuleId, + condition: + new FaultInjectionConditionBuilder() + .WithOperationType(FaultInjectionOperationType.ReadItem) + .WithRegion(region1) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.ResponseDelay) + .WithDelay(TimeSpan.FromMilliseconds(3000)) + .Build()) + .Build(); + + List rules = new List { serviceUnavailableRule }; + FaultInjector faultInjector = new FaultInjector(rules); + + // Now that the ppaf enablement flag is returned from gateway, we need to intercept the response and remove the flag from the response, so that + // the environment variable set above is honored. + HttpClientHandlerHelper httpClientHandlerHelper = new HttpClientHandlerHelper() + { + ResponseIntercepter = async (response, request) => + { + string json = await response?.Content?.ReadAsStringAsync(); + if (json.Length > 0 && json.Contains("enablePerPartitionFailoverBehavior")) + { + JObject parsedDatabaseAccountResponse = JObject.Parse(json); + parsedDatabaseAccountResponse.Property("enablePerPartitionFailoverBehavior").Value = enablePartitionLevelFailover.ToString(); + + HttpResponseMessage interceptedResponse = new() + { + StatusCode = response.StatusCode, + Content = new StringContent(parsedDatabaseAccountResponse.ToString()), + Version = response.Version, + ReasonPhrase = response.ReasonPhrase, + RequestMessage = response.RequestMessage, + }; + + return interceptedResponse; + } + + return response; + }, + }; + + List preferredRegions = new List { region1, region2, region3 }; + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConsistencyLevel = ConsistencyLevel.Session, + FaultInjector = faultInjector, + RequestTimeout = TimeSpan.FromSeconds(5), + ApplicationPreferredRegions = preferredRegions, + HttpClientFactory = () => new HttpClient(httpClientHandlerHelper), + }; + + List itemsList = new() + { + new() { Id = "smTestId1", Pk = "smpk1" }, + }; + + try + { + using CosmosClient cosmosClient = new(connectionString: this.connectionString, clientOptions: cosmosClientOptions); + Database database = cosmosClient.GetDatabase(MultiRegionSetupHelpers.dbName); + Container container = database.GetContainer(MultiRegionSetupHelpers.containerName); + + // Act and Assert. + await this.TryCreateItems(itemsList); + + //Must Ensure the data is replicated to all regions + await Task.Delay(3000); + + ItemResponse readResponse = await container.ReadItemAsync( + id: itemsList[0].Id, + partitionKey: new PartitionKey(itemsList[0].Pk)); + + IReadOnlyList<(string regionName, Uri uri)> contactedRegionMapping = readResponse.Diagnostics.GetContactedRegions(); + HashSet contactedRegions = new(contactedRegionMapping.Select(r => r.regionName)); + + Assert.AreEqual( + expected: HttpStatusCode.OK, + actual: readResponse.StatusCode); + + CosmosTraceDiagnostics traceDiagnostic = readResponse.Diagnostics as CosmosTraceDiagnostics; + Assert.IsNotNull(traceDiagnostic); + + traceDiagnostic.Value.Data.TryGetValue("Hedge Context", out object hedgeContext); + + if (enablePartitionLevelFailover) + { + Assert.IsNotNull(hedgeContext); + List hedgedRegions = ((IEnumerable)hedgeContext).ToList(); + + Assert.IsTrue(hedgedRegions.Count > 1, "Since the first region is not available, the request should atleast hedge to the next region."); + Assert.IsTrue(hedgedRegions.Contains(region1) && (hedgedRegions.Contains(region2) || hedgedRegions.Contains(region3))); + } + else + { + Assert.IsNull(hedgeContext); + } + + Assert.IsNotNull(contactedRegions); + Assert.IsTrue(contactedRegions.Count == 1, "Asserting that when the read request succeeds on any region, given that there were no availability loss."); + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelFailoverEnabled, null); + + await this.TryDeleteItems(itemsList); + } + } + + [TestMethod] + [TestCategory("MultiRegion")] + [Owner("ntripician")] + public async Task AddressRefreshInternalServerErrorTest() + { + FaultInjectionRule internalServerError = new FaultInjectionRuleBuilder( + id: "rule1", + condition: new FaultInjectionConditionBuilder() + .WithOperationType(FaultInjectionOperationType.MetadataRefreshAddresses) + .WithRegion(region1) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.InternalServerError) + .Build()) + .Build(); + + List rules = new List() { internalServerError }; + FaultInjector faultInjector = new FaultInjector(rules); + + internalServerError.Disable(); + + CosmosClientOptions clientOptions = new CosmosClientOptions() + { + ConnectionMode = ConnectionMode.Direct, + Serializer = this.cosmosSystemTextJsonSerializer, + ApplicationRegion = region1, + }; + + using (CosmosClient faultInjectionClient = new CosmosClient( + connectionString: this.connectionString, + clientOptions: faultInjector.GetFaultInjectionClientOptions(clientOptions))) + { + Database database = faultInjectionClient.GetDatabase(MultiRegionSetupHelpers.dbName); + Container container = database.GetContainer(MultiRegionSetupHelpers.containerName); + + internalServerError.Enable(); + + try + { + ItemResponse response = await container.ReadItemAsync("testId", new PartitionKey("pk")); + Assert.IsTrue(internalServerError.GetHitCount() > 0); + Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); + } + catch (CosmosException ex) + { + Assert.Fail(ex.Message); + } + } + } + + private async Task TryCreateItems(List testItems) + { + foreach (CosmosIntegrationTestObject item in testItems) + { + await this.TryCreateItem(item); + } + } + + private async Task TryCreateItem(CosmosIntegrationTestObject testItem) + { + try + { + await this.container.CreateItemAsync(testItem); + } + catch (CosmosException ce) + { + Assert.Fail($"Failed to create item with id: {testItem.Id}, message: {ce.Message}"); + } + } + + private async Task TryDeleteItems(List testItems) + { + foreach (CosmosIntegrationTestObject item in testItems) + { + await this.TryDeleteItem(item); + } + } + + private async Task TryDeleteItem(CosmosIntegrationTestObject testItem) + { + try + { + await this.container.DeleteItemAsync( + testItem.Id, + new PartitionKey(testItem.Pk)); + } + catch (CosmosException ex) when (ex.StatusCode == HttpStatusCode.NotFound) + { + // Ignore + } + } + + public sealed class TestCosmosItem + { + [JsonConstructor] + public TestCosmosItem( + string id, + string pk, + string title, + string email, + string body, + DateTime createdUtc, + DateTime modifiedUtc, + DateTime[] extraDates) + { + this.id = id; + this.pk = pk; + this.title = title; + this.email = email; + this.body = body; + this.CreatedUtc = createdUtc; + this.ModifiedUtc = modifiedUtc; + this.ExtraDates = extraDates; + } + +#pragma warning disable IDE1006 + public string id { get; } + public string pk { get; } + public string title { get; } + public string email { get; } + public string body { get; } +#pragma warning restore IDE1006 // Naming Styles + public DateTime CreatedUtc { get; } + public DateTime ModifiedUtc { get; } + public DateTime[] ExtraDates { get; } + } } } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemLinqTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemLinqTests.cs index efffeae1cb..9f1b8c2177 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemLinqTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemLinqTests.cs @@ -949,6 +949,26 @@ public async Task LinqSelectEverythingWithoutQueryableTest() Assert.AreEqual(2, (await this.FetchResults(queryDefinition)).Count); } + [TestMethod] + public async Task LinqSkipOrderBy() + { + IList itemList = await ToDoActivity.CreateRandomItems(this.Container, 3, randomPartitionKey: true); + IQueryable queryable = this.Container.GetItemLinqQueryable() + .OrderBy(x => x.cost) + .Skip(1); + + FeedIterator feedIterator = queryable.ToFeedIterator(); + + int count = 0; + while (feedIterator.HasMoreResults) + { + FeedResponse feedResponse = feedIterator.ReadNextAsync().Result; + count += feedResponse.Count; + } + + Assert.AreEqual(2, count); + } + private class NumberLinqItem { public string id; diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs index 38d976c480..277c7b868b 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs @@ -668,8 +668,87 @@ public async Task NonPartitionKeyLookupCacheTest(bool binaryEncodingEnabledInCli { Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, null); } - } - + } + + [TestMethod] + public async Task HttpRequestVersionIsOnePointOneWhenUsingGatewayMode() + { + Version httpVersionOnePointOne = new Version(1, 1); + int hitCount = 0; + + using CosmosClient client = TestCommon.CreateCosmosClient(builder => + { + builder.WithConnectionModeGateway(); + builder.WithSendingRequestEventArgs((sender, e) => + { + if (e.IsHttpRequest()) + { + Assert.AreEqual(httpVersionOnePointOne, e.HttpRequest.Version); + hitCount++; + } + }); + }); + + Cosmos.Database database = await client.CreateDatabaseIfNotExistsAsync("HttpVersionTestDb"); + Container container = await database.CreateContainerIfNotExistsAsync("HttpVersionTestContainer", "/pk"); + + ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity(); + ItemResponse response = await container.CreateItemAsync(testItem, new Cosmos.PartitionKey(testItem.pk)); + + Assert.IsNotNull(response); + Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); + Assert.IsNotNull(response.Resource); + Assert.IsNotNull(response.Diagnostics); + Assert.IsTrue(hitCount > 0, "HTTP request event handler was not triggered"); + + await database.DeleteAsync(); + } + + [TestMethod] + public async Task HttpRequestVersionIsTwoPointZeroWhenUsingThinClientMode() + { + try + { + Environment.SetEnvironmentVariable(ConfigurationManager.ThinClientModeEnabled, "True"); + + Version expectedGatewayVersion = new(1, 1); + Version expectedThinClientVersion = new(2, 0); + + List postRequestVersions = new(); + + using CosmosClient client = TestCommon.CreateCosmosClient(builder => + { + builder.WithConnectionModeGateway(); + builder.WithSendingRequestEventArgs((sender, e) => + { + if (e.HttpRequest.Method == HttpMethod.Post) + { + postRequestVersions.Add(e.HttpRequest.Version); + } + }); + }); + + Cosmos.Database database = await client.CreateDatabaseIfNotExistsAsync("HttpVersionTestDb"); + Container container = await database.CreateContainerIfNotExistsAsync("HttpVersionTestContainer", "/pk"); + + ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity(); + + await Assert.ThrowsExceptionAsync(() => container.CreateItemAsync(testItem, new Cosmos.PartitionKey(testItem.pk))); + + Assert.AreEqual(3, postRequestVersions.Count, "Expected exactly 3 POST requests (DB, Container, Item)."); + + Assert.AreEqual(expectedGatewayVersion, postRequestVersions[0], "Expected HTTP/1.1 for CreateDatabaseAsync."); + Assert.AreEqual(expectedGatewayVersion, postRequestVersions[1], "Expected HTTP/1.1 for CreateContainerAsync."); + Assert.AreEqual(expectedThinClientVersion, postRequestVersions[2], "Expected HTTP/2.0 for CreateItemAsync."); + + await database.DeleteAsync(); + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.ThinClientModeEnabled, null); + } + } + [TestMethod] [DataRow(true, true, DisplayName = "Test scenario when binary encoding is enabled at client level and expected stream response type is binary.")] [DataRow(true, false, DisplayName = "Test scenario when binary encoding is enabled at client level and expected stream response type is text.")] @@ -768,6 +847,138 @@ public async Task CreateDropItemStreamTest(bool binaryEncodingEnabledInClient, b { Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, null); } + } + + [TestMethod] + [Owner("dkunda")] + [DataRow(true, true, DisplayName = "Test scenario when binary encoding is enabled at client level and stream conversation for binary encoding is skipped.")] + [DataRow(true, false, DisplayName = "Test scenario when binary encoding is enabled at client level and stream conversation for binary encoding is enabled.")] + [DataRow(false, true, DisplayName = "Test scenario when binary encoding is disabled at client level and stream conversation for binary encoding is skipped.")] + [DataRow(false, false, DisplayName = "Test scenario when binary encoding is disabled at client level and stream conversation for binary encoding is enabled.")] + public async Task CreateItemStream_WithEnableBinaryResponseOptions_ShouldSkipStreamConversation( + bool binaryEncodingEnabledInClient, + bool enableStreamPassThrough) + { + Cosmos.Database database = null; + Container container = null; + try + { + string databaseName = "binary-encoding-db"; + string containerName = "binary-encoding-container"; + if (binaryEncodingEnabledInClient) + { + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, "True"); + } + + (string endpoint, string authKey) = TestCommon.GetAccountInfo(); + CosmosClientOptions clientOptions = new CosmosClientOptions() + { + EnableStreamPassThrough = enableStreamPassThrough, + }; + + CosmosClient cosmosClient = new ( + endpoint, + authKey, + clientOptions); + + DatabaseResponse dbResponse = await cosmosClient.CreateDatabaseIfNotExistsAsync(databaseName); + database = dbResponse.Database; + + ContainerProperties properties = new (id: containerName, partitionKeyPath: "/pk"); + container = await database.CreateContainerIfNotExistsAsync(properties); + + ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity(); + CosmosSerializerCore cosmosSerializer = new CosmosSerializerCore(); + using (Stream stream = cosmosSerializer.ToStream( + testItem, + canUseBinaryEncodingForPointOperations: binaryEncodingEnabledInClient)) + { + if (binaryEncodingEnabledInClient) + { + // Asserting the input stream is in binary format. + AssertOnResponseSerializationBinaryType(stream); + } + else + { + // Asserting the input stream is in text format. + AssertOnResponseSerializationTextType(stream); + } + + using (ResponseMessage response = await container.CreateItemStreamAsync( + streamPayload: stream, + partitionKey: new Cosmos.PartitionKey(testItem.pk))) + { + Assert.IsNotNull(response); + Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); + Assert.IsTrue(response.Headers.RequestCharge > 0); + Assert.IsNotNull(response.Headers.ActivityId); + Assert.IsNotNull(response.Headers.ETag); + Assert.IsNotNull(response.Diagnostics); + Assert.IsTrue(!string.IsNullOrEmpty(response.Diagnostics.ToString())); + Assert.IsTrue(response.Diagnostics.GetClientElapsedTime() > TimeSpan.Zero); + + if (!enableStreamPassThrough) + { + AssertOnResponseSerializationTextType(response.Content); + } + else + { + if (binaryEncodingEnabledInClient) + { + AssertOnResponseSerializationBinaryType(response.Content); + } + else + { + AssertOnResponseSerializationTextType(response.Content); + } + } + } + } + + using (ResponseMessage response = await container.ReadItemStreamAsync( + id: testItem.id, + partitionKey: new Cosmos.PartitionKey(testItem.pk))) + { + Assert.IsNotNull(response); + Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); + Assert.IsTrue(response.Headers.RequestCharge > 0); + Assert.IsNotNull(response.Headers.ActivityId); + Assert.IsNotNull(response.Headers.ETag); + Assert.IsNotNull(response.Diagnostics); + Assert.IsTrue(!string.IsNullOrEmpty(response.Diagnostics.ToString())); + Assert.IsTrue(response.Diagnostics.GetClientElapsedTime() > TimeSpan.Zero); + + if (!enableStreamPassThrough) + { + AssertOnResponseSerializationTextType(response.Content); + } + else + { + if (binaryEncodingEnabledInClient) + { + AssertOnResponseSerializationBinaryType(response.Content); + } + else + { + AssertOnResponseSerializationTextType(response.Content); + } + } + } + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, null); + + if (container != null) + { + await container.DeleteContainerStreamAsync(); + } + + if (database != null) + { + await database.DeleteAsync(); + } + } } [TestMethod] @@ -3669,6 +3880,318 @@ public async Task MalformedChangeFeedContinuationTokenSubStatusCodeTest() Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode); Assert.AreEqual(SubStatusCodes.MalformedContinuationToken, response.Headers.SubStatusCode); + } + + [TestMethod] + [DataRow(false, DisplayName = "CreateItemAsync - Binary encoding disabled.")] + [DataRow(true, DisplayName = "CreateItemAsync - Binary encoding enabled.")] + public async Task CreateItemAsyncTest(bool binaryEncodingEnabled) + { + if (binaryEncodingEnabled) + { + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, "True"); + } + + try + { + // Create new client, db, container with binary serializer + (CosmosClient client, Cosmos.Database db, Container container) = + await this.CreateTestResourcesAsync(); + + try + { + ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity(); + + ItemResponse createResponse = + await container.CreateItemAsync(testItem, new Cosmos.PartitionKey(testItem.pk)); + + Assert.IsNotNull(createResponse); + Assert.AreEqual(HttpStatusCode.Created, createResponse.StatusCode); + Assert.IsNotNull(createResponse.Resource); + Assert.AreEqual(testItem.id, createResponse.Resource.id); + Assert.IsNotNull(createResponse.Diagnostics); + + Assert.IsTrue(createResponse.Diagnostics.GetClientElapsedTime() > TimeSpan.Zero); + Assert.AreEqual(0, createResponse.Diagnostics.GetFailedRequestCount()); + } + finally + { + await db.DeleteAsync(); + client.Dispose(); + } + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, null); + } + } + + [TestMethod] + [DataRow(false, DisplayName = "UpsertItemAsync - Binary encoding disabled.")] + [DataRow(true, DisplayName = "UpsertItemAsync - Binary encoding enabled.")] + public async Task UpsertItemAsyncTest(bool binaryEncodingEnabled) + { + if (binaryEncodingEnabled) + { + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, "True"); + } + + try + { + (CosmosClient client, Cosmos.Database db, Container container) = + await this.CreateTestResourcesAsync(); + + try + { + ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity(); + + ItemResponse createAsUpsertResponse = + await container.UpsertItemAsync(testItem, new Cosmos.PartitionKey(testItem.pk)); + + Assert.IsNotNull(createAsUpsertResponse); + Assert.AreEqual(HttpStatusCode.Created, createAsUpsertResponse.StatusCode); + Assert.IsNotNull(createAsUpsertResponse.Resource); + Assert.AreEqual(testItem.id, createAsUpsertResponse.Resource.id); + + testItem.description = "Updated via Upsert"; + testItem.taskNum = 9999; + + ItemResponse updateAsUpsertResponse = + await container.UpsertItemAsync(testItem, new Cosmos.PartitionKey(testItem.pk)); + + Assert.IsNotNull(updateAsUpsertResponse); + Assert.AreEqual(HttpStatusCode.OK, updateAsUpsertResponse.StatusCode); + Assert.IsNotNull(updateAsUpsertResponse.Resource); + Assert.AreEqual(testItem.id, updateAsUpsertResponse.Resource.id); + Assert.AreEqual(9999, updateAsUpsertResponse.Resource.taskNum); + + Assert.IsNotNull(updateAsUpsertResponse.Diagnostics); + Assert.IsTrue(updateAsUpsertResponse.Diagnostics.GetClientElapsedTime() > TimeSpan.Zero); + Assert.AreEqual(0, updateAsUpsertResponse.Diagnostics.GetFailedRequestCount()); + } + finally + { + await db.DeleteAsync(); + client.Dispose(); + } + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, null); + } + } + + [TestMethod] + [DataRow(false, DisplayName = "ReadItemAsync - Binary encoding disabled.")] + [DataRow(true, DisplayName = "ReadItemAsync - Binary encoding enabled.")] + public async Task ReadItemAsyncTest(bool binaryEncodingEnabled) + { + if (binaryEncodingEnabled) + { + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, "True"); + } + + try + { + (CosmosClient client, Cosmos.Database db, Container container) = + await this.CreateTestResourcesAsync(); + + try + { + ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity(); + ItemResponse createResponse = + await container.CreateItemAsync(testItem, new Cosmos.PartitionKey(testItem.pk)); + Assert.AreEqual(HttpStatusCode.Created, createResponse.StatusCode); + + ItemResponse readResponse = + await container.ReadItemAsync(testItem.id, new Cosmos.PartitionKey(testItem.pk)); + + Assert.IsNotNull(readResponse); + Assert.AreEqual(HttpStatusCode.OK, readResponse.StatusCode); + Assert.IsNotNull(readResponse.Resource); + Assert.AreEqual(testItem.id, readResponse.Resource.id); + Assert.IsTrue(readResponse.Diagnostics.GetClientElapsedTime() > TimeSpan.Zero); + Assert.AreEqual(0, readResponse.Diagnostics.GetFailedRequestCount()); + } + finally + { + await db.DeleteAsync(); + client.Dispose(); + } + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, null); + } + } + + [TestMethod] + [DataRow(false, DisplayName = "ReplaceItemAsync - Binary encoding disabled.")] + [DataRow(true, DisplayName = "ReplaceItemAsync - Binary encoding enabled.")] + public async Task ReplaceItemAsyncTest(bool binaryEncodingEnabled) + { + if (binaryEncodingEnabled) + { + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, "True"); + } + + try + { + (CosmosClient client, Cosmos.Database db, Container container) = + await this.CreateTestResourcesAsync(); + + try + { + ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity(); + ItemResponse createResponse = + await container.CreateItemAsync(testItem, new Cosmos.PartitionKey(testItem.pk)); + Assert.AreEqual(HttpStatusCode.Created, createResponse.StatusCode); + + testItem.description = "Replaced description"; + testItem.taskNum = 1234; + + ItemResponse replaceResponse = + await container.ReplaceItemAsync(testItem, testItem.id, new Cosmos.PartitionKey(testItem.pk)); + + Assert.IsNotNull(replaceResponse); + Assert.AreEqual(HttpStatusCode.OK, replaceResponse.StatusCode); + Assert.IsNotNull(replaceResponse.Resource); + Assert.AreEqual(testItem.id, replaceResponse.Resource.id); + Assert.AreEqual(1234, replaceResponse.Resource.taskNum); + + Assert.IsNotNull(replaceResponse.Diagnostics); + Assert.IsTrue(replaceResponse.Diagnostics.GetClientElapsedTime() > TimeSpan.Zero); + Assert.AreEqual(0, replaceResponse.Diagnostics.GetFailedRequestCount()); + } + finally + { + await db.DeleteAsync(); + client.Dispose(); + } + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, null); + } + } + + [TestMethod] + [DataRow(false, DisplayName = "DeleteItemAsync - Binary encoding disabled.")] + [DataRow(true, DisplayName = "DeleteItemAsync - Binary encoding enabled.")] + public async Task DeleteItemAsyncTest(bool binaryEncodingEnabled) + { + if (binaryEncodingEnabled) + { + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, "True"); + } + + try + { + (CosmosClient client, Cosmos.Database db, Container container) = + await this.CreateTestResourcesAsync(); + + try + { + ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity(); + ItemResponse createResponse = + await container.CreateItemAsync(testItem, new Cosmos.PartitionKey(testItem.pk)); + Assert.AreEqual(HttpStatusCode.Created, createResponse.StatusCode); + + ItemResponse deleteResponse = + await container.DeleteItemAsync(testItem.id, new Cosmos.PartitionKey(testItem.pk)); + + Assert.IsNotNull(deleteResponse); + Assert.AreEqual(HttpStatusCode.NoContent, deleteResponse.StatusCode); + Assert.IsNotNull(deleteResponse.Diagnostics); + Assert.IsTrue(deleteResponse.Diagnostics.GetClientElapsedTime() > TimeSpan.Zero); + + try + { + await container.ReadItemAsync(testItem.id, new Cosmos.PartitionKey(testItem.pk)); + Assert.Fail("Read should have thrown a 404, as the item was deleted."); + } + catch (CosmosException ex) when (ex.StatusCode == HttpStatusCode.NotFound) + { + } + } + finally + { + await db.DeleteAsync(); + client.Dispose(); + } + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, null); + } + } + + [TestMethod] + [DataRow(false, DisplayName = "QueryItemAsyncTest - Binary encoding disabled.")] + [DataRow(true, DisplayName = "QueryItemAsyncTest - Binary encoding enabled.")] + public async Task QueryItemAsyncTest(bool binaryEncodingEnabled) + { + if (binaryEncodingEnabled) + { + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, "True"); + } + + try + { + (CosmosClient client, Cosmos.Database db, Container container) = + await this.CreateTestResourcesAsync(); + + try + { + List items = new List(); + for (int i = 0; i < 5; i++) + { + ToDoActivity item = ToDoActivity.CreateRandomToDoActivity($"testPartition{i}"); + items.Add(item); + await container.CreateItemAsync(item, new Cosmos.PartitionKey(item.pk)); + } + + QueryDefinition query = new QueryDefinition("SELECT * FROM c"); + FeedIterator feedIterator = container.GetItemQueryIterator(query); + + int totalCount = 0; + while (feedIterator.HasMoreResults) + { + FeedResponse page = await feedIterator.ReadNextAsync(); + totalCount += page.Count; + } + + Assert.AreEqual( + expected: items.Count, + actual: totalCount, + message: "All inserted items should be returned by the query!"); + } + finally + { + await db.DeleteAsync(); + client.Dispose(); + } + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, null); + } + } + + private async Task<(CosmosClient client, Cosmos.Database db, Container container)> CreateTestResourcesAsync() + { + CosmosClient client = TestCommon.CreateCosmosClient( + useCustomSeralizer: false, + validatePartitionKeyRangeCalls: false, + accountEndpointOverride: null); + + Cosmos.Database db = await client.CreateDatabaseAsync(Guid.NewGuid().ToString()); + Container container = await db.CreateContainerAsync( + id: Guid.NewGuid().ToString(), + partitionKeyPath: "/pk", + throughput: 4000); + + return (client, db, container); } private static async Task GivenItemStreamAsyncWhenMissingMemberHandlingIsErrorThenExpectsCosmosExceptionTestAsync( diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemThinClientTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemThinClientTests.cs new file mode 100644 index 0000000000..ad06353022 --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemThinClientTests.cs @@ -0,0 +1,416 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Text.Json; + using System.Text.Json.Serialization; + using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using static Microsoft.Azure.Cosmos.SDK.EmulatorTests.MultiRegionSetupHelpers; + using TestObject = MultiRegionSetupHelpers.CosmosIntegrationTestObject; + + [TestClass] + public class CosmosItemThinClientTests + { + private string connectionString; + private CosmosClient client; + private Database database; + private Container container; + private CosmosSystemTextJsonSerializer cosmosSystemTextJsonSerializer; + + private const int ItemCount = 1000; + + [TestInitialize] + public async Task TestInitAsync() + { + this.connectionString = Environment.GetEnvironmentVariable("COSMOSDB_THINCLIENT"); + Environment.SetEnvironmentVariable(ConfigurationManager.ThinClientModeEnabled, "True"); + + if (string.IsNullOrEmpty(this.connectionString)) + { + Assert.Fail("Set environment variable COSMOSDB_THINCLIENT to run the tests"); + } + + JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions + { + PropertyNamingPolicy = null, + PropertyNameCaseInsensitive = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + }; + this.cosmosSystemTextJsonSerializer = new MultiRegionSetupHelpers.CosmosSystemTextJsonSerializer(jsonSerializerOptions); + + this.client = new CosmosClient( + this.connectionString, + new CosmosClientOptions() + { + ConnectionMode = ConnectionMode.Gateway, + Serializer = this.cosmosSystemTextJsonSerializer, + }); + + string uniqueDbName = "TestDb_" + Guid.NewGuid().ToString(); + this.database = await this.client.CreateDatabaseIfNotExistsAsync(uniqueDbName); + string uniqueContainerName = "TestContainer_" + Guid.NewGuid().ToString(); + this.container = await this.database.CreateContainerIfNotExistsAsync(uniqueContainerName, "/pk"); + } + + + [TestCleanup] + public async Task TestCleanupAsync() + { + Environment.SetEnvironmentVariable(ConfigurationManager.ThinClientModeEnabled, "False"); + + if (this.database != null) + { + await this.database.DeleteAsync(); + } + + this.client?.Dispose(); + } + + private IEnumerable GenerateItems(string partitionKey) + { + List items = new List(); + for (int i = 0; i < ItemCount; i++) + { + items.Add(new TestObject + { + Id = Guid.NewGuid().ToString(), + Pk = partitionKey, + Other = "Test Item " + i + }); + } + + return items; + } + + [TestMethod] + [TestCategory("ThinClient")] + public async Task CreateItemsTest() + { + string pk = "pk_create"; + IEnumerable items = this.GenerateItems(pk); + + foreach (TestObject item in items) + { + ItemResponse response = await this.container.CreateItemAsync(item, new PartitionKey(item.Pk)); + Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); + } + } + + [TestMethod] + [TestCategory("ThinClient")] + public async Task ReadItemsTest() + { + string pk = "pk_read"; + List items = this.GenerateItems(pk).ToList(); + + foreach (TestObject item in items) + { + await this.container.CreateItemAsync(item, new PartitionKey(item.Pk)); + } + + foreach (TestObject item in items) + { + ItemResponse response = await this.container.ReadItemAsync(item.Id, new PartitionKey(item.Pk)); + Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); + Assert.AreEqual(item.Id, response.Resource.Id); + } + } + + [TestMethod] + [TestCategory("ThinClient")] + public async Task ReplaceItemsTest() + { + string pk = "pk_replace"; + List items = this.GenerateItems(pk).ToList(); + + foreach (TestObject item in items) + { + await this.container.CreateItemAsync(item, new PartitionKey(item.Pk)); + } + + foreach (TestObject item in items) + { + TestObject updatedItem = new TestObject + { + Id = item.Id, + Pk = item.Pk, + Other = "Updated " + item.Other + }; + + ItemResponse response = await this.container.ReplaceItemAsync(updatedItem, updatedItem.Id, new PartitionKey(updatedItem.Pk)); + Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); + Assert.AreEqual("Updated " + item.Other, response.Resource.Other); + } + } + + [TestMethod] + [TestCategory("ThinClient")] + public async Task UpsertItemsTest() + { + string pk = "pk_upsert"; + IEnumerable items = this.GenerateItems(pk); + + foreach (TestObject item in items) + { + ItemResponse response = await this.container.UpsertItemAsync(item, new PartitionKey(item.Pk)); + Assert.IsTrue(response.StatusCode == HttpStatusCode.Created || response.StatusCode == HttpStatusCode.OK); + } + } + + [TestMethod] + [TestCategory("ThinClient")] + public async Task DeleteItemsTest() + { + string pk = "pk_delete"; + List items = this.GenerateItems(pk).ToList(); + + foreach (TestObject item in items) + { + await this.container.CreateItemAsync(item, new PartitionKey(item.Pk)); + } + + foreach (TestObject item in items) + { + ItemResponse response = await this.container.DeleteItemAsync(item.Id, new PartitionKey(item.Pk)); + Assert.AreEqual(HttpStatusCode.NoContent, response.StatusCode); + } + } + + [TestMethod] + [TestCategory("ThinClient")] + public async Task CreateItemStreamTest() + { + string pk = "pk_create_stream"; + IEnumerable items = this.GenerateItems(pk); + + foreach (TestObject item in items) + { + using (Stream stream = this.cosmosSystemTextJsonSerializer.ToStream(item)) + { + using (ResponseMessage response = await this.container.CreateItemStreamAsync(stream, new PartitionKey(item.Pk))) + { + Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); + } + } + } + } + + [TestMethod] + [TestCategory("ThinClient")] + public async Task ReadItemStreamTest() + { + string pk = "pk_read_stream"; + List items = this.GenerateItems(pk).ToList(); + + foreach (TestObject item in items) + { + await this.container.CreateItemAsync(item, new PartitionKey(item.Pk)); + } + + foreach (TestObject item in items) + { + using (ResponseMessage response = await this.container.ReadItemStreamAsync(item.Id, new PartitionKey(item.Pk))) + { + Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); + } + } + } + + [TestMethod] + [TestCategory("ThinClient")] + public async Task ReplaceItemStreamTest() + { + string pk = "pk_replace_stream"; + List items = this.GenerateItems(pk).ToList(); + + foreach (TestObject item in items) + { + await this.container.CreateItemAsync(item, new PartitionKey(item.Pk)); + } + + foreach (TestObject item in items) + { + TestObject updatedItem = new TestObject + { + Id = item.Id, + Pk = item.Pk, + Other = "Updated " + item.Other + }; + + using (Stream stream = this.cosmosSystemTextJsonSerializer.ToStream(updatedItem)) + { + using (ResponseMessage response = await this.container.ReplaceItemStreamAsync(stream, updatedItem.Id, new PartitionKey(updatedItem.Pk))) + { + Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); + } + } + } + } + + [TestMethod] + [TestCategory("ThinClient")] + public async Task UpsertItemStreamTest() + { + string pk = "pk_upsert_stream"; + IEnumerable items = this.GenerateItems(pk); + + foreach (TestObject item in items) + { + using (Stream stream = this.cosmosSystemTextJsonSerializer.ToStream(item)) + { + using (ResponseMessage response = await this.container.UpsertItemStreamAsync(stream, new PartitionKey(item.Pk))) + { + Assert.IsTrue(response.StatusCode == HttpStatusCode.Created || response.StatusCode == HttpStatusCode.OK); + } + } + } + } + + [TestMethod] + [TestCategory("ThinClient")] + public async Task DeleteItemStreamTest() + { + string pk = "pk_delete_stream"; + List items = this.GenerateItems(pk).ToList(); + + foreach (TestObject item in items) + { + await this.container.CreateItemAsync(item, new PartitionKey(item.Pk)); + } + + foreach (TestObject item in items) + { + using (ResponseMessage response = await this.container.DeleteItemStreamAsync(item.Id, new PartitionKey(item.Pk))) + { + Assert.AreEqual(HttpStatusCode.NoContent, response.StatusCode); + } + } + } + + [TestMethod] + [TestCategory("ThinClient")] + public async Task QueryItemsTest() + { + string pk = "pk_query"; + List items = this.GenerateItems(pk).ToList(); + + foreach (TestObject item in items) + { + await this.container.CreateItemAsync(item, new PartitionKey(item.Pk)); + } + + string query = $"SELECT * FROM c WHERE c.pk = '{pk}'"; + FeedIterator iterator = this.container.GetItemQueryIterator(query); + + int count = 0; + while (iterator.HasMoreResults) + { + FeedResponse response = await iterator.ReadNextAsync(); + count += response.Count; + } + + Assert.AreEqual(ItemCount, count); + } + + [TestMethod] + [TestCategory("ThinClient")] + public async Task QueryItemsStreamTest() + { + string pk = "pk_query_stream"; + List items = this.GenerateItems(pk).ToList(); + + foreach (TestObject item in items) + { + await this.container.CreateItemAsync(item, new PartitionKey(item.Pk)); + } + + QueryDefinition query = new QueryDefinition("SELECT * FROM c WHERE c.pk = @pk").WithParameter("@pk", pk); + FeedIterator iterator = this.container.GetItemQueryStreamIterator(query); + + int count = 0; + while (iterator.HasMoreResults) + { + using (ResponseMessage response = await iterator.ReadNextAsync()) + { + Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); + + using (StreamReader reader = new StreamReader(response.Content)) + { + string json = await reader.ReadToEndAsync(); + using (JsonDocument doc = JsonDocument.Parse(json)) + { + count += doc.RootElement.GetProperty("Documents").GetArrayLength(); + } + } + } + } + + Assert.AreEqual(ItemCount, count); + } + + [TestMethod] + [TestCategory("ThinClient")] + public async Task BulkCreateItemsTest() + { + CosmosClient bulkClient = new CosmosClient( + this.connectionString, + new CosmosClientOptions + { + ConnectionMode = ConnectionMode.Gateway, + Serializer = this.cosmosSystemTextJsonSerializer, + AllowBulkExecution = true, + }); + + string pk = "pk_bulk"; + List items = this.GenerateItems(pk).ToList(); + List>> tasks = new List>>(); + + Container bulkContainer = bulkClient.GetContainer(this.database.Id, this.container.Id); + + foreach (TestObject item in items) + { + tasks.Add(bulkContainer.CreateItemAsync(item, new PartitionKey(item.Pk))); + } + + await Task.WhenAll(tasks); + + foreach (Task> task in tasks) + { + Assert.AreEqual(HttpStatusCode.Created, task.Result.StatusCode); + } + + bulkClient.Dispose(); + } + + [TestMethod] + [TestCategory("ThinClient")] + public async Task TransactionalBatchCreateItemsTest() + { + string pk = "pk_batch"; + List items = this.GenerateItems(pk).Take(100).ToList(); + + TransactionalBatch batch = this.container.CreateTransactionalBatch(new PartitionKey(pk)); + + foreach (TestObject item in items) + { + batch.CreateItem(item); + } + + TransactionalBatchResponse batchResponse = await batch.ExecuteAsync(); + Assert.AreEqual(HttpStatusCode.OK, batchResponse.StatusCode); + + for (int i = 0; i < items.Count; i++) + { + Assert.AreEqual(HttpStatusCode.Created, batchResponse[i].StatusCode); + } + } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosMultiHashTest.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosMultiHashTest.cs index 01e1fc5c66..e92d7fc51c 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosMultiHashTest.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosMultiHashTest.cs @@ -510,5 +510,50 @@ public async Task MultiHashQueryItemTest() } } } + + [TestMethod] + public async Task ReadManyNullPkValueTest() + { + Document doc = new Document { Id = "readMany" }; + doc.SetValue("ZipCode", "10000"); + + await this.container.CreateItemAsync(doc); + + Cosmos.PartitionKey pk = new PartitionKeyBuilder() + .Add("10000") + .AddNoneType() + .Build(); + + ItemResponse ir = await this.container.ReadItemAsync("readMany", pk); + Assert.IsNotNull(ir.Resource); + Assert.AreEqual(ir.StatusCode, HttpStatusCode.OK); + + FeedResponse feedResponse = await this.container.ReadManyItemsAsync( + new List<(string, Cosmos.PartitionKey)> { ("readMany", pk) }); + + Assert.AreEqual(1, feedResponse.Count()); + } + + [TestMethod] + public async Task ReadManyAllNullPkValueTest() + { + Document doc = new Document { Id = "readMany" }; + + await this.container.CreateItemAsync(doc); + + Cosmos.PartitionKey pk = new PartitionKeyBuilder() + .AddNoneType() + .AddNoneType() + .Build(); + + ItemResponse ir = await this.container.ReadItemAsync("readMany", pk); + Assert.IsNotNull(ir.Resource); + Assert.AreEqual(ir.StatusCode, HttpStatusCode.OK); + + FeedResponse feedResponse = await this.container.ReadManyItemsAsync( + new List<(string, Cosmos.PartitionKey)> { ("readMany", pk) }); + + Assert.AreEqual(1, feedResponse.Count()); + } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosOperationCanceledExceptionTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosOperationCanceledExceptionTests.cs index e76dc45d76..52c1aab8b0 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosOperationCanceledExceptionTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosOperationCanceledExceptionTests.cs @@ -81,6 +81,7 @@ private async Task CheckCancellationTokenTestAsync( Container container, CancellationToken cancellationToken) { + string diagnosticsMessageStartString = "CosmosDiagnostics: {\"Summary\":{"; ToDoActivity toDoActivity = ToDoActivity.CreateRandomToDoActivity(); try @@ -98,8 +99,8 @@ await container.CreateItemAsync( string message = ce.Message; string diagnostics = ce.Diagnostics.ToString(); string toString = ce.ToString(); - Assert.IsTrue(toString.Contains(diagnostics), $"Exception ToString() : {toString} does not contain diagnostics: {diagnostics}"); - Assert.IsTrue(message.Contains(diagnostics), $"Message : {message} does not contain diagnostics: {diagnostics}"); + Assert.IsTrue(toString.Contains(diagnosticsMessageStartString), $"Exception ToString() : {toString} does not contain diagnostics: {diagnostics}"); + Assert.IsTrue(message.Contains(diagnosticsMessageStartString), $"Message : {message} does not contain diagnostics: {diagnostics}"); string messageWithoutDiagnostics = message[..message.IndexOf(Environment.NewLine)].Trim(); Assert.IsTrue(toString.Contains(messageWithoutDiagnostics), $"Exception ToString() : {toString} does not contain message: {messageWithoutDiagnostics}"); } @@ -118,8 +119,8 @@ await container.CreateItemAsync( string message = ce.Message; string diagnostics = ce.Diagnostics.ToString(); string toString = ce.ToString(); - Assert.IsTrue(toString.Contains(diagnostics), $"Exception ToString() : {toString} does not contain diagnostics: {diagnostics}"); - Assert.IsTrue(message.Contains(diagnostics), $"Message : {message} does not contain diagnostics: {diagnostics}"); + Assert.IsTrue(toString.Contains(diagnosticsMessageStartString), $"Exception ToString() : {toString} does not contain diagnostics: {diagnostics}"); + Assert.IsTrue(message.Contains(diagnosticsMessageStartString), $"Message : {message} does not contain diagnostics: {diagnostics}"); string messageWithoutDiagnostics = message[..message.IndexOf(Environment.NewLine)].Trim(); Assert.IsTrue(toString.Contains(messageWithoutDiagnostics), $"Exception ToString() : {toString} does not contain message: {messageWithoutDiagnostics}"); } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosReadManyItemsTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosReadManyItemsTests.cs index 05184d7826..f70454eb2d 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosReadManyItemsTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosReadManyItemsTests.cs @@ -51,11 +51,18 @@ public async Task Cleanup() } [TestMethod] - [DataRow(true, DisplayName = "Validates Read Many scenario with advanced replica selection enabled.")] - [DataRow(false, DisplayName = "Validates Read Many scenario with advanced replica selection disabled.")] + [DataRow(true, true, DisplayName = "Validates Read Many scenario with advanced replica selection enabled.")] + [DataRow(true, false, DisplayName = "Validates Read Many scenario with advanced replica selection disabled.")] + [DataRow(false, true, DisplayName = "Validates Read Many scenario with advanced replica selection enabled.")] + [DataRow(false, false, DisplayName = "Validates Read Many scenario with advanced replica selection disabled.")] public async Task ReadManyTypedTestWithAdvancedReplicaSelection( + bool binaryEncodingEnabled, bool advancedReplicaSelectionEnabled) { + if (binaryEncodingEnabled) + { + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, "True"); + } CosmosClientOptions clientOptions = new () { EnableAdvancedReplicaSelectionForTcp = advancedReplicaSelectionEnabled, diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CustomSerializationTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CustomSerializationTests.cs index 3334c201d1..364f554a97 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CustomSerializationTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CustomSerializationTests.cs @@ -14,6 +14,7 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; + using Microsoft.Azure.Cosmos.Tracing; using Microsoft.Azure.Cosmos.Utils; using Microsoft.Azure.Documents; using Microsoft.Azure.Documents.Client; @@ -244,6 +245,7 @@ public async Task TestStoredProcJsonSerializerSettings() }"; DocumentClient client = new DocumentClient(this.hostUri, this.masterKey, serializerSettings); + await client.EnsureValidClientAsync(NoOpTrace.Singleton); StoredProcedure sproc = await client.CreateStoredProcedureAsync(this.collectionUri, storedProcedureDef); @@ -326,6 +328,8 @@ public void TestStoredProcedure() connectionPolicy, defaultConsistencyLevel); + client.EnsureValidClientAsync(NoOpTrace.Singleton).Wait(); + // Create a simple stored procedure string scriptId = "bulkImportScript"; StoredProcedure sproc = new StoredProcedure @@ -533,6 +537,9 @@ private void SetupDateTimeScenario(JsonSerializerSettings serializerSettings, st serializerSettings, connectionPolicy, defaultConsistencyLevel); + + client.EnsureValidClientAsync(NoOpTrace.Singleton).Wait(); + originalDocument = new Document(); originalDocument.SetPropertyValue(jsonPropertyName, "2017-05-18T17:17:32.7514920Z"); originalDocument.SetPropertyValue(PartitionKeyProperty, "value"); @@ -566,7 +573,9 @@ public static JsonSerializerSettings GetSerializerWithCustomConverterAndBinder() private class CustomJsonSerializer : CosmosSerializer { private static readonly Encoding DefaultEncoding = new UTF8Encoding(false, true); +#pragma warning disable IDE0044 // Add readonly modifier private JsonSerializer serializer; +#pragma warning restore IDE0044 // Add readonly modifier public CustomJsonSerializer(JsonSerializerSettings jsonSerializerSettings) { this.serializer = JsonSerializer.Create(jsonSerializerSettings); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/DocumentClientUnitTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/DocumentClientUnitTests.cs index 227f308baf..43fe495852 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/DocumentClientUnitTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/DocumentClientUnitTests.cs @@ -13,6 +13,7 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests using Microsoft.Azure.Cosmos.Internal; using Microsoft.Azure.Cosmos.Linq; using Microsoft.Azure.Cosmos.Query.Core.QueryPlan; + using Microsoft.Azure.Cosmos.Tracing; using Microsoft.Azure.Cosmos.Utils; using Microsoft.Azure.Documents; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -58,6 +59,7 @@ public async Task RetryExceedingMaxTimeLimit() (HttpMessageHandler)null, connectionPolicy); + await client.EnsureValidClientAsync(NoOpTrace.Singleton); await client.GetDatabaseAccountAsync(); int expectedExecutionTimes = 11; @@ -144,6 +146,7 @@ public async Task OpenConnectionsToAllReplicasAsync_WhenStoreModelThrowsInternal (HttpMessageHandler)null, connectionPolicy); + await client.EnsureValidClientAsync(NoOpTrace.Singleton); await client.GetDatabaseAccountAsync(); client.StoreModel = mockStoreModel.Object; client.GatewayStoreModel = mockStoreModel.Object; @@ -200,6 +203,7 @@ private void TestRetryOnThrottled(int? numberOfRetries) (HttpMessageHandler)null, connectionPolicy); + client.EnsureValidClientAsync(NoOpTrace.Singleton).Wait(); client.GetDatabaseAccountAsync().Wait(); int expectedExecutionTimes = numberOfRetries + 1 ?? 10; diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/DynamicQueryable.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/DynamicQueryable.cs index 9271561e06..8881a43f84 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/DynamicQueryable.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/DynamicQueryable.cs @@ -245,10 +245,16 @@ internal class ClassFactory static ClassFactory() { } // Trigger lazy initialization of static fields +#pragma warning disable IDE0044 // Add readonly modifier ModuleBuilder module; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier Dictionary classes; +#pragma warning restore IDE0044 // Add readonly modifier int classCount; +#pragma warning disable IDE0044 // Add readonly modifier ReaderWriterLock rwLock; +#pragma warning restore IDE0044 // Add readonly modifier private ClassFactory() { @@ -613,13 +619,21 @@ interface IEnumerableSignatures static Dictionary keywords; +#pragma warning disable IDE0044 // Add readonly modifier Dictionary symbols; +#pragma warning restore IDE0044 // Add readonly modifier IDictionary externals; +#pragma warning disable IDE0044 // Add readonly modifier Dictionary literals; +#pragma warning restore IDE0044 // Add readonly modifier ParameterExpression it; +#pragma warning disable IDE0044 // Add readonly modifier string text; +#pragma warning restore IDE0044 // Add readonly modifier int textPos; +#pragma warning disable IDE0044 // Add readonly modifier int textLen; +#pragma warning restore IDE0044 // Add readonly modifier char ch; Token token; diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Fluent/ContainerSettingsTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Fluent/ContainerSettingsTests.cs index 4de78ab0a5..16186a5835 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Fluent/ContainerSettingsTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Fluent/ContainerSettingsTests.cs @@ -7,7 +7,6 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json.Linq; using System; - using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; using System.Linq; @@ -592,7 +591,7 @@ await databaseForVectorEmbedding.DefineContainer(containerName, partitionKeyPath .WithVectorIndex() .Path(vector3Path, VectorIndexType.DiskANN) .WithQuantizationByteSize(2) - .WithIndexingSearchListSize(5) + .WithIndexingSearchListSize(35) .WithVectorIndexShardKey(new string[] { "/ZipCode" }) .Attach() .Attach() @@ -621,7 +620,7 @@ await databaseForVectorEmbedding.DefineContainer(containerName, partitionKeyPath Assert.AreEqual(vector3Path, containerSettings.IndexingPolicy.VectorIndexes[2].Path); Assert.AreEqual(VectorIndexType.DiskANN, containerSettings.IndexingPolicy.VectorIndexes[2].Type); Assert.AreEqual(2, containerSettings.IndexingPolicy.VectorIndexes[2].QuantizationByteSize); - Assert.AreEqual(5, containerSettings.IndexingPolicy.VectorIndexes[2].IndexingSearchListSize); + Assert.AreEqual(35, containerSettings.IndexingPolicy.VectorIndexes[2].IndexingSearchListSize); CollectionAssert.AreEqual(new string[] { "/ZipCode" }, containerSettings.IndexingPolicy.VectorIndexes[2].VectorIndexShardKey); } finally @@ -683,52 +682,6 @@ await this.database.DefineContainer(containerName, partitionKeyPath) Assert.AreEqual(HttpStatusCode.NoContent, containerResponse.StatusCode); } - [Ignore] - [TestMethod] - public async Task WithComputedProperties() - { - string containerName = Guid.NewGuid().ToString(); - string partitionKeyPath = "/users"; - - var definitions = new[] - { - new { Name = "lowerName", Query = "SELECT VALUE LOWER(c.name) FROM c" }, - new { Name = "estimatedTax", Query = "SELECT VALUE c.salary * 0.2 FROM c" } - }; - ContainerResponse containerResponse = - await this.database.DefineContainer(containerName, partitionKeyPath) - .WithComputedProperties() - .WithComputedProperty(definitions[0].Name, definitions[0].Query) - .WithComputedProperty(definitions[1].Name, definitions[1].Query) - .Attach() - .CreateAsync(); - - Assert.AreEqual(HttpStatusCode.Created, containerResponse.StatusCode); - Assert.AreEqual(containerName, containerResponse.Resource.Id); - Assert.AreEqual(partitionKeyPath, containerResponse.Resource.PartitionKey.Paths.First()); - - Assert.AreEqual(2, containerResponse.Resource.ComputedProperties.Count); - Assert.AreEqual(definitions[0].Name, containerResponse.Resource.ComputedProperties[0].Name); - Assert.AreEqual(definitions[0].Query, containerResponse.Resource.ComputedProperties[0].Query); - Assert.AreEqual(definitions[1].Name, containerResponse.Resource.ComputedProperties[1].Name); - Assert.AreEqual(definitions[1].Query, containerResponse.Resource.ComputedProperties[1].Query); - - Container container = containerResponse; - containerResponse = await container.ReadContainerAsync(); - Assert.AreEqual(HttpStatusCode.OK, containerResponse.StatusCode); - Assert.AreEqual(containerName, containerResponse.Resource.Id); - Assert.AreEqual(partitionKeyPath, containerResponse.Resource.PartitionKey.Paths.First()); - - Assert.AreEqual(2, containerResponse.Resource.ComputedProperties.Count); - Assert.AreEqual(definitions[0].Name, containerResponse.Resource.ComputedProperties[0].Name); - Assert.AreEqual(definitions[0].Query, containerResponse.Resource.ComputedProperties[0].Query); - Assert.AreEqual(definitions[1].Name, containerResponse.Resource.ComputedProperties[1].Name); - Assert.AreEqual(definitions[1].Query, containerResponse.Resource.ComputedProperties[1].Query); - - containerResponse = await containerResponse.Container.DeleteContainerAsync(); - Assert.AreEqual(HttpStatusCode.NoContent, containerResponse.StatusCode); - } - [TestMethod] public async Task TestFullTextSearchPolicy() { @@ -853,6 +806,103 @@ await databaseForVectorEmbedding.DefineContainer(containerName, partitionKeyPath } } + [Ignore("Marking as ignore until emulator is updated")] + [TestMethod] + public async Task TestFullTextSearchPolicyOptionalLanguage() + { + string fullTextPath1 = "/fts1"; + Database databaseForFullTextSearch = await this.GetClient().CreateDatabaseAsync("fullTextSearchDB", + cancellationToken: this.cancellationToken); + + try + { + string containerName = "fullTextContainerTest"; + string partitionKeyPath = "/pk"; + + ContainerResponse containerResponse = + await databaseForFullTextSearch.DefineContainer(containerName, partitionKeyPath) + .WithFullTextPolicy( + defaultLanguage: null, + fullTextPaths: new Collection() { new FullTextPath() + { + Path = fullTextPath1 + }}) + .Attach() + .WithIndexingPolicy() + .WithFullTextIndex() + .Path(fullTextPath1) + .Attach() + .Attach() + .CreateAsync(); + + Assert.AreEqual(HttpStatusCode.Created, containerResponse.StatusCode); + Assert.AreEqual(containerName, containerResponse.Resource.Id); + Assert.AreEqual(partitionKeyPath, containerResponse.Resource.PartitionKey.Paths.First()); + ContainerProperties containerSettings = containerResponse.Resource; + + // Validate FullText Paths. + Assert.IsNotNull(containerSettings.FullTextPolicy); + Assert.IsNull(containerSettings.FullTextPolicy.DefaultLanguage); + Assert.IsNotNull(containerSettings.FullTextPolicy.FullTextPaths); + Assert.AreEqual(1, containerSettings.FullTextPolicy.FullTextPaths.Count()); + Assert.IsNull(containerSettings.FullTextPolicy.FullTextPaths[0].Language); + + // Validate Full Text Indexes. + Assert.IsNotNull(containerSettings.IndexingPolicy.FullTextIndexes); + Assert.AreEqual(1, containerSettings.IndexingPolicy.FullTextIndexes.Count()); + Assert.AreEqual(fullTextPath1, containerSettings.IndexingPolicy.FullTextIndexes[0].Path); + } + finally + { + await databaseForFullTextSearch.DeleteAsync(); + } + } + + [Ignore] + [TestMethod] + public async Task WithComputedProperties() + { + string containerName = Guid.NewGuid().ToString(); + string partitionKeyPath = "/users"; + + var definitions = new[] + { + new { Name = "lowerName", Query = "SELECT VALUE LOWER(c.name) FROM c" }, + new { Name = "estimatedTax", Query = "SELECT VALUE c.salary * 0.2 FROM c" } + }; + ContainerResponse containerResponse = + await this.database.DefineContainer(containerName, partitionKeyPath) + .WithComputedProperties() + .WithComputedProperty(definitions[0].Name, definitions[0].Query) + .WithComputedProperty(definitions[1].Name, definitions[1].Query) + .Attach() + .CreateAsync(); + + Assert.AreEqual(HttpStatusCode.Created, containerResponse.StatusCode); + Assert.AreEqual(containerName, containerResponse.Resource.Id); + Assert.AreEqual(partitionKeyPath, containerResponse.Resource.PartitionKey.Paths.First()); + + Assert.AreEqual(2, containerResponse.Resource.ComputedProperties.Count); + Assert.AreEqual(definitions[0].Name, containerResponse.Resource.ComputedProperties[0].Name); + Assert.AreEqual(definitions[0].Query, containerResponse.Resource.ComputedProperties[0].Query); + Assert.AreEqual(definitions[1].Name, containerResponse.Resource.ComputedProperties[1].Name); + Assert.AreEqual(definitions[1].Query, containerResponse.Resource.ComputedProperties[1].Query); + + Container container = containerResponse; + containerResponse = await container.ReadContainerAsync(); + Assert.AreEqual(HttpStatusCode.OK, containerResponse.StatusCode); + Assert.AreEqual(containerName, containerResponse.Resource.Id); + Assert.AreEqual(partitionKeyPath, containerResponse.Resource.PartitionKey.Paths.First()); + + Assert.AreEqual(2, containerResponse.Resource.ComputedProperties.Count); + Assert.AreEqual(definitions[0].Name, containerResponse.Resource.ComputedProperties[0].Name); + Assert.AreEqual(definitions[0].Query, containerResponse.Resource.ComputedProperties[0].Query); + Assert.AreEqual(definitions[1].Name, containerResponse.Resource.ComputedProperties[1].Name); + Assert.AreEqual(definitions[1].Query, containerResponse.Resource.ComputedProperties[1].Query); + + containerResponse = await containerResponse.Container.DeleteContainerAsync(); + Assert.AreEqual(HttpStatusCode.NoContent, containerResponse.StatusCode); + } [TestMethod] public async Task ThroughputTest() diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/GlobalSuppressions.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/GlobalSuppressions.cs new file mode 100644 index 0000000000..b2bf932a66 --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/GlobalSuppressions.cs @@ -0,0 +1,20 @@ +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. + +using System.Diagnostics.CodeAnalysis; + +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Services.Management.Tests.LinqProviderTests.LinqGeneralBaselineTests.DerivedFooCollection.Item(System.Int32)")] +[assembly: SuppressMessage("Style", "IDE0027:Use expression body for accessor", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Services.Management.Tests.LinqProviderTests.LinqGeneralBaselineTests.FooStringCollection.Item(System.Int32)")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.SDK.EmulatorTests.HeadersValidationTests.TestUserAgentContainer.BaseUserAgent")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Services.Management.Tests.LinqProviderTests.LinqGeneralBaselineTests.DerivedFooCollection.Count")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Services.Management.Tests.LinqProviderTests.LinqGeneralBaselineTests.DerivedFooCollection.IsReadOnly")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Services.Management.Tests.LinqProviderTests.LinqGeneralBaselineTests.FooStringCollection.Count")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Services.Management.Tests.LinqProviderTests.LinqGeneralBaselineTests.FooStringCollection.IsReadOnly")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Services.Management.Tests.BaselineTest.BaselineTests`2.BaselineTestResult.#ctor(Microsoft.Azure.Cosmos.Services.Management.Tests.BaselineTest.BaselineTestInput,Microsoft.Azure.Cosmos.Services.Management.Tests.BaselineTest.BaselineTestOutput)")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Services.Management.Tests.LinqProviderTests.LinqAggregateFunctionBaselineTests.LinqAggregateInput.#ctor(System.String,System.Linq.Expressions.Expression{System.Func{System.Boolean,System.Object}})")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Services.Management.Tests.LinqProviderTests.LinqScalarFunctionInput.#ctor(System.String,System.Linq.Expressions.Expression{System.Func{System.Boolean,System.Object}})")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:Microsoft.Azure.Cosmos.Test.Management.Tests.LinqProviderTests.LinqConstantFoldingBaselineTests.LinqExpressionInput.#ctor(System.String,System.Linq.Expressions.Expression,System.String)")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:System.Linq.Dynamic.DynamicProperty.#ctor(System.String,System.Type)")] +[assembly: SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "", Scope = "member", Target = "~M:System.Linq.Dynamic.ExpressionParser.#ctor(System.Linq.Expressions.ParameterExpression[],System.String,System.Object[])")] diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/HeadersValidationTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/HeadersValidationTests.cs index 9120e7179a..229f235e3d 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/HeadersValidationTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/HeadersValidationTests.cs @@ -27,7 +27,9 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests [TestClass] public class HeadersValidationTests { +#pragma warning disable IDE0044 // Add readonly modifier private static byte BinarySerializationByteMarkValue = 128; +#pragma warning restore IDE0044 // Add readonly modifier private string currentVersion; private byte[] currentVersionUTF8; @@ -745,15 +747,14 @@ public async Task ValidateVersionHeader() HttpConstants.Versions.CurrentVersion = "2015-01-01"; client.Dispose(); client = TestCommon.CreateClient(true); - try - { - doc = (await client.CreateDocumentAsync(coll.SelfLink, new Document())).Resource; - Assert.Fail("Should have faild because of version error"); - } - catch (CosmosException dce) - { - Assert.AreEqual(dce.StatusCode, HttpStatusCode.BadRequest); - } + Assert.Fail("Should have faild because of version error"); + } + catch (AggregateException ae) + { + Assert.IsTrue(ae.InnerException is CosmosException); + + CosmosException ce = (CosmosException) ae.InnerException; + Assert.AreEqual(ce.StatusCode, HttpStatusCode.BadRequest); } finally { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Linq/LinqGeneralBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Linq/LinqGeneralBaselineTests.cs index 8f7d4f9b88..a5cdf0c837 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Linq/LinqGeneralBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Linq/LinqGeneralBaselineTests.cs @@ -1983,7 +1983,8 @@ orderby f.FamilyId select f.FamilyId)); inputs.Add(new LinqTestInput("OrderBy -> Select", b => getQuery(b).OrderBy(f => f.FamilyId).Select(f => f.FamilyId))); inputs.Add(new LinqTestInput("OrderBy -> Select -> Take", b => getQuery(b).OrderBy(f => f.FamilyId).Select(f => f.FamilyId).Take(10))); - inputs.Add(new LinqTestInput("OrderBy -> Select -> Select", b => getQuery(b).OrderBy(f => f.FamilyId).Select(f => f.FamilyId).Select(x => x))); + inputs.Add(new LinqTestInput("OrderBy -> Select -> Select", b => getQuery(b).OrderBy(f => f.FamilyId).Select(f => f.FamilyId).Select(x => x))); + inputs.Add(new LinqTestInput("OrderBy -> Skip", b => getQuery(b).OrderBy(f => f.FamilyId).Skip(1))); // Descending inputs.Add(new LinqTestInput("Select -> order by", b => getQuery(b).Select(family => family.FamilyId).OrderByDescending(id => id))); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Linq/LinqTestsCommon.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Linq/LinqTestsCommon.cs index 0821dc3014..37d2b62e6a 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Linq/LinqTestsCommon.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Linq/LinqTestsCommon.cs @@ -678,6 +678,8 @@ public class LinqTestInput : BaselineTestInput // Ignore Ordering for AnonymousType object internal bool ignoreOrder; + + internal bool serializeOutput; internal LinqTestInput( string description, @@ -685,14 +687,16 @@ internal LinqTestInput( bool skipVerification = false, bool ignoreOrder = false, string expressionStr = null, - string inputData = null) + string inputData = null, + bool serializeOutput = false) : base(description) { this.Expression = expr ?? throw new ArgumentNullException($"{nameof(expr)} must not be null."); this.skipVerification = skipVerification; this.ignoreOrder = ignoreOrder; this.expressionStr = expressionStr; - this.inputData = inputData; + this.inputData = inputData; + this.serializeOutput = serializeOutput; } public static string FilterInputExpression(string input) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Linq/LinqTranslationBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Linq/LinqTranslationBaselineTests.cs index 19b131cd73..85242ef652 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Linq/LinqTranslationBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Linq/LinqTranslationBaselineTests.cs @@ -18,7 +18,9 @@ namespace Microsoft.Azure.Cosmos.Services.Management.Tests.LinqProviderTests using System.Linq.Dynamic; using System.Text; using Microsoft.Azure.Cosmos.SDK.EmulatorTests; - using System.Threading.Tasks; + using System.Threading.Tasks; + + using static Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions; [Microsoft.Azure.Cosmos.SDK.EmulatorTests.TestClass] public class LinqTranslationBaselineTests : BaselineTests @@ -110,7 +112,10 @@ internal class DataObject : LinqTestObject public double IntField; public string StringField; public string StringField2; - public int[] ArrayField; + public int[] ArrayField; + public float[] VectorFloatField; + public byte[] VectorInt8Field; + public sbyte[] VectorUInt8Field; public List EnumerableField; public Point Point; public int? NullableField; @@ -344,8 +349,8 @@ public void TestRegexMatchFunction() new LinqTestInput("RegexMatch with 2nd argument invalid string options", b => getQuery(b).Where(doc => doc.StringField.RegexMatch("abcd", "this should error out on the back end"))), }; this.ExecuteTestSuite(inputs); - } - + } + [TestMethod] public void TestFullTextContainsFunction() { @@ -388,6 +393,387 @@ public void TestFullTextContainsFunction() }; this.ExecuteTestSuite(inputs); } + + [TestMethod] + public void TestVectorDistanceFunction() + { + const int Records = 2; + const int MaxStringLength = 100; + static DataObject createDataObj(Random random) + { + DataObject obj = new DataObject + { + StringField = LinqTestsCommon.RandomString(random, random.Next(MaxStringLength)), + Id = Guid.NewGuid().ToString(), + VectorUInt8Field = new sbyte[] {1, 2, 3}, + VectorInt8Field = new byte[] { 1, 2, 3 }, + VectorFloatField = new float[] { 1, 2.0f, 3.0f }, + Pk = "Test" + }; + return obj; + } + Func> getQuery = LinqTestsCommon.GenerateTestCosmosData(createDataObj, Records, testContainer); + + List inputs = new List + { + new LinqTestInput("Float VectorDistance + Order By Rank", b => getQuery(b) + .OrderByRank(doc => doc.VectorFloatField.VectorDistance(new float[] {2,3,4}, false, null)) + .Select(doc => doc.Pk)), + new LinqTestInput("Float VectorDistance + Order By", b => getQuery(b) + .OrderBy(doc => doc.VectorFloatField.VectorDistance(new float[] {2,3,4}, false, null)) + .Select(doc => doc.Pk)), + new LinqTestInput("Float VectorDistance + Select", b => getQuery(b) + .Select(doc => doc.VectorFloatField.VectorDistance(new float[] {2,3,4}, false, null))), + new LinqTestInput("Float VectorDistance + Where", b => getQuery(b) + .Where(doc => doc.VectorFloatField.VectorDistance(new float[] {2,3,4}, false, null) > 0) + .Select(doc => doc.Pk)), + new LinqTestInput("Float VectorDistance + GroupBy", b => getQuery(b) + .GroupBy(doc => doc.VectorFloatField.VectorDistance(new float[] {2,3,4}, false, null), (key, values) => key)), + new LinqTestInput("Float VectorDistance with non null fourth option", b => getQuery(b) + .Select(doc => doc.VectorFloatField.VectorDistance(new float[] { 2, 3, 4 }, true, new VectorDistanceOptions() { DistanceFunction = DistanceFunction.Cosine, DataType = VectorDataType.Float32, SearchListSizeMultiplier = 20}))), + new LinqTestInput("Float VectorDistance with non null fourth option with default SearchListSizeMultiplier", b => getQuery(b) + .Select(doc => doc.VectorFloatField.VectorDistance(new float[] { 2, 3, 4 }, true, new VectorDistanceOptions() { DistanceFunction = DistanceFunction.Cosine, DataType = VectorDataType.Float32}))), + new LinqTestInput("Float VectorDistance with non null fourth option with default DataType", b => getQuery(b) + .Select(doc => doc.VectorFloatField.VectorDistance(new float[] { 2, 3, 4 }, true, new VectorDistanceOptions() { DistanceFunction = DistanceFunction.Cosine, SearchListSizeMultiplier = 10}))), + new LinqTestInput("Float VectorDistance with non null fourth option with default DistanceFunction", b => getQuery(b) + .Select(doc => doc.VectorFloatField.VectorDistance(new float[] { 2, 3, 4 }, true, new VectorDistanceOptions() { DataType = VectorDataType.Float32, SearchListSizeMultiplier = 10}))), + new LinqTestInput("Float VectorDistance with non null fourth option with all default values", b => getQuery(b) + .Select(doc => doc.VectorFloatField.VectorDistance(new float[] { 2, 3, 4 }, true, new VectorDistanceOptions()))), + new LinqTestInput("Float VectorDistance + RRF", b => getQuery(b) + .OrderByRank(doc => RRF(doc.VectorFloatField.VectorDistance(new float[] { 2, 3, 4 }, false, null), + doc.VectorFloatField.VectorDistance(new float[] { 3, 4, 5 }, false, null))) + .Select(doc => doc.Pk)), + new LinqTestInput("Float VectorDistance + RRF + FullTextScore", b => getQuery(b) + .OrderByRank(doc => RRF(doc.VectorFloatField.VectorDistance(new float[] { 2, 3, 4 }, false, null), + doc.VectorFloatField.FullTextScore("string", "name"))) + .Select(doc => doc.Pk)), + + new LinqTestInput("UInt8 VectorDistance + Order By Rank", b => getQuery(b) + .OrderByRank(doc => doc.VectorUInt8Field.VectorDistance(new sbyte[] { 2, 3, 4 }, false, null)) + .Select(doc => doc.Pk)), + new LinqTestInput("UInt8 VectorDistance + Order By", b => getQuery(b) + .OrderBy(doc => doc.VectorUInt8Field.VectorDistance(new sbyte[] { 2, 3, 4 }, false, null)) + .Select(doc => doc.Pk)), + new LinqTestInput("UInt8 VectorDistance + Select", b => getQuery(b) + .Select(doc => doc.VectorUInt8Field.VectorDistance(new sbyte[] { 2, 3, 4 }, false, null))), + new LinqTestInput("UInt8 VectorDistance + Where", b => getQuery(b) + .Where(doc => doc.VectorUInt8Field.VectorDistance(new sbyte[] { 2, 3, 4 }, false, null) > 0) + .Select(doc => doc.Pk)), + new LinqTestInput("UInt8 VectorDistance + GroupBy", b => getQuery(b) + .GroupBy(doc => doc.VectorUInt8Field.VectorDistance(new sbyte[] { 2, 3, 4 }, false, null), (key, values) => key)), + new LinqTestInput("UInt8 VectorDistance with non null fourth option", b => getQuery(b) + .Select(doc => doc.VectorUInt8Field.VectorDistance(new sbyte[] { 2, 3, 4 }, true, new VectorDistanceOptions() { DistanceFunction = DistanceFunction.DotProduct, DataType = VectorDataType.Uint8, SearchListSizeMultiplier = 20 }))), + new LinqTestInput("UInt8 VectorDistance with non null fourth option with default DistanceFunction", b => getQuery(b) + .Select(doc => doc.VectorUInt8Field.VectorDistance(new sbyte[] { 2, 3, 4 }, true, new VectorDistanceOptions() { DataType = VectorDataType.Uint8, SearchListSizeMultiplier = 20 }))), + new LinqTestInput("UInt8 VectorDistance with non null fourth option with default SearchListSizeMultiplier", b => getQuery(b) + .Select(doc => doc.VectorUInt8Field.VectorDistance(new sbyte[] { 2, 3, 4 }, true, new VectorDistanceOptions() { DistanceFunction = DistanceFunction.DotProduct, DataType = VectorDataType.Uint8 }))), + new LinqTestInput("UInt8 VectorDistance with non null fourth option with default DistanceFunction and SearchListSizeMultiplier", b => getQuery(b) + .Select(doc => doc.VectorUInt8Field.VectorDistance(new sbyte[] { 2, 3, 4 }, true, new VectorDistanceOptions() { DataType = VectorDataType.Uint8 }))), + new LinqTestInput("UInt8 VectorDistance + RRF", b => getQuery(b) + .OrderByRank(doc => RRF(doc.VectorUInt8Field.VectorDistance(new sbyte[] { 2, 3, 4 }, false, null), + doc.VectorUInt8Field.VectorDistance(new sbyte[] { 3, 4, 5 }, false, null))) + .Select(doc => doc.Pk)), + new LinqTestInput("UInt8 VectorDistance + RRF + non null fourth option with default SearchListSizeMultiplier", b => getQuery(b) + .OrderByRank(doc => RRF(doc.VectorUInt8Field.VectorDistance(new sbyte[] { 2, 3, 4 }, false, null), + doc.VectorUInt8Field.VectorDistance(new sbyte[] { 3, 4, 5 }, false, new VectorDistanceOptions() { DistanceFunction = DistanceFunction.DotProduct, DataType = VectorDataType.Uint8 }))) + .Select(doc => doc.Pk)), + new LinqTestInput("UInt8 VectorDistance + RRF + FullTextScore", b => getQuery(b) + .OrderByRank(doc => RRF(doc.VectorUInt8Field.VectorDistance(new sbyte[] { 2, 3, 4 }, false, null), + doc.VectorUInt8Field.FullTextScore("string", "name"))) + .Select(doc => doc.Pk)), + new LinqTestInput("UInt8 VectorDistance + RRF + FullTextScore + non null fourth option with default DistanceFunction", b => getQuery(b) + .OrderByRank(doc => RRF(doc.VectorUInt8Field.VectorDistance(new sbyte[] { 2, 3, 4 }, false, new VectorDistanceOptions() { DataType = VectorDataType.Uint8, SearchListSizeMultiplier = 20 }), + doc.VectorUInt8Field.FullTextScore("string", "name"))) + .Select(doc => doc.Pk)), + + new LinqTestInput("Int8 VectorDistance + Order By Rank", b => getQuery(b) + .OrderByRank(doc => doc.VectorInt8Field.VectorDistance(new byte[] { 2, 3, 4 }, false, null)) + .Select(doc => doc.Pk)), + new LinqTestInput("Int8 VectorDistance + Order By", b => getQuery(b) + .OrderBy(doc => doc.VectorInt8Field.VectorDistance(new byte[] { 2, 3, 4 }, false, null)) + .Select(doc => doc.Pk)), + new LinqTestInput("Int8 VectorDistance + Select", b => getQuery(b) + .Select(doc => doc.VectorInt8Field.VectorDistance(new byte[] { 2, 3, 4 }, false, null))), + new LinqTestInput("Int8 VectorDistance + Where", b => getQuery(b) + .Where(doc => doc.VectorInt8Field.VectorDistance(new byte[] { 2, 3, 4 }, false, null) > 0) + .Select(doc => doc.Pk)), + new LinqTestInput("Int8 VectorDistance + GroupBy", b => getQuery(b) + .GroupBy(doc => doc.VectorInt8Field.VectorDistance(new byte[] { 2, 3, 4 }, false, null), (key, values) => key)), + new LinqTestInput("Int8 VectorDistance with non null fourth option", b => getQuery(b) + .Select(doc => doc.VectorInt8Field.VectorDistance(new byte[] { 2, 3, 4 }, true, new VectorDistanceOptions() { DistanceFunction = DistanceFunction.Euclidean, DataType = VectorDataType.Int8}))), + new LinqTestInput("Int8 VectorDistance + RRF", b => getQuery(b) + .OrderByRank(doc => RRF(doc.VectorInt8Field.VectorDistance(new byte[] { 2, 3, 4 }, false, null), + doc.VectorInt8Field.VectorDistance(new byte[] { 3, 4, 5 }, false, null))) + .Select(doc => doc.Pk)), + new LinqTestInput("Int8 VectorDistance + RRF + FullTextScore", b => getQuery(b) + .OrderByRank(doc => RRF(doc.VectorInt8Field.VectorDistance(new byte[] { 2, 3, 4 }, false, null), + doc.VectorInt8Field.FullTextScore("string", "name"))) + .Select(doc => doc.Pk)), + + // Other cases regarding fourth option + new LinqTestInput("VectorDistance with empty object", b => getQuery(b) + .Select(doc => doc.VectorFloatField.VectorDistance(new float[] { 2, 3, 4 }, true, new VectorDistanceOptions{}))), + new LinqTestInput("VectorDistance with empty object 2", b => getQuery(b) + .Select(doc => doc.VectorFloatField.VectorDistance(new float[] { 2, 3, 4 }, true, null))), + new LinqTestInput("VectorDistance with default values", b => getQuery(b) + .Select(doc => doc.VectorFloatField.VectorDistance(new float[] { 2, 3, 4 }, true, new VectorDistanceOptions { DataType = VectorDataType.Float32, DistanceFunction = DistanceFunction.Euclidean, SearchListSizeMultiplier = 10 }))), + // ISSUE-TODO-leminh - the following two variations produce different results in the official run. + // new LinqTestInput("VectorDistance with non default values 1", b => getQuery(b) + // .Select(doc => doc.VectorFloatField.VectorDistance(new float[] { 2, 3, 4 }, true, new VectorDistanceOptions { DataType = VectorDataType.// Int8, DistanceFunction = DistanceFunction.Cosine, SearchListSizeMultiplier = 20 }))), + // new LinqTestInput("VectorDistance with non default values 2", b => getQuery(b) + // .Select(doc => doc.VectorFloatField.VectorDistance(new float[] { 2, 3, 4 }, true, new VectorDistanceOptions { DataType = VectorDataType.Uint8, DistanceFunction = DistanceFunction.DotProduct, SearchListSizeMultiplier = 50 }))), + new LinqTestInput("VectorDistance with nullable values", b => getQuery(b) + .Select(doc => doc.VectorFloatField.VectorDistance(new float[] { 2, 3, 4 }, true, new VectorDistanceOptions { DataType = null, DistanceFunction = null, SearchListSizeMultiplier = null }))), + new LinqTestInput("VectorDistance with partial fourth option", b => getQuery(b) + .Select(doc => doc.VectorFloatField.VectorDistance(new float[] { 2, 3, 4 }, true, new VectorDistanceOptions() { DistanceFunction = DistanceFunction.Euclidean }))), + new LinqTestInput("VectorDistance with partial fourth option 2", b => getQuery(b) + .Select(doc => doc.VectorFloatField.VectorDistance(new float[] { 2, 3, 4 }, true, new VectorDistanceOptions() { SearchListSizeMultiplier = 1 }))), + + // Negative case + new LinqTestInput("VectorDistance with fourth option with invalid values 1", b => getQuery(b) + .Select(doc => doc.VectorFloatField.VectorDistance(new float[] { 2, 3, 4 }, true, new VectorDistanceOptions() { SearchListSizeMultiplier = -100 }))) + }; + + foreach (LinqTestInput input in inputs) + { + // VectorDistance are not supported client side. + // Therefore this method is verified with baseline only. + input.skipVerification = true; + input.serializeOutput = true; + } + + this.ExecuteTestSuite(inputs); + } + + [TestMethod] + public void TestFullTextScoreOrderByRankFunction() + { + const int Records = 2; + const int MaxStringLength = 100; + static DataObject createDataObj(Random random) + { + DataObject obj = new DataObject + { + StringField = LinqTestsCommon.RandomString(random, random.Next(MaxStringLength)), + Id = Guid.NewGuid().ToString(), + Pk = "Test" + }; + return obj; + } + Func> getQuery = LinqTestsCommon.GenerateTestCosmosData(createDataObj, Records, testContainer); + + List inputs = new List + { + new LinqTestInput("FullTextScore with 1 element array", b => getQuery(b) + .OrderByRank(doc => doc.StringField.FullTextScore("test1")) + .Select(doc => doc.Pk)), + new LinqTestInput("FullTextScore with 3 element array", b => getQuery(b) + .OrderByRank(doc => doc.StringField.FullTextScore("test1", "test2", "test3")) + .Select(doc => doc.Pk)), + new LinqTestInput("FullTextScore with 1 element array", b => getQuery(b) + .OrderByRank(doc => doc.StringField.FullTextScore(new string[] { "test1" })) + .Select(doc => doc.Pk)), + new LinqTestInput("FullTextScore with 3 element array", b => getQuery(b) + .OrderByRank(doc => doc.StringField.FullTextScore(new string[] { "test1", "test2", "test3" })) + .Select(doc => doc.Pk)), + + // Negative case: FullTextScore in non order by clause + new LinqTestInput("FullTextScore in WHERE clause", b => getQuery(b) + .Where(doc => doc.StringField.FullTextScore(new string[] { "test1" }) != 123)), + new LinqTestInput("FullTextScore in WHERE clause 2", b => getQuery(b) + .Where(doc => doc.StringField.FullTextScore(new string[] { "test1", "test2", "test3" }) != 123)), + + new LinqTestInput("FullTextScore in WHERE clause", b => getQuery(b) + .Where(doc => doc.StringField.FullTextScore("test1") != 123)), + new LinqTestInput("FullTextScore in WHERE clause 2", b => getQuery(b) + .Where(doc => doc.StringField.FullTextScore("test1", "test2", "test3") != 123)), + }; + + foreach (LinqTestInput input in inputs) + { + // OrderBy are not supported client side. + // Therefore this method is verified with baseline only. + input.skipVerification = true; + input.serializeOutput = true; + } + + this.ExecuteTestSuite(inputs); + } + + [TestMethod] + public void TestRRFOrderByRankFunction() + { + const int Records = 2; + const int MaxStringLength = 100; + static DataObject createDataObj(Random random) + { + DataObject obj = new DataObject + { + StringField = LinqTestsCommon.RandomString(random, random.Next(MaxStringLength)), + IntField = 1, + Id = Guid.NewGuid().ToString(), + Pk = "Test" + }; + return obj; + } + Func> getQuery = LinqTestsCommon.GenerateTestCosmosData(createDataObj, Records, testContainer); + + List inputs = new List + { + new LinqTestInput("RRF with 2 functions", b => getQuery(b) + .OrderByRank(doc => RRF(doc.StringField.FullTextScore(new string[] { "test1" }), + doc.StringField2.FullTextScore(new string[] { "test1", "test2", "test3" }))) + .Select(doc => doc.Pk)), + + new LinqTestInput("RRF with 3 functions", b => getQuery(b) + .OrderByRank(doc => RRF(doc.StringField.FullTextScore(new string[] { "test1" }), + doc.StringField.FullTextScore(new string[] { "test1", "text2" }), + doc.StringField2.FullTextScore(new string[] { "test1", "test2", "test3" }))) + .Select(doc => doc.Pk)), + + // Negative case: FullTextScore in non order by clause + new LinqTestInput("RRF with 1 function", b => getQuery(b) + .OrderByRank(doc => RRF(doc.StringField.FullTextScore(new string[] { "test1" }))) + .Select(doc => doc.Pk)), + + new LinqTestInput("RRF in WHERE clause", b => getQuery(b) + .Where(doc => RRF(doc.StringField.FullTextScore(new string[] { "test1" })) != 123)), + new LinqTestInput("RRF in WHERE clause 2", b => getQuery(b) + .Where(doc => RRF(doc.StringField.FullTextScore(new string[] { "test1" }), + doc.StringField2.FullTextScore(new string[] { "test1", "test2", "test3" })) != 123)), + + new LinqTestInput("RRF with non scoring function", b => getQuery(b) + .OrderByRank(doc => RRF(doc.StringField.FullTextScore(new string[] { "test1" }), 123))), + new LinqTestInput("RRF with non scoring function 2", b => getQuery(b) + .OrderByRank(doc => RRF(doc.StringField.FullTextScore(new string[] { "test1" }), doc.IntField * 1.0))), + new LinqTestInput("RRF with non scoring function 3", b => getQuery(b) + .OrderByRank(doc => RRF(doc.StringField.FullTextScore(new string[] { "test1" }), doc.StringField2.Length))), + new LinqTestInput("RRF with non scoring function 4", b => getQuery(b) + .OrderByRank(doc => RRF(doc.StringField.FullTextScore(new string[] { "test1" }), doc.ArrayField.Count()))), + new LinqTestInput("RRF with RRF", b => getQuery(b) + .OrderByRank(doc => RRF(doc.StringField.FullTextScore(new string[] { "test1" }), + RRF(doc.StringField2.FullTextScore(new string[] { "test1", "test2", "test3" }), + doc.StringField.FullTextScore(new string[] { "test1", "test2"}))))) + }; + + foreach (LinqTestInput input in inputs) + { + // OrderBy are not supported client side. + // Therefore this method is verified with baseline only. + input.skipVerification = true; + input.serializeOutput = true; + } + + this.ExecuteTestSuite(inputs); + } + + [TestMethod] + public void TestOrderByRankFunctionComposeWithOtherFunctions() + { + const int Records = 2; + const int MaxStringLength = 100; + static DataObject createDataObj(Random random) + { + DataObject obj = new DataObject + { + StringField = LinqTestsCommon.RandomString(random, random.Next(MaxStringLength)), + NumericField = 1, + Id = Guid.NewGuid().ToString(), + Pk = "Test" + }; + return obj; + } + Func> getQuery = LinqTestsCommon.GenerateTestCosmosData(createDataObj, Records, testContainer); + + List inputs = new List + { + // Select + new LinqTestInput("Select + Order By Rank", b => getQuery(b) + .Select(doc => doc.Pk) + .OrderByRank(doc => doc.FullTextScore(new string[] { "test1" }))), + + new LinqTestInput("Order By Rank + Select", b => getQuery(b) + .OrderByRank(doc => doc.StringField.FullTextScore(new string[] { "test1" })) + .Select(doc => doc.Pk)), + + new LinqTestInput("Select + Order By Rank + Select", b => getQuery(b) + .Select(doc => new { stringField = doc.StringField, PartitionKey = doc.Pk }) + .OrderByRank(doc => doc.stringField.FullTextScore(new string[] { "test1" })) + .Select(doc => doc.PartitionKey)), + + // Join + new LinqTestInput("SelectMany + Order By Rank", b => getQuery(b) + .SelectMany(doc => doc.ArrayField) + .OrderByRank(doc => doc.ToString().FullTextScore(new string[] { "test1" }))), + + new LinqTestInput("Order By Rank + SelectMany", b => getQuery(b) + .OrderByRank(doc => doc.StringField.FullTextScore(new string[] { "test1" })) + .SelectMany(doc => doc.ArrayField)), + + // Skip + new LinqTestInput("Skip + Order By Rank", b => getQuery(b) + .Skip(1) + .OrderByRank(doc => doc.StringField.FullTextScore(new string[] { "test1" }))), + + new LinqTestInput("Order By Rank + Skip", b => getQuery(b) + .OrderByRank(doc => doc.StringField.FullTextScore(new string[] { "test1" })) + .Skip(1) + .Select(doc => doc.Pk)), + + // Take + new LinqTestInput("Take + Order By Rank", b => getQuery(b) + .Take(1) + .OrderByRank(doc => doc.StringField.FullTextScore(new string[] { "test1" }))), + + new LinqTestInput("Order By Rank + Take", b => getQuery(b) + .OrderByRank(doc => doc.StringField.FullTextScore(new string[] { "test1" })) + .Take(1) + .Select(doc => doc.Pk)), + + // GroupBy + new LinqTestInput("GroupBy + Order By Rank", b => getQuery(b) + .GroupBy(doc => doc.StringField, (key, values) => values.Count()) + .OrderByRank(doc => doc.ToString().FullTextScore(new string[] { "test1" }))), + + new LinqTestInput("Order By Rank + GroupBy", b => getQuery(b) + .OrderByRank(doc => doc.StringField.FullTextScore(new string[] { "test1" })) + .GroupBy(doc => doc.Pk, (key, values) => values.Count())), + + // Order By + // $issue-todo-leminh-20250424: There's an issue with OrderBy follows by OrderBy - the most recent order by is the only one that is applied to the query. + // This will be addressed in a separate PR + new LinqTestInput("Order By + Order By Rank", b => getQuery(b) + .OrderBy(doc => doc.NumericField) + .OrderByRank(doc => doc.StringField.FullTextScore(new string[] { "test1" })) + .Select(doc => doc.Pk)), + + new LinqTestInput("Order By Rank + Order By", b => getQuery(b) + .OrderByRank(doc => doc.StringField.FullTextScore(new string[] { "test1" })) + .OrderBy(doc => doc.NumericField) + .Select(doc => doc.Pk)), + + // Where + new LinqTestInput("Where + Order By Rank", b => getQuery(b) + .Where(doc => doc.NumericField > 0) + .OrderByRank(doc => doc.StringField.FullTextScore(new string[] { "test1" })) + .Select(doc => doc.Pk)), + + new LinqTestInput("Order By Rank + Where", b => getQuery(b) + .OrderByRank(doc => doc.StringField.FullTextScore(new string[] { "test1" })) + .Where(doc => doc.NumericField > 0) + .Select(doc => doc.Pk)), + }; + + foreach (LinqTestInput input in inputs) + { + // OrderBy are not supported client side. + // Therefore this method is verified with baseline only. + input.skipVerification = true; + input.serializeOutput = true; + } + + this.ExecuteTestSuite(inputs); + } [TestMethod] public void TestMemberInitializer() @@ -1421,7 +1807,7 @@ public void TestSelectManyWithFilters() public override LinqTestOutput ExecuteTest(LinqTestInput input) { - return LinqTestsCommon.ExecuteTest(input); + return LinqTestsCommon.ExecuteTest(input, input.serializeOutput); } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Metrics/OpenTelemetryMetricsTest.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Metrics/OpenTelemetryMetricsTest.cs index 2f751c0419..97728d3263 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Metrics/OpenTelemetryMetricsTest.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Metrics/OpenTelemetryMetricsTest.cs @@ -25,7 +25,7 @@ public class OpenTelemetryMetricsTest : BaseCosmosClientHelper private static readonly Dictionary expectedOperationMetrics = new() { { "db.client.operation.duration", MetricType.Histogram }, - { "db.client.response.row_count", MetricType.Histogram}, + { "db.client.response.returned_rows", MetricType.Histogram}, { "azure.cosmosdb.client.operation.request_charge", MetricType.Histogram }, { "azure.cosmosdb.client.active_instance.count", MetricType.LongSumNonMonotonic } }; diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Microsoft.Azure.Cosmos.EmulatorTests.csproj b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Microsoft.Azure.Cosmos.EmulatorTests.csproj index 99586d304b..c4ac7927ee 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Microsoft.Azure.Cosmos.EmulatorTests.csproj +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Microsoft.Azure.Cosmos.EmulatorTests.csproj @@ -240,6 +240,18 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + PreserveNewest diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/OfferTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/OfferTests.cs index d2015cc8ae..08dfbea423 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/OfferTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/OfferTests.cs @@ -24,7 +24,9 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests public sealed class OfferTests { +#pragma warning disable IDE0044 // Add readonly modifier private PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition { Paths = new System.Collections.ObjectModel.Collection(new[] { "/id" }), Kind = PartitionKind.Hash }; +#pragma warning restore IDE0044 // Add readonly modifier private readonly struct TestCase { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/PartitionKeyRangeCacheTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/PartitionKeyRangeCacheTests.cs index 5ca4d1dd37..ee8c763a8c 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/PartitionKeyRangeCacheTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/PartitionKeyRangeCacheTests.cs @@ -54,8 +54,8 @@ public async Task VerifyPkRangeCacheRefreshOnSplitWithErrorsAsync() ifNoneMatchValues.Add(request.Headers.IfNoneMatch.ToString()); pkRangeCalls++; - - if (pkRangeCalls == throwOnPkRefreshCount) + //account for metadata retry + if (pkRangeCalls == throwOnPkRefreshCount || pkRangeCalls == throwOnPkRefreshCount + 1) { failedIfNoneMatchValue = request.Headers.IfNoneMatch.ToString(); if (signalSplitException.IsSet) @@ -132,10 +132,10 @@ public async Task VerifyPkRangeCacheRefreshOnSplitWithErrorsAsync() pkRangesRefreshed.Wait(); Assert.IsFalse(causeSplitExceptionInRntbdCall); - Assert.AreEqual(4, pkRangeCalls); + Assert.AreEqual(5, pkRangeCalls); Assert.AreEqual(1, ifNoneMatchValues.Count(x => string.IsNullOrEmpty(x))); - Assert.AreEqual(3, ifNoneMatchValues.Count(x => x == failedIfNoneMatchValue), $"3 request with same if none value. 1 initial, 2 from the split errors. split exception count: {countSplitExceptions}; {string.Join(';', ifNoneMatchValues)}"); + Assert.AreEqual(4, ifNoneMatchValues.Count(x => x == failedIfNoneMatchValue), $"4 request with same if none value. 1 initial, 2 from the split errors, 1 retry. split exception count: {countSplitExceptions}; {string.Join(';', ifNoneMatchValues)}"); HashSet verifyUniqueIfNoneHeaderValues = new HashSet(); foreach (string ifNoneValue in ifNoneMatchValues) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/CosmosUndefinedQueryTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/CosmosUndefinedQueryTests.cs index 5fe7f28c87..436e9dc771 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/CosmosUndefinedQueryTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/CosmosUndefinedQueryTests.cs @@ -5,7 +5,6 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.Query using System.Collections.ObjectModel; using System.Linq; using System.Threading.Tasks; - using Azure; using Microsoft.Azure.Cosmos.CosmosElements; using Microsoft.Azure.Cosmos.CosmosElements.Numbers; using Microsoft.Azure.Cosmos.Json; @@ -23,10 +22,10 @@ public sealed class CosmosUndefinedQueryTests : QueryTestsBase private const int IntegerValue = 42; - private const string StringValue = "string"; - - private const string ArrayValue = "[10, 20]"; - + private const string StringValue = "string"; + + private const string ArrayValue = "[10, 20]"; + private const string ObjectValue = "{\"type\":\"object\"}"; private static readonly int[] PageSizes = new[] { 5, 10, -1 }; @@ -51,6 +50,18 @@ await this.CreateIngestQueryDeleteAsync( indexingPolicy: CompositeIndexPolicy); } + [TestMethod] + public async Task HybridSearchTests() + { + // Removing the await causes the test framework to not run this test + await this.CreateIngestQueryDeleteAsync( + connectionModes: ConnectionModes.Direct | ConnectionModes.Gateway, + collectionTypes: CollectionTypes.MultiPartition | CollectionTypes.SinglePartition, + documents: Documents, + query: HybridSearchTests, + indexingPolicy: CompositeIndexPolicy); + } + private static async Task RunTests(Container container, IReadOnlyList _) { await OrderByTests(container); @@ -58,7 +69,57 @@ private static async Task RunTests(Container container, IReadOnlyList _) + { + UndefinedProjectionTestCase[] testCases = new[] + { + MakeUndefinedProjectionTest( + query: "SELECT c.AlwaysUndefinedField " + + "FROM c " + + "ORDER BY RANK FullTextScore(c.AlwaysUndefinedField, ['needle'])", + expectedCount: DocumentCount), + MakeUndefinedProjectionTest( + query: "SELECT VALUE c.AlwaysUndefinedField " + + "FROM c " + + "ORDER BY RANK FullTextScore(c.AlwaysUndefinedField, ['needle'])", + expectedCount: 0), + MakeUndefinedProjectionTest( + query: "SELECT c.AlwaysUndefinedField " + + "FROM c " + + "ORDER BY RANK RRF(FullTextScore(c.AlwaysUndefinedField, ['needle']), FullTextScore(c.AnotherUndefinedField, ['needle']))", + expectedCount: DocumentCount), + MakeUndefinedProjectionTest( + query: "SELECT VALUE c.AlwaysUndefinedField " + + "FROM c " + + "ORDER BY RANK RRF(FullTextScore(c.AlwaysUndefinedField, ['needle']), FullTextScore(c.AnotherUndefinedField, ['needle']))", + expectedCount: 0), + MakeUndefinedProjectionTest( + query: $"SELECT c.AlwaysUndefinedField " + + $"FROM c " + + $"ORDER BY RANK FullTextScore(c.{nameof(MixedTypeDocument.MixedTypeField)}, ['needle'])", + expectedCount: DocumentCount), + MakeUndefinedProjectionTest( + query: $"SELECT VALUE c.AlwaysUndefinedField " + + $"FROM c " + + $"ORDER BY RANK FullTextScore(c.{nameof(MixedTypeDocument.MixedTypeField)}, ['needle'])", + expectedCount: 0), + MakeUndefinedProjectionTest( + query: $"SELECT c.AlwaysUndefinedField " + + $"FROM c " + + $"ORDER BY RANK RRF(FullTextScore(c.{nameof(MixedTypeDocument.MixedTypeField)}, ['needle']),FullTextScore(c.{nameof(MixedTypeDocument.Index)}, ['needle']))", + expectedCount: DocumentCount), + MakeUndefinedProjectionTest( + query: $"SELECT VALUE c.AlwaysUndefinedField " + + $"FROM c " + + $"ORDER BY RANK RRF(FullTextScore(c.{nameof(MixedTypeDocument.MixedTypeField)}, ['needle']),FullTextScore(c.{nameof(MixedTypeDocument.Index)}, ['needle']))", + expectedCount: 0), + }; + + await RunUndefinedProjectionTests(container, testCases); + await RunUntypedTestsAsync(container, testCases); + } + + private static Task UntypedTests(Container container) { UndefinedProjectionTestCase[] undefinedProjectionTestCases = new[] { @@ -79,13 +140,18 @@ private static async Task UntypedTests(Container container) expectedCount: 0), MakeUndefinedProjectionTest( query: $"SELECT VALUE AVG(c.{nameof(MixedTypeDocument.MixedTypeField)}) FROM c", - expectedCount: 0), - MakeUndefinedProjectionTest( + expectedCount: 0), + MakeUndefinedProjectionTest( query: $"SELECT DISTINCT VALUE SUM(c.{nameof(MixedTypeDocument.MixedTypeField)}) FROM c", expectedCount: 0) }; - foreach (UndefinedProjectionTestCase testCase in undefinedProjectionTestCases) + return RunUntypedTestsAsync(container, undefinedProjectionTestCases); + } + + private static async Task RunUntypedTestsAsync(Container container, IEnumerable testCases) + { + foreach (UndefinedProjectionTestCase testCase in testCases) { foreach (int pageSize in PageSizes) { @@ -122,6 +188,24 @@ private static async Task UntypedTests(Container container) Assert.AreEqual(testCase.ExpectedResultCount, actualCount); } } + } + + private static async Task RunUndefinedProjectionTests(Container container, IEnumerable testCases) + { + foreach (UndefinedProjectionTestCase testCase in testCases) + { + foreach (int pageSize in PageSizes) + { + List results = await RunQueryCombinationsAsync( + container, + testCase.Query, + new QueryRequestOptions { MaxItemCount = pageSize }, + QueryDrainingMode.HoldState); + + Assert.AreEqual(testCase.ExpectedResultCount, results.Count); + Assert.IsTrue(results.All(x => x is UndefinedProjection)); + } + } } private static async Task OrderByTests(Container container) @@ -237,10 +321,10 @@ private static async Task GroupByTests(Container container) value: DocumentsPerTypeCount), MakeGrouping( key: CosmosArray.Parse(ArrayValue), - value: DocumentsPerTypeCount), + value: DocumentsPerTypeCount), MakeGrouping( key: CosmosObject.Parse(ObjectValue), - value: DocumentsPerTypeCount), + value: DocumentsPerTypeCount), }), MakeGroupByTest( query: $"SELECT SUM(c.{nameof(MixedTypeDocument.MixedTypeField)}) as {nameof(GroupByProjection.MixedTypeField)}, " + @@ -361,9 +445,9 @@ private static async Task GroupByTests(Container container) }; foreach (GroupByUndefinedTestCase testCase in mixedTypeTestCases) - { + { foreach (int pageSize in PageSizes) - { + { List actual = await QueryWithoutContinuationTokensAsync( container, testCase.Query, @@ -457,14 +541,14 @@ private static List CreateDocuments(int count) case 4: mixedTypeElement = CosmosString.Create(StringValue); break; - - case 5: - mixedTypeElement = CosmosArray.Parse(ArrayValue); - break; - - case 6: - mixedTypeElement = CosmosObject.Parse(ObjectValue); - break; + + case 5: + mixedTypeElement = CosmosArray.Parse(ArrayValue); + break; + + case 6: + mixedTypeElement = CosmosObject.Parse(ObjectValue); + break; default: mixedTypeElement = null; diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/HybridSearchQueryTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/HybridSearchQueryTests.cs index df095840da..b3f240491e 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/HybridSearchQueryTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/HybridSearchQueryTests.cs @@ -58,19 +58,6 @@ public sealed class HybridSearchQueryTests : QueryTestsBase [TestMethod] public async Task SanityTests() - { - CosmosArray documentsArray = await LoadDocuments(); - IEnumerable documents = documentsArray.Select(document => document.ToString()); - - await this.CreateIngestQueryDeleteAsync( - connectionModes: ConnectionModes.Direct, // | ConnectionModes.Gateway, - collectionTypes: CollectionTypes.MultiPartition, // | CollectionTypes.SinglePartition, - documents: documents, - query: RunSanityTests, - indexingPolicy: CompositeIndexPolicy); - } - - private static async Task RunSanityTests(Container container, IReadOnlyList _) { List testCases = new List { @@ -146,6 +133,68 @@ ORDER BY RANK RRF(VectorDistance(c.vector, {SampleVector}), FullTextScore(c.titl new List>{new List{ 21, 75, 37, 24, 26, 35, 49, 87, 55, 9 } }), }; + await this.RunTests(testCases); + } + + [TestMethod] + [Ignore("This test is disabled because it needs an emulator refresh.")] + public async Task WeightedRankFusionTests() + { + List testCases = new List + { + MakeSanityTest(@" + SELECT c.index AS Index, c.title AS Title, c.text AS Text + FROM c + WHERE FullTextContains(c.title, 'John') OR FullTextContains(c.text, 'John') OR FullTextContains(c.text, 'United States') + ORDER BY RANK RRF(FullTextScore(c.title, ['John']), FullTextScore(c.text, ['United States']), [1, 1])", + new List>{ + new List{ 61, 51, 49, 54, 75, 24, 77, 76, 80, 25, 22, 2, 66, 57, 85 }, + new List{ 61, 51, 49, 54, 75, 24, 77, 76, 80, 25, 22, 2, 66, 85, 57 }, + }), + MakeSanityTest(@" + SELECT c.index AS Index, c.title AS Title, c.text AS Text + FROM c + WHERE FullTextContains(c.title, 'John') OR FullTextContains(c.text, 'John') OR FullTextContains(c.text, 'United States') + ORDER BY RANK RRF(FullTextScore(c.title, ['John']), FullTextScore(c.text, ['United States']), [10, 10])", + new List>{ + new List{ 61, 51, 49, 54, 75, 24, 77, 76, 80, 25, 22, 2, 66, 57, 85 }, + new List{ 61, 51, 49, 54, 75, 24, 77, 76, 80, 25, 22, 2, 66, 85, 57 }, + }), + MakeSanityTest(@" + SELECT TOP 10 c.index AS Index, c.title AS Title, c.text AS Text + FROM c + WHERE FullTextContains(c.title, 'John') OR FullTextContains(c.text, 'John') OR FullTextContains(c.text, 'United States') + ORDER BY RANK RRF(FullTextScore(c.title, ['John']), FullTextScore(c.text, ['United States']), [0.1, 0.1])", + new List>{ new List{ 61, 51, 49, 54, 75, 24, 77, 76, 80, 25 } }), + MakeSanityTest(@" + SELECT c.index AS Index, c.title AS Title, c.text AS Text + FROM c + WHERE FullTextContains(c.title, 'John') OR FullTextContains(c.text, 'John') OR FullTextContains(c.text, 'United States') + ORDER BY RANK RRF(FullTextScore(c.title, ['John']), FullTextScore(c.text, ['United States']), [-1, -1])", + new List>{ + new List{ 85, 57, 66, 2, 22, 25, 77, 76, 80, 75, 24, 49, 54, 51, 81 }, + new List{ 57, 85, 2, 66, 22, 25, 80, 76, 77, 24, 75, 54, 49, 51, 61 }, + }), + }; + + await this.RunTests(testCases); + } + + private async Task RunTests(IEnumerable testCases) + { + CosmosArray documentsArray = await LoadDocuments(); + IEnumerable documents = documentsArray.Select(document => document.ToString()); + + await this.CreateIngestQueryDeleteAsync( + connectionModes: ConnectionModes.Direct, // | ConnectionModes.Gateway, + collectionTypes: CollectionTypes.MultiPartition, // | CollectionTypes.SinglePartition, + documents: documents, + query: (container, _) => RunTests(container, testCases), + indexingPolicy: CompositeIndexPolicy); + } + + private static async Task RunTests(Container container, IEnumerable testCases) + { foreach (SanityTestCase testCase in testCases) { List result = await RunQueryCombinationsAsync( diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/MockCosmosQueryClient.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/MockCosmosQueryClient.cs index 6dd861ec88..63b9e88fbb 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/MockCosmosQueryClient.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/MockCosmosQueryClient.cs @@ -6,9 +6,7 @@ using Microsoft.Azure.Cosmos.Query.Core; using Microsoft.Azure.Cosmos.Query.Core.QueryPlan; using Microsoft.Azure.Documents; - using Microsoft.Azure.Cosmos.Diagnostics; using Microsoft.Azure.Cosmos.Query.Core.Monads; - using Microsoft.Azure.Cosmos.Query.Core.Pipeline; using Microsoft.Azure.Cosmos.Tracing; using Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination; diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/NegativeQueryTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/NegativeQueryTests.cs index c9deb491f5..69bacca9e2 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/NegativeQueryTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/NegativeQueryTests.cs @@ -114,6 +114,8 @@ async Task ImplementationAsync(Container container, IReadOnlyList ("QueryInfo.Offset", "SELECT c.name FROM c OFFSET 2147483648 LIMIT 10"), ("QueryInfo.Limit", "SELECT c.name FROM c OFFSET 10 LIMIT 2147483648"), ("QueryInfo.Top", "SELECT TOP 2147483648 c.name FROM c"), + ("QueryInfo.Offset", "SELECT c.name FROM c ORDER BY c.name OFFSET 2147483648 LIMIT 10"), + ("QueryInfo.Limit", "SELECT c.name FROM c ORDER BY c.name OFFSET 10 LIMIT 2147483648") }) try { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/NonStreamingOrderByQueryTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/NonStreamingOrderByQueryTests.cs index abf9261351..7881745f37 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/NonStreamingOrderByQueryTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/NonStreamingOrderByQueryTests.cs @@ -83,8 +83,8 @@ await this.CreateIngestQueryDeleteAsync( [TestMethod] public async Task QueryFeatureFlagTests() { - using EnvironmentVariable nonStreamingOrderByDisabled = new EnvironmentVariable( - ConfigurationManager.NonStreamingOrderByQueryFeatureDisabled); + using EnvironmentVariable hybridSearchQueryPlanOptimizationDisabled = new EnvironmentVariable( + ConfigurationManager.HybridSearchQueryPlanOptimizationDisabled); static async Task ImplementationAsync(Container container, IReadOnlyList _) { @@ -92,7 +92,7 @@ static async Task ImplementationAsync(Container container, IReadOnlyList ExecuteQueryPlanRequestAsync { this.validator.Validate(supportedQueryFeatures); - if (this.validator.ExpectNonStreamingOrderBy) + if (this.validator.ExpectQueryPlanOptimizationDisabled) { // older emulator in the github repo does not support non-streaming order by, and will send back 400 supportedQueryFeatures = SupportedQueryFeaturesString; diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/OptimisticDirectExecutionQueryTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/OptimisticDirectExecutionQueryTests.cs index 431081ecb2..d79b5bee36 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/OptimisticDirectExecutionQueryTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/OptimisticDirectExecutionQueryTests.cs @@ -1,44 +1,83 @@ -namespace Microsoft.Azure.Cosmos.EmulatorTests.Query -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Threading.Tasks; - using Microsoft.Azure.Cosmos.CosmosElements; - using Microsoft.Azure.Cosmos.Query.Core; - using Microsoft.VisualStudio.TestTools.UnitTesting; - - [TestClass] - [TestCategory("Query")] - public sealed class OptimisticDirectExecutionQueryTests : QueryTestsBase +namespace Microsoft.Azure.Cosmos.EmulatorTests.Query +{ + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Linq; + using System.Net; + using System.Text; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos.CosmosElements; + using Microsoft.Azure.Cosmos.Query.Core; + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + [TestCategory("Query")] + public sealed class OptimisticDirectExecutionQueryTests : QueryTestsBase { + private const int MaxConcurrency = -1; private const int NumberOfDocuments = 8; private const string PartitionKeyField = "key"; private const string NumberField = "numberField"; private const string NullField = "nullField"; + private const string TextField = "text"; + private const string VectorField = "vector"; + private const string ClientDisableOptimisticDirectExecution = "clientDisableOptimisticDirectExecution"; - private static class PageSizeOptions - { + private const QueryDrainingMode AllDrainModes = QueryDrainingMode.ContinuationToken | QueryDrainingMode.HoldState; + + private static readonly PartitionKey PartitionKey1 = new PartitionKey("1"); + private static readonly PartitionKey PartitionKey2 = new PartitionKey("2"); + + private static readonly Cosmos.VectorEmbeddingPolicy EmbeddingPolicy = new Cosmos.VectorEmbeddingPolicy( + new Collection() + { + new Embedding() + { + Path = $"/{VectorField}", + DataType = VectorDataType.Float32, + DistanceFunction = DistanceFunction.DotProduct, + Dimensions = 3, + } + }); + + private static readonly Cosmos.IndexingPolicy VectorIndexingPolicy = new Cosmos.IndexingPolicy() + { + IncludedPaths = new Collection() + { + new IncludedPath() { Path = "/*" }, + }, + VectorIndexes = new Collection() + { + new VectorIndexPath() + { + Path = $"/{VectorField}", + Type = VectorIndexType.Flat, + } + }, + }; + + private static class PageSizeOptions + { public static readonly int[] NonGroupByAndNoContinuationTokenPageSizeOptions = { -1, 10 }; public static readonly int[] NonGroupByWithContinuationTokenPageSizeOptions = { 1, 2 }; public static readonly int[] GroupByPageSizeOptions = { -1 }; - public static readonly int[] PageSize100 = { 100 }; - } - - [TestMethod] - public async Task TestPassingOptimisticDirectExecutionQueries() + public static readonly int[] PageSize100 = { 100 }; + } + + [TestMethod] + public async Task TestPassingOptimisticDirectExecutionQueries() { IReadOnlyList empty = new List(0); IReadOnlyList first5Integers = Enumerable.Range(0, 5).ToList(); IReadOnlyList first7Integers = Enumerable.Range(0, NumberOfDocuments).ToList(); IReadOnlyList first7IntegersReversed = Enumerable.Range(0, NumberOfDocuments).Reverse().ToList(); - + PartitionKey partitionKeyValue = new PartitionKey("/value"); - List singlePartitionContainerTestCases = new List() - { - // Tests for bool enableOptimisticDirectExecution + List singlePartitionContainerTestCases = new List() + { + // Tests for bool enableOptimisticDirectExecution CreateInput( query: $"SELECT TOP 5 VALUE r.numberField FROM r ORDER BY r.{PartitionKeyField}", expectedResult: first5Integers, @@ -52,8 +91,8 @@ public async Task TestPassingOptimisticDirectExecutionQueries() partitionKey: partitionKeyValue, enableOptimisticDirectExecution: false, pageSizeOptions: PageSizeOptions.NonGroupByAndNoContinuationTokenPageSizeOptions, - expectedPipelineType: TestInjections.PipelineType.Passthrough), - + expectedPipelineType: TestInjections.PipelineType.Passthrough), + // Simple query (requiresDist = false) CreateInput( query: $"SELECT VALUE r.numberField FROM r", @@ -105,7 +144,7 @@ public async Task TestPassingOptimisticDirectExecutionQueries() partitionKey: null, enableOptimisticDirectExecution: true, pageSizeOptions: PageSizeOptions.NonGroupByAndNoContinuationTokenPageSizeOptions, - expectedPipelineType: TestInjections.PipelineType.OptimisticDirectExecution), + expectedPipelineType: TestInjections.PipelineType.OptimisticDirectExecution), CreateInput( query: $"SELECT DISTINCT VALUE r.{NumberField} FROM r ORDER BY r.{NumberField} DESC", expectedResult: first7IntegersReversed, @@ -113,7 +152,7 @@ public async Task TestPassingOptimisticDirectExecutionQueries() enableOptimisticDirectExecution: true, pageSizeOptions: PageSizeOptions.NonGroupByWithContinuationTokenPageSizeOptions, expectedPipelineType: TestInjections.PipelineType.Specialized), - + // DISTINCT (requiresDist = true) CreateInput( query: $"SELECT DISTINCT VALUE r.{NumberField} FROM r", @@ -144,7 +183,7 @@ public async Task TestPassingOptimisticDirectExecutionQueries() partitionKey: null, enableOptimisticDirectExecution: true, pageSizeOptions: PageSizeOptions.GroupByPageSizeOptions, - expectedPipelineType: TestInjections.PipelineType.OptimisticDirectExecution), + expectedPipelineType: TestInjections.PipelineType.OptimisticDirectExecution), // TOP (requiresDist = false) CreateInput( @@ -234,11 +273,11 @@ public async Task TestPassingOptimisticDirectExecutionQueries() partitionKey: null, pageSizeOptions: PageSizeOptions.NonGroupByWithContinuationTokenPageSizeOptions, enableOptimisticDirectExecution: true, - expectedPipelineType: TestInjections.PipelineType.OptimisticDirectExecution) + expectedPipelineType: TestInjections.PipelineType.OptimisticDirectExecution) }; - List multiPartitionContainerTestCases = new List() - { + List multiPartitionContainerTestCases = new List() + { // Simple query (requiresDist = false) CreateInput( query: $"SELECT VALUE r.numberField FROM r", @@ -267,8 +306,8 @@ public async Task TestPassingOptimisticDirectExecutionQueries() partitionKey: null, enableOptimisticDirectExecution: true, pageSizeOptions: PageSizeOptions.NonGroupByWithContinuationTokenPageSizeOptions, - expectedPipelineType: TestInjections.PipelineType.Passthrough), - + expectedPipelineType: TestInjections.PipelineType.Passthrough), + // DISTINCT with ORDER BY (requiresDist = true) CreateInput( query: $"SELECT DISTINCT VALUE r.{NumberField} FROM r ORDER BY r.{NumberField} DESC", @@ -351,14 +390,7 @@ public async Task TestPassingOptimisticDirectExecutionQueries() enableOptimisticDirectExecution: true, pageSizeOptions: PageSizeOptions.NonGroupByAndNoContinuationTokenPageSizeOptions, expectedPipelineType: TestInjections.PipelineType.Specialized), - CreateInput( - query: $"SELECT TOP 5 VALUE r.{NumberField} FROM r ORDER BY r.{NumberField}", - expectedResult: first5Integers, - partitionKey: null, - enableOptimisticDirectExecution: true, - pageSizeOptions: PageSizeOptions.NonGroupByWithContinuationTokenPageSizeOptions, - expectedPipelineType: TestInjections.PipelineType.Specialized), - + // OFFSET LIMIT with WHERE and BETWEEN (requiresDist = false) CreateInput( query: $"SELECT VALUE r.numberField FROM r WHERE r.{NumberField} BETWEEN 0 AND {NumberOfDocuments} OFFSET 1 LIMIT 1", @@ -387,24 +419,141 @@ public async Task TestPassingOptimisticDirectExecutionQueries() partitionKey: null, enableOptimisticDirectExecution: true, pageSizeOptions: PageSizeOptions.NonGroupByWithContinuationTokenPageSizeOptions, - expectedPipelineType: TestInjections.PipelineType.Specialized) + expectedPipelineType: TestInjections.PipelineType.Specialized) }; - IReadOnlyList documents = CreateDocuments(NumberOfDocuments, PartitionKeyField, NumberField, NullField); - - await this.CreateIngestQueryDeleteAsync( - ConnectionModes.Direct | ConnectionModes.Gateway, - CollectionTypes.SinglePartition, - documents, - (container, documents) => RunTests(singlePartitionContainerTestCases, container), - "/" + PartitionKeyField); - - await this.CreateIngestQueryDeleteAsync( - ConnectionModes.Direct | ConnectionModes.Gateway, - CollectionTypes.MultiPartition, - documents, - (container, documents) => RunTests(multiPartitionContainerTestCases, container), - "/" + PartitionKeyField); + IReadOnlyList documents = CreateDocuments(NumberOfDocuments, PartitionKeyField, NumberField, NullField); + + await this.CreateIngestQueryDeleteAsync( + ConnectionModes.Direct | ConnectionModes.Gateway, + CollectionTypes.SinglePartition, + documents, + (container, documents) => RunTests(singlePartitionContainerTestCases, container, AllDrainModes), + "/" + PartitionKeyField); + + await this.CreateIngestQueryDeleteAsync( + ConnectionModes.Direct | ConnectionModes.Gateway, + CollectionTypes.MultiPartition, + documents, + (container, documents) => RunTests(multiPartitionContainerTestCases, container, AllDrainModes), + "/" + PartitionKeyField); + } + + [TestMethod] + public async Task TestOrderByQueries() + { + IReadOnlyList documents = new List + { + $@"{{ {PartitionKeyField}: ""{1}"", {NumberField}: {1}, {VectorField}: [1, 1, 1], {TextField}: ""Dogs have four paws and fur. They make good pets. They are loyal and have an acute sense of smell. They are canines."" }}", + $@"{{ {PartitionKeyField}: ""{1}"", {NumberField}: {2}, {VectorField}: [0, 0, 1], {TextField}: ""Cats have four paws and fur. They make good pets. They are independent and have extremely fast reflexes. They are felines."" }}", + $@"{{ {PartitionKeyField}: ""{1}"", {NumberField}: {3}, {VectorField}: [0, 1, 1], {TextField}: ""Chinchillas have four paws and fur. They make good pets. They are cute and their fur is very soft. They are rodents."" }}", + $@"{{ {PartitionKeyField}: ""{1}"", {NumberField}: {4}, {VectorField}: [1, 1, 1], {TextField}: ""Elephants have four legs and thick skin. They are massive and intelligent. They have excellent memory and are herbivores."" }}", + $@"{{ {PartitionKeyField}: ""{2}"", {NumberField}: {5}, {VectorField}: [2, 2, 0], {TextField}: ""Rabbits have four paws and soft fur. They make good pets. They are quick and agile with strong hind legs. They are lagomorphs."" }}", + $@"{{ {PartitionKeyField}: ""{2}"", {NumberField}: {6}, {VectorField}: [1, 1, 0], {TextField}: ""Horses have four hooves and flowing manes. They are strong and graceful. They have been companions to humans for centuries. They are equines."" }}", + $@"{{ {PartitionKeyField}: ""{2}"", {NumberField}: {7}, {VectorField}: [0, -1, -2], {TextField}: ""Lions have four paws and golden fur. They are powerful predators. They live in prides and are known as the king of beasts. They are felines."" }}", + $@"{{ {PartitionKeyField}: ""{2}"", {NumberField}: {8}, {VectorField}: [-1, -1, 0], {TextField}: ""Bears have four paws and thick fur. They are large omnivores. They can be both gentle and fierce depending on the situation. They are ursines."" }}", + }; + + List testCases = new List() + { + CreateInput( + query: $"SELECT VALUE r.{NumberField} FROM r WHERE r.{NumberField} != 1 ORDER BY VectorDistance(r.{VectorField}, [1, 1, 1])", + expectedResult: new List{5, 4, 6, 3, 2, 8, 7}, + partitionKey: null, + enableOptimisticDirectExecution: false, + pageSizeOptions: PageSizeOptions.NonGroupByWithContinuationTokenPageSizeOptions, + expectedPipelineType: TestInjections.PipelineType.Specialized), + CreateInput( + query: $"SELECT VALUE r.{NumberField} FROM r WHERE r.{NumberField} != 1 ORDER BY VectorDistance(r.{VectorField}, [1, 1, 1])", + expectedResult: new List{ 4, 3, 2 }, + partitionKey: PartitionKey1, + enableOptimisticDirectExecution: false, + pageSizeOptions: PageSizeOptions.NonGroupByWithContinuationTokenPageSizeOptions, + expectedPipelineType: TestInjections.PipelineType.Specialized), + CreateInput( + query: $"SELECT VALUE r.{NumberField} FROM r WHERE r.{NumberField} != 1 ORDER BY VectorDistance(r.{VectorField}, [1, 1, 1])", + expectedResult: new List{ 5, 6, 8, 7 }, + partitionKey: PartitionKey2, + enableOptimisticDirectExecution: false, + pageSizeOptions: PageSizeOptions.NonGroupByWithContinuationTokenPageSizeOptions, + expectedPipelineType: TestInjections.PipelineType.Specialized), + + CreateInput( + query: $"SELECT VALUE r.{NumberField} FROM r WHERE NOT FullTextContains(r.{TextField}, 'elephants') ORDER BY RANK FullTextScore(r.{TextField}, 'paws', 'fur', 'dogs', 'bears')", + expectedResult: new List{1, 8, 3, 2, 7, 5, 6}, + partitionKey: null, + enableOptimisticDirectExecution: false, + pageSizeOptions: PageSizeOptions.NonGroupByWithContinuationTokenPageSizeOptions, + expectedPipelineType: TestInjections.PipelineType.Specialized), + CreateInput( + query: $"SELECT VALUE r.{NumberField} FROM r WHERE NOT FullTextContains(r.{TextField}, 'elephants') ORDER BY RANK FullTextScore(r.{TextField}, 'paws', 'fur', 'dogs', 'bears')", + expectedResult: new List{ 1, 3, 2 }, + partitionKey: PartitionKey1, + enableOptimisticDirectExecution: false, + pageSizeOptions: PageSizeOptions.NonGroupByWithContinuationTokenPageSizeOptions, + expectedPipelineType: TestInjections.PipelineType.Specialized), + CreateInput( + query: $"SELECT VALUE r.{NumberField} FROM r WHERE NOT FullTextContains(r.{TextField}, 'elephants') ORDER BY RANK FullTextScore(r.{TextField}, 'paws', 'fur', 'dogs', 'bears')", + expectedResult: new List{ 8, 7, 5, 6 }, + partitionKey: PartitionKey2, + enableOptimisticDirectExecution: false, + pageSizeOptions: PageSizeOptions.NonGroupByWithContinuationTokenPageSizeOptions, + expectedPipelineType: TestInjections.PipelineType.Specialized), + + CreateInput( + query: $"SELECT VALUE r.{NumberField} FROM r WHERE NOT FullTextContains(r.{TextField}, 'elephants') ORDER BY RANK RRF(FullTextScore(r.{TextField}, 'paws'), FullTextScore(r.{TextField}, 'fur'), FullTextScore(r.{TextField}, 'dogs'), FullTextScore(r.{TextField}, 'bears'))", + expectedResult: new List{3, 1, 2, 8, 7, 5, 6}, + partitionKey: null, + enableOptimisticDirectExecution: false, + pageSizeOptions: PageSizeOptions.NonGroupByWithContinuationTokenPageSizeOptions, + expectedPipelineType: TestInjections.PipelineType.Specialized), + CreateInput( + query: $"SELECT VALUE r.{NumberField} FROM r WHERE NOT FullTextContains(r.{TextField}, 'elephants') ORDER BY RANK RRF(FullTextScore(r.{TextField}, 'paws'), FullTextScore(r.{TextField}, 'fur'), FullTextScore(r.{TextField}, 'dogs'), FullTextScore(r.{TextField}, 'bears'))", + expectedResult: new List{ 3, 1, 2 }, + partitionKey: PartitionKey1, + enableOptimisticDirectExecution: false, + pageSizeOptions: PageSizeOptions.NonGroupByWithContinuationTokenPageSizeOptions, + expectedPipelineType: TestInjections.PipelineType.Specialized), + CreateInput( + query: $"SELECT VALUE r.{NumberField} FROM r WHERE NOT FullTextContains(r.{TextField}, 'elephants') ORDER BY RANK RRF(FullTextScore(r.{TextField}, 'paws'), FullTextScore(r.{TextField}, 'fur'), FullTextScore(r.{TextField}, 'dogs'), FullTextScore(r.{TextField}, 'bears'))", + expectedResult: new List{ 8, 7, 5, 6}, + partitionKey: PartitionKey2, + enableOptimisticDirectExecution: false, + pageSizeOptions: PageSizeOptions.NonGroupByWithContinuationTokenPageSizeOptions, + expectedPipelineType: TestInjections.PipelineType.Specialized), + }; + + static Task RunTestsAsync( + CosmosClient cosmosClient, + Container container, + IReadOnlyList testCases) + { + ContainerInternal containerInternal = container as ContainerInternal; + Assert.IsNotNull(containerInternal, "Container should be of type ContainerInternal for direct execution tests."); + + DatabaseInternal databaseInternal = containerInternal.Database as DatabaseInternal; + Assert.IsNotNull(databaseInternal, "Database should be of type DatabaseInternal for direct execution tests."); + + MockCosmosQueryClient cosmosQueryClient = new MockCosmosQueryClient(cosmosClient.ClientContext, containerInternal, forceQueryPlanGatewayElseServiceInterop: true); + ContainerInlineCore containerInlineCore = new ContainerInlineCore(cosmosClient.ClientContext, databaseInternal, containerInternal.Id, cosmosQueryClient); + return RunTests(testCases, containerInlineCore, QueryDrainingMode.HoldState); + } + + foreach (ConnectionMode connectionMode in new[] { ConnectionMode.Gateway, ConnectionMode.Direct} ) + { + CosmosClient cosmosClient = this.CreateDefaultCosmosClient(connectionMode); + + await this.CreateIngestQueryDeleteAsync( + ToTestConnectionMode(connectionMode), + CollectionTypes.SinglePartition | CollectionTypes.MultiPartition, + documents, + (container, documents) => RunTestsAsync(cosmosClient, container, testCases), + "/" + PartitionKeyField, + VectorIndexingPolicy, + (_) => cosmosClient, + GeospatialType.Geography, + EmbeddingPolicy); + } } [TestMethod] @@ -474,40 +623,40 @@ public async Task TestQueriesWithPartitionKeyNone() expectedPipelineType: TestInjections.PipelineType.OptimisticDirectExecution), }; - List documents = new List(documentCount); - for (int i = 0; i < documentCount; ++i) - { - string document = $@"{{ {NumberField}: {i}, {NullField}: null }}"; - documents.Add(document); + List documents = new List(documentCount); + for (int i = 0; i < documentCount; ++i) + { + string document = $@"{{ {NumberField}: {i}, {NullField}: null }}"; + documents.Add(document); } await this.CreateIngestQueryDeleteAsync( ConnectionModes.Direct | ConnectionModes.Gateway, CollectionTypes.NonPartitioned | CollectionTypes.SinglePartition | CollectionTypes.MultiPartition, documents, - (container, documents) => RunTests(testCases, container), + (container, documents) => RunTests(testCases, container, AllDrainModes), "/undefinedPartitionKey"); - } - - [TestMethod] - public async Task TestFailingOptimisticDirectExecutionOutput() - { - IReadOnlyList documents = CreateDocuments(NumberOfDocuments, PartitionKeyField, NumberField, NullField); - - // check if bad continuation queries and syntax error queries are handled by pipeline - IDictionary invalidQueries = new Dictionary - { - { "SELECT * FROM t", Guid.NewGuid().ToString() }, - { "SELECT TOP 10 * FOM r", null }, - { "this is not a valid query", null }, - }; - - await this.CreateIngestQueryDeleteAsync( - ConnectionModes.Direct | ConnectionModes.Gateway, - CollectionTypes.SinglePartition | CollectionTypes.MultiPartition, - documents, - (container, documents) => RunFailingTests(container, invalidQueries), - "/" + PartitionKeyField); + } + + [TestMethod] + public async Task TestFailingOptimisticDirectExecutionOutput() + { + IReadOnlyList documents = CreateDocuments(NumberOfDocuments, PartitionKeyField, NumberField, NullField); + + // check if bad continuation queries and syntax error queries are handled by pipeline + IDictionary invalidQueries = new Dictionary + { + { "SELECT * FROM t", Guid.NewGuid().ToString() }, + { "SELECT TOP 10 * FOM r", null }, + { "this is not a valid query", null }, + }; + + await this.CreateIngestQueryDeleteAsync( + ConnectionModes.Direct | ConnectionModes.Gateway, + CollectionTypes.SinglePartition | CollectionTypes.MultiPartition, + documents, + (container, documents) => RunFailingTests(container, invalidQueries), + "/" + PartitionKeyField); } //TODO: Remove Ignore flag once emulator is updated to 1101 @@ -567,18 +716,18 @@ public async Task TestKnownIssues() expectedPipelineType: TestInjections.PipelineType.OptimisticDirectExecution) }; - List documents = new List(documentCount); - for (int i = 0; i < documentCount; ++i) - { - string document = $@"{{ {NumberField}: {i}, {NullField}: null }}"; - documents.Add(document); + List documents = new List(documentCount); + for (int i = 0; i < documentCount; ++i) + { + string document = $@"{{ {NumberField}: {i}, {NullField}: null }}"; + documents.Add(document); } await this.CreateIngestQueryDeleteAsync( ConnectionModes.Direct, CollectionTypes.SinglePartition, documents, - (container, documents) => RunTests(testCases, container), + (container, documents) => RunTests(testCases, container, AllDrainModes), "/undefinedPartitionKey"); } @@ -673,21 +822,21 @@ private async Task TestQueryExecutionUsingODEEnvironmentVariable(string environm Environment.SetEnvironmentVariable("AZURE_COSMOS_OPTIMISTIC_DIRECT_EXECUTION_ENABLED", environmentVariableValue); PartitionKey partitionKeyValue = new PartitionKey("/value"); List singlePartitionContainerTestCases = new List() - { + { CreateInput( query: $"SELECT TOP 5 VALUE r.numberField FROM r ORDER BY r.{PartitionKeyField}", expectedResult: first5Integers, partitionKey: partitionKeyValue, enableOptimisticDirectExecution: null, // Uses environment variable pageSizeOptions: PageSizeOptions.NonGroupByAndNoContinuationTokenPageSizeOptions, - expectedPipelineType: expectODEPipeline ? TestInjections.PipelineType.OptimisticDirectExecution : TestInjections.PipelineType.Passthrough), + expectedPipelineType: expectODEPipeline ? TestInjections.PipelineType.OptimisticDirectExecution : TestInjections.PipelineType.Passthrough), CreateInput( query: $"SELECT TOP 5 VALUE r.numberField FROM r ORDER BY r.{PartitionKeyField}", expectedResult: first5Integers, partitionKey: partitionKeyValue, enableOptimisticDirectExecution: false, // Overrides environment variable pageSizeOptions: PageSizeOptions.NonGroupByAndNoContinuationTokenPageSizeOptions, - expectedPipelineType: TestInjections.PipelineType.Passthrough), + expectedPipelineType: TestInjections.PipelineType.Passthrough), CreateInput( query: $"SELECT TOP 5 VALUE r.numberField FROM r ORDER BY r.{PartitionKeyField}", expectedResult: first5Integers, @@ -703,7 +852,7 @@ await this.CreateIngestQueryDeleteAsync( ConnectionModes.Direct | ConnectionModes.Gateway, CollectionTypes.SinglePartition, documents, - (container, documents) => RunTests(singlePartitionContainerTestCases, container), + (container, documents) => RunTests(singlePartitionContainerTestCases, container, AllDrainModes), "/" + PartitionKeyField); } finally @@ -711,117 +860,138 @@ await this.CreateIngestQueryDeleteAsync( // Attempt to protect other ODE tests from side-effects in case of test failure. Environment.SetEnvironmentVariable("AZURE_COSMOS_OPTIMISTIC_DIRECT_EXECUTION_ENABLED", null); } - } - - private static async Task RunTests(IEnumerable testCases, Container container) - { - foreach (DirectExecutionTestCase testCase in testCases) - { - foreach (int pageSize in testCase.PageSizeOptions) - { - QueryRequestOptions feedOptions = new QueryRequestOptions - { - MaxItemCount = pageSize, - PartitionKey = testCase.PartitionKey, - TestSettings = new TestInjections(simulate429s: false, simulateEmptyPages: false, new TestInjections.ResponseStats()) + } + + private static async Task RunTests(IEnumerable testCases, Container container, QueryDrainingMode queryDrainingMode) + { + foreach (DirectExecutionTestCase testCase in testCases) + { + foreach (int pageSize in testCase.PageSizeOptions) + { + QueryRequestOptions feedOptions = new QueryRequestOptions + { + MaxItemCount = pageSize, + PartitionKey = testCase.PartitionKey, + TestSettings = new TestInjections(simulate429s: false, simulateEmptyPages: false, new TestInjections.ResponseStats()), + MaxConcurrency = MaxConcurrency, }; if(testCase.EnableOptimisticDirectExecution.HasValue) { feedOptions.EnableOptimisticDirectExecution = testCase.EnableOptimisticDirectExecution.Value; - } - - List items = await RunQueryAsync( - container, - testCase.Query, - feedOptions); - - int[] actual = items.Cast().Select(x => (int)Number64.ToLong(x.Value)).ToArray(); - - Assert.IsTrue(testCase.ExpectedResult.SequenceEqual(actual)); - Assert.AreEqual(testCase.ExpectedPipelineType, feedOptions.TestSettings.Stats.PipelineType.Value); - } - } - } - - private static async Task RunFailingTests(Container container, IDictionary invalidQueries) - { - QueryRequestOptions feedOptions = new QueryRequestOptions - { - PartitionKey = new Cosmos.PartitionKey("/value"), - EnableOptimisticDirectExecution = true, - TestSettings = new TestInjections(simulate429s: false, simulateEmptyPages: false, new TestInjections.ResponseStats()) - }; - - foreach (KeyValuePair queryAndResult in invalidQueries) - { - try - { - await container.GetItemQueryIterator( - queryDefinition: new QueryDefinition(queryAndResult.Key), - continuationToken: queryAndResult.Value, - requestOptions: feedOptions).ReadNextAsync(); - - Assert.Fail("Expect exception"); - } - catch (CosmosException dce) - { - Assert.IsTrue(dce.StatusCode == HttpStatusCode.BadRequest); - } - catch (AggregateException aggrEx) - { - Assert.Fail(aggrEx.ToString()); - } - } - } - - private static IReadOnlyList CreateDocuments(int documentCount, string partitionKey, string numberField, string nullField) - { - List documents = new List(documentCount); - for (int i = 0; i < documentCount; ++i) - { - string document = $@"{{ {partitionKey}: ""/value"", {numberField}: {i}, {nullField}: null }}"; - documents.Add(document); - } - - return documents; - } - - private static DirectExecutionTestCase CreateInput( - string query, - IReadOnlyList expectedResult, - PartitionKey? partitionKey, - bool? enableOptimisticDirectExecution, - int[] pageSizeOptions, - TestInjections.PipelineType expectedPipelineType) - { - return new DirectExecutionTestCase(query, expectedResult, partitionKey, enableOptimisticDirectExecution, pageSizeOptions, expectedPipelineType); + } + + List items = await RunQueryCombinationsAsync( + container, + testCase.Query, + feedOptions, + queryDrainingMode); + + int[] actual = items.Cast().Select(x => (int)Number64.ToLong(x.Value)).ToArray(); + + bool resultsMatched = testCase.ExpectedResult.SequenceEqual(actual); + bool pipelineTypeMatched = testCase.ExpectedPipelineType == feedOptions.TestSettings.Stats.PipelineType.Value; + if(!resultsMatched || !pipelineTypeMatched) + { + StringBuilder errorMessage = new StringBuilder(); + errorMessage.AppendLine(testCase.ToString()); + errorMessage.AppendLine($"Actual: [{string.Join(", ", actual)}]"); + errorMessage.AppendLine($"Actual PipelineType: {feedOptions.TestSettings.Stats.PipelineType.Value}"); + + Assert.Fail(errorMessage.ToString()); + } + } + } + } + + private static async Task RunFailingTests(Container container, IDictionary invalidQueries) + { + QueryRequestOptions feedOptions = new QueryRequestOptions + { + PartitionKey = new Cosmos.PartitionKey("/value"), + EnableOptimisticDirectExecution = true, + TestSettings = new TestInjections(simulate429s: false, simulateEmptyPages: false, new TestInjections.ResponseStats()) + }; + + foreach (KeyValuePair queryAndResult in invalidQueries) + { + try + { + await container.GetItemQueryIterator( + queryDefinition: new QueryDefinition(queryAndResult.Key), + continuationToken: queryAndResult.Value, + requestOptions: feedOptions).ReadNextAsync(); + + Assert.Fail("Expect exception"); + } + catch (CosmosException dce) + { + Assert.IsTrue(dce.StatusCode == HttpStatusCode.BadRequest); + } + catch (AggregateException aggrEx) + { + Assert.Fail(aggrEx.ToString()); + } + } + } + + private static IReadOnlyList CreateDocuments(int documentCount, string partitionKey, string numberField, string nullField) + { + List documents = new List(documentCount); + for (int i = 0; i < documentCount; ++i) + { + string document = $@"{{ {partitionKey}: ""/value"", {numberField}: {i}, {nullField}: null }}"; + documents.Add(document); + } + + return documents; } - private readonly struct DirectExecutionTestCase - { - public string Query { get; } - public IReadOnlyList ExpectedResult { get; } - public PartitionKey? PartitionKey { get; } - public bool? EnableOptimisticDirectExecution { get; } - public int[] PageSizeOptions { get; } - public TestInjections.PipelineType ExpectedPipelineType { get; } - - public DirectExecutionTestCase( - string query, - IReadOnlyList expectedResult, - PartitionKey? partitionKey, - bool? enableOptimisticDirectExecution, - int[] pageSizeOptions, - TestInjections.PipelineType expectedPipelineType) - { - this.Query = query; - this.ExpectedResult = expectedResult; - this.PartitionKey = partitionKey; - this.EnableOptimisticDirectExecution = enableOptimisticDirectExecution; - this.PageSizeOptions = pageSizeOptions; - this.ExpectedPipelineType = expectedPipelineType; - } - } - } -} + private static DirectExecutionTestCase CreateInput( + string query, + IReadOnlyList expectedResult, + PartitionKey? partitionKey, + bool? enableOptimisticDirectExecution, + int[] pageSizeOptions, + TestInjections.PipelineType expectedPipelineType) + { + return new DirectExecutionTestCase(query, expectedResult, partitionKey, enableOptimisticDirectExecution, pageSizeOptions, expectedPipelineType); + } + + private readonly struct DirectExecutionTestCase + { + public string Query { get; } + public IReadOnlyList ExpectedResult { get; } + public PartitionKey? PartitionKey { get; } + public bool? EnableOptimisticDirectExecution { get; } + public int[] PageSizeOptions { get; } + public TestInjections.PipelineType ExpectedPipelineType { get; } + + public DirectExecutionTestCase( + string query, + IReadOnlyList expectedResult, + PartitionKey? partitionKey, + bool? enableOptimisticDirectExecution, + int[] pageSizeOptions, + TestInjections.PipelineType expectedPipelineType) + { + this.Query = query; + this.ExpectedResult = expectedResult; + this.PartitionKey = partitionKey; + this.EnableOptimisticDirectExecution = enableOptimisticDirectExecution; + this.PageSizeOptions = pageSizeOptions; + this.ExpectedPipelineType = expectedPipelineType; + } + + public override string ToString() + { + return $"Query: {this.Query}\n" + + $"PartitionKey: {this.PartitionKey}\n" + + $"EnableOptimisticDirectExecution: {this.EnableOptimisticDirectExecution}\n" + + $"PageSizeOptions: [{string.Join(", ", this.PageSizeOptions)}]\n" + + $"ExpectedPipelineType: {this.ExpectedPipelineType}\n" + + $"ExpectedResult: [{string.Join(", ", this.ExpectedResult)}]\n"; + } + } + } +} diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/PopulateIndexMetricsTest.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/PopulateIndexMetricsTest.cs index 084e7738a5..a6bd8e91e3 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/PopulateIndexMetricsTest.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/PopulateIndexMetricsTest.cs @@ -2,14 +2,10 @@ { using System; using System.Collections.Generic; - using System.Linq; - using System.Text; using System.Threading.Tasks; using Microsoft.Azure.Cosmos.CosmosElements; - using Microsoft.Azure.Cosmos.Query.Core.Metrics; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Azure.Documents; - using Newtonsoft.Json; using Microsoft.Azure.Cosmos.SDK.EmulatorTests.QueryOracle; [TestClass] diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/QueryAdvisorTest.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/QueryAdvisorTest.cs index b0851e4366..9b18bf1acd 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/QueryAdvisorTest.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/QueryAdvisorTest.cs @@ -5,14 +5,10 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.Query { using System; using System.Collections.Generic; - using System.Linq; - using System.Text; using System.Threading.Tasks; using Microsoft.Azure.Cosmos.CosmosElements; - using Microsoft.Azure.Cosmos.Query.Core.Metrics; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Azure.Documents; - using Newtonsoft.Json; using Microsoft.Azure.Cosmos.SDK.EmulatorTests.QueryOracle; [TestClass] diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/QueryTestsBase.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/QueryTestsBase.cs index 99048cd125..bf65aace55 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/QueryTestsBase.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/QueryTestsBase.cs @@ -10,13 +10,11 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.Query using System.Collections.ObjectModel; using System.Linq; using System.Net; - using System.Runtime.CompilerServices; using System.Runtime.ExceptionServices; using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.Azure.Cosmos.CosmosElements; - using Microsoft.Azure.Cosmos.Query.Core.Pipeline; using Microsoft.Azure.Cosmos.Routing; using Microsoft.Azure.Cosmos.SDK.EmulatorTests; using Microsoft.Azure.Cosmos.Tracing; @@ -102,15 +100,17 @@ private async Task> GetPartitionKeyRanges(Conta } private async Task CreateMultiPartitionContainer( - string partitionKey = "/id", - Microsoft.Azure.Cosmos.IndexingPolicy indexingPolicy = null, - Cosmos.GeospatialType geospatialType = Cosmos.GeospatialType.Geography) + string partitionKey, + Microsoft.Azure.Cosmos.IndexingPolicy indexingPolicy, + Cosmos.GeospatialType geospatialType, + Cosmos.VectorEmbeddingPolicy vectorEmbeddingPolicy) { ContainerResponse containerResponse = await this.CreatePartitionedContainer( throughput: 25000, partitionKey: partitionKey, indexingPolicy: indexingPolicy, - geospatialType); + geospatialType, + vectorEmbeddingPolicy); IReadOnlyList ranges = await this.GetPartitionKeyRanges(containerResponse); Assert.IsTrue( @@ -121,15 +121,17 @@ private async Task CreateMultiPartitionContainer( } private async Task CreateSinglePartitionContainer( - string partitionKey = "/id", - Microsoft.Azure.Cosmos.IndexingPolicy indexingPolicy = null, - Cosmos.GeospatialType geospatialType = Cosmos.GeospatialType.Geography) + string partitionKey, + Microsoft.Azure.Cosmos.IndexingPolicy indexingPolicy, + Cosmos.GeospatialType geospatialType, + Cosmos.VectorEmbeddingPolicy vectorEmbeddingPolicy) { ContainerResponse containerResponse = await this.CreatePartitionedContainer( throughput: 4000, partitionKey: partitionKey, indexingPolicy: indexingPolicy, - geospatialType: geospatialType); + geospatialType: geospatialType, + vectorEmbeddingPolicy: vectorEmbeddingPolicy); Assert.IsNotNull(containerResponse); Assert.AreEqual(HttpStatusCode.Created, containerResponse.StatusCode); @@ -158,9 +160,10 @@ await NonPartitionedContainerHelper.CreateNonPartitionedContainer( private async Task CreatePartitionedContainer( int throughput, - string partitionKey = "/id", - Microsoft.Azure.Cosmos.IndexingPolicy indexingPolicy = null, - Cosmos.GeospatialType geospatialType = Cosmos.GeospatialType.Geography) + string partitionKey, + Microsoft.Azure.Cosmos.IndexingPolicy indexingPolicy, + Cosmos.GeospatialType geospatialType, + Cosmos.VectorEmbeddingPolicy vectorEmbeddingPolicy) { // Assert that database exists (race deletes are possible when used concurrently) ResponseMessage responseMessage = await this.database.ReadStreamAsync(); @@ -190,7 +193,8 @@ private async Task CreatePartitionedContainer( Paths = new Collection { partitionKey }, Kind = PartitionKind.Hash }, - GeospatialConfig = new Cosmos.GeospatialConfig(geospatialType) + GeospatialConfig = new Cosmos.GeospatialConfig(geospatialType), + VectorEmbeddingPolicy = vectorEmbeddingPolicy }, // This throughput needs to be about half the max with multi master // otherwise it will create about twice as many partitions. @@ -206,57 +210,63 @@ private async Task CreatePartitionedContainer( private Task<(Container, IReadOnlyList)> CreateNonPartitionedContainerAndIngestDocumentsAsync( IEnumerable documents, - Cosmos.IndexingPolicy indexingPolicy = null, - Cosmos.GeospatialType geospatialType = Cosmos.GeospatialType.Geography) + Cosmos.IndexingPolicy indexingPolicy, + Cosmos.GeospatialType geospatialType) { return this.CreateContainerAndIngestDocumentsAsync( CollectionTypes.NonPartitioned, documents, partitionKey: null, indexingPolicy: indexingPolicy, - geospatialType: geospatialType); + geospatialType: geospatialType, + vectorEmbeddingPolicy: null); } private Task<(Container, IReadOnlyList)> CreateSinglePartitionContainerAndIngestDocumentsAsync( IEnumerable documents, - string partitionKey = "/id", - Cosmos.IndexingPolicy indexingPolicy = null, - Cosmos.GeospatialType geospatialType = Cosmos.GeospatialType.Geography) + string partitionKey, + Cosmos.IndexingPolicy indexingPolicy, + Cosmos.GeospatialType geospatialType, + Cosmos.VectorEmbeddingPolicy vectorEmbeddingPolicy) { return this.CreateContainerAndIngestDocumentsAsync( CollectionTypes.SinglePartition, documents, partitionKey, indexingPolicy, - geospatialType); + geospatialType, + vectorEmbeddingPolicy); } private Task<(Container, IReadOnlyList)> CreateMultiPartitionContainerAndIngestDocumentsAsync( IEnumerable documents, - string partitionKey = "/id", - Cosmos.IndexingPolicy indexingPolicy = null, - Cosmos.GeospatialType geospatialType = Cosmos.GeospatialType.Geography) + string partitionKey, + Cosmos.IndexingPolicy indexingPolicy, + Cosmos.GeospatialType geospatialType, + Cosmos.VectorEmbeddingPolicy vectorEmbeddingPolicy) { return this.CreateContainerAndIngestDocumentsAsync( CollectionTypes.MultiPartition, documents, partitionKey, indexingPolicy, - geospatialType); + geospatialType, + vectorEmbeddingPolicy); } private async Task<(Container, IReadOnlyList)> CreateContainerAndIngestDocumentsAsync( CollectionTypes collectionType, IEnumerable documents, - string partitionKey = "/id", - Cosmos.IndexingPolicy indexingPolicy = null, - Cosmos.GeospatialType geospatialType = Cosmos.GeospatialType.Geography) + string partitionKey, + Cosmos.IndexingPolicy indexingPolicy, + Cosmos.GeospatialType geospatialType, + Cosmos.VectorEmbeddingPolicy vectorEmbeddingPolicy) { Container container = collectionType switch { CollectionTypes.NonPartitioned => await this.CreateNonPartitionedContainerAsync(indexingPolicy, geospatialType), - CollectionTypes.SinglePartition => await this.CreateSinglePartitionContainer(partitionKey, indexingPolicy, geospatialType), - CollectionTypes.MultiPartition => await this.CreateMultiPartitionContainer(partitionKey, indexingPolicy, geospatialType), + CollectionTypes.SinglePartition => await this.CreateSinglePartitionContainer(partitionKey, indexingPolicy, geospatialType, vectorEmbeddingPolicy), + CollectionTypes.MultiPartition => await this.CreateMultiPartitionContainer(partitionKey, indexingPolicy, geospatialType, vectorEmbeddingPolicy), _ => throw new ArgumentException($"Unknown {nameof(CollectionTypes)} : {collectionType}"), }; List insertedDocuments = new List(); @@ -369,6 +379,16 @@ internal delegate Task Query( internal delegate CosmosClient CosmosClientFactory(ConnectionMode connectionMode); + internal static ConnectionModes ToTestConnectionMode(ConnectionMode connectionMode) + { + return connectionMode switch + { + ConnectionMode.Direct => ConnectionModes.Direct, + ConnectionMode.Gateway => ConnectionModes.Gateway, + _ => throw new ArgumentOutOfRangeException(nameof(connectionMode), connectionMode, null) + }; + } + internal Task CreateIngestQueryDeleteAsync( ConnectionModes connectionModes, CollectionTypes collectionTypes, @@ -377,7 +397,8 @@ internal Task CreateIngestQueryDeleteAsync( string partitionKey = "/id", Cosmos.IndexingPolicy indexingPolicy = null, CosmosClientFactory cosmosClientFactory = null, - Cosmos.GeospatialType geospatialType = Cosmos.GeospatialType.Geography) + Cosmos.GeospatialType geospatialType = Cosmos.GeospatialType.Geography, + Cosmos.VectorEmbeddingPolicy vectorEmbeddingPolicy = null) { Task queryWrapper(Container container, IReadOnlyList inputDocuments, object throwaway) { @@ -393,7 +414,8 @@ Task queryWrapper(Container container, IReadOnlyList inputDocument partitionKey, indexingPolicy, cosmosClientFactory, - geospatialType); + geospatialType, + vectorEmbeddingPolicy); } internal Task CreateIngestQueryDeleteAsync( @@ -405,7 +427,8 @@ internal Task CreateIngestQueryDeleteAsync( string partitionKey = "/id", Cosmos.IndexingPolicy indexingPolicy = null, CosmosClientFactory cosmosClientFactory = null, - Cosmos.GeospatialType geospatialType = Cosmos.GeospatialType.Geography) + Cosmos.GeospatialType geospatialType = Cosmos.GeospatialType.Geography, + Cosmos.VectorEmbeddingPolicy vectorEmbeddingPolicy = null) { return this.CreateIngestQueryDeleteAsync( connectionModes, @@ -416,7 +439,8 @@ internal Task CreateIngestQueryDeleteAsync( testArgs, partitionKey, indexingPolicy, - geospatialType); + geospatialType, + vectorEmbeddingPolicy); } /// @@ -446,7 +470,8 @@ internal async Task CreateIngestQueryDeleteAsync( T testArgs, string partitionKey = "/id", Cosmos.IndexingPolicy indexingPolicy = null, - Cosmos.GeospatialType geospatialType = Cosmos.GeospatialType.Geography) + Cosmos.GeospatialType geospatialType = Cosmos.GeospatialType.Geography, + Cosmos.VectorEmbeddingPolicy vectorEmbeddingPolicy = null) { try { @@ -468,12 +493,14 @@ internal async Task CreateIngestQueryDeleteAsync( documents, partitionKey, indexingPolicy, - geospatialType), + geospatialType, + vectorEmbeddingPolicy), CollectionTypes.MultiPartition => this.CreateMultiPartitionContainerAndIngestDocumentsAsync( documents, partitionKey, indexingPolicy, - geospatialType), + geospatialType, + vectorEmbeddingPolicy), _ => throw new ArgumentException($"Unknown {nameof(CollectionTypes)} : {collectionType}"), }; collectionsAndDocuments.Add(await createContainerTask); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/SanityQueryTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/SanityQueryTests.cs index f28ae7a98b..92d557f5ee 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/SanityQueryTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/SanityQueryTests.cs @@ -13,7 +13,6 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.Query using Microsoft.Azure.Cosmos.CosmosElements; using Microsoft.Azure.Cosmos.CosmosElements.Numbers; using Microsoft.Azure.Cosmos.Query.Core; - using Microsoft.Azure.Cosmos.Query.Core.QueryPlan; using Microsoft.Azure.Cosmos.SDK.EmulatorTests.QueryOracle; using Microsoft.Azure.Cosmos.Tracing; using Microsoft.Azure.Documents; @@ -779,13 +778,9 @@ async Task> AssertSpecializedAsync(string query, Cosmos.Part await AssertSpecializedAsync("SELECT * FROM c ORDER BY c._ts"); - // Parallel and ORDER BY with partition key - foreach (string query in new string[] - { - "SELECT * FROM c WHERE c.key = 5", - "SELECT * FROM c WHERE c.key = 5 ORDER BY c._ts", - }) - { + // Parallel with partition key + { + string query = "SELECT * FROM c WHERE c.key = 5"; List queryResults = await AssertPassthroughAsync(query, partitionKey); Assert.AreEqual( 3, diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/QueryPerfTest/ContentSerializationPerformanceTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/QueryPerfTest/ContentSerializationPerformanceTests.cs index 8ff5660c6f..987a9305b0 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/QueryPerfTest/ContentSerializationPerformanceTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/QueryPerfTest/ContentSerializationPerformanceTests.cs @@ -1,53 +1,106 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests { using System; - using System.Diagnostics; + using System.Collections.Generic; using System.IO; + using System.Linq; + using System.Text.Json; using System.Threading.Tasks; using Microsoft.Azure.Cosmos; - using Microsoft.Azure.Cosmos.Json; + using Microsoft.Azure.Documents; using Microsoft.VisualStudio.TestTools.UnitTesting; [Ignore] [TestClass] public class ContentSerializationPerformanceTests { - private const string RawDataFileName = "ContentSerializationPerformanceTestsRawData.csv"; private const string DiagnosticsDataFileName = "ContentSerializationPerformanceTestsDiagnosticsData.txt"; - private readonly QueryStatisticsDatumVisitor queryStatisticsDatumVisitor; + private readonly Dictionary queryStatisticsDatumVisitorMap; private readonly string endpoint; private readonly string authKey; private readonly string cosmosDatabaseId; private readonly string containerId; - private readonly string contentSerialization; - private readonly string query; - private readonly int numberOfIterations; - private readonly int warmupIterations; - private readonly int MaxConcurrency; - private readonly int MaxItemCount; + private readonly int insertDocumentCount; + private readonly IReadOnlyList queries; + private readonly int iterationCount; + private readonly int warmupIterationCount; + private readonly int maxConcurrency; + private readonly int maxItemCount; private readonly bool useStronglyTypedIterator; + private readonly string outputPath; + private readonly string outputDirectoryName; public ContentSerializationPerformanceTests() { - this.queryStatisticsDatumVisitor = new(); + this.queryStatisticsDatumVisitorMap = new Dictionary + { + { SupportedSerializationFormats.JsonText, new QueryStatisticsDatumVisitor() }, + { SupportedSerializationFormats.CosmosBinary, new QueryStatisticsDatumVisitor() } + }; + this.endpoint = Utils.ConfigurationManager.AppSettings["GatewayEndpoint"]; this.authKey = Utils.ConfigurationManager.AppSettings["MasterKey"]; this.cosmosDatabaseId = Utils.ConfigurationManager.AppSettings["QueryPerformanceTests.CosmosDatabaseId"]; this.containerId = Utils.ConfigurationManager.AppSettings["QueryPerformanceTests.ContainerId"]; - this.contentSerialization = Utils.ConfigurationManager.AppSettings["QueryPerformanceTests.ContentSerialization"]; - this.query = Utils.ConfigurationManager.AppSettings["QueryPerformanceTests.Query"]; - this.numberOfIterations = int.Parse(Utils.ConfigurationManager.AppSettings["QueryPerformanceTests.NumberOfIterations"]); - this.warmupIterations = int.Parse(Utils.ConfigurationManager.AppSettings["QueryPerformanceTests.WarmupIterations"]); - this.MaxConcurrency = int.Parse(Utils.ConfigurationManager.AppSettings["QueryPerformanceTests.MaxConcurrency"]); - this.MaxItemCount = int.Parse(Utils.ConfigurationManager.AppSettings["QueryPerformanceTests.MaxItemCount"]); + this.insertDocumentCount = int.Parse(Utils.ConfigurationManager.AppSettings["QueryPerformanceTests.InsertDocumentCount"]); + this.queries = JsonSerializer.Deserialize>(Utils.ConfigurationManager.AppSettings["QueryPerformanceTests.Queries"]); + this.iterationCount = int.Parse(Utils.ConfigurationManager.AppSettings["QueryPerformanceTests.NumberOfIterations"]); + this.warmupIterationCount = int.Parse(Utils.ConfigurationManager.AppSettings["QueryPerformanceTests.WarmupIterations"]); + this.maxConcurrency = int.Parse(Utils.ConfigurationManager.AppSettings["QueryPerformanceTests.MaxConcurrency"]); + this.maxItemCount = int.Parse(Utils.ConfigurationManager.AppSettings["QueryPerformanceTests.MaxItemCount"]); this.useStronglyTypedIterator = bool.Parse(Utils.ConfigurationManager.AppSettings["QueryPerformanceTests.UseStronglyTypedIterator"]); + this.outputPath = Utils.ConfigurationManager.AppSettings["QueryPerformanceTests.OutputPath"]; + this.outputDirectoryName = Utils.ConfigurationManager.AppSettings["QueryPerformanceTests.OutputDirectoryName"]; } [TestMethod] - public async Task ConnectEndpoint() + public async Task SetupBenchmark() { - using (CosmosClient client = new CosmosClient(this.endpoint, this.authKey, + CosmosClient client = new CosmosClient( + this.endpoint, + this.authKey, + new CosmosClientOptions + { + ConnectionMode = ConnectionMode.Direct + }); + + Cosmos.Database database = await client.CreateDatabaseIfNotExistsAsync(this.cosmosDatabaseId); + + FeedIterator iterator = database.GetContainerQueryIterator(); + + bool containerExists = false; + while (iterator.HasMoreResults) + { + FeedResponse containers = await iterator.ReadNextAsync().ConfigureAwait(false); + if (containers.Any(c => c.Id == this.containerId)) + { + containerExists = true; + break; + } + } + + if (containerExists) + { + Container previousContainer = database.GetContainer(this.containerId); + await previousContainer.DeleteContainerAsync(); + } + + Container container = await database.CreateContainerIfNotExistsAsync( + id: this.containerId, + partitionKeyPath: "/myPartitionKey", + throughput: 400 + ); + + await this.InsertDocuments(container); + } + + [TestMethod] + public async Task RunBenchmark() + { + using (CosmosClient client = new CosmosClient( + this.endpoint, + this.authKey, new CosmosClientOptions { ConnectionMode = ConnectionMode.Direct @@ -59,81 +112,160 @@ public async Task ConnectEndpoint() private async Task RunAsync(CosmosClient client) { - Database cosmosDatabase = client.GetDatabase(this.cosmosDatabaseId); - Container container = cosmosDatabase.GetContainer(this.containerId); - string rawDataPath = Path.GetFullPath(RawDataFileName); - MetricsSerializer metricsSerializer = new MetricsSerializer(); - for (int i = 0; i < this.numberOfIterations; i++) + Container container = client.GetContainer(this.cosmosDatabaseId, this.containerId); + string outputPath = Path.GetFullPath(!string.IsNullOrWhiteSpace(this.outputPath) ? this.outputPath : Directory.GetCurrentDirectory()); + + string fullOutputPath = Path.Combine(outputPath, this.outputDirectoryName); + if (!Directory.Exists(fullOutputPath)) { - await this.RunQueryAsync(container); + Directory.CreateDirectory(fullOutputPath); } - Console.WriteLine("File path for raw data: ", rawDataPath); - using (StreamWriter writer = new StreamWriter(new FileStream(rawDataPath, FileMode.Create, FileAccess.Write))) + foreach (string query in this.queries) { - metricsSerializer.Serialize(writer, this.queryStatisticsDatumVisitor, this.numberOfIterations, this.warmupIterations, rawData: true); + foreach (SupportedSerializationFormats serializationFormat in new[] { SupportedSerializationFormats.JsonText, SupportedSerializationFormats.CosmosBinary }) + { + for (int i = 0; i < this.warmupIterationCount; i++) + { + await this.RunQueryAsync(container, query, serializationFormat, isWarmup: true); + } + + MetricsSerializer metricsSerializer = new(); + for (int i = 0; i < this.iterationCount; i++) + { + await this.RunQueryAsync(container, query, serializationFormat, isWarmup: false); + } + metricsSerializer.Serialize(fullOutputPath, this.queryStatisticsDatumVisitorMap[serializationFormat], this.iterationCount, query, serializationFormat); + } } - metricsSerializer.Serialize(Console.Out, this.queryStatisticsDatumVisitor, this.numberOfIterations, this.warmupIterations, rawData: false); + Console.WriteLine($"Output file path: {fullOutputPath}"); + File.Delete(Path.GetFullPath(DiagnosticsDataFileName)); } - private async Task RunQueryAsync(Container container) + private async Task InsertDocuments(Container container) + { + string[] regions = { "Arizona", "California", "Florida", "Utah", "New York", "Oregon" }; + + for (int i = 0; i < this.insertDocumentCount; i++) + { + States state = new States + { + MyPartitionKey = $"partition-{i}", + Id = $"id-{i}", + Name = $"State-{i}", + City = $"City-{i % 1000}", + PostalCode = $"{(10000 + (i % 90000))}", + Region = regions[i % regions.Length], + UserDefinedID = i % 1000, + WordsArray = new List { "alpha", "beta", "gamma", "delta" }, + Tags = new Tags + { + Words = new List { "sun", "moon", "stars", "comet" }, + Numbers = $"{i % 100}-{(i / 2) % 100}-{(i / 3) % 100}" + }, + RecipientList = new List + { + new RecipientList + { + Name = $"Recipient-{i % 100}", + City = $"RecipientCity-{i % 1000}", + PostalCode = $"{(20000 + (i * 7) % 80000)}", + Region = regions[i % regions.Length], + GUID = $"guid-{i}", + Quantity = (i % 99) + 1 + } + } + }; + + await container.CreateItemAsync(state, new Cosmos.PartitionKey(state.MyPartitionKey)); + + if(i % 1000 == 0) + { + Console.WriteLine($"Number of documents inserted: " + i); + } + } + } + + private async Task RunQueryAsync(Container container, string query, SupportedSerializationFormats serializationFormat, bool isWarmup) { QueryRequestOptions requestOptions = new QueryRequestOptions() { - MaxConcurrency = this.MaxConcurrency, - MaxItemCount = this.MaxItemCount, + MaxConcurrency = this.maxConcurrency, + MaxItemCount = this.maxItemCount, + SupportedSerializationFormats = serializationFormat }; - if (this.useStronglyTypedIterator) + if (isWarmup) { - using (FeedIterator iterator = container.GetItemQueryIterator( - queryText: this.query, + using (FeedIterator iterator = container.GetItemQueryIterator( + queryText: query, requestOptions: requestOptions)) { - await this.GetIteratorResponse(iterator); + while (iterator.HasMoreResults) + { + await iterator.ReadNextAsync(); + } } } else { - using (FeedIterator distinctQueryIterator = container.GetItemQueryIterator( - queryText: this.query, + if (this.useStronglyTypedIterator) + { + using (FeedIterator iterator = container.GetItemQueryIterator( + queryText: query, requestOptions: requestOptions)) + { + await this.GetIteratorResponse(iterator, serializationFormat); + } + } + else { - await this.GetIteratorResponse(distinctQueryIterator); + using (FeedIterator iterator = container.GetItemQueryIterator( + queryText: query, + requestOptions: requestOptions)) + { + await this.GetIteratorResponse(iterator, serializationFormat); + } } } } - private async Task GetIteratorResponse(FeedIterator feedIterator) + private async Task GetIteratorResponse(FeedIterator feedIterator, SupportedSerializationFormats serializationFormat) { + string diagnosticDataPath = Path.GetFullPath(DiagnosticsDataFileName); + QueryStatisticsDatumVisitor visitor = this.queryStatisticsDatumVisitorMap[serializationFormat]; + MetricsAccumulator metricsAccumulator = new MetricsAccumulator(); Documents.ValueStopwatch totalTime = new Documents.ValueStopwatch(); - Documents.ValueStopwatch getTraceTime = new Documents.ValueStopwatch(); - string diagnosticDataPath = Path.GetFullPath(DiagnosticsDataFileName); + Documents.ValueStopwatch accumulateMetricsTime = new Documents.ValueStopwatch(); + while (feedIterator.HasMoreResults) { totalTime.Start(); FeedResponse response = await feedIterator.ReadNextAsync(); - getTraceTime.Start(); + accumulateMetricsTime.Start(); if (response.RequestCharge != 0) { using (StreamWriter outputFile = new StreamWriter(path: diagnosticDataPath, append: true)) { outputFile.WriteLine(response.Diagnostics.ToString()); } - metricsAccumulator.ReadFromTrace(response, this.queryStatisticsDatumVisitor); + metricsAccumulator.ReadFromTrace(response, visitor); } - getTraceTime.Stop(); + accumulateMetricsTime.Stop(); totalTime.Stop(); + if (response.RequestCharge != 0) { - this.queryStatisticsDatumVisitor.AddEndToEndTime(totalTime.ElapsedMilliseconds - getTraceTime.ElapsedMilliseconds); - this.queryStatisticsDatumVisitor.PopulateMetrics(); + visitor.AddEndToEndTime(totalTime.ElapsedMilliseconds - accumulateMetricsTime.ElapsedMilliseconds); + visitor.AddRequestCharge(response.RequestCharge); + visitor.PopulateMetrics(); } + totalTime.Reset(); - getTraceTime.Reset(); + accumulateMetricsTime.Reset(); } } } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/QueryPerfTest/MetricsAccumulator.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/QueryPerfTest/MetricsAccumulator.cs index a7e6032001..3d648857e1 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/QueryPerfTest/MetricsAccumulator.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/QueryPerfTest/MetricsAccumulator.cs @@ -1,6 +1,5 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests { - using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; @@ -13,125 +12,141 @@ internal class MetricsAccumulator { - private const string BackendKeyValue = "Query Metrics"; - private const string TransportKeyValue = "Client Side Request Stats"; - private const string ClientParseTimeNode = "POCO Materialization"; - private const string ClientDeserializationTimeNode = "Get Cosmos Element Response"; - private const string TransportNodeName = "Microsoft.Azure.Documents.ServerStoreModel Transport Request"; - - - public void ReadFromTrace(FeedResponse Response, QueryStatisticsDatumVisitor queryStatisticsDatumVisitor) + public void ReadFromTrace(FeedResponse response, QueryStatisticsDatumVisitor queryStatisticsDatumVisitor) { - ITrace trace = ((CosmosTraceDiagnostics)Response.Diagnostics).Value; + ITrace trace = ((CosmosTraceDiagnostics)response.Diagnostics).Value; - //POCO Materialization occurs once per iteration including all the roundtrips - List retrieveQueryMetricTraces = this.FindQueryMetrics(trace: trace, nodeNameOrKeyName: ClientParseTimeNode, isKeyName: false); + // POCO materialization occurs once per item each roundtrip for calls with status code 200 + List retrieveQueryMetricTraces = this.ExtractTraces(trace: trace, nodeOrKeyName: TraceDatumKeys.QueryResponseSerialization, isKeyName: false); foreach (ITrace queryMetricTrace in retrieveQueryMetricTraces) { queryStatisticsDatumVisitor.AddPocoTime(queryMetricTrace.Duration.TotalMilliseconds); } - //Get Cosmos Element Response occurs once per roundtrip for calls with status code 200 - List retrieveCosmosElementTraces = this.FindQueryMetrics(trace: trace, nodeNameOrKeyName: ClientDeserializationTimeNode, isKeyName: false); + // Get cosmos element response occurs once per roundtrip for calls with status code 200 + List getCosmosElementTraces = this.ExtractTraces(trace: trace, nodeOrKeyName: TraceDatumKeys.GetCosmosElementResponse, isKeyName: false); + + // Query combinedMetrics occurs once per roundtrip for calls with status code 200 + List queryMetricsTraces = this.ExtractTraces(trace: trace, nodeOrKeyName: TraceDatumKeys.QueryMetrics, isKeyName: true); - //Query metrics occurs once per roundtrip for calls with status code 200 - List backendMetrics = this.FindQueryMetrics(trace: trace, nodeNameOrKeyName: BackendKeyValue, isKeyName: true); + // Clientside request stats occur once per roundtrip for all status codes + List clientSideRequestStatsTraces = this.ExtractTraces( + trace: trace, + nodeOrKeyName: TraceDatumKeys.ClientSideRequestStats, + isKeyName: true, + currentNodeName: TraceDatumKeys.TransportRequest); - //Client metrics occurs once per roundtrip for all status codes - List transitMetrics = this.FindQueryMetrics(trace: trace, nodeNameOrKeyName: TransportKeyValue, isKeyName: true, currentNodeName: TransportNodeName); - List> backendAndClientMetrics = new(); - int i = 0; - int j = 0; - int k = 0; - foreach (ITrace node in transitMetrics) + List combinedMetricsList = new(); + int getCosmosElementTraceCount = 0; + int queryMetricsTraceCount = 0; + foreach (ITrace clientSideRequestStatsTrace in clientSideRequestStatsTraces) { - Debug.Assert(node.Data.Count == 1, "Exactly one transit metric expected"); - KeyValuePair kvp = node.Data.Single(); - Assert.IsInstanceOfType(kvp.Value, typeof(ClientSideRequestStatisticsTraceDatum)); - ClientSideRequestStatisticsTraceDatum clientSideRequestStatisticsTraceDatum = (ClientSideRequestStatisticsTraceDatum)kvp.Value; - foreach (ClientSideRequestStatisticsTraceDatum.StoreResponseStatistics storeResponse in clientSideRequestStatisticsTraceDatum.StoreResponseStatisticsList) + Debug.Assert(clientSideRequestStatsTrace.Data.Count == 1, "Expected 1 Client Side Request Stats Traces Object"); + + KeyValuePair clientSideMetrics = clientSideRequestStatsTrace.Data.Single(); + Assert.IsInstanceOfType(clientSideMetrics.Value, typeof(ClientSideRequestStatisticsTraceDatum)); + ClientSideRequestStatisticsTraceDatum clientSideRequestStatisticsTraceDatum = (ClientSideRequestStatisticsTraceDatum)clientSideMetrics.Value; + + foreach (ClientSideRequestStatisticsTraceDatum.StoreResponseStatistics storeResponseStats in clientSideRequestStatisticsTraceDatum.StoreResponseStatisticsList) { - if (storeResponse.StoreResult.StatusCode == StatusCodes.Ok) + if (storeResponseStats.StoreResult.StatusCode == StatusCodes.Ok) { - backendAndClientMetrics.Add(Tuple.Create(retrieveCosmosElementTraces[k], backendMetrics[j], node)); - j++; - k++; + combinedMetricsList.Add(new QueryCombinedMetricsTraces(getCosmosElementTraces[getCosmosElementTraceCount], queryMetricsTraces[queryMetricsTraceCount], clientSideRequestStatsTrace)); + getCosmosElementTraceCount++; + queryMetricsTraceCount++; } else { - //We add null values to the tuple since status codes other than Ok will not have data for 'Query Metrics' and 'Get Cosmos Element Response' - backendAndClientMetrics.Add(Tuple.Create(null, null, node)); + // Failed requests will only have Client Side Request Stats + combinedMetricsList.Add(new QueryCombinedMetricsTraces(null, null, clientSideRequestStatsTrace)); } } } - Debug.Assert(i == transitMetrics.Count, "All 'transit metrics' must be grouped."); - Debug.Assert(j == backendMetrics.Count, "All 'backend metrics' must be grouped."); - Debug.Assert(k == retrieveCosmosElementTraces.Count, "All 'Get Cosmos Element Response' traces must be grouped."); - - int l = 1; - foreach (Tuple metrics in backendAndClientMetrics) + int traceCount = 0; + foreach (QueryCombinedMetricsTraces combinedMetrics in combinedMetricsList) { - if (metrics.Item2 != null) + if (combinedMetrics.GetCosmosElementTrace != null) { - Debug.Assert(metrics.Item1 != null, "'Get Cosmos Element Response' is null"); - queryStatisticsDatumVisitor.AddGetCosmosElementResponseTime(metrics.Item1.Duration.TotalMilliseconds); - foreach (KeyValuePair kvp in metrics.Item2.Data) + queryStatisticsDatumVisitor.AddGetCosmosElementResponseTime(combinedMetrics.GetCosmosElementTrace.Duration.TotalMilliseconds); + queryStatisticsDatumVisitor.AddRequestCharge(response.RequestCharge); + + foreach (KeyValuePair datum in combinedMetrics.QueryMetricsTrace.Data) { - switch (kvp.Value) + switch (datum.Value) { case TraceDatum traceDatum: traceDatum.Accept(queryStatisticsDatumVisitor); break; default: - Debug.Fail("Unexpected type", $"Type not supported {metrics.Item2.GetType()}"); + Debug.Fail("Unexpected type", $"Type not supported {datum.Value.GetType()}"); break; } } - //add metrics to the list except for last roundtrip which is taken care of in ContentSerializationPerformanceTest class - if (l != backendMetrics.Count) + // Add combinedMetrics to the list except for last roundtrip which is taken care of in ContentSerializationPerformanceTest class + if (traceCount < queryMetricsTraces.Count - 1) { queryStatisticsDatumVisitor.PopulateMetrics(); } - l++; } - foreach (KeyValuePair kvp in metrics.Item3.Data) + foreach (KeyValuePair datum in combinedMetrics.ClientSideRequestStatsTrace.Data) { - switch (kvp.Value) + switch (datum.Value) { case TraceDatum traceDatum: traceDatum.Accept(queryStatisticsDatumVisitor); break; default: - Debug.Fail("Unexpected type", $"Type not supported {metrics.Item3.GetType()}"); + Debug.Fail("Unexpected type", $"Type not supported {datum.Value.GetType()}"); break; } } + + traceCount++; } } - private List FindQueryMetrics(ITrace trace, string nodeNameOrKeyName, bool isKeyName, string currentNodeName = null) + private List ExtractTraces(ITrace trace, string nodeOrKeyName, bool isKeyName, string currentNodeName = null) { - List queryMetricsNodes = new(); - Queue queue = new Queue(); - queue.Enqueue(trace); - while (queue.Count > 0) + List traceList = new(); + Queue traceQueue = new Queue(); + traceQueue.Enqueue(trace); + + while (traceQueue.Count > 0) { - ITrace node = queue.Dequeue(); - if ((isKeyName && node.Data.ContainsKey(nodeNameOrKeyName) && (currentNodeName == null || node.Name == currentNodeName)) || - (node.Name == nodeNameOrKeyName)) + ITrace traceObject = traceQueue.Dequeue(); + if ((isKeyName && traceObject.Data.ContainsKey(nodeOrKeyName) && (currentNodeName == null || traceObject.Name == currentNodeName)) || + (traceObject.Name == nodeOrKeyName)) { - queryMetricsNodes.Add(node); + traceList.Add(traceObject); } - foreach (ITrace child in node.Children) + + foreach (ITrace childTraceObject in traceObject.Children) { - queue.Enqueue(child); + traceQueue.Enqueue(childTraceObject); } } - return queryMetricsNodes; + return traceList; + } + + public readonly struct QueryCombinedMetricsTraces + { + public QueryCombinedMetricsTraces(ITrace getCosmosElementTrace, ITrace queryMetricsTrace, ITrace clientSideRequestStatsTrace) + { + Debug.Assert((getCosmosElementTrace == null) == (queryMetricsTrace == null)); + Debug.Assert(clientSideRequestStatsTrace != null, "Client Side Request Stats cannot be null"); + + this.GetCosmosElementTrace = getCosmosElementTrace; + this.QueryMetricsTrace = queryMetricsTrace; + this.ClientSideRequestStatsTrace = clientSideRequestStatsTrace; + } + + public ITrace GetCosmosElementTrace { get; } + public ITrace QueryMetricsTrace { get; } + public ITrace ClientSideRequestStatsTrace { get; } } } } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/QueryPerfTest/MetricsSerializer.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/QueryPerfTest/MetricsSerializer.cs index c73612caa7..2ad3cd628d 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/QueryPerfTest/MetricsSerializer.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/QueryPerfTest/MetricsSerializer.cs @@ -7,16 +7,13 @@ internal class MetricsSerializer { - private const string PrintMedian = "Median"; - private const string PrintQueryMetrics = "QueryMetrics"; - private const string PrintBadRequests = "BadRequest"; - private readonly Func[] metricsDelegate = new Func[] { metric => metric.RetrievedDocumentCount, metric => metric.RetrievedDocumentSize, metric => metric.OutputDocumentCount, - metric => metric.OutputDocumentSize, + metric => metric.OutputDocumentSize, + metric => metric.RUCharge, metric => metric.TotalQueryExecutionTime, metric => metric.DocumentLoadTime, metric => metric.DocumentWriteTime, @@ -79,7 +76,8 @@ private List SumOfRoundTrips(int roundTrips, IReadOnlyLi RetrievedDocumentCount = metricsPerRoundTrip.Sum(metric => metric.RetrievedDocumentCount), RetrievedDocumentSize = metricsPerRoundTrip.Sum(metric => metric.RetrievedDocumentSize), OutputDocumentCount = metricsPerRoundTrip.Sum(metric => metric.OutputDocumentCount), - OutputDocumentSize = metricsPerRoundTrip.Sum(metric => metric.OutputDocumentSize), + OutputDocumentSize = metricsPerRoundTrip.Sum(metric => metric.OutputDocumentSize), + RUCharge = metricsPerRoundTrip.Sum(metric => metric.RUCharge), TotalQueryExecutionTime = metricsPerRoundTrip.Sum(metric => metric.TotalQueryExecutionTime), DocumentLoadTime = metricsPerRoundTrip.Sum(metric => metric.DocumentLoadTime), DocumentWriteTime = metricsPerRoundTrip.Sum(metric => metric.DocumentWriteTime), @@ -100,81 +98,145 @@ private List SumOfRoundTrips(int roundTrips, IReadOnlyLi return sumOfRoundTripsList; } - - private List EliminateWarmupIterations(IReadOnlyList noWarmupList, int roundTrips, int warmupIterations) - { - int iterationsToEliminate = warmupIterations * roundTrips; - noWarmupList = noWarmupList.Skip(iterationsToEliminate).ToList(); - return noWarmupList.ToList(); - } - - public void Serialize(TextWriter textWriter, QueryStatisticsDatumVisitor queryStatisticsDatumVisitor, int numberOfIterations, int warmupIterations, bool rawData) - { - int roundTrips = queryStatisticsDatumVisitor.QueryMetricsList.Count / numberOfIterations; - if (rawData == false) - { - textWriter.WriteLine(roundTrips); - List noWarmupList = this.EliminateWarmupIterations(queryStatisticsDatumVisitor.QueryMetricsList, roundTrips, warmupIterations); - if (roundTrips > 1) - { - noWarmupList = this.SumOfRoundTrips(roundTrips, noWarmupList); - } - this.CalculateAverage(noWarmupList).ForEach(textWriter.WriteLine); - textWriter.WriteLine(); - textWriter.WriteLine(PrintMedian); - textWriter.WriteLine(); - this.CalculateMedian(noWarmupList.ToList()).ForEach(textWriter.WriteLine); - } - else - { - textWriter.WriteLine(); - textWriter.WriteLine(PrintQueryMetrics); - int roundTripCount = 1; - int iterationCount = 1; - textWriter.Write(string.Format("\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"{4}\",\"{5}\",\"{6}\",\"{7}\",\"{8}\",\"{9}\",\"{10}\"," + - "\"{11}\",\"{12}\",\"{13}\",\"{14}\",\"{15}\",\"{16}\",\"{17}\"", "Iteration", "RoundTrip", - "RetrievedDocumentCount", "RetrievedDocumentSize", "OutputDocumentCount", "OutputDocumentSize", "TotalQueryExecutionTime", - "DocumentLoadTime", "DocumentWriteTime", "Created", "ChannelAcquisitionStarted", "Pipelined", "TransitTime", "Received", - "Completed", "PocoTime", "GetCosmosElementResponseTime", "EndToEndTime")); - textWriter.WriteLine(); - foreach (QueryStatisticsMetrics metrics in queryStatisticsDatumVisitor.QueryMetricsList) - { - if (roundTripCount <= roundTrips) - { - textWriter.WriteLine(string.Format("\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"{4}\",\"{5}\",\"{6}\",\"{7}\",\"{8}\",\"{9}\",\"{10}\"," + - "\"{11}\",\"{12}\",\"{13}\",\"{14}\",\"{15}\",\"{16}\",\"{17}\"", iterationCount, roundTripCount, - metrics.RetrievedDocumentCount, metrics.RetrievedDocumentSize, metrics.OutputDocumentCount, - metrics.OutputDocumentSize, metrics.TotalQueryExecutionTime, metrics.DocumentLoadTime, metrics.DocumentWriteTime, - metrics.Created, metrics.ChannelAcquisitionStarted, metrics.Pipelined, metrics.TransitTime, metrics.Received, - metrics.Completed, metrics.PocoTime, metrics.GetCosmosElementResponseTime, metrics.EndToEndTime)); - - roundTripCount++; - } - else - { - iterationCount++; - roundTripCount = 1; - textWriter.WriteLine(string.Format("\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"{4}\",\"{5}\",\"{6}\",\"{7}\",\"{8}\",\"{9}\",\"{10}\"," + - "\"{11}\",\"{12}\",\"{13}\",\"{14}\",\"{15}\",\"{16}\",\"{17}\"", iterationCount, roundTripCount, - metrics.RetrievedDocumentCount, metrics.RetrievedDocumentSize, metrics.OutputDocumentCount, - metrics.OutputDocumentSize, metrics.TotalQueryExecutionTime, metrics.DocumentLoadTime, metrics.DocumentWriteTime, - metrics.Created, metrics.ChannelAcquisitionStarted, metrics.Pipelined, metrics.TransitTime, metrics.Received, - metrics.Completed, metrics.PocoTime, metrics.GetCosmosElementResponseTime, metrics.EndToEndTime)); - roundTripCount++; - } - } - - textWriter.WriteLine(); - textWriter.WriteLine(PrintBadRequests); - foreach (QueryStatisticsMetrics metrics in queryStatisticsDatumVisitor.BadRequestMetricsList) - { - textWriter.WriteLine(string.Format("\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"{4}\",\"{5}\"", metrics.BadRequestCreated, - metrics.BadRequestChannelAcquisitionStarted, metrics.BadRequestPipelined, metrics.BadRequestTransitTime, - metrics.BadRequestReceived, metrics.BadRequestCompleted)); - textWriter.WriteLine(); - } - } - textWriter.Flush(); + + public void Serialize(string outputPath, QueryStatisticsDatumVisitor visitor, int numberOfIterations, string query, Microsoft.Azure.Documents.SupportedSerializationFormats serializationFormat) + { + int roundTrips = visitor.QueryMetricsList.Count / numberOfIterations; + string formattedQuery = $"\"{query}\""; + List metricsList = visitor.QueryMetricsList.ToList(); + if (roundTrips > 1) + { + metricsList = this.SumOfRoundTrips(roundTrips, metricsList); + } + + string[] headers = { + "Query", + "TransportSerializationFormat", + "RetrievedDocumentCount", + "RetrievedDocumentSize", + "OutputDocumentCount", + "OutputDocumentSize", + "RUCharge", + "TotalQueryExecutionTime", + "DocumentLoadTime", + "DocumentWriteTime", + "Created", + "ChannelAcquisitionStarted", + "Pipelined", + "TransitTime", + "Received", + "Completed", + "PocoTime", + "GetCosmosElementResponseTime", + "EndToEndTime" + }; + + string averagesPath = Path.Combine(outputPath, "averages.csv"); + bool fileExists = File.Exists(averagesPath); + + List averageData = this.CalculateAverage(metricsList); + using (StreamWriter writer = new StreamWriter(averagesPath, append: true)) + { + if (!fileExists) + { + writer.WriteLine(string.Join(",", headers)); + } + + writer.WriteLine(formattedQuery + "," + serializationFormat + "," + string.Join(",", averageData)); + } + + string mediansPath = Path.Combine(outputPath, "medians.csv"); + fileExists = File.Exists(mediansPath); + + List medianData = this.CalculateMedian(metricsList); + using (StreamWriter writer = new StreamWriter(mediansPath, append: true)) + { + if (!fileExists) + { + writer.WriteLine(string.Join(",", headers)); + } + + writer.WriteLine(formattedQuery + "," + serializationFormat + "," + string.Join(",", medianData)); + } + + string metricsPath = Path.Combine(outputPath, "raw_data.csv"); + fileExists = File.Exists(metricsPath); + + using (StreamWriter writer = new StreamWriter(metricsPath, append: true)) + { + if (!fileExists) + { + string[] fullHeaders = new string[] { "Iteration", "RoundTrip" }.Concat(headers).ToArray(); + writer.WriteLine(string.Join(",", fullHeaders)); + } + + int iteration = 1; + int roundTrip = 1; + foreach (QueryStatisticsMetrics metrics in visitor.QueryMetricsList) + { + object[] values = new object[] + { + formattedQuery, + serializationFormat, + iteration, + roundTrip, + metrics.RetrievedDocumentCount, + metrics.RetrievedDocumentSize, + metrics.OutputDocumentCount, + metrics.OutputDocumentSize, + metrics.RUCharge, + metrics.TotalQueryExecutionTime, + metrics.DocumentLoadTime, + metrics.DocumentWriteTime, + metrics.Created, + metrics.ChannelAcquisitionStarted, + metrics.Pipelined, + metrics.TransitTime, + metrics.Received, + metrics.Completed, + metrics.PocoTime, + metrics.GetCosmosElementResponseTime, + metrics.EndToEndTime + }; + writer.WriteLine(string.Join(",", values)); + + iteration++; + if (iteration > numberOfIterations) + { + iteration = 1; + roundTrip++; + } + } + } + + // Write bad_requests.csv + string badRequestsPath = Path.Combine(outputPath, "bad_requests.csv"); + using (StreamWriter writer = new StreamWriter(badRequestsPath)) + { + string[] badRequestHeaders = { + "BadRequestCreated", + "BadRequestChannelAcquisitionStarted", + "BadRequestPipelined", + "BadRequestTransitTime", + "BadRequestReceived", + "BadRequestCompleted" + }; + writer.WriteLine(string.Join(",", badRequestHeaders)); + + foreach (QueryStatisticsMetrics metrics in visitor.BadRequestMetricsList) + { + double[] values = new double[] + { + metrics.BadRequestCreated, + metrics.BadRequestChannelAcquisitionStarted, + metrics.BadRequestPipelined, + metrics.BadRequestTransitTime, + metrics.BadRequestReceived, + metrics.BadRequestCompleted + }; + writer.WriteLine(string.Join(",", values)); + } + } } } } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/QueryPerfTest/QueryStatisticsDatumVisitor.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/QueryPerfTest/QueryStatisticsDatumVisitor.cs index c100146bdb..1c13e90a2d 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/QueryPerfTest/QueryStatisticsDatumVisitor.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/QueryPerfTest/QueryStatisticsDatumVisitor.cs @@ -37,6 +37,11 @@ public void AddPocoTime(double time) public void AddGetCosmosElementResponseTime(double time) { this.queryMetrics.GetCosmosElementResponseTime = time; + } + + public void AddRequestCharge(double rus) + { + this.queryMetrics.RUCharge = rus; } public void Visit(QueryMetricsTraceDatum queryMetricsTraceDatum) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/SessionRetryOptionsTest.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/SessionRetryOptionsTest.cs new file mode 100644 index 0000000000..4f87e51e19 --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/SessionRetryOptionsTest.cs @@ -0,0 +1,484 @@ +namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests +{ + using System; + using System.Collections.Generic; + using System.Data; + using System.Diagnostics; + using System.Linq; + using System.Net; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos; + using Microsoft.Azure.Cosmos.FaultInjection; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Container = Container; + + [TestClass] + public class SessionRetryOptionsTest + { + private string connectionString; + private IDictionary writeRegionMap; + + // to run code before running each test + [TestInitialize] + public async Task TestInitAsync() + { + this.connectionString = ConfigurationManager.GetEnvironmentVariable("COSMOSDB_MULTI_REGION", null); + if (string.IsNullOrEmpty(this.connectionString)) + { + Assert.Fail("Set environment variable COSMOSDB_MULTI_REGION to run the tests"); + } + + CosmosClient client = new CosmosClient(this.connectionString); + await MultiRegionSetupHelpers.GetOrCreateMultiRegionDatabaseAndContainers(client); + this.writeRegionMap = client.DocumentClient.GlobalEndpointManager.GetAvailableWriteEndpointsByLocation(); + Assert.IsTrue(this.writeRegionMap.Count() >= 2); + + } + + [TestMethod] + [DataRow(FaultInjectionOperationType.ReadItem, DisplayName = "No retries for ReadItem when MaxInRegionRetryCount is 0 and EnableRemoteRegionPreferredForSessionRetry is true")] + [DataRow(FaultInjectionOperationType.QueryItem, DisplayName = "No retries for QueryItem when MaxInRegionRetryCount is 0 and and EnableRemoteRegionPreferredForSessionRetry is true")] + [TestCategory("MultiMaster")] + public async Task ReadOrQueryOperationWithMaxInRegionRetryCountZero(FaultInjectionOperationType faultInjectionOperationType) + { + string[] preferredRegions = this.writeRegionMap.Keys.ToArray(); + + FaultInjectionRule badSessionTokenRule = new FaultInjectionRuleBuilder( + id: "badSessionTokenRule", + condition: + new FaultInjectionConditionBuilder() + .WithOperationType(faultInjectionOperationType) + .WithRegion(preferredRegions[0]) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.ReadSessionNotAvailable) + .Build()) + .WithDuration(TimeSpan.FromMinutes(10)) + .Build(); + + List rules = new List() { badSessionTokenRule }; + FaultInjector faultInjector = new FaultInjector(rules); + Assert.IsNotNull(faultInjector); + + CosmosClientOptions clientOptions = new CosmosClientOptions() + { + EnableRemoteRegionPreferredForSessionRetry = true, + ConsistencyLevel = ConsistencyLevel.Session, + ApplicationPreferredRegions = preferredRegions, + ConnectionMode = ConnectionMode.Direct, + }; + + // Explicitly set MaxInRegionRetryCount to 0 in SessionRetryOptions + clientOptions.SessionRetryOptions.MaxInRegionRetryCount = 0; + using (CosmosClient faultInjectionClient = new CosmosClient( + connectionString: this.connectionString, + clientOptions: faultInjector.GetFaultInjectionClientOptions(clientOptions))) + { + Database database = faultInjectionClient.GetDatabase(MultiRegionSetupHelpers.dbName); + Container container = await database.CreateContainerIfNotExistsAsync("sessionRetryPolicy", "/id"); + string GUID = Guid.NewGuid().ToString(); + dynamic testObject = new + { + id = GUID, + name = "customer one", + address = new + { + line1 = "45 new street", + city = "mckinney", + postalCode = "98989", + } + }; + + ItemResponse response = await container.CreateItemAsync(testObject); + Assert.IsNotNull(response); + + OperationExecutionResult executionResult = await this.PerformDocumentOperation(faultInjectionOperationType, container, testObject); + this.ValidateOperationExecutionResult(executionResult, true); + + // Assert that only the original attempt happened (no retries) + long hitCount = badSessionTokenRule.GetHitCount(); + Assert.AreEqual(4, hitCount, $"There should be only one attempt (no retries) for {faultInjectionOperationType} when MaxInRegionRetryCount is 0 and RemotePreferredRegion is set to true."); + } + + } + + [TestMethod] + [DataRow(FaultInjectionOperationType.ReadItem, 2, true, DisplayName = "Validate Read Item operation with remote region preferred.")] + [DataRow(FaultInjectionOperationType.QueryItem, 1, true, DisplayName = "Validate Query Item operation with remote region preferred.")] + [DataRow(FaultInjectionOperationType.ReadItem, 2, false, DisplayName = "Validate Read Item operation with local region preferred.")] + [DataRow(FaultInjectionOperationType.QueryItem, 2, false, DisplayName = "Validate Query Item operation with local region preferred.")] + [TestCategory("MultiMaster")] + public async Task ReadOperationWithReadSessionUnavailableTest(FaultInjectionOperationType faultInjectionOperationType, + int sessionTokenMismatchRetryAttempts, Boolean remoteRegionPreferred) + { + string[] preferredRegions = this.writeRegionMap.Keys.ToArray(); + Environment.SetEnvironmentVariable(ConfigurationManager.MinInRegionRetryTimeForWritesInMs, "100"); + Environment.SetEnvironmentVariable(ConfigurationManager.MaxRetriesInLocalRegionWhenRemoteRegionPreferred, Convert.ToString(sessionTokenMismatchRetryAttempts)); + try + { + // if I go to first region for reading an item, I should get a 404/2002 response for 10 minutes + FaultInjectionRule badSessionTokenRule = new FaultInjectionRuleBuilder( + id: "badSessionTokenRule", + condition: + new FaultInjectionConditionBuilder() + .WithOperationType(faultInjectionOperationType) + .WithRegion(preferredRegions[0]) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.ReadSessionNotAvailable) + .Build()) + .WithDuration(TimeSpan.FromMinutes(10)) + .Build(); + + List rules = new List() { badSessionTokenRule }; + FaultInjector faultInjector = new FaultInjector(rules); + Assert.IsNotNull(faultInjector); + CosmosClientOptions clientOptions = new CosmosClientOptions() + { + EnableRemoteRegionPreferredForSessionRetry = remoteRegionPreferred, + ConsistencyLevel = ConsistencyLevel.Session, + ApplicationPreferredRegions = preferredRegions, + ConnectionMode = ConnectionMode.Direct, + }; + + using (CosmosClient faultInjectionClient = new CosmosClient( + connectionString: this.connectionString, + clientOptions: faultInjector.GetFaultInjectionClientOptions(clientOptions))) + { + Database database = faultInjectionClient.GetDatabase(MultiRegionSetupHelpers.dbName); + Container container = await database.CreateContainerIfNotExistsAsync("sessionRetryPolicy", "/id"); + string GUID = Guid.NewGuid().ToString(); + dynamic testObject = new + { + id = GUID, + name = "customer one", + address = new + { + line1 = "45 new street", + city = "mckinney", + postalCode = "98989", + } + + }; + + ItemResponse response = await container.CreateItemAsync(testObject); + Assert.IsNotNull(response); + + OperationExecutionResult executionResult = await this.PerformDocumentOperation(faultInjectionOperationType, container, testObject); + this.ValidateOperationExecutionResult(executionResult, remoteRegionPreferred); + + // For a non-write operation, the request can go to multiple replicas (upto 4 replicas) + // Check if the SessionTokenMismatchRetryPolicy retries on the bad / lagging region + // for sessionTokenMismatchRetryAttempts by tracking the badSessionTokenRule hit count + long hitCount = badSessionTokenRule.GetHitCount(); + + if (remoteRegionPreferred) + { + Assert.IsTrue(hitCount >= sessionTokenMismatchRetryAttempts && hitCount <= (1 + sessionTokenMismatchRetryAttempts) * 4); + } + } + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.MinInRegionRetryTimeForWritesInMs, null); + Environment.SetEnvironmentVariable(ConfigurationManager.MaxRetriesInLocalRegionWhenRemoteRegionPreferred, null); + } + } + + [TestMethod] + [DataRow(FaultInjectionOperationType.CreateItem, 2, true, DisplayName = "Validate Write Item operation with remote region preferred.")] + [DataRow(FaultInjectionOperationType.ReplaceItem, 1, true, DisplayName = "Validate Replace Item operation with remote region preferred.")] + [DataRow(FaultInjectionOperationType.DeleteItem, 2, true, DisplayName = "Validate Delete Item operation with remote region preferred.")] + [DataRow(FaultInjectionOperationType.UpsertItem, 3, true, DisplayName = "Validate Upsert Item operation with remote region preferred.")] + [DataRow(FaultInjectionOperationType.PatchItem, 1, true, DisplayName = "Validate Patch Item operation with remote region preferred.")] + [DataRow(FaultInjectionOperationType.CreateItem, 3, false, DisplayName = "Validate Write Item operation with local region preferred.")] + [DataRow(FaultInjectionOperationType.ReplaceItem, 1, false, DisplayName = "Validate Replace Item operation with local region preferred.")] + [DataRow(FaultInjectionOperationType.DeleteItem, 2, false, DisplayName = "Validate Delete Item operation with local region preferred.")] + [DataRow(FaultInjectionOperationType.UpsertItem, 1, false, DisplayName = "Validate Upsert Item operation with local region preferred.")] + [DataRow(FaultInjectionOperationType.PatchItem, 1, false, DisplayName = "Validate Patch Item operation with remote region preferred.")] + [TestCategory("MultiMaster")] + public async Task WriteOperationWithReadSessionUnavailableTest(FaultInjectionOperationType faultInjectionOperationType, + int sessionTokenMismatchRetryAttempts, Boolean remoteRegionPreferred) + { + + string[] preferredRegions = this.writeRegionMap.Keys.ToArray(); + Environment.SetEnvironmentVariable(ConfigurationManager.MinInRegionRetryTimeForWritesInMs, "100"); + Environment.SetEnvironmentVariable(ConfigurationManager.MaxRetriesInLocalRegionWhenRemoteRegionPreferred, Convert.ToString(sessionTokenMismatchRetryAttempts)); + + try + { + FaultInjectionRule badSessionTokenRule = new FaultInjectionRuleBuilder( + id: "badSessionTokenRule", + condition: + new FaultInjectionConditionBuilder() + .WithOperationType(faultInjectionOperationType) + .WithRegion(preferredRegions[0]) + .Build(), + result: + FaultInjectionResultBuilder.GetResultBuilder(FaultInjectionServerErrorType.ReadSessionNotAvailable) + .Build()) + .WithDuration(TimeSpan.FromMinutes(10)) + .Build(); + + List rules = new List() { badSessionTokenRule }; + FaultInjector faultInjector = new FaultInjector(rules); + + CosmosClientOptions clientOptions = new CosmosClientOptions() + { + EnableRemoteRegionPreferredForSessionRetry = remoteRegionPreferred, + ConsistencyLevel = ConsistencyLevel.Session, + ApplicationPreferredRegions = preferredRegions, + ConnectionMode = ConnectionMode.Direct, + }; + + using (CosmosClient faultInjectionClient = new CosmosClient( + connectionString: this.connectionString, + clientOptions: faultInjector.GetFaultInjectionClientOptions(clientOptions))) + { + Database database = faultInjectionClient.GetDatabase(MultiRegionSetupHelpers.dbName); + Container container = await database.CreateContainerIfNotExistsAsync("sessionRetryPolicy", "/id"); + string GUID = Guid.NewGuid().ToString(); + dynamic testObject = new + { + id = GUID, + name = "customer one", + address = new + { + line1 = "45 new street", + city = "mckinney", + postalCode = "98989", + } + + }; + + OperationExecutionResult executionResult = await this.PerformDocumentOperation(faultInjectionOperationType, container, testObject); + this.ValidateOperationExecutionResult(executionResult, remoteRegionPreferred); + + // For a write operation, the request can just go to the primary replica + // Check if the SessionTokenMismatchRetryPolicy retries on the bad / lagging region + // for sessionTokenMismatchRetryAttempts by tracking the badSessionTokenRule hit count + long hitCount = badSessionTokenRule.GetHitCount(); + if (remoteRegionPreferred) + { + // higher hit count is possible while in MinRetryWaitTimeWithinRegion + Assert.IsTrue(hitCount >= sessionTokenMismatchRetryAttempts); + } + } + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.MinInRegionRetryTimeForWritesInMs, null); + Environment.SetEnvironmentVariable(ConfigurationManager.MaxRetriesInLocalRegionWhenRemoteRegionPreferred, null); + } + } + + private void ValidateOperationExecutionResult(OperationExecutionResult operationExecutionResult, Boolean remoteRegionPreferred) + { + int sessionTokenMismatchDefaultWaitTime = 5000; + + FaultInjectionOperationType executionOpType = operationExecutionResult.OperationType; + HttpStatusCode statusCode = operationExecutionResult.StatusCode; + + int executionDuration = operationExecutionResult.Duration; + Trace.TraceInformation($" status code is {statusCode}"); + Trace.TraceInformation($" execution duration is {executionDuration}"); + + if (executionOpType == FaultInjectionOperationType.CreateItem) + { + Assert.IsTrue(statusCode == HttpStatusCode.Created); + } + else if (executionOpType == FaultInjectionOperationType.DeleteItem) + { + Assert.IsTrue(statusCode == HttpStatusCode.NoContent); + + } + else if (executionOpType == FaultInjectionOperationType.UpsertItem) + { + Assert.IsTrue(statusCode == HttpStatusCode.OK || statusCode == HttpStatusCode.Created); + + } + else + { + Assert.IsTrue(statusCode == HttpStatusCode.OK); + } + + if (remoteRegionPreferred) + { + Assert.IsTrue(executionDuration < sessionTokenMismatchDefaultWaitTime); + } + else + { + Assert.IsTrue(executionDuration > sessionTokenMismatchDefaultWaitTime); + } + } + + + private async Task PerformDocumentOperation(FaultInjectionOperationType operationType, Container container, + dynamic testObject) + { + + Stopwatch durationTimer = new Stopwatch(); + if (operationType == FaultInjectionOperationType.ReadItem) + { + durationTimer.Start(); + ItemResponse itemResponse = await container.ReadItemAsync(testObject.id, + new PartitionKey(testObject.id)); + durationTimer.Stop(); + int timeElapsed = Convert.ToInt32(durationTimer.Elapsed.TotalMilliseconds); + + return new OperationExecutionResult( + itemResponse.Diagnostics, + timeElapsed, + itemResponse.StatusCode, + operationType); + + } + + if (operationType == FaultInjectionOperationType.CreateItem) + { + durationTimer.Start(); + ItemResponse itemResponse = await container.CreateItemAsync(testObject); + + durationTimer.Stop(); + int timeElapsed = Convert.ToInt32(durationTimer.Elapsed.TotalMilliseconds); + + return new OperationExecutionResult( + itemResponse.Diagnostics, + timeElapsed, + itemResponse.StatusCode, + operationType); + + } + + if (operationType == FaultInjectionOperationType.ReplaceItem) + { + + await container.CreateItemAsync(testObject); + durationTimer.Start(); + + ItemResponse itemResponse = await container.ReplaceItemAsync(testObject, testObject.id, new PartitionKey(testObject.id)); + + durationTimer.Stop(); + int timeElapsed = Convert.ToInt32(durationTimer.Elapsed.TotalMilliseconds); + + return new OperationExecutionResult( + itemResponse.Diagnostics, + timeElapsed, + itemResponse.StatusCode, + operationType); + + } + + + if (operationType == FaultInjectionOperationType.UpsertItem) + { + + durationTimer.Start(); + ItemResponse itemResponse = await container.UpsertItemAsync(testObject, new PartitionKey(testObject.id)); + + durationTimer.Stop(); + int timeElapsed = Convert.ToInt32(durationTimer.Elapsed.TotalMilliseconds); + + return new OperationExecutionResult( + itemResponse.Diagnostics, + timeElapsed, + itemResponse.StatusCode, + operationType); + + } + + if (operationType == FaultInjectionOperationType.DeleteItem) + { + + await container.CreateItemAsync(testObject); + + durationTimer.Start(); + ItemResponse itemResponse = await container.DeleteItemAsync(testObject.id, new PartitionKey(testObject.id)); + + durationTimer.Stop(); + int timeElapsed = Convert.ToInt32(durationTimer.Elapsed.TotalMilliseconds); + + return new OperationExecutionResult( + itemResponse.Diagnostics, + timeElapsed, + itemResponse.StatusCode, + operationType); + + } + + if (operationType == FaultInjectionOperationType.QueryItem) + { + durationTimer.Start(); + String query = $"SELECT * from c where c.id = \"{testObject.id}\""; + FeedIterator feed = container.GetItemQueryIterator(query); + Assert.IsTrue(feed.HasMoreResults); + FeedResponse feedResponse = null; + while (feed.HasMoreResults) + { + feedResponse = await feed.ReadNextAsync(); + Assert.IsNotNull(feedResponse); + Trace.TraceInformation($" feed response count is {feedResponse.Count}"); + Assert.IsTrue(feedResponse.Count == 1); + } + + durationTimer.Stop(); + int timeElapsed = Convert.ToInt32(durationTimer.Elapsed.TotalMilliseconds); + + return new OperationExecutionResult( + feedResponse.Diagnostics, + timeElapsed, + feedResponse.StatusCode, + operationType); + + } + + if (operationType == FaultInjectionOperationType.PatchItem) + { + await container.CreateItemAsync(testObject); + durationTimer.Start(); + + ItemResponse itemResponse = await container.PatchItemAsync(testObject.id, new PartitionKey(testObject.id), + patchOperations: new[] + { + PatchOperation.Replace("/name", "Customer Two") + }); + + durationTimer.Stop(); + int timeElapsed = Convert.ToInt32(durationTimer.Elapsed.TotalMilliseconds); + + + + return new OperationExecutionResult( + itemResponse.Diagnostics, + timeElapsed, + itemResponse.StatusCode, + operationType); + + } + + + + return null; + } + + } + + internal class OperationExecutionResult + { + public CosmosDiagnostics Diagnostics { get; set; } + public int Duration { get; set; } + public HttpStatusCode StatusCode { get; set; } + public FaultInjectionOperationType OperationType { get; set; } + + public OperationExecutionResult(CosmosDiagnostics diagnostics, int duration, HttpStatusCode statusCode, FaultInjectionOperationType operationType) + { + this.Diagnostics = diagnostics; + this.Duration = duration; + this.StatusCode = statusCode; + this.OperationType = operationType; + } + } + + + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/SpatialTest.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/SpatialTest.cs index 279014dccf..67fea61f50 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/SpatialTest.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/SpatialTest.cs @@ -17,7 +17,9 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests [TestClass] public class SpatialTest { +#pragma warning disable IDE0044 // Add readonly modifier private PartitionKeyDefinition defaultPartitionKeyDefinition = new PartitionKeyDefinition { Paths = new System.Collections.ObjectModel.Collection(new[] { "/pk" }), Kind = PartitionKind.Hash }; +#pragma warning restore IDE0044 // Add readonly modifier private class SpatialSampleClass { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/StoredProcedureTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/StoredProcedureTests.cs index 6d8a0f7873..90f729d10c 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/StoredProcedureTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/StoredProcedureTests.cs @@ -123,6 +123,52 @@ public async Task CRUDTest() Assert.IsTrue(diagnostics.Contains("StatusCode")); } + [TestMethod] + public async Task CRUDStreamTest() + { + string sprocId = Guid.NewGuid().ToString(); + string sprocBody = "function() { { var x = 42; } }"; + + StoredProcedureProperties storedProcedureProperties = new StoredProcedureProperties(sprocId, sprocBody); + ResponseMessage responseMessage = await this.scripts.CreateStoredProcedureStreamAsync( + storedProcedureProperties); + Assert.AreEqual(HttpStatusCode.Created, responseMessage.StatusCode); + Assert.IsNotNull(responseMessage.Diagnostics); + string diagnostics = responseMessage.Diagnostics.ToString(); + Assert.IsFalse(string.IsNullOrEmpty(diagnostics)); + Assert.IsTrue(diagnostics.Contains("StatusCode")); + + responseMessage = await this.scripts.ReadStoredProcedureStreamAsync(sprocId); + Assert.AreEqual(HttpStatusCode.OK, responseMessage.StatusCode); + Assert.IsNotNull(responseMessage.Diagnostics); + diagnostics = responseMessage.Diagnostics.ToString(); + Assert.IsFalse(string.IsNullOrEmpty(diagnostics)); + Assert.IsTrue(diagnostics.Contains("StatusCode")); + + string updatedBody = @"function(name) { var context = getContext(); + var response = context.getResponse(); + response.setBody(""hello there "" + name); + }"; + + storedProcedureProperties = new StoredProcedureProperties(sprocId, updatedBody); + ResponseMessage replaceResponseMessage = await this.scripts.ReplaceStoredProcedureStreamAsync( + storedProcedureProperties); + + Assert.AreEqual(HttpStatusCode.OK, replaceResponseMessage.StatusCode); + Assert.IsNotNull(replaceResponseMessage.Diagnostics); + diagnostics = replaceResponseMessage.Diagnostics.ToString(); + Assert.IsFalse(string.IsNullOrEmpty(diagnostics)); + Assert.IsTrue(diagnostics.Contains("StatusCode")); + + + ResponseMessage deleteResponseMessage = await this.scripts.DeleteStoredProcedureStreamAsync(sprocId); + Assert.AreEqual(HttpStatusCode.NoContent, deleteResponseMessage.StatusCode); + Assert.IsNotNull(deleteResponseMessage.Diagnostics); + diagnostics = deleteResponseMessage.Diagnostics.ToString(); + Assert.IsFalse(string.IsNullOrEmpty(diagnostics)); + Assert.IsTrue(diagnostics.Contains("StatusCode")); + } + [TestMethod] public async Task ExecutionLogsTests() { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/SynchronizationContextTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/SynchronizationContextTests.cs index fd7ab80eb0..4fa692ed3f 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/SynchronizationContextTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/SynchronizationContextTests.cs @@ -177,7 +177,9 @@ public void VerifySynchronizationContextDoesNotLock(bool withClientTelemetry) public class TestSynchronizationContext : SynchronizationContext { +#pragma warning disable IDE0044 // Add readonly modifier private object locker = new object(); +#pragma warning restore IDE0044 // Add readonly modifier public override void Post(SendOrPostCallback d, object state) { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Tracing/EndToEndTraceWriterBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Tracing/EndToEndTraceWriterBaselineTests.cs index a9151ae136..d056374f38 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Tracing/EndToEndTraceWriterBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Tracing/EndToEndTraceWriterBaselineTests.cs @@ -19,6 +19,7 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.Tracing using Microsoft.Azure.Cosmos.ChangeFeed; using Microsoft.Azure.Cosmos.CosmosElements; using Microsoft.Azure.Cosmos.Diagnostics; + using Microsoft.Azure.Cosmos.FaultInjection; using Microsoft.Azure.Cosmos.SDK.EmulatorTests; using Microsoft.Azure.Cosmos.Services.Management.Tests.BaselineTest; using Microsoft.Azure.Cosmos.Telemetry; @@ -499,7 +500,7 @@ public async Task ChangeFeedAsync() public async Task QueryAsync() { List inputs = new List(); - QueryRequestOptions requestOptions = new QueryRequestOptions() { IsNonStreamingOrderByQueryFeatureDisabled = true }; + QueryRequestOptions requestOptions = new QueryRequestOptions() { IsHybridSearchQueryPlanOptimizationDisabled = true }; int startLineNumber; int endLineNumber; @@ -716,6 +717,59 @@ public async Task QueryAsync() this.ExecuteTestSuite(inputs); } + [TestMethod] + public async Task ValidateCorrectSubStatusCodeTestAsync() + { + FaultInjectionCondition condition = new FaultInjectionConditionBuilder() + .WithConnectionType(FaultInjectionConnectionType.Direct) + .WithOperationType(FaultInjectionOperationType.ReadItem) + .Build(); + + FaultInjectionServerErrorResult result = new FaultInjectionServerErrorResultBuilder(FaultInjectionServerErrorType.ReadSessionNotAvailable) + .Build(); + + FaultInjectionRule rule = new FaultInjectionRuleBuilder("readSessionNotAvailable", condition, result) + .Build(); + + FaultInjector injector = new FaultInjector(new List { rule }); + + rule.Disable(); + + CosmosClientOptions clientOptions = new CosmosClientOptions() + { + ConnectionMode = ConnectionMode.Direct, + ConsistencyLevel = ConsistencyLevel.Eventual, + FaultInjector = injector, + }; + + (string endpoint, string authKey) = TestCommon.GetAccountInfo(); + + using (CosmosClient client = new CosmosClient(endpoint, authKey, clientOptions)) + { + + Database testDatabase = await client.CreateDatabaseAsync("testDatabase"); + Container testContainer = await testDatabase.CreateContainerAsync(new ContainerProperties("testContainer", "/pk")); + + ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity(); + await testContainer.CreateItemAsync(testItem, new PartitionKey(testItem.pk)); + + rule.Enable(); + + try + { + ItemResponse _ = await testContainer.ReadItemAsync(testItem.id, new PartitionKey(testItem.pk)); + } + catch (CosmosException ex) + { + Assert.IsTrue(ex.Diagnostics.ToString().Contains("ReadSessionNotAvailable")); + } + finally + { + await testDatabase.DeleteAsync(); + } + } + } + [TestMethod] public async Task ValidateInvalidCredentialsTraceAsync() { @@ -766,6 +820,7 @@ public async Task ValidateInvalidCredentialsTraceAsync() } [TestMethod] + [TestCategory("Flaky")] public async Task TypedPointOperationsAsync() { List inputs = new List(); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/TransportWrapperTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/TransportWrapperTests.cs index 9e7394bf21..a5c61a66bc 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/TransportWrapperTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/TransportWrapperTests.cs @@ -92,7 +92,7 @@ private void ValidateTransportException(CosmosException cosmosException) Assert.IsTrue(message.Contains("TransportException: A client transport error occurred: The connection failed"), "StoreResult Exception is missing"); string diagnostics = cosmosException.Diagnostics.ToString(); Assert.IsNotNull(diagnostics); - Assert.IsTrue(diagnostics.Contains("TransportException: A client transport error occurred: The connection failed")); + Assert.IsTrue(diagnostics.Contains("A client transport error occurred: The connection failed")); } private void ValidateTransportException(ResponseMessage responseMessage) @@ -104,7 +104,7 @@ private void ValidateTransportException(ResponseMessage responseMessage) Assert.IsTrue(message.Contains("Reason: (Channel is closed"), "Should contain exception message"); string diagnostics = responseMessage.Diagnostics.ToString(); Assert.IsNotNull(diagnostics); - Assert.IsTrue(diagnostics.Contains("TransportException: A client transport error occurred: The connection failed")); + Assert.IsTrue(diagnostics.Contains("A client transport error occurred: The connection failed")); } private static void Interceptor( diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/TriggersTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/TriggersTests.cs index b21feb3e68..fbf0daac03 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/TriggersTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/TriggersTests.cs @@ -106,28 +106,84 @@ public async Task CRUDTest() } [TestMethod] - [DataRow(TriggerOperation.Create)] - [DataRow(TriggerOperation.Upsert)] - public async Task ValidatePreTriggerTest(TriggerOperation triggerOperation) + public async Task CRUDStreamTest() { - string triggerId = "SetJobNumber"; - - // Prevent failures if previous test did not clean up correctly - try + TriggerProperties settings = new TriggerProperties { - await this.scripts.DeleteTriggerAsync(triggerId); - } - catch (CosmosException ex) when (ex.StatusCode == HttpStatusCode.NotFound) + Id = Guid.NewGuid().ToString(), + Body = TriggersTests.GetTriggerFunction(".05"), + TriggerOperation = Cosmos.Scripts.TriggerOperation.Create, + TriggerType = Cosmos.Scripts.TriggerType.Pre + }; + + + ResponseMessage triggerResponseMessage = + await this.scripts.CreateTriggerStreamAsync( + settings); + Assert.AreEqual(HttpStatusCode.Created, triggerResponseMessage.StatusCode); + Assert.IsNotNull(triggerResponseMessage.Diagnostics); + string diagnostics = triggerResponseMessage.Diagnostics.ToString(); + Assert.IsFalse(string.IsNullOrEmpty(diagnostics)); + Assert.IsTrue(diagnostics.Contains("StatusCode")); + + triggerResponseMessage = await this.scripts.ReadTriggerStreamAsync(settings.Id); + Assert.AreEqual(HttpStatusCode.OK, triggerResponseMessage.StatusCode); + Assert.IsNotNull(triggerResponseMessage.Diagnostics); + diagnostics = triggerResponseMessage.Diagnostics.ToString(); + Assert.IsFalse(string.IsNullOrEmpty(diagnostics)); + Assert.IsTrue(diagnostics.Contains("StatusCode")); + + TriggerProperties updatedSettings = settings; + updatedSettings.Body = TriggersTests.GetTriggerFunction(".42"); + + ResponseMessage replaceResponseMessage = await this.scripts.ReplaceTriggerStreamAsync( + updatedSettings); + Assert.AreEqual(HttpStatusCode.OK, replaceResponseMessage.StatusCode); + Assert.IsNotNull(replaceResponseMessage.Diagnostics); + diagnostics = replaceResponseMessage.Diagnostics.ToString(); + Assert.IsFalse(string.IsNullOrEmpty(diagnostics)); + Assert.IsTrue(diagnostics.Contains("StatusCode")); + + replaceResponseMessage = await this.scripts.DeleteTriggerStreamAsync(updatedSettings.Id); + Assert.AreEqual(HttpStatusCode.NoContent, replaceResponseMessage.StatusCode); + Assert.IsNotNull(replaceResponseMessage.Diagnostics); + diagnostics = replaceResponseMessage.Diagnostics.ToString(); + Assert.IsFalse(string.IsNullOrEmpty(diagnostics)); + Assert.IsTrue(diagnostics.Contains("StatusCode")); + } + + + [DataRow(TriggerOperation.Create, false, DisplayName = "TriggerOperation - Create with Binary encoding disabled.")] + [DataRow(TriggerOperation.Create, true, DisplayName = "TriggerOperation - Create with Binary encoding enabled.")] + [DataRow(TriggerOperation.Upsert, false, DisplayName = "TriggerOperation - Upsert with Binary encoding disabled.")] + [DataRow(TriggerOperation.Upsert, true, DisplayName = "TriggerOperation - Upsert with Binary encoding enabled.")] + public async Task ValidatePreTriggerTest(TriggerOperation triggerOperation, bool binaryEncodingEnabled) + { + if (binaryEncodingEnabled) { - //swallow + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, "True"); } - TriggerProperties trigger = new TriggerProperties + try { - Id = triggerId, - TriggerType = TriggerType.Pre, - TriggerOperation = triggerOperation, - Body = @"function setJobNumber() { + string triggerId = "SetJobNumber"; + + // Prevent failures if previous test did not clean up correctly + try + { + await this.scripts.DeleteTriggerAsync(triggerId); + } + catch (CosmosException ex) when (ex.StatusCode == HttpStatusCode.NotFound) + { + //swallow + } + + TriggerProperties trigger = new TriggerProperties + { + Id = triggerId, + TriggerType = TriggerType.Pre, + TriggerOperation = triggerOperation, + Body = @"function setJobNumber() { var context = getContext(); var request = context.getRequest(); var containerManager = context.getCollection(); @@ -146,78 +202,83 @@ public async Task ValidatePreTriggerTest(TriggerOperation triggerOperation) // update the document that will be created request.setBody(documentToCreate); }", - }; + }; - TriggerProperties cosmosTrigger = await this.scripts.CreateTriggerAsync(trigger); + TriggerProperties cosmosTrigger = await this.scripts.CreateTriggerAsync(trigger); - Job value = new Job() { Id = Guid.NewGuid(), InvestigationKey = "investigation~1" }; + Job value = new Job() { Id = Guid.NewGuid(), InvestigationKey = "investigation~1" }; - Job item = null; - if (triggerOperation == TriggerOperation.Create) - { - // this should create the document successfully with jobnumber of 1 - item = await this.container.CreateItemAsync(item: value, partitionKey: null, requestOptions: new ItemRequestOptions + Job item = null; + if (triggerOperation == TriggerOperation.Create) { - PreTriggers = new List { triggerId } - }); - } - else if(triggerOperation == TriggerOperation.Upsert) - { - // this should create the document successfully with jobnumber of 1 - item = await this.container.UpsertItemAsync(item: value, partitionKey: null, requestOptions: new ItemRequestOptions + // this should create the document successfully with jobnumber of 1 + item = await this.container.CreateItemAsync(item: value, partitionKey: null, requestOptions: new ItemRequestOptions + { + PreTriggers = new List { triggerId } + }); + } + else if (triggerOperation == TriggerOperation.Upsert) { - PreTriggers = new List { triggerId } - }); - } - - Assert.AreEqual(value.Id, item.Id); - Assert.AreEqual(value.InvestigationKey, item.InvestigationKey); - Assert.AreEqual(1, item.JobNumber); + // this should create the document successfully with jobnumber of 1 + item = await this.container.UpsertItemAsync(item: value, partitionKey: null, requestOptions: new ItemRequestOptions + { + PreTriggers = new List { triggerId } + }); + } - List result = this.container.GetItemLinqQueryable(allowSynchronousQueryExecution: true).Where(x => x.InvestigationKey == "investigation~1").ToList(); - Assert.IsNotNull(result); - Assert.AreEqual(1, result.Count); - Job jobFromLinq = result.First(); + Assert.AreEqual(value.Id, item.Id); + Assert.AreEqual(value.InvestigationKey, item.InvestigationKey); + Assert.AreEqual(1, item.JobNumber); - Assert.AreEqual(value.Id, jobFromLinq.Id); - Assert.AreEqual(value.InvestigationKey, jobFromLinq.InvestigationKey); - Assert.AreEqual(1, jobFromLinq.JobNumber); + List result = this.container.GetItemLinqQueryable(allowSynchronousQueryExecution: true).Where(x => x.InvestigationKey == "investigation~1").ToList(); + Assert.IsNotNull(result); + Assert.AreEqual(1, result.Count); + Job jobFromLinq = result.First(); - value.Id = Guid.NewGuid(); + Assert.AreEqual(value.Id, jobFromLinq.Id); + Assert.AreEqual(value.InvestigationKey, jobFromLinq.InvestigationKey); + Assert.AreEqual(1, jobFromLinq.JobNumber); - Job item2 = null; - if (triggerOperation == TriggerOperation.Create) - { - // this should create the document successfully with jobnumber of 2 - item2 = await this.container.CreateItemAsync(item: value, partitionKey: null, requestOptions: new ItemRequestOptions + value.Id = Guid.NewGuid(); + + Job item2 = null; + if (triggerOperation == TriggerOperation.Create) { - PreTriggers = new List { "SetJobNumber" } - }); - } - else if (triggerOperation == TriggerOperation.Upsert) - { - // this should create the document successfully with jobnumber of 1 - item2 = await this.container.UpsertItemAsync(item: value, partitionKey: null, requestOptions: new ItemRequestOptions + // this should create the document successfully with jobnumber of 2 + item2 = await this.container.CreateItemAsync(item: value, partitionKey: null, requestOptions: new ItemRequestOptions + { + PreTriggers = new List { "SetJobNumber" } + }); + } + else if (triggerOperation == TriggerOperation.Upsert) { - PreTriggers = new List { "SetJobNumber" } - }); - } + // this should create the document successfully with jobnumber of 1 + item2 = await this.container.UpsertItemAsync(item: value, partitionKey: null, requestOptions: new ItemRequestOptions + { + PreTriggers = new List { "SetJobNumber" } + }); + } - Assert.AreEqual(value.Id, item2.Id); - Assert.AreEqual(value.InvestigationKey, item2.InvestigationKey); - Assert.AreEqual(2, item2.JobNumber); + Assert.AreEqual(value.Id, item2.Id); + Assert.AreEqual(value.InvestigationKey, item2.InvestigationKey); + Assert.AreEqual(2, item2.JobNumber); - result = this.container.GetItemLinqQueryable(allowSynchronousQueryExecution: true).Where(x => x.InvestigationKey == "investigation~1").ToList(); - Assert.IsNotNull(result); - Assert.AreEqual(2, result.Count); - jobFromLinq = result.First(x => x.JobNumber == 2); + result = this.container.GetItemLinqQueryable(allowSynchronousQueryExecution: true).Where(x => x.InvestigationKey == "investigation~1").ToList(); + Assert.IsNotNull(result); + Assert.AreEqual(2, result.Count); + jobFromLinq = result.First(x => x.JobNumber == 2); - Assert.AreEqual(value.Id, jobFromLinq.Id); - Assert.AreEqual(value.InvestigationKey, jobFromLinq.InvestigationKey); - Assert.AreEqual(2, jobFromLinq.JobNumber); + Assert.AreEqual(value.Id, jobFromLinq.Id); + Assert.AreEqual(value.InvestigationKey, jobFromLinq.InvestigationKey); + Assert.AreEqual(2, jobFromLinq.JobNumber); - // Delete existing user defined functions. - await this.scripts.DeleteTriggerAsync(triggerId); + // Delete existing user defined functions. + await this.scripts.DeleteTriggerAsync(triggerId); + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, null); + } } [TestMethod] diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/UserDefinedFunctionsTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/UserDefinedFunctionsTests.cs index cf3354575d..627abff2ad 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/UserDefinedFunctionsTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/UserDefinedFunctionsTests.cs @@ -101,6 +101,50 @@ public async Task CRUDTest() Assert.AreEqual(HttpStatusCode.NoContent, replaceResponse.StatusCode); } + [TestMethod] + public async Task CRUDStreamTest() + { + UserDefinedFunctionProperties settings = new UserDefinedFunctionProperties + { + Id = Guid.NewGuid().ToString(), + Body = UserDefinedFunctionsTests.function, + }; + + ResponseMessage responseMessage = + await this.scripts.CreateUserDefinedFunctionStreamAsync( + settings); + Assert.AreEqual(HttpStatusCode.Created, responseMessage.StatusCode); + Assert.IsNotNull(responseMessage.Diagnostics); + string diagnostics = responseMessage.Diagnostics.ToString(); + Assert.IsFalse(string.IsNullOrEmpty(diagnostics)); + Assert.IsTrue(diagnostics.Contains("StatusCode")); + + responseMessage = await this.scripts.ReadUserDefinedFunctionStreamAsync(settings.Id); + Assert.AreEqual(HttpStatusCode.OK, responseMessage.StatusCode); + Assert.IsNotNull(responseMessage.Diagnostics); + diagnostics = responseMessage.Diagnostics.ToString(); + Assert.IsFalse(string.IsNullOrEmpty(diagnostics)); + Assert.IsTrue(diagnostics.Contains("StatusCode")); + + UserDefinedFunctionProperties updatedSettings = settings; + updatedSettings.Body = @"function(amt) { return amt * 0.42; }"; + + ResponseMessage replaceResponseMessage = await this.scripts.ReplaceUserDefinedFunctionStreamAsync( + updatedSettings); + Assert.IsNotNull(replaceResponseMessage.Diagnostics); + diagnostics = replaceResponseMessage.Diagnostics.ToString(); + Assert.IsFalse(string.IsNullOrEmpty(diagnostics)); + Assert.IsTrue(diagnostics.Contains("StatusCode")); + Assert.AreEqual(HttpStatusCode.OK, replaceResponseMessage.StatusCode); + + replaceResponseMessage = await this.scripts.DeleteUserDefinedFunctionStreamAsync(settings.Id); + Assert.IsNotNull(replaceResponseMessage.Diagnostics); + diagnostics = replaceResponseMessage.Diagnostics.ToString(); + Assert.IsFalse(string.IsNullOrEmpty(diagnostics)); + Assert.IsTrue(diagnostics.Contains("StatusCode")); + Assert.AreEqual(HttpStatusCode.NoContent, replaceResponseMessage.StatusCode); + } + [TestMethod] public async Task ValidateUserDefinedFunctionsTest() { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/LocalEmulatorTokenCredential.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/LocalEmulatorTokenCredential.cs index e71eea6ca0..c40a5e331f 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/LocalEmulatorTokenCredential.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/LocalEmulatorTokenCredential.cs @@ -18,15 +18,18 @@ public class LocalEmulatorTokenCredential : TokenCredential private readonly DateTime? DefaultDateTime = null; private readonly Action GetTokenCallback; private readonly string masterKey; + private readonly string expectedScope; - internal LocalEmulatorTokenCredential( + internal LocalEmulatorTokenCredential( + string expectedScope, string masterKey = null, Action getTokenCallback = null, DateTime? defaultDateTime = null) { this.masterKey = masterKey; this.GetTokenCallback = getTokenCallback; - this.DefaultDateTime = defaultDateTime; + this.DefaultDateTime = defaultDateTime; + this.expectedScope = expectedScope; } public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) @@ -40,9 +43,8 @@ public override ValueTask GetTokenAsync(TokenRequestContext request } private AccessToken GetAccessToken(TokenRequestContext requestContext, CancellationToken cancellationToken) - { - // Verify that the request context is a valid URI - Assert.AreEqual("https://127.0.0.1/.default", requestContext.Scopes.First()); + { + Assert.AreEqual(this.expectedScope, requestContext.Scopes.First()); this.GetTokenCallback?.Invoke( requestContext, diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/RequestChargeHelper.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/RequestChargeHelper.cs index 19f0ab0e53..fadef57bc8 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/RequestChargeHelper.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/RequestChargeHelper.cs @@ -11,7 +11,9 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests /// internal sealed class RequestChargeHelper { +#pragma warning disable IDE0044 // Add readonly modifier private Dictionary chargeStore; +#pragma warning restore IDE0044 // Add readonly modifier internal RequestChargeHelper() { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/RetriableTestClass.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/RetriableTestClass.cs index 8dd03dcaa0..4c6d793987 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/RetriableTestClass.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/RetriableTestClass.cs @@ -38,7 +38,9 @@ public override VisualStudio.TestTools.UnitTesting.TestMethodAttribute GetTestMe public class RetriableTestMethod : VisualStudio.TestTools.UnitTesting.TestMethodAttribute { private readonly VisualStudio.TestTools.UnitTesting.TestMethodAttribute testMethod; +#pragma warning disable IDE0044 // Add readonly modifier private int maxRetry; +#pragma warning restore IDE0044 // Add readonly modifier public RetriableTestMethod( int maxRetry, VisualStudio.TestTools.UnitTesting.TestMethodAttribute testMethod) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/TestCommon.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/TestCommon.cs index 7c9a4c665d..bf46caf89a 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/TestCommon.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/TestCommon.cs @@ -5,6 +5,7 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests { using System; + using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; @@ -12,6 +13,7 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests using System.Linq; using System.Net; using System.Net.Http; + using System.Reflection; using System.Security.Cryptography; using System.Text; using System.Threading; @@ -28,6 +30,7 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests using Microsoft.Azure.Documents.Routing; using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json; + using static Microsoft.Azure.Cosmos.Routing.GlobalPartitionEndpointManagerCore; internal static class TestCommon { @@ -253,6 +256,7 @@ internal static DocumentClient CreateClient(bool useGateway, Protocol protocol = apiType, recievedResponseEventHandler); + client.EnsureValidClientAsync(NoOpTrace.Singleton).Wait(); return client; } @@ -1587,6 +1591,36 @@ public static ISessionToken CreateSessionToken(ISessionToken from, long globalLS } } + public static PartitionKeyRangeFailoverInfo GetFailoverInfoForFirstPartitionUsingReflection( + GlobalPartitionEndpointManager globalPartitionEndpointManager, + bool isReadOnlyOrMultiMaster) + { + string fieldName = isReadOnlyOrMultiMaster + ? "PartitionKeyRangeToLocationForReadAndWrite" + : "PartitionKeyRangeToLocationForWrite"; + + if (globalPartitionEndpointManager is GlobalPartitionEndpointManagerCore globalPartitionEndpointManagerCore) + { + FieldInfo fieldInfo = globalPartitionEndpointManagerCore + .GetType() + .GetField( + name: fieldName, + bindingAttr: BindingFlags.Instance | BindingFlags.NonPublic) + ?? throw new InvalidOperationException($"Could not find '{fieldName}' field on GlobalPartitionEndpointManagerCore."); + + Lazy> pkRangeMappings = (Lazy>)fieldInfo + .GetValue( + obj: globalPartitionEndpointManagerCore); + + if (pkRangeMappings.IsValueCreated) + { + return pkRangeMappings.Value?.First().Value; + } + } + + return null; + } + private class DisposableList : IDisposable { private readonly List disposableList; diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/settings.json b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/settings.json index 611ba8c677..48d75ec66d 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/settings.json +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/settings.json @@ -13,12 +13,14 @@ "MasterStalenessIntervalInSeconds": "1", "QueryPerformanceTests.CosmosDatabaseId": "db", "QueryPerformanceTests.ContainerId": "container", - "QueryPerformanceTests.ContentSerialization": "JsonText", - "QueryPerformanceTests.Query": "SELECT TOP 1 c.region FROM c", + "QueryPerformanceTests.InsertDocumentCount": "10000", + "QueryPerformanceTests.Queries": "[\"SELECT TOP 1 c.region FROM c\"]", "QueryPerformanceTests.MaxConcurrency": "-1", "QueryPerformanceTests.MaxItemCount": "-1", "QueryPerformanceTests.NumberOfIterations": "1", "QueryPerformanceTests.WarmupIterations": "0", - "QueryPerformanceTests.UseStronglyTypedIterator": "true" + "QueryPerformanceTests.UseStronglyTypedIterator": "true", + "QueryPerformanceTests.OutputPath": "", + "QueryPerformanceTests.OutputDirectoryName": "perf_metrics_output" } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Benchmarks/MasterKeyAuthorizationBenchmark.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Benchmarks/MasterKeyAuthorizationBenchmark.cs index f3cd49b65d..05b69f8822 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Benchmarks/MasterKeyAuthorizationBenchmark.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Benchmarks/MasterKeyAuthorizationBenchmark.cs @@ -13,8 +13,12 @@ namespace Microsoft.Azure.Cosmos.Performance.Tests [Config(typeof(SdkBenchmarkConfiguration))] public class MasterKeyAuthorizationBenchmark { +#pragma warning disable IDE0044 // Add readonly modifier private IComputeHash authKeyHashFunction; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier private INameValueCollection testHeaders; +#pragma warning restore IDE0044 // Add readonly modifier public MasterKeyAuthorizationBenchmark() { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/GlobalSuppressions.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/GlobalSuppressions.cs new file mode 100644 index 0000000000..7266ebe8ff --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/GlobalSuppressions.cs @@ -0,0 +1,8 @@ +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. + +using System.Diagnostics.CodeAnalysis; + +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Performance.Tests.Services.ConfigurationService.Configuration")] diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/JsonRoundTripBenchmarks.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/JsonRoundTripBenchmarks.cs index afb7833f0f..0c832b14cb 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/JsonRoundTripBenchmarks.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/JsonRoundTripBenchmarks.cs @@ -14,22 +14,22 @@ public class JsonRoundTripBenchmarks { private static class Payloads { - //public static readonly CurratedDocsPayload CombinedScriptsData = CurratedDocsPayload.CreateFromCurratedDocs("CombinedScriptsData"); - //public static readonly CurratedDocsPayload Countries = CurratedDocsPayload.CreateFromCurratedDocs("countries"); - //public static readonly CurratedDocsPayload Devtestcoll = CurratedDocsPayload.CreateFromCurratedDocs("devtestcoll"); - //public static readonly CurratedDocsPayload Lastfm = CurratedDocsPayload.CreateFromCurratedDocs("lastfm"); - //public static readonly CurratedDocsPayload LogData = CurratedDocsPayload.CreateFromCurratedDocs("LogData"); - //public static readonly CurratedDocsPayload MillionSong1KDocuments = CurratedDocsPayload.CreateFromCurratedDocs("MillionSong1KDocuments"); - //public static readonly CurratedDocsPayload MsnCollection = CurratedDocsPayload.CreateFromCurratedDocs("MsnCollection"); - public static readonly CurratedDocsPayload NutritionData = CurratedDocsPayload.CreateFromCurratedDocs("NutritionData"); - //public static readonly CurratedDocsPayload RunsCollection = CurratedDocsPayload.CreateFromCurratedDocs("runsCollection"); - //public static readonly CurratedDocsPayload StatesCommittees = CurratedDocsPayload.CreateFromCurratedDocs("states_committees"); - //public static readonly CurratedDocsPayload StatesLegislators = CurratedDocsPayload.CreateFromCurratedDocs("states_legislators"); - //public static readonly CurratedDocsPayload Store01C = CurratedDocsPayload.CreateFromCurratedDocs("store01C"); - //public static readonly CurratedDocsPayload TicinoErrorBuckets = CurratedDocsPayload.CreateFromCurratedDocs("TicinoErrorBuckets"); - //public static readonly CurratedDocsPayload TwitterData = CurratedDocsPayload.CreateFromCurratedDocs("twitter_data"); - //public static readonly CurratedDocsPayload Ups1 = CurratedDocsPayload.CreateFromCurratedDocs("ups1"); - //public static readonly CurratedDocsPayload XpertEvents = CurratedDocsPayload.CreateFromCurratedDocs("XpertEvents"); + //public static readonly CuratedDocsPayload CombinedScriptsData = CuratedDocsPayload.CreateFromCuratedDocs("CombinedScriptsData"); + //public static readonly CuratedDocsPayload Countries = CuratedDocsPayload.CreateFromCuratedDocs("countries"); + //public static readonly CuratedDocsPayload Devtestcoll = CuratedDocsPayload.CreateFromCuratedDocs("devtestcoll"); + //public static readonly CuratedDocsPayload Lastfm = CuratedDocsPayload.CreateFromCuratedDocs("lastfm"); + //public static readonly CuratedDocsPayload LogData = CuratedDocsPayload.CreateFromCuratedDocs("LogData"); + //public static readonly CuratedDocsPayload MillionSong1KDocuments = CuratedDocsPayload.CreateFromCuratedDocs("MillionSong1KDocuments"); + //public static readonly CuratedDocsPayload MsnCollection = CuratedDocsPayload.CreateFromCuratedDocs("MsnCollection"); + public static readonly CuratedDocsPayload NutritionData = CuratedDocsPayload.CreateFromCuratedDocs("NutritionData"); + //public static readonly CuratedDocsPayload RunsCollection = CuratedDocsPayload.CreateFromCuratedDocs("runsCollection"); + //public static readonly CuratedDocsPayload StatesCommittees = CuratedDocsPayload.CreateFromCuratedDocs("states_committees"); + //public static readonly CuratedDocsPayload StatesLegislators = CuratedDocsPayload.CreateFromCuratedDocs("states_legislators"); + //public static readonly CuratedDocsPayload Store01C = CuratedDocsPayload.CreateFromCuratedDocs("store01C"); + //public static readonly CuratedDocsPayload TicinoErrorBuckets = CuratedDocsPayload.CreateFromCuratedDocs("TicinoErrorBuckets"); + //public static readonly CuratedDocsPayload TwitterData = CuratedDocsPayload.CreateFromCuratedDocs("twitter_data"); + //public static readonly CuratedDocsPayload Ups1 = CuratedDocsPayload.CreateFromCuratedDocs("ups1"); + //public static readonly CuratedDocsPayload XpertEvents = CuratedDocsPayload.CreateFromCuratedDocs("XpertEvents"); } #if false @@ -44,6 +44,9 @@ public void ReaderToWriter( { SerializationFormat.Text => JsonReader.Create(payload.Text), SerializationFormat.Binary => JsonReader.Create(payload.Binary), + SerializationFormat.BinaryWithDictionaryEncoding => JsonReader.Create( + payload.BinaryWithDictionaryEncoding.binary, + payload.BinaryWithDictionaryEncoding.dictionary), SerializationFormat.NewtonsoftText => NewtonsoftToCosmosDBReader.CreateFromBuffer(payload.Text), _ => throw new ArgumentException($"Unexpected {nameof(sourceFormat)} of type: '{sourceFormat}'"), }; @@ -52,6 +55,9 @@ public void ReaderToWriter( { SerializationFormat.Text => JsonWriter.Create(JsonSerializationFormat.Text), SerializationFormat.Binary => JsonWriter.Create(JsonSerializationFormat.Binary), + SerializationFormat.BinaryWithDictionaryEncoding => JsonWriter.Create( + JsonSerializationFormat.Binary, + new JsonStringDictionary(capacity: 128)), SerializationFormat.NewtonsoftText => NewtonsoftToCosmosDBWriter.CreateTextWriter(), _ => throw new ArgumentException($"Unexpected {nameof(destinationFormat)} of type: {destinationFormat}"), }; @@ -63,13 +69,16 @@ public void ReaderToWriter( [Benchmark] [ArgumentsSource(nameof(NavigatorToWriterArguments))] public void NavigatorToWriter( - CurratedDocsPayload payload, + CuratedDocsPayload payload, SerializationFormat sourceFormat, SerializationFormat destinationFormat) { IJsonNavigator navigator = sourceFormat switch { SerializationFormat.Text => JsonNavigator.Create(payload.Text), + SerializationFormat.BinaryWithDictionaryEncoding => JsonNavigator.Create( + payload.BinaryWithDictionaryEncoding.binary, + payload.BinaryWithDictionaryEncoding.dictionary), SerializationFormat.Binary => JsonNavigator.Create(payload.Binary), _ => throw new ArgumentException($"Unexpected {nameof(sourceFormat)} of type: '{sourceFormat}'"), }; @@ -78,6 +87,9 @@ public void NavigatorToWriter( { SerializationFormat.Text => JsonWriter.Create(JsonSerializationFormat.Text), SerializationFormat.Binary => JsonWriter.Create(JsonSerializationFormat.Binary), + SerializationFormat.BinaryWithDictionaryEncoding => JsonWriter.Create( + JsonSerializationFormat.Binary, + jsonStringDictionary: sourceFormat == SerializationFormat.BinaryWithDictionaryEncoding ? payload.BinaryWithDictionaryEncoding.dictionary : new JsonStringDictionary()), SerializationFormat.NewtonsoftText => NewtonsoftToCosmosDBWriter.CreateTextWriter(), _ => throw new ArgumentException($"Unexpected {nameof(destinationFormat)} of type: {destinationFormat}"), }; @@ -90,25 +102,29 @@ public enum SerializationFormat Text, Binary, NewtonsoftText, + BinaryWithDictionaryEncoding } - public readonly struct CurratedDocsPayload + public readonly struct CuratedDocsPayload { - private CurratedDocsPayload( + private CuratedDocsPayload( string name, ReadOnlyMemory text, - ReadOnlyMemory binary) + ReadOnlyMemory binary, + (ReadOnlyMemory binary, IJsonStringDictionary dictionary) binaryWithDictionaryEncoding) { this.Name = name; this.Text = text; this.Binary = binary; + this.BinaryWithDictionaryEncoding = binaryWithDictionaryEncoding; } public string Name { get; } public ReadOnlyMemory Text { get; } public ReadOnlyMemory Binary { get; } + internal (ReadOnlyMemory binary, IJsonStringDictionary dictionary) BinaryWithDictionaryEncoding { get; } - public static CurratedDocsPayload CreateFromCurratedDocs(string name) + public static CuratedDocsPayload CreateFromCuratedDocs(string name) { if (name == null) { @@ -123,11 +139,13 @@ public static CurratedDocsPayload CreateFromCurratedDocs(string name) ReadOnlyMemory text = Encoding.UTF8.GetBytes(json); ReadOnlyMemory binary = JsonTestUtils.ConvertTextToBinary(json); + ReadOnlyMemory dictionaryEncodedBinary = JsonTestUtils.ConvertTextToBinary(json, out IJsonStringDictionary jsonStringDictionary); - return new CurratedDocsPayload( + return new CuratedDocsPayload( name: name, text: text, - binary: binary); + binary: binary, + binaryWithDictionaryEncoding: (dictionaryEncodedBinary, jsonStringDictionary)); } catch (Exception) { @@ -146,7 +164,7 @@ public IEnumerable NavigatorToWriterArguments() { foreach (FieldInfo fieldInfo in typeof(Payloads).GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)) { - CurratedDocsPayload payload = (CurratedDocsPayload)fieldInfo.GetValue(null); + CuratedDocsPayload payload = (CuratedDocsPayload)fieldInfo.GetValue(null); foreach (SerializationFormat sourceFormat in Enum.GetValues(typeof(SerializationFormat))) { if (sourceFormat == SerializationFormat.NewtonsoftText) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/JsonRoundTripBenchmarksResults.txt b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/JsonRoundTripBenchmarksResults.txt index fb7b339903..74df840884 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/JsonRoundTripBenchmarksResults.txt +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/JsonRoundTripBenchmarksResults.txt @@ -1,8 +1,15 @@ -| Method | payload | sourceFormat | destinationFormat | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | -|------------------ |-------------- |------------- |------------------ |-------------:|-----------:|-----------:|---------:|---------:|---------:|-----------:| -| NavigatorToWriter | NutritionData | Text | Text | 201.48 us | 4.008 us | 11.240 us | 207.7637 | 207.2754 | 207.2754 | 1523.71 KB | -| NavigatorToWriter | NutritionData | Text | Binary | 24,779.95 us | 515.386 us | 755.445 us | 875.0000 | 500.0000 | 125.0000 | 5053.33 KB | -| NavigatorToWriter | NutritionData | Text | NewtonsoftText | 21,345.64 us | 424.472 us | 354.453 us | 875.0000 | 437.5000 | - | 5208.27 KB | -| NavigatorToWriter | NutritionData | Binary | Text | 10,177.14 us | 200.911 us | 231.370 us | 562.5000 | 250.0000 | 250.0000 | 2219.84 KB | -| NavigatorToWriter | NutritionData | Binary | Binary | 35.25 us | 0.705 us | 1.780 us | 57.8613 | 57.5562 | 57.5562 | 269.46 KB | -| NavigatorToWriter | NutritionData | Binary | NewtonsoftText | 11,517.08 us | 227.602 us | 212.899 us | 625.0000 | 296.8750 | - | 3583.33 KB | \ No newline at end of file + +| Method | payload | sourceFormat | destinationFormat | Mean | Error | StdDev | Gen0 | Gen1 | Gen2 | Allocated | +|------------------ |-------------- |--------------------- |--------------------- |-------------:|-----------:|-----------:|---------:|---------:|---------:|----------:| +| NavigatorToWriter | NutritionData | Text | Text | 92.35 us | 1.704 us | 2.155 us | 167.1143 | 166.8701 | 166.8701 | 1247977 B | +| NavigatorToWriter | NutritionData | Text | Binary | 21,444.08 us | 421.873 us | 518.098 us | 781.2500 | 500.0000 | 187.5000 | 7269944 B | +| NavigatorToWriter | NutritionData | Text | NewtonsoftText | 17,613.40 us | 97.891 us | 81.744 us | 718.7500 | 343.7500 | - | 7612708 B | +| NavigatorToWriter | NutritionData | Text | Binar(...)oding [28] | 21,241.05 us | 274.450 us | 256.721 us | 718.7500 | 406.2500 | 125.0000 | 7029835 B | +| NavigatorToWriter | NutritionData | Binary | Text | 7,893.67 us | 76.961 us | 71.989 us | 726.5625 | 507.8125 | 500.0000 | 4368099 B | +| NavigatorToWriter | NutritionData | Binary | Binary | 10,039.53 us | 195.458 us | 225.089 us | 500.0000 | 312.5000 | 218.7500 | 3762505 B | +| NavigatorToWriter | NutritionData | Binary | NewtonsoftText | 9,267.23 us | 36.610 us | 32.453 us | 546.8750 | 265.6250 | - | 5730286 B | +| NavigatorToWriter | NutritionData | Binary | Binar(...)oding [28] | 10,157.81 us | 27.351 us | 25.584 us | 421.8750 | 250.0000 | 140.6250 | 3522685 B | +| NavigatorToWriter | NutritionData | Binar(...)oding [28] | Text | 7,769.64 us | 33.549 us | 28.015 us | 726.5625 | 507.8125 | 500.0000 | 4367899 B | +| NavigatorToWriter | NutritionData | Binar(...)oding [28] | Binary | NA | NA | NA | - | - | - | - | +| NavigatorToWriter | NutritionData | Binar(...)oding [28] | NewtonsoftText | 9,184.78 us | 97.329 us | 91.041 us | 546.8750 | 265.6250 | - | 5730286 B | +| NavigatorToWriter | NutritionData | Binar(...)oding [28] | Binar(...)oding [28] | 10,136.68 us | 40.451 us | 37.837 us | 421.8750 | 250.0000 | 140.6250 | 3505577 B | \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/PocoDeserializerBenchmark.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/PocoDeserializerBenchmark.cs index 8ff745dd1e..a9981b6eb0 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/PocoDeserializerBenchmark.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/PocoDeserializerBenchmark.cs @@ -6,6 +6,7 @@ using System.Runtime.InteropServices; using System.Text; using BenchmarkDotNet.Attributes; + using Microsoft.Azure.Cosmos.Json; using Microsoft.Azure.Cosmos.Json.Interop; using Microsoft.Azure.Cosmos.Tests.Json; using Microsoft.Azure.Cosmos.Tests.Poco; @@ -58,6 +59,13 @@ public void RunBenchmark(PocoSerializationFormat serializationFormat) this.peoplePayload.Binary)); break; + case PocoSerializationFormat.BinaryWithDictionaryEncoding: + reader = new CosmosDBToNewtonsoftReader( + Cosmos.Json.JsonReader.Create( + this.peoplePayload.BinaryWithDictionaryEncoding.binary, + this.peoplePayload.BinaryWithDictionaryEncoding.dictionary)); + break; + default: throw new ArgumentOutOfRangeException(serializationFormat.ToString()); } @@ -79,29 +87,35 @@ public enum PocoSerializationFormat Text, NewtonsoftText, Binary, + BinaryWithDictionaryEncoding } private readonly struct Payload { private Payload( ReadOnlyMemory text, - ReadOnlyMemory binary) + ReadOnlyMemory binary, + (ReadOnlyMemory binary, IJsonStringDictionary dictionary) binaryWithDictionaryEncoding) { this.Text = text; this.Binary = binary; + this.BinaryWithDictionaryEncoding = binaryWithDictionaryEncoding; } public ReadOnlyMemory Text { get; } public ReadOnlyMemory Binary { get; } + public (ReadOnlyMemory binary, IJsonStringDictionary dictionary) BinaryWithDictionaryEncoding { get; } public static Payload Create(string json) { ReadOnlyMemory text = Encoding.UTF8.GetBytes(json); ReadOnlyMemory binary = JsonTestUtils.ConvertTextToBinary(json); + ReadOnlyMemory dictionaryEncodedBinary = JsonTestUtils.ConvertTextToBinary(json, out IJsonStringDictionary jsonStringDictionary); return new Payload( text, - binary); + binary, + (dictionaryEncodedBinary, jsonStringDictionary)); } } } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/PocoDeserializerBenchmarkResults.txt b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/PocoDeserializerBenchmarkResults.txt index 243657a20a..e5ea31d54a 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/PocoDeserializerBenchmarkResults.txt +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/PocoDeserializerBenchmarkResults.txt @@ -1,5 +1,6 @@ -| Method | serializationFormat | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | -|------------- |--------------------- |---------:|---------:|---------:|--------:|-------:|------:|----------:| -| RunBenchmark | Text | 964.8 us | 22.76 us | 66.76 us | 41.0156 | 1.9531 | - | 174.16 KB | -| RunBenchmark | NewtonsoftText | 596.5 us | 12.52 us | 22.58 us | 36.1328 | - | - | 150.15 KB | -| RunBenchmark | Binary | 573.3 us | 10.38 us | 9.71 us | 41.0156 | 0.9766 | - | 169.76 KB | \ No newline at end of file +| Method | serializationFormat | Mean | Error | StdDev | Median | Gen0 | Gen1 | Allocated | +|------------- |--------------------- |---------:|---------:|---------:|---------:|--------:|-------:|----------:| +| RunBenchmark | Text | 426.3 us | 23.98 us | 70.70 us | 386.4 us | 15.6250 | 0.9766 | 163.63 KB | +| RunBenchmark | NewtonsoftText | 237.6 us | 1.42 us | 1.26 us | 237.6 us | 11.4746 | 0.9766 | 117.4 KB | +| RunBenchmark | Binary | 265.5 us | 1.03 us | 0.86 us | 265.3 us | 15.6250 | 0.9766 | 163.8 KB | +| RunBenchmark | Binar(...)oding [28] | 268.0 us | 1.36 us | 1.21 us | 267.3 us | 15.6250 | 0.9766 | 163.8 KB | \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Mocks/MockDocumentClient.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Mocks/MockDocumentClient.cs index 891b56351b..9453b37aa0 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Mocks/MockDocumentClient.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Mocks/MockDocumentClient.cs @@ -152,7 +152,7 @@ ValueTask ICosmosAuthorizationTokenProvider.GetUserAuthorizationTokenAsy private void Init() { - this.collectionCache = new Mock(null, new ServerStoreModel(null), null, null, null); + this.collectionCache = new Mock(null, new ServerStoreModel(null), null, null, null, false); ContainerProperties containerProperties = ContainerProperties.CreateWithResourceId("test"); containerProperties.PartitionKey = partitionKeyDefinition; @@ -181,7 +181,7 @@ private void Init() }, string.Empty); - this.partitionKeyRangeCache = new Mock(null, null, null, null); + this.partitionKeyRangeCache = new Mock(null, null, null, null, false); this.partitionKeyRangeCache.Setup( m => m.TryLookupAsync( It.IsAny(), @@ -209,7 +209,7 @@ private void Init() It.IsAny())) .Returns(Task.FromResult((IReadOnlyList)result)); - this.globalEndpointManager = new Mock(this, new ConnectionPolicy()); + this.globalEndpointManager = new Mock(this, new ConnectionPolicy(), false); this.telemetryToServiceHelper = TelemetryToServiceHelper.CreateAndInitializeClientConfigAndTelemetryJob("perf-test-client", this.ConnectionPolicy, diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Query/ParsingBenchmark.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Query/ParsingBenchmark.cs index 62363f8a58..28afb80ade 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Query/ParsingBenchmark.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Query/ParsingBenchmark.cs @@ -1,160 +1,161 @@ -// ---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -// ---------------------------------------------------------------- - -namespace Microsoft.Azure.Cosmos.Query -{ - using System; - using System.Collections.Generic; - using System.Text; - using BenchmarkDotNet.Attributes; - using Microsoft.Azure.Cosmos.Query.Core; - using Microsoft.Azure.Cosmos.Query.Core.Monads; - using Microsoft.Azure.Cosmos.Query.Core.Parser; - using Microsoft.Azure.Cosmos.Query.Core.QueryPlan; - using Microsoft.Azure.Cosmos.SqlObjects; - using Microsoft.Azure.Documents; - using Newtonsoft.Json; - - [MemoryDiagnoser] - public class ParsingBenchmark - { - private static readonly IDictionary DefaultQueryengineConfiguration = - new Dictionary() - { - {"maxSqlQueryInputLength", 30720}, - {"maxJoinsPerSqlQuery", 5}, - {"maxLogicalAndPerSqlQuery", 200}, - {"maxLogicalOrPerSqlQuery", 200}, - {"maxUdfRefPerSqlQuery", 6}, - {"maxInExpressionItemsCount", 8000}, - {"queryMaxInMemorySortDocumentCount", 500}, - {"maxQueryRequestTimeoutFraction", 0.90}, - {"sqlAllowNonFiniteNumbers", false}, - {"sqlAllowAggregateFunctions", true}, - {"sqlAllowSubQuery", false}, - {"allowNewKeywords", true}, - {"sqlAllowLike", false}, - {"sqlAllowGroupByClause", false}, - {"maxSpatialQueryCells", 12}, - {"spatialMaxGeometryPointCount", 256}, - {"sqlDisableQueryILOptimization", false}, - {"sqlDisableFilterPlanOptimization", false} - }; - - private static readonly QueryPartitionProvider QueryPartitionProvider = new QueryPartitionProvider(DefaultQueryengineConfiguration); - - private static readonly PartitionKeyDefinition PartitionKeyDefinition = new PartitionKeyDefinition() - { - Paths = new System.Collections.ObjectModel.Collection() - { - "/id", - }, - Kind = PartitionKind.Hash, - }; - - private readonly SqlQuerySpec ShortQuery; - private readonly SqlQuerySpec MediumQuery; - private readonly SqlQuerySpec LongQuery; - - public ParsingBenchmark() - { - this.ShortQuery = new SqlQuerySpec("SELECT * FROM c"); - this.MediumQuery = new SqlQuerySpec(@" - SELECT * - FROM c - WHERE c.name = 'John' AND c.age = 35 - ORDER BY c.height - OFFSET 5 LIMIT 10"); - StringBuilder longQueryText = new StringBuilder(); - longQueryText.Append("SELECT * FROM c WHERE c.number IN ("); - - for (int i = 0; i < 1024; i++) - { - if (i != 0) - { - longQueryText.Append(","); - } - - longQueryText.Append(i); - } - - longQueryText.Append(")"); - this.LongQuery = new SqlQuerySpec(longQueryText.ToString()); - } - - [Benchmark] - [ArgumentsSource(nameof(Arguments))] - public void ParseBenchmark(QueryLength queryLength, ParserType parserType) - { - SqlQuerySpec sqlQuerySpec = queryLength switch - { - QueryLength.Short => this.ShortQuery, - QueryLength.Medium => this.MediumQuery, - QueryLength.Long => this.LongQuery, - _ => throw new ArgumentOutOfRangeException(nameof(queryLength)), - }; - - Action parseMethod = parserType switch - { - ParserType.Managed => ParseUsingMangedParser, - ParserType.Native => ParseUsingNativeParser, - _ => throw new ArgumentOutOfRangeException(nameof(parserType)), - }; - - for (int i = 0; i < 1000; i++) - { - parseMethod(sqlQuerySpec); - } - } - - private static void ParseUsingMangedParser(SqlQuerySpec sqlQuerySpec) - { - if (!SqlQueryParser.TryParse(sqlQuerySpec.QueryText, out SqlQuery sqlQuery)) - { - throw new InvalidOperationException("FAILED TO PARSE QUERY."); - } - } - - private static void ParseUsingNativeParser(SqlQuerySpec sqlQuerySpec) - { - TryCatch tryGetQueryPlan = QueryPartitionProvider.TryGetPartitionedQueryExecutionInfo( - querySpecJsonString: JsonConvert.SerializeObject(sqlQuerySpec), +// ---------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// ---------------------------------------------------------------- + +namespace Microsoft.Azure.Cosmos.Query +{ + using System; + using System.Collections.Generic; + using System.Text; + using BenchmarkDotNet.Attributes; + using Microsoft.Azure.Cosmos.Query.Core; + using Microsoft.Azure.Cosmos.Query.Core.Monads; + using Microsoft.Azure.Cosmos.Query.Core.Parser; + using Microsoft.Azure.Cosmos.Query.Core.QueryPlan; + using Microsoft.Azure.Cosmos.SqlObjects; + using Microsoft.Azure.Documents; + using Newtonsoft.Json; + + [MemoryDiagnoser] + public class ParsingBenchmark + { + private static readonly IDictionary DefaultQueryengineConfiguration = + new Dictionary() + { + {"maxSqlQueryInputLength", 30720}, + {"maxJoinsPerSqlQuery", 5}, + {"maxLogicalAndPerSqlQuery", 200}, + {"maxLogicalOrPerSqlQuery", 200}, + {"maxUdfRefPerSqlQuery", 6}, + {"maxInExpressionItemsCount", 8000}, + {"queryMaxInMemorySortDocumentCount", 500}, + {"maxQueryRequestTimeoutFraction", 0.90}, + {"sqlAllowNonFiniteNumbers", false}, + {"sqlAllowAggregateFunctions", true}, + {"sqlAllowSubQuery", false}, + {"allowNewKeywords", true}, + {"sqlAllowLike", false}, + {"sqlAllowGroupByClause", false}, + {"maxSpatialQueryCells", 12}, + {"spatialMaxGeometryPointCount", 256}, + {"sqlDisableQueryILOptimization", false}, + {"sqlDisableFilterPlanOptimization", false} + }; + + private static readonly QueryPartitionProvider QueryPartitionProvider = new QueryPartitionProvider(DefaultQueryengineConfiguration); + + private static readonly PartitionKeyDefinition PartitionKeyDefinition = new PartitionKeyDefinition() + { + Paths = new System.Collections.ObjectModel.Collection() + { + "/id", + }, + Kind = PartitionKind.Hash, + }; + + private readonly SqlQuerySpec ShortQuery; + private readonly SqlQuerySpec MediumQuery; + private readonly SqlQuerySpec LongQuery; + + public ParsingBenchmark() + { + this.ShortQuery = new SqlQuerySpec("SELECT * FROM c"); + this.MediumQuery = new SqlQuerySpec(@" + SELECT * + FROM c + WHERE c.name = 'John' AND c.age = 35 + ORDER BY c.height + OFFSET 5 LIMIT 10"); + StringBuilder longQueryText = new StringBuilder(); + longQueryText.Append("SELECT * FROM c WHERE c.number IN ("); + + for (int i = 0; i < 1024; i++) + { + if (i != 0) + { + longQueryText.Append(","); + } + + longQueryText.Append(i); + } + + longQueryText.Append(")"); + this.LongQuery = new SqlQuerySpec(longQueryText.ToString()); + } + + [Benchmark] + [ArgumentsSource(nameof(Arguments))] + public void ParseBenchmark(QueryLength queryLength, ParserType parserType) + { + SqlQuerySpec sqlQuerySpec = queryLength switch + { + QueryLength.Short => this.ShortQuery, + QueryLength.Medium => this.MediumQuery, + QueryLength.Long => this.LongQuery, + _ => throw new ArgumentOutOfRangeException(nameof(queryLength)), + }; + + Action parseMethod = parserType switch + { + ParserType.Managed => ParseUsingMangedParser, + ParserType.Native => ParseUsingNativeParser, + _ => throw new ArgumentOutOfRangeException(nameof(parserType)), + }; + + for (int i = 0; i < 1000; i++) + { + parseMethod(sqlQuerySpec); + } + } + + private static void ParseUsingMangedParser(SqlQuerySpec sqlQuerySpec) + { + if (!SqlQueryParser.TryParse(sqlQuerySpec.QueryText, out SqlQuery sqlQuery)) + { + throw new InvalidOperationException("FAILED TO PARSE QUERY."); + } + } + + private static void ParseUsingNativeParser(SqlQuerySpec sqlQuerySpec) + { + TryCatch tryGetQueryPlan = QueryPartitionProvider.TryGetPartitionedQueryExecutionInfo( + querySpecJsonString: JsonConvert.SerializeObject(sqlQuerySpec), partitionKeyDefinition: PartitionKeyDefinition, - vectorEmbeddingPolicy: null, - requireFormattableOrderByQuery: true, - isContinuationExpected: false, - allowNonValueAggregateQuery: true, - hasLogicalPartitionKey: false, - allowDCount: true, - useSystemPrefix: false, - geospatialType: Cosmos.GeospatialType.Geography); - - tryGetQueryPlan.ThrowIfFailed(); - } - - public IEnumerable Arguments() - { - foreach (QueryLength queryLength in Enum.GetValues(typeof(QueryLength))) - { - foreach (ParserType parserType in Enum.GetValues(typeof(ParserType))) - { - yield return new object[] { queryLength, parserType }; - } - } - } - - public enum ParserType - { - Managed, - Native, - } - - public enum QueryLength - { - Short, - Medium, - Long, - } - } -} + vectorEmbeddingPolicy: null, + requireFormattableOrderByQuery: true, + isContinuationExpected: false, + allowNonValueAggregateQuery: true, + hasLogicalPartitionKey: false, + allowDCount: true, + hybridSearchSkipOrderByRewrite: false, + useSystemPrefix: false, + geospatialType: Cosmos.GeospatialType.Geography); + + tryGetQueryPlan.ThrowIfFailed(); + } + + public IEnumerable Arguments() + { + foreach (QueryLength queryLength in Enum.GetValues(typeof(QueryLength))) + { + foreach (ParserType parserType in Enum.GetValues(typeof(ParserType))) + { + yield return new object[] { queryLength, parserType }; + } + } + } + + public enum ParserType + { + Managed, + Native, + } + + public enum QueryLength + { + Short, + Medium, + Long, + } + } +} diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Services/ConfigurationService.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Services/ConfigurationService.cs index a4268f96c8..5940baa0b6 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Services/ConfigurationService.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Services/ConfigurationService.cs @@ -18,7 +18,9 @@ public static CosmosDBConfiguration Configuration } } +#pragma warning disable IDE0044 // Add readonly modifier private static Lazy cosmosDBConfiguration = new Lazy(CreateConfiguration); +#pragma warning restore IDE0044 // Add readonly modifier private static CosmosDBConfiguration CreateConfiguration() { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/TimerWheel/Utils.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/TimerWheel/Utils.cs index 5c98cb6056..034cfc9405 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/TimerWheel/Utils.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/TimerWheel/Utils.cs @@ -9,7 +9,9 @@ namespace Microsoft.Azure.Cosmos.Performance.Tests.Benchmarks internal static class TimerUtilities { +#pragma warning disable IDE0044 // Add readonly modifier private static Random random = new Random(); +#pragma warning restore IDE0044 // Add readonly modifier public static IReadOnlyList GenerateTimeoutList( int count, int maxTimeoutValue, diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/AsyncCacheTest.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/AsyncCacheTest.cs index 46f961b9c1..c61bc4ef33 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/AsyncCacheTest.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/AsyncCacheTest.cs @@ -13,7 +13,6 @@ namespace Microsoft.Azure.Cosmos.Tests using Microsoft.Azure.Cosmos.Common; using Microsoft.Azure.Documents; using Microsoft.VisualStudio.TestTools.UnitTesting; - [TestClass] public class AsyncCacheTest { @@ -308,6 +307,45 @@ await Task.Factory.StartNew(() => ); } + [DataTestMethod] + [DataRow(true)] + [DataRow(false)] + public async Task GetAsync_Assert_OnExceptionPostProcessing(bool enabled) + { + AsyncCache cacheDefault = new AsyncCache(enableAsyncCacheExceptionNoSharing: enabled); + + // Arrange + Exception testException = new TimeoutException("Simulated timeout exception"); + CancellationToken cancellationToken = CancellationToken.None; + + // Simulate a failing lambda function + Func> failingLambda = () => Task.FromException(testException); + + // Act + try + { + await cacheDefault.GetAsync( + "testKey", + obsoleteValue: null, + singleValueInitFunc: failingLambda, + cancellationToken, + forceRefresh: false); + } + catch (TimeoutException ex) + { + if (enabled) + { + // Assert that the expected exception was rethrown + Assert.IsFalse(Object.ReferenceEquals(testException, ex)); + } else + { + // Assert that no cloning and rethrowing was done on the exceptions, + Assert.IsTrue(Object.ReferenceEquals(testException, ex)); + } + + } + } + private int GenerateIntFuncThatThrows() { throw new InvalidOperationException(); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/OrderByClauseSqlParserBaselineTests.MultiOrderByRank.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/OrderByClauseSqlParserBaselineTests.MultiOrderByRank.xml new file mode 100644 index 0000000000..3809e7e879 --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/OrderByClauseSqlParserBaselineTests.MultiOrderByRank.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/OrderByClauseSqlParserBaselineTests.SingleOrderByRank.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/OrderByClauseSqlParserBaselineTests.SingleOrderByRank.xml new file mode 100644 index 0000000000..fc1fee0704 --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/OrderByClauseSqlParserBaselineTests.SingleOrderByRank.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Distinct.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Distinct.xml index de339d029c..893b368e5d 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Distinct.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Distinct.xml @@ -125,7 +125,7 @@ [[],"Infinity") - diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.OffsetLimit.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.OffsetLimit.xml index 5d993aebda..b5ebba84f7 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.OffsetLimit.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.OffsetLimit.xml @@ -502,7 +502,7 @@ FROM c False - False - Microsoft.Azure.Cosmos.Query.Core.Monads.ExceptionWithStackTraceException : TryCatch resulted in an exception. -Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","offset":0,"limit":20,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC\nOFFSET 0 LIMIT 20","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"skip":2147483648,"take":10,"requiresGlobalStatistics":true}} +Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","offset":0,"limit":20,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC\nOFFSET 0 LIMIT 20","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"componentWeights":[],"skip":2147483648,"take":10,"requiresGlobalStatistics":true}} System.ArgumentOutOfRangeException : Specified argument was out of the range of valid values. (Parameter 'HybridSearchQueryInfo.Skip') @@ -764,7 +764,7 @@ FROM c False - False - Microsoft.Azure.Cosmos.Query.Core.Monads.ExceptionWithStackTraceException : TryCatch resulted in an exception. -Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","offset":0,"limit":20,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC\nOFFSET 0 LIMIT 20","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"skip":10,"take":2147483648,"requiresGlobalStatistics":true}} +Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","offset":0,"limit":20,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC\nOFFSET 0 LIMIT 20","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"componentWeights":[],"skip":10,"take":2147483648,"requiresGlobalStatistics":true}} System.ArgumentOutOfRangeException : Specified argument was out of the range of valid values. (Parameter 'HybridSearchQueryInfo.Take') diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Top.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Top.xml index 88fe9e438e..3e719ac912 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Top.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Top.xml @@ -508,7 +508,7 @@ FROM c False - @@ -554,7 +554,7 @@ FROM c False - @@ -576,7 +576,7 @@ ORDER BY _FullTextScore(c.text, ["swim"], {documentdb-formattablehybridsearchque Microsoft.Azure.Cosmos.Query.Core.Monads.ExceptionWithStackTraceException : TryCatch resulted in an exception. -Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","top":0,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT TOP 4294967296 c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"take":2147483648,"requiresGlobalStatistics":true}} +Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","top":0,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT TOP 4294967296 c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"componentWeights":[],"take":2147483648,"requiresGlobalStatistics":true}} System.ArgumentOutOfRangeException : Specified argument was out of the range of valid values. (Parameter 'HybridSearchQueryInfo.Take') diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/SqlObjectVisitorBaselineTests.SqlFunctionCalls.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/SqlObjectVisitorBaselineTests.SqlFunctionCalls.xml index d40ced7026..c96170c087 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/SqlObjectVisitorBaselineTests.SqlFunctionCalls.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/SqlObjectVisitorBaselineTests.SqlFunctionCalls.xml @@ -739,6 +739,50 @@ ARRAY(42) + + + ARRAY_AVG + + + + + + 323897902 + + + ARRAY_CONCAT @@ -1975,17 +2019,17 @@ COUNT(42) "Arguments": [ { "Literal": { - "Value": "Year" + "Value": "yyyy" } }, { "Literal": { - "Value": 2020 + "Value": 1 } }, { "Literal": { - "Value": "YYYY" + "Value": "2020-08-06T20:45:22.1234567Z" } } ], @@ -1993,16 +2037,84 @@ COUNT(42) }]]> - + + 1610287731 + + + + + + DateTimeBin + + + + + + -2042557462 + + + + + + DateTimeFormat + + + + + - 1570860718 - + -366443220 + @@ -2010,7 +2122,7 @@ DateTimeAdd( DateTimeDiff - + - 702180380 - + -1313869462 + @@ -2171,6 +2283,32 @@ DateTimeToTimestamp("2020-08-06T20:45:22.1234567Z") + + + DAY + + + + + + 730252520 + + + DEGREES @@ -2369,6 +2507,46 @@ GetCurrentTimestamp() + + + IIF + + + + + + 1912853209 + + + INDEX_OF @@ -2455,6 +2633,32 @@ IS_BOOL(true) + + + IS_DATETIME + + + + + + -1529891165 + + + IS_DEFINED @@ -2635,6 +2839,40 @@ IS_STRING("hello") + + + LastIndexOf + + + + + + -1618285648 + + + LEFT @@ -2891,6 +3129,32 @@ MIN(42) + + + MONTH + + + + + + -1384364250 + + + ObjectToArray @@ -3203,25 +3467,305 @@ RTRIM(42) - SIGN + SetDifference - + + 1109260146 + + + + + + SetEqual + + + + + + -2058439928 + + + + + + SetIntersect + + + + + + -644124670 + + + + + + SetUnion + + + + + + 1177661016 + + + + + + SIGN + + + + + 1835961124 @@ -3527,6 +4071,92 @@ StringEquals( + + + StringJoin + + + + + + 379070440 + + + + + + StringSplit + + + + + + 1939927191 + + + StringToArray @@ -3905,4 +4535,100 @@ UPPER(42) + + + VectorDistance + + + + + + 341383158 + + + + + + YEAR + + + + + + 1895825496 + + + \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/SqlObjectVisitorBaselineTests.SqlQueries.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/SqlObjectVisitorBaselineTests.SqlQueries.xml index 94eeeffc08..e4a45bf679 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/SqlObjectVisitorBaselineTests.SqlQueries.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/SqlObjectVisitorBaselineTests.SqlQueries.xml @@ -709,7 +709,8 @@ GROUP BY "some"["random"]["path"][42], "some"["random"]["path"][42] }, "IsDescending": false } - ] + ], + "Rank": false }]]> @@ -784,7 +785,8 @@ ORDER BY "some"["random"]["path"][42] ASC }, "IsDescending": true } - ] + ], + "Rank": false }]]> @@ -968,7 +970,8 @@ OFFSET 0 LIMIT 0 }, "IsDescending": false } - ] + ], + "Rank": false }, "OffsetLimitClause": { "OffsetSpec": { @@ -1106,7 +1109,8 @@ OFFSET 0 LIMIT 0 }, "IsDescending": false } - ] + ], + "Rank": false }, "OffsetLimitClause": { "OffsetSpec": { @@ -1247,7 +1251,8 @@ OFFSET 0 LIMIT 0 }, "IsDescending": false } - ] + ], + "Rank": false }, "OffsetLimitClause": { "OffsetSpec": { @@ -1388,7 +1393,8 @@ ARRAY( }, "IsDescending": false } - ] + ], + "Rank": false }, "OffsetLimitClause": { "OffsetSpec": { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Batch/BatchAsyncBatcherTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Batch/BatchAsyncBatcherTests.cs index 02819588ab..a250395267 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Batch/BatchAsyncBatcherTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Batch/BatchAsyncBatcherTests.cs @@ -799,7 +799,7 @@ private class ClientWithSplitDetection : MockDocumentClient public ClientWithSplitDetection() { - this.partitionKeyRangeCache = new Mock(MockBehavior.Strict, null, null, null, null); + this.partitionKeyRangeCache = new Mock(MockBehavior.Strict, null, null, null, null, false); this.partitionKeyRangeCache.Setup( m => m.TryGetOverlappingRangesAsync( It.IsAny(), diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Batch/BatchAsyncContainerExecutorTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Batch/BatchAsyncContainerExecutorTests.cs index 93aa72519a..d77afc627a 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Batch/BatchAsyncContainerExecutorTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Batch/BatchAsyncContainerExecutorTests.cs @@ -377,7 +377,7 @@ private class ClientWithSplitDetection : MockDocumentClient public ClientWithSplitDetection() { - this.partitionKeyRangeCache = new Mock(MockBehavior.Strict, null, null, null, null); + this.partitionKeyRangeCache = new Mock(MockBehavior.Strict, null, null, null, null, false); this.partitionKeyRangeCache.Setup( m => m.TryGetOverlappingRangesAsync( It.IsAny(), diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Batch/BatchAsyncOperationContextTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Batch/BatchAsyncOperationContextTests.cs index a291209dc4..b686449c42 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Batch/BatchAsyncOperationContextTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Batch/BatchAsyncOperationContextTests.cs @@ -287,7 +287,7 @@ private class ClientWithSplitDetection : MockDocumentClient public ClientWithSplitDetection() { - this.partitionKeyRangeCache = new Mock(MockBehavior.Strict, null, null, null, null); + this.partitionKeyRangeCache = new Mock(MockBehavior.Strict, null, null, null, null, false); this.partitionKeyRangeCache.Setup( m => m.TryGetOverlappingRangesAsync( It.IsAny(), diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BulkPartitionKeyRangeGoneRetryPolicyTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BulkPartitionKeyRangeGoneRetryPolicyTests.cs index 10cd9868cc..fe75375e6d 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BulkPartitionKeyRangeGoneRetryPolicyTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BulkPartitionKeyRangeGoneRetryPolicyTests.cs @@ -145,7 +145,7 @@ private class ClientWithSplitDetection : MockDocumentClient public ClientWithSplitDetection() { - this.partitionKeyRangeCache = new Mock(MockBehavior.Strict, null, null, null, null); + this.partitionKeyRangeCache = new Mock(MockBehavior.Strict, null, null, null, null, false); this.partitionKeyRangeCache.Setup( m => m.TryGetOverlappingRangesAsync( It.IsAny(), diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CancellationTokenTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CancellationTokenTests.cs index ef31029960..56640a2789 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CancellationTokenTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CancellationTokenTests.cs @@ -64,7 +64,10 @@ async Task sendFunc(HttpRequestMessage request) null, MockCosmosUtil.CreateCosmosHttpClient( () => new HttpClient(messageHandler), - eventSource)); + eventSource), + GlobalPartitionEndpointManagerNoOp.Instance); + + TestUtils.SetupCachesInGatewayStoreModel(storeModel, endpointManager); using (new ActivityScope(Guid.NewGuid())) { @@ -206,17 +209,23 @@ private static GatewayStoreModel MockGatewayStoreModel(Func mockDocumentClient = new Mock(); mockDocumentClient.Setup(client => client.ServiceEndpoint).Returns(new Uri("https://foo")); - Mock endpointManager = new Mock(mockDocumentClient.Object, new ConnectionPolicy()); + Mock endpointManager = new Mock(mockDocumentClient.Object, new ConnectionPolicy(), false); endpointManager.Setup(gep => gep.ResolveServiceEndpoint(It.IsAny())).Returns(new Uri("http://localhost")); ISessionContainer sessionContainer = new SessionContainer(string.Empty); HttpMessageHandler messageHandler = new MockMessageHandler(sendFunc); - return new GatewayStoreModel( + + GatewayStoreModel storeModel = new GatewayStoreModel( endpointManager.Object, sessionContainer, Cosmos.ConsistencyLevel.Eventual, new DocumentClientEventSource(), new JsonSerializerSettings(), - MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler))); + MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler)), + GlobalPartitionEndpointManagerNoOp.Instance); + + TestUtils.SetupCachesInGatewayStoreModel(storeModel, endpointManager.Object); + + return storeModel; } // Creates a StoreModel that will return addresses for normal requests and throw for address refresh diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ChangeFeed/PartitionSynchronizerCoreTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ChangeFeed/PartitionSynchronizerCoreTests.cs index 3974ef50b5..140e8bb098 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ChangeFeed/PartitionSynchronizerCoreTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ChangeFeed/PartitionSynchronizerCoreTests.cs @@ -61,8 +61,9 @@ public async Task HandlePartitionGoneAsync_PKRangeBasedLease_Split() Mock pkRangeCache = new Mock( Mock.Of(), Mock.Of(), - Mock.Of(), - this.endpointManager); + new Mock(false).Object, + this.endpointManager, + false); List resultingRanges = new List() { @@ -125,8 +126,9 @@ public async Task HandlePartitionGoneAsync_EpkBasedLease_Split() Mock pkRangeCache = new Mock( Mock.Of(), Mock.Of(), - Mock.Of(), - this.endpointManager); + new Mock(false).Object, + this.endpointManager, + false); List resultingRanges = new List() { @@ -194,8 +196,9 @@ public async Task HandlePartitionGoneAsync_PKRangeBasedLease_Merge() Mock pkRangeCache = new Mock( Mock.Of(), Mock.Of(), - Mock.Of(), - this.endpointManager); + new Mock(false).Object, + this.endpointManager, + false); List resultingRanges = new List() { @@ -253,8 +256,9 @@ public async Task HandlePartitionGoneAsync_EpkBasedLease_Merge() Mock pkRangeCache = new Mock( Mock.Of(), Mock.Of(), - Mock.Of(), - this.endpointManager); + new Mock(false).Object, + this.endpointManager, + false); List resultingRanges = new List() { @@ -302,8 +306,9 @@ public async Task CreateMissingLeases_NoLeases() Mock pkRangeCache = new Mock( Mock.Of(), Mock.Of(), - Mock.Of(), - this.endpointManager); + new Mock(false).Object, + this.endpointManager, + false); List resultingRanges = new List() { @@ -348,8 +353,9 @@ public async Task CreateMissingLeases_SomePKRangeLeases() Mock pkRangeCache = new Mock( Mock.Of(), Mock.Of(), - Mock.Of(), - this.endpointManager); + new Mock(false).Object, + this.endpointManager, + false); List resultingRanges = new List() { @@ -400,8 +406,9 @@ public async Task CreateMissingLeases_SomePKRangeAndEPKLeases() Mock pkRangeCache = new Mock( Mock.Of(), Mock.Of(), - Mock.Of(), - this.endpointManager); + new Mock(false).Object, + this.endpointManager, + false); List resultingRanges = new List() { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ClientRetryPolicyTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ClientRetryPolicyTests.cs index 46e51348be..d5b067f964 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ClientRetryPolicyTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ClientRetryPolicyTests.cs @@ -25,8 +25,12 @@ [TestClass] public sealed class ClientRetryPolicyTests { - private static Uri Location1Endpoint = new Uri("https://location1.documents.azure.com"); - private static Uri Location2Endpoint = new Uri("https://location2.documents.azure.com"); +#pragma warning disable IDE0044 // Add readonly modifier + private static Uri Location1Endpoint = new Uri("https://location1.documents.azure.com"); +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier + private static Uri Location2Endpoint = new Uri("https://location2.documents.azure.com"); +#pragma warning restore IDE0044 // Add readonly modifier private ReadOnlyCollection preferredLocations; private AccountProperties databaseAccount; @@ -164,13 +168,16 @@ public async Task ShouldRetryAsync_WhenRequestThrottledWithResourceNotAvailable_ } /// - /// Tests to see if different 503 substatus codes are handeled correctly + /// Tests to see if different 503 substatus and other similar status codes are handeled correctly /// /// The substatus code being Tested. - [DataRow((int)SubStatusCodes.Unknown)] - [DataRow((int)SubStatusCodes.TransportGenerated503)] + [DataRow((int)StatusCodes.ServiceUnavailable, (int)SubStatusCodes.Unknown, "ServiceUnavailable")] + [DataRow((int)StatusCodes.ServiceUnavailable, (int)SubStatusCodes.TransportGenerated503, "ServiceUnavailable")] + [DataRow((int)StatusCodes.InternalServerError, (int)SubStatusCodes.Unknown, "InternalServerError")] + [DataRow((int)StatusCodes.Gone, (int)SubStatusCodes.LeaseNotFound, "LeaseNotFound")] + [DataRow((int)StatusCodes.Forbidden, (int)SubStatusCodes.DatabaseAccountNotFound, "DatabaseAccountNotFound")] [DataTestMethod] - public void Http503SubStatusHandelingTests(int testCode) + public void Http503LikeSubStatusHandelingTests(int statusCode, int SubStatusCode, string message) { const bool enableEndpointDiscovery = true; @@ -187,14 +194,14 @@ public void Http503SubStatusHandelingTests(int testCode) Exception serviceUnavailableException = new Exception(); Mock nameValueCollection = new Mock(); - HttpStatusCode serviceUnavailable = HttpStatusCode.ServiceUnavailable; + HttpStatusCode serviceUnavailable = (HttpStatusCode)statusCode; DocumentClientException documentClientException = new DocumentClientException( - message: "Service Unavailable", + message: message, innerException: serviceUnavailableException, responseHeaders: nameValueCollection.Object, statusCode: serviceUnavailable, - substatusCode: (SubStatusCodes)testCode, + substatusCode: (SubStatusCodes)SubStatusCode, requestUri: null ); @@ -210,7 +217,6 @@ public void Http503SubStatusHandelingTests(int testCode) [TestMethod] [DataRow(true, DisplayName = "Case when partition level failover is enabled.")] [DataRow(false, DisplayName = "Case when partition level failover is disabled.")] - public void HttpRequestExceptionHandelingTests( bool enablePartitionLevelFailover) { @@ -237,14 +243,15 @@ public void HttpRequestExceptionHandelingTests( partitionKeyRangeLocationCache: this.partitionKeyRangeLocationCache, retryOptions: new RetryOptions(), enableEndpointDiscovery: enableEndpointDiscovery, - isPertitionLevelFailoverEnabled: enablePartitionLevelFailover); + isPartitionLevelFailoverEnabled: enablePartitionLevelFailover); CancellationToken cancellationToken = new (); HttpRequestException httpRequestException = new (message: "Connecting to endpoint has failed."); GlobalPartitionEndpointManagerCore.PartitionKeyRangeFailoverInfo partitionKeyRangeFailoverInfo = ClientRetryPolicyTests.GetPartitionKeyRangeFailoverInfoUsingReflection( this.partitionKeyRangeLocationCache, - request.RequestContext.ResolvedPartitionKeyRange); + request.RequestContext.ResolvedPartitionKeyRange, + isReadOnlyOrMultiMasterWriteRequest: false); // Validate that the partition key range failover info is not present before the http request exception was captured in the retry policy. Assert.IsNull(partitionKeyRangeFailoverInfo); @@ -256,11 +263,92 @@ public void HttpRequestExceptionHandelingTests( partitionKeyRangeFailoverInfo = ClientRetryPolicyTests.GetPartitionKeyRangeFailoverInfoUsingReflection( this.partitionKeyRangeLocationCache, - request.RequestContext.ResolvedPartitionKeyRange); + request.RequestContext.ResolvedPartitionKeyRange, + isReadOnlyOrMultiMasterWriteRequest: false); + + if (enablePartitionLevelFailover) + { + // Validate that the partition key range failover info to the next account region is present after the http request exception was captured in the retry policy. + Assert.AreEqual(partitionKeyRangeFailoverInfo.Current, readLocations[1]); + } + else + { + Assert.IsNull(partitionKeyRangeFailoverInfo); + } + } + + /// + /// Test to validate that when an OperationCanceledException is thrown during the retry attempt, for a single master write account with PPAF enabled, + /// a partition level failover is applied and the subsequent requests will be retried on the next region for the faulty partition. + /// + [TestMethod] + [DataRow(true, true, DisplayName = "Read Request - Case when partition level failover is enabled.")] + [DataRow(false, true, DisplayName = "Write Request - Case when partition level failover is enabled.")] + [DataRow(true, false, DisplayName = "Read Request - Case when partition level failover is disabled.")] + [DataRow(false, false, DisplayName = "Write Request - Case when partition level failover is disabled.")] + public void CosmosOperationCancelledExceptionHandelingTests( + bool isReadOnlyRequest, + bool enablePartitionLevelFailover) + { + int requestThreshold = isReadOnlyRequest ? 10 : 5; + const bool enableEndpointDiscovery = true; + const string suffix = "-FF-FF-FF-FF-FF-FF-FF-FF-FF-FF-FF-FF-FF-FF-FF"; + + //Creates a sample write request + DocumentServiceRequest request = this.CreateRequest(isReadOnlyRequest, false); + request.RequestContext.ResolvedPartitionKeyRange = new PartitionKeyRange() { Id = "0", MinInclusive = "3F" + suffix, MaxExclusive = "5F" + suffix }; + + //Create GlobalEndpointManager + using GlobalEndpointManager endpointManager = this.Initialize( + useMultipleWriteLocations: false, + enableEndpointDiscovery: enableEndpointDiscovery, + isPreferredLocationsListEmpty: false, + enablePartitionLevelFailover: enablePartitionLevelFailover); + + // Capture the read locations. + ReadOnlyCollection readLocations = endpointManager.ReadEndpoints; + + //Create Retry Policy + ClientRetryPolicy retryPolicy = new( + globalEndpointManager: endpointManager, + partitionKeyRangeLocationCache: this.partitionKeyRangeLocationCache, + retryOptions: new RetryOptions(), + enableEndpointDiscovery: enableEndpointDiscovery, + isPartitionLevelFailoverEnabled: enablePartitionLevelFailover); + + CancellationToken cancellationToken = new(); + OperationCanceledException operationCancelledException = new(message: "Operation was cancelled due to cancellation token expiry."); + + GlobalPartitionEndpointManagerCore.PartitionKeyRangeFailoverInfo partitionKeyRangeFailoverInfo = ClientRetryPolicyTests.GetPartitionKeyRangeFailoverInfoUsingReflection( + this.partitionKeyRangeLocationCache, + request.RequestContext.ResolvedPartitionKeyRange, + isReadOnlyOrMultiMasterWriteRequest: isReadOnlyRequest); + + // Validate that the partition key range failover info is not present before the http request exception was captured in the retry policy. + Assert.IsNull(partitionKeyRangeFailoverInfo); + + Task retryStatus; + + // With cancellation token expiry, the retry policy should not failover the offending partition + // until the write threshold is met. + for (int i=0; i< requestThreshold; i++) + { + retryPolicy.OnBeforeSendRequest(request); + retryStatus = retryPolicy.ShouldRetryAsync(operationCancelledException, cancellationToken); + } + + retryStatus = retryPolicy.ShouldRetryAsync(operationCancelledException, cancellationToken); + Assert.IsFalse(retryStatus.Result.ShouldRetry); + + partitionKeyRangeFailoverInfo = ClientRetryPolicyTests.GetPartitionKeyRangeFailoverInfoUsingReflection( + this.partitionKeyRangeLocationCache, + request.RequestContext.ResolvedPartitionKeyRange, + isReadOnlyOrMultiMasterWriteRequest: isReadOnlyRequest); if (enablePartitionLevelFailover) { // Validate that the partition key range failover info to the next account region is present after the http request exception was captured in the retry policy. + Assert.IsNotNull(partitionKeyRangeFailoverInfo); Assert.AreEqual(partitionKeyRangeFailoverInfo.Current, readLocations[1]); } else @@ -363,7 +451,7 @@ private async Task ValidateConnectTimeoutTriggersClientRetryPolicyAsync( this.partitionKeyRangeLocationCache = GlobalPartitionEndpointManagerNoOp.Instance; - ClientRetryPolicy retryPolicy = new ClientRetryPolicy(mockDocumentClientContext.GlobalEndpointManager, this.partitionKeyRangeLocationCache, new RetryOptions(), enableEndpointDiscovery: true, isPertitionLevelFailoverEnabled: false); + ClientRetryPolicy retryPolicy = new ClientRetryPolicy(mockDocumentClientContext.GlobalEndpointManager, this.partitionKeyRangeLocationCache, new RetryOptions(), enableEndpointDiscovery: true, isPartitionLevelFailoverEnabled: false); INameValueCollection headers = new DictionaryNameValueCollection(); headers.Set(HttpConstants.HttpHeaders.ConsistencyLevel, ConsistencyLevel.BoundedStaleness.ToString()); @@ -434,12 +522,14 @@ await BackoffRetryUtility.ExecuteAsync( private static GlobalPartitionEndpointManagerCore.PartitionKeyRangeFailoverInfo GetPartitionKeyRangeFailoverInfoUsingReflection( GlobalPartitionEndpointManager globalPartitionEndpointManager, - PartitionKeyRange pkRange) + PartitionKeyRange pkRange, + bool isReadOnlyOrMultiMasterWriteRequest) { + string fieldName = isReadOnlyOrMultiMasterWriteRequest ? "PartitionKeyRangeToLocationForReadAndWrite" : "PartitionKeyRangeToLocationForWrite"; FieldInfo fieldInfo = globalPartitionEndpointManager .GetType() .GetField( - name: "PartitionKeyRangeToLocation", + name: fieldName, bindingAttr: BindingFlags.Instance | BindingFlags.NonPublic); if (fieldInfo != null) @@ -495,6 +585,7 @@ private GlobalEndpointManager Initialize( bool enforceSingleMasterSingleWriteLocation = false, // Some tests depend on the Initialize to create an account with multiple write locations, even when not multi master ReadOnlyCollection preferedRegionListOverride = null, bool enablePartitionLevelFailover = false, + bool enablePartitionLevelCircuitBreaker = false, bool multimasterMetadataWriteRetryTest = false) { this.databaseAccount = ClientRetryPolicyTests.CreateDatabaseAccount( @@ -544,7 +635,10 @@ private GlobalEndpointManager Initialize( if (enablePartitionLevelFailover) { - this.partitionKeyRangeLocationCache = new GlobalPartitionEndpointManagerCore(endpointManager); + this.partitionKeyRangeLocationCache = new GlobalPartitionEndpointManagerCore( + globalEndpointManager: endpointManager, + isPartitionLevelFailoverEnabled: enablePartitionLevelFailover, + isPartitionLevelCircuitBreakerEnabled: enablePartitionLevelFailover || enablePartitionLevelCircuitBreaker); } else { @@ -639,8 +733,12 @@ public void Dispose() private class MockAddressResolver : IAddressResolverExtension { - private List oldAddressInformations; - private List newAddressInformations; +#pragma warning disable IDE0044 // Add readonly modifier + private List oldAddressInformations; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier + private List newAddressInformations; +#pragma warning restore IDE0044 // Add readonly modifier public int NumberOfRefreshes { get; set; } @@ -709,8 +807,12 @@ public void SetOpenConnectionsHandler( private class MockTransportClient : TransportClient { - private Dictionary uriToStoreResponseMap; - private Dictionary uriToExceptionMap; +#pragma warning disable IDE0044 // Add readonly modifier + private Dictionary uriToStoreResponseMap; +#pragma warning restore IDE0044 // Add readonly modifier +#pragma warning disable IDE0044 // Add readonly modifier + private Dictionary uriToExceptionMap; +#pragma warning restore IDE0044 // Add readonly modifier public MockTransportClient( Dictionary uriToStoreResponseMap, diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/ContractTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/ContractTests.cs index 7cb8f6fa7f..28ef46988b 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/ContractTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/ContractTests.cs @@ -29,7 +29,7 @@ public void ApiVersionTest() CollectionAssert.AreEqual(Encoding.UTF8.GetBytes(HttpConstants.Versions.v2020_07_15), HttpConstants.Versions.CurrentVersionUTF8); ulong capabilitites = SDKSupportedCapabilitiesHelpers.GetSDKSupportedCapabilities(); - Assert.AreEqual(capabilitites & (ulong)SDKSupportedCapabilities.PartitionMerge, (ulong)SDKSupportedCapabilities.PartitionMerge); + Assert.AreEqual((ulong)(SDKSupportedCapabilities.PartitionMerge | SDKSupportedCapabilities.IgnoreUnknownRntbdTokens), capabilitites & (ulong)(SDKSupportedCapabilities.PartitionMerge | SDKSupportedCapabilities.IgnoreUnknownRntbdTokens)); } [TestMethod] diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json index 992059af23..55895ac3e7 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json @@ -1,16 +1,5 @@ { "Subclasses": { - "Microsoft.Azure.Cosmos.AvailabilityStrategy;System.Object;IsAbstract:True;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { - "Subclasses": {}, - "Members": { - "Microsoft.Azure.Cosmos.AvailabilityStrategy CrossRegionHedgingStrategy(System.TimeSpan, System.Nullable`1[System.TimeSpan], Boolean)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.AvailabilityStrategy CrossRegionHedgingStrategy(System.TimeSpan, System.Nullable`1[System.TimeSpan], Boolean);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - } - }, - "NestedTypes": {} - }, "Microsoft.Azure.Cosmos.ChangeFeedItem`1;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:True;IsSerializable:False": { "Subclasses": {}, "Members": { @@ -257,59 +246,6 @@ }, "NestedTypes": {} }, - "Microsoft.Azure.Cosmos.ComputedProperty;System.Object;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { - "Subclasses": {}, - "Members": { - "System.String get_Name()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "System.String get_Name();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.String get_Query()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "System.String get_Query();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.String Name[Newtonsoft.Json.JsonPropertyAttribute(PropertyName = \"name\")]": { - "Type": "Property", - "Attributes": [ - "JsonPropertyAttribute" - ], - "MethodInfo": "System.String Name;CanRead:True;CanWrite:True;System.String get_Name();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_Name(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.String Query[Newtonsoft.Json.JsonPropertyAttribute(PropertyName = \"query\")]": { - "Type": "Property", - "Attributes": [ - "JsonPropertyAttribute" - ], - "MethodInfo": "System.String Query;CanRead:True;CanWrite:True;System.String get_Query();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_Query(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Void .ctor()": { - "Type": "Constructor", - "Attributes": [], - "MethodInfo": "[Void .ctor(), Void .ctor()]" - }, - "Void set_Name(System.String)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "Void set_Name(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Void set_Query(System.String)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "Void set_Query(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - } - }, - "NestedTypes": {} - }, "Microsoft.Azure.Cosmos.Container;System.Object;IsAbstract:True;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { @@ -323,11 +259,6 @@ "Attributes": [], "MethodInfo": "System.Threading.Tasks.Task`1[System.Boolean] IsFeedRangePartOfAsync(Microsoft.Azure.Cosmos.FeedRange, Microsoft.Azure.Cosmos.FeedRange, System.Threading.CancellationToken);IsAbstract:False;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, - "System.Threading.Tasks.Task`1[System.Boolean] IsFeedRangePartOfAsync(Microsoft.Azure.Cosmos.FeedRange, Microsoft.Azure.Cosmos.FeedRange, System.Threading.CancellationToken)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "System.Threading.Tasks.Task`1[System.Boolean] IsFeedRangePartOfAsync(Microsoft.Azure.Cosmos.FeedRange, Microsoft.Azure.Cosmos.FeedRange, System.Threading.CancellationToken);IsAbstract:False;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, "System.Threading.Tasks.Task`1[System.Collections.Generic.IEnumerable`1[System.String]] GetPartitionKeyRangesAsync(Microsoft.Azure.Cosmos.FeedRange, System.Threading.CancellationToken)": { "Type": "Method", "Attributes": [], @@ -351,27 +282,50 @@ "Attributes": [], "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedPolicy get_ChangeFeedPolicy();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, - "Microsoft.Azure.Cosmos.FullTextPolicy FullTextPolicy[Newtonsoft.Json.JsonIgnoreAttribute()]": { + "Void set_ChangeFeedPolicy(Microsoft.Azure.Cosmos.ChangeFeedPolicy)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Void set_ChangeFeedPolicy(Microsoft.Azure.Cosmos.ChangeFeedPolicy);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + } + }, + "NestedTypes": {} + }, + "Microsoft.Azure.Cosmos.CosmosClientOptions;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { + "Subclasses": {}, + "Members": { + "Boolean EnableRemoteRegionPreferredForSessionRetry": { "Type": "Property", - "Attributes": [ - "JsonIgnoreAttribute" - ], - "MethodInfo": "Microsoft.Azure.Cosmos.FullTextPolicy FullTextPolicy;CanRead:True;CanWrite:True;Microsoft.Azure.Cosmos.FullTextPolicy get_FullTextPolicy();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_FullTextPolicy(Microsoft.Azure.Cosmos.FullTextPolicy);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + "Attributes": [], + "MethodInfo": "Boolean EnableRemoteRegionPreferredForSessionRetry;CanRead:True;CanWrite:True;Boolean get_EnableRemoteRegionPreferredForSessionRetry();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_EnableRemoteRegionPreferredForSessionRetry(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, - "Microsoft.Azure.Cosmos.FullTextPolicy get_FullTextPolicy()": { + "Boolean get_EnableRemoteRegionPreferredForSessionRetry()": { "Type": "Method", "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.FullTextPolicy get_FullTextPolicy();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + "MethodInfo": "Boolean get_EnableRemoteRegionPreferredForSessionRetry();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, - "Void set_ChangeFeedPolicy(Microsoft.Azure.Cosmos.ChangeFeedPolicy)": { + "System.Nullable`1[System.Int32] get_ThroughputBucket()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.Nullable`1[System.Int32] get_ThroughputBucket();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Nullable`1[System.Int32] ThroughputBucket": { + "Type": "Property", "Attributes": [], - "MethodInfo": "Void set_ChangeFeedPolicy(Microsoft.Azure.Cosmos.ChangeFeedPolicy);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + "MethodInfo": "System.Nullable`1[System.Int32] ThroughputBucket;CanRead:True;CanWrite:True;System.Nullable`1[System.Int32] get_ThroughputBucket();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_ThroughputBucket(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, - "Void set_FullTextPolicy(Microsoft.Azure.Cosmos.FullTextPolicy)": { + "Void set_EnableRemoteRegionPreferredForSessionRetry(Boolean)": { "Type": "Method", "Attributes": [], - "MethodInfo": "Void set_FullTextPolicy(Microsoft.Azure.Cosmos.FullTextPolicy);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + "MethodInfo": "Void set_EnableRemoteRegionPreferredForSessionRetry(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_ThroughputBucket(System.Nullable`1[System.Int32])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_ThroughputBucket(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" } }, "NestedTypes": {} @@ -700,10 +654,15 @@ "Microsoft.Azure.Cosmos.CosmosDbClientMetrics+OperationMetrics+Unit;System.Object;IsAbstract:True;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:True;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { - "System.String Count": { + "System.String Instance": { + "Type": "Field", + "Attributes": [], + "MethodInfo": "System.String Instance;IsInitOnly:False;IsStatic:True;" + }, + "System.String Item": { "Type": "Field", "Attributes": [], - "MethodInfo": "System.String Count;IsInitOnly:False;IsStatic:True;" + "MethodInfo": "System.String Item;IsInitOnly:False;IsStatic:True;" }, "System.String RequestUnit": { "Type": "Field", @@ -1056,10 +1015,15 @@ "Microsoft.Azure.Cosmos.CosmosDbClientMetrics+OperationMetrics+Unit;System.Object;IsAbstract:True;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:True;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { - "System.String Count": { + "System.String Instance": { "Type": "Field", "Attributes": [], - "MethodInfo": "System.String Count;IsInitOnly:False;IsStatic:True;" + "MethodInfo": "System.String Instance;IsInitOnly:False;IsStatic:True;" + }, + "System.String Item": { + "Type": "Field", + "Attributes": [], + "MethodInfo": "System.String Item;IsInitOnly:False;IsStatic:True;" }, "System.String RequestUnit": { "Type": "Field", @@ -1131,10 +1095,15 @@ "Microsoft.Azure.Cosmos.CosmosDbClientMetrics+OperationMetrics+Unit;System.Object;IsAbstract:True;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:True;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { - "System.String Count": { + "System.String Instance": { "Type": "Field", "Attributes": [], - "MethodInfo": "System.String Count;IsInitOnly:False;IsStatic:True;" + "MethodInfo": "System.String Instance;IsInitOnly:False;IsStatic:True;" + }, + "System.String Item": { + "Type": "Field", + "Attributes": [], + "MethodInfo": "System.String Item;IsInitOnly:False;IsStatic:True;" }, "System.String RequestUnit": { "Type": "Field", @@ -1160,22 +1129,6 @@ }, "NestedTypes": {} }, - "Microsoft.Azure.Cosmos.Fluent.ComputedPropertiesDefinition`1;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:True;IsSerializable:False": { - "Subclasses": {}, - "Members": { - "Microsoft.Azure.Cosmos.Fluent.ComputedPropertiesDefinition`1[T] WithComputedProperty(System.String, System.String)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.ComputedPropertiesDefinition`1[T] WithComputedProperty(System.String, System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "T Attach()": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "T Attach();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - } - }, - "NestedTypes": {} - }, "Microsoft.Azure.Cosmos.Fluent.ContainerBuilder;Microsoft.Azure.Cosmos.Fluent.ContainerDefinition`1[[Microsoft.Azure.Cosmos.Fluent.ContainerBuilder, ]];IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { @@ -1183,11 +1136,6 @@ "Type": "Method", "Attributes": [], "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.ChangeFeedPolicyDefinition WithChangeFeedPolicy(System.TimeSpan);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Microsoft.Azure.Cosmos.Fluent.FullTextPolicyDefinition WithFullTextPolicy(System.String, System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath])": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.FullTextPolicyDefinition WithFullTextPolicy(System.String, System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" } }, "NestedTypes": {} @@ -1195,58 +1143,15 @@ "Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { - "Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder WithAvailabilityStrategy(Microsoft.Azure.Cosmos.AvailabilityStrategy)": { + "Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder WithEnableRemoteRegionPreferredForSessionRetry(Boolean)": { "Type": "Method", "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder WithAvailabilityStrategy(Microsoft.Azure.Cosmos.AvailabilityStrategy);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - } - }, - "NestedTypes": {} - }, - "Microsoft.Azure.Cosmos.Fluent.FullTextIndexDefinition`1;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:True;IsSerializable:False": { - "Subclasses": {}, - "Members": { - "Microsoft.Azure.Cosmos.Fluent.FullTextIndexDefinition`1[T] Path(System.String)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.FullTextIndexDefinition`1[T] Path(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "T Attach()": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "T Attach();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder WithEnableRemoteRegionPreferredForSessionRetry(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, - "Void .ctor(T, System.Action`1[Microsoft.Azure.Cosmos.FullTextIndexPath])": { - "Type": "Constructor", - "Attributes": [], - "MethodInfo": "[Void .ctor(T, System.Action`1[Microsoft.Azure.Cosmos.FullTextIndexPath]), Void .ctor(T, System.Action`1[Microsoft.Azure.Cosmos.FullTextIndexPath])]" - } - }, - "NestedTypes": {} - }, - "Microsoft.Azure.Cosmos.Fluent.FullTextPolicyDefinition;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { - "Subclasses": {}, - "Members": { - "Microsoft.Azure.Cosmos.Fluent.ContainerBuilder Attach()": { + "Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder WithThroughputBucket(Int32)": { "Type": "Method", "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.ContainerBuilder Attach();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Void .ctor(Microsoft.Azure.Cosmos.Fluent.ContainerBuilder, System.String, System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath], System.Action`1[Microsoft.Azure.Cosmos.FullTextPolicy])": { - "Type": "Constructor", - "Attributes": [], - "MethodInfo": "[Void .ctor(Microsoft.Azure.Cosmos.Fluent.ContainerBuilder, System.String, System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath], System.Action`1[Microsoft.Azure.Cosmos.FullTextPolicy]), Void .ctor(Microsoft.Azure.Cosmos.Fluent.ContainerBuilder, System.String, System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath], System.Action`1[Microsoft.Azure.Cosmos.FullTextPolicy])]" - } - }, - "NestedTypes": {} - }, - "Microsoft.Azure.Cosmos.Fluent.IndexingPolicyDefinition`1;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:True;IsSerializable:False": { - "Subclasses": {}, - "Members": { - "Microsoft.Azure.Cosmos.Fluent.FullTextIndexDefinition`1[Microsoft.Azure.Cosmos.Fluent.IndexingPolicyDefinition`1[T]] WithFullTextIndex()": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.FullTextIndexDefinition`1[Microsoft.Azure.Cosmos.Fluent.IndexingPolicyDefinition`1[T]] WithFullTextIndex();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder WithThroughputBucket(Int32);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" } }, "NestedTypes": {} @@ -1263,177 +1168,11 @@ "Type": "Method", "Attributes": [], "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.VectorIndexDefinition`1[T] WithQuantizationByteSize(Int32);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - } - }, - "NestedTypes": {} - }, - "Microsoft.Azure.Cosmos.FullTextIndexPath;System.Object;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { - "Subclasses": {}, - "Members": { - "System.String get_Path()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "System.String get_Path();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.String Path[Newtonsoft.Json.JsonPropertyAttribute(PropertyName = \"path\")]": { - "Type": "Property", - "Attributes": [ - "JsonPropertyAttribute" - ], - "MethodInfo": "System.String Path;CanRead:True;CanWrite:True;System.String get_Path();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_Path(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Void .ctor()": { - "Type": "Constructor", - "Attributes": [], - "MethodInfo": "[Void .ctor(), Void .ctor()]" - }, - "Void set_Path(System.String)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "Void set_Path(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - } - }, - "NestedTypes": {} - }, - "Microsoft.Azure.Cosmos.FullTextPath;System.Object;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { - "Subclasses": {}, - "Members": { - "Boolean Equals(Microsoft.Azure.Cosmos.FullTextPath)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Boolean Equals(Microsoft.Azure.Cosmos.FullTextPath);IsAbstract:False;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:True;" - }, - "System.String get_Language()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "System.String get_Language();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.String get_Path()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "System.String get_Path();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.String Language[Newtonsoft.Json.JsonPropertyAttribute(PropertyName = \"language\")]": { - "Type": "Property", - "Attributes": [ - "JsonPropertyAttribute" - ], - "MethodInfo": "System.String Language;CanRead:True;CanWrite:True;System.String get_Language();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_Language(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.String Path[Newtonsoft.Json.JsonPropertyAttribute(PropertyName = \"path\")]": { - "Type": "Property", - "Attributes": [ - "JsonPropertyAttribute" - ], - "MethodInfo": "System.String Path;CanRead:True;CanWrite:True;System.String get_Path();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_Path(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Void .ctor()": { - "Type": "Constructor", - "Attributes": [], - "MethodInfo": "[Void .ctor(), Void .ctor()]" - }, - "Void set_Language(System.String)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "Void set_Language(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, - "Void set_Path(System.String)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "Void set_Path(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Void ValidateFullTextPath()": { + "Microsoft.Azure.Cosmos.Fluent.VectorIndexDefinition`1[T] WithVectorIndexShardKey(System.String[])": { "Type": "Method", "Attributes": [], - "MethodInfo": "Void ValidateFullTextPath();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - } - }, - "NestedTypes": {} - }, - "Microsoft.Azure.Cosmos.FullTextPolicy;System.Object;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { - "Subclasses": {}, - "Members": { - "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath] FullTextPaths[Newtonsoft.Json.JsonIgnoreAttribute()]": { - "Type": "Property", - "Attributes": [ - "JsonIgnoreAttribute" - ], - "MethodInfo": "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath] FullTextPaths;CanRead:True;CanWrite:True;System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath] get_FullTextPaths();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_FullTextPaths(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath] get_FullTextPaths()": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath] get_FullTextPaths();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.String DefaultLanguage[Newtonsoft.Json.JsonPropertyAttribute(NullValueHandling = 1, PropertyName = \"defaultLanguage\")]": { - "Type": "Property", - "Attributes": [ - "JsonPropertyAttribute" - ], - "MethodInfo": "System.String DefaultLanguage;CanRead:True;CanWrite:True;System.String get_DefaultLanguage();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_DefaultLanguage(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.String get_DefaultLanguage()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "System.String get_DefaultLanguage();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Void .ctor()": { - "Type": "Constructor", - "Attributes": [], - "MethodInfo": "[Void .ctor(), Void .ctor()]" - }, - "Void set_DefaultLanguage(System.String)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "Void set_DefaultLanguage(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Void set_FullTextPaths(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath])": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Void set_FullTextPaths(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - } - }, - "NestedTypes": {} - }, - "Microsoft.Azure.Cosmos.IndexingPolicy;System.Object;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { - "Subclasses": {}, - "Members": { - "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextIndexPath] FullTextIndexes[Newtonsoft.Json.JsonPropertyAttribute(NullValueHandling = 1, PropertyName = \"fullTextIndexes\")]": { - "Type": "Property", - "Attributes": [ - "JsonPropertyAttribute" - ], - "MethodInfo": "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextIndexPath] FullTextIndexes;CanRead:True;CanWrite:True;System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextIndexPath] get_FullTextIndexes();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_FullTextIndexes(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextIndexPath]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextIndexPath] get_FullTextIndexes()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextIndexPath] get_FullTextIndexes();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Void set_FullTextIndexes(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextIndexPath])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "Void set_FullTextIndexes(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextIndexPath]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.VectorIndexDefinition`1[T] WithVectorIndexShardKey(System.String[]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" } }, "NestedTypes": {} @@ -1588,6 +1327,18 @@ "Attributes": [], "MethodInfo": "Microsoft.Azure.Cosmos.OperationMetricsOptions OperationMetricsOptions;CanRead:True;CanWrite:True;Microsoft.Azure.Cosmos.OperationMetricsOptions get_OperationMetricsOptions();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_OperationMetricsOptions(Microsoft.Azure.Cosmos.OperationMetricsOptions);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "System.Nullable`1[System.Int32] get_ThroughputBucket()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.Nullable`1[System.Int32] get_ThroughputBucket();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Nullable`1[System.Int32] ThroughputBucket": { + "Type": "Property", + "Attributes": [], + "MethodInfo": "System.Nullable`1[System.Int32] ThroughputBucket;CanRead:True;CanWrite:True;System.Nullable`1[System.Int32] get_ThroughputBucket();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_ThroughputBucket(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Void set_AvailabilityStrategy(Microsoft.Azure.Cosmos.AvailabilityStrategy)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { "Type": "Method", "Attributes": [ @@ -1608,6 +1359,13 @@ "CompilerGeneratedAttribute" ], "MethodInfo": "Void set_OperationMetricsOptions(Microsoft.Azure.Cosmos.OperationMetricsOptions);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_ThroughputBucket(System.Nullable`1[System.Int32])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_ThroughputBucket(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" } }, "NestedTypes": {} @@ -1639,6 +1397,20 @@ ], "MethodInfo": "Int32 QuantizationByteSize;CanRead:True;CanWrite:True;Int32 get_QuantizationByteSize();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_QuantizationByteSize(Int32);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "System.String[] get_VectorIndexShardKey()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.String[] get_VectorIndexShardKey();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String[] VectorIndexShardKey[Newtonsoft.Json.JsonPropertyAttribute(NullValueHandling = 1, PropertyName = \"vectorIndexShardKey\")]": { + "Type": "Property", + "Attributes": [ + "JsonPropertyAttribute" + ], + "MethodInfo": "System.String[] VectorIndexShardKey;CanRead:True;CanWrite:True;System.String[] get_VectorIndexShardKey();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_VectorIndexShardKey(System.String[]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Void set_IndexingSearchListSize(Int32)": { "Type": "Method", "Attributes": [], @@ -1648,6 +1420,13 @@ "Type": "Method", "Attributes": [], "MethodInfo": "Void set_QuantizationByteSize(Int32);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_VectorIndexShardKey(System.String[])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_VectorIndexShardKey(System.String[]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" } }, "NestedTypes": {} diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json index 80b1b00f1d..54e00c2a53 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json @@ -166,10 +166,10 @@ "Microsoft.Azure.Cosmos.AvailabilityStrategy;System.Object;IsAbstract:True;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { - "Microsoft.Azure.Cosmos.AvailabilityStrategy CrossRegionHedgingStrategy(System.TimeSpan, System.Nullable`1[System.TimeSpan])": { + "Microsoft.Azure.Cosmos.AvailabilityStrategy CrossRegionHedgingStrategy(System.TimeSpan, System.Nullable`1[System.TimeSpan], Boolean)": { "Type": "Method", "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.AvailabilityStrategy CrossRegionHedgingStrategy(System.TimeSpan, System.Nullable`1[System.TimeSpan]);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + "MethodInfo": "Microsoft.Azure.Cosmos.AvailabilityStrategy CrossRegionHedgingStrategy(System.TimeSpan, System.Nullable`1[System.TimeSpan], Boolean);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, "Microsoft.Azure.Cosmos.AvailabilityStrategy DisabledStrategy()": { "Type": "Method", @@ -370,6 +370,11 @@ "Attributes": [], "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder WithErrorNotification(ChangeFeedMonitorErrorDelegate);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder WithInMemoryLeaseContainer()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder WithInMemoryLeaseContainer();IsAbstract:False;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder WithInstanceName(System.String)": { "Type": "Method", "Attributes": [], @@ -2225,6 +2230,18 @@ "Attributes": [], "MethodInfo": "Microsoft.Azure.Cosmos.ConflictResolutionPolicy get_ConflictResolutionPolicy();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "Microsoft.Azure.Cosmos.FullTextPolicy FullTextPolicy[Newtonsoft.Json.JsonIgnoreAttribute()]": { + "Type": "Property", + "Attributes": [ + "JsonIgnoreAttribute" + ], + "MethodInfo": "Microsoft.Azure.Cosmos.FullTextPolicy FullTextPolicy;CanRead:True;CanWrite:True;Microsoft.Azure.Cosmos.FullTextPolicy get_FullTextPolicy();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_FullTextPolicy(Microsoft.Azure.Cosmos.FullTextPolicy);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Microsoft.Azure.Cosmos.FullTextPolicy get_FullTextPolicy()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.FullTextPolicy get_FullTextPolicy();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Microsoft.Azure.Cosmos.GeospatialConfig GeospatialConfig[Newtonsoft.Json.JsonIgnoreAttribute()]": { "Type": "Property", "Attributes": [ @@ -2463,6 +2480,11 @@ ], "MethodInfo": "Void set_DefaultTimeToLive(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "Void set_FullTextPolicy(Microsoft.Azure.Cosmos.FullTextPolicy)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Void set_FullTextPolicy(Microsoft.Azure.Cosmos.FullTextPolicy);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Void set_GeospatialConfig(Microsoft.Azure.Cosmos.GeospatialConfig)": { "Type": "Method", "Attributes": [], @@ -3537,6 +3559,11 @@ "Attributes": [], "MethodInfo": "System.Nullable`1[System.TimeSpan] RetryAfter;CanRead:True;CanWrite:False;System.Nullable`1[System.TimeSpan] get_RetryAfter();IsAbstract:False;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "System.Object Clone()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Object Clone();IsAbstract:False;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:True;" + }, "System.String ActivityId": { "Type": "Property", "Attributes": [], @@ -3663,6 +3690,11 @@ "Attributes": [], "MethodInfo": "System.Exception GetBaseException();IsAbstract:False;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "System.Object Clone()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Object Clone();IsAbstract:False;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:True;" + }, "System.String get_HelpLink()": { "Type": "Method", "Attributes": [], @@ -4798,10 +4830,20 @@ "Attributes": [], "MethodInfo": "System.String get_IndexMetrics();IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "System.String get_QueryAdvice()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.String get_QueryAdvice();IsAbstract:False;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "System.String IndexMetrics": { "Type": "Property", "Attributes": [], "MethodInfo": "System.String IndexMetrics;CanRead:True;CanWrite:False;System.String get_IndexMetrics();IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String QueryAdvice": { + "Type": "Property", + "Attributes": [], + "MethodInfo": "System.String QueryAdvice;CanRead:True;CanWrite:False;System.String get_QueryAdvice();IsAbstract:False;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" } }, "NestedTypes": {} @@ -4903,6 +4945,11 @@ "Attributes": [], "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.ConflictResolutionDefinition WithConflictResolution();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "Microsoft.Azure.Cosmos.Fluent.FullTextPolicyDefinition WithFullTextPolicy(System.String, System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath])": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.FullTextPolicyDefinition WithFullTextPolicy(System.String, System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Microsoft.Azure.Cosmos.Fluent.UniqueKeyDefinition WithUniqueKey()": { "Type": "Method", "Attributes": [], @@ -5023,6 +5070,11 @@ "Attributes": [], "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder WithApplicationRegion(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder WithAvailabilityStrategy(Microsoft.Azure.Cosmos.AvailabilityStrategy)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder WithAvailabilityStrategy(Microsoft.Azure.Cosmos.AvailabilityStrategy);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder WithBulkExecution(Boolean)": { "Type": "Method", "Attributes": [], @@ -5136,6 +5188,43 @@ }, "NestedTypes": {} }, + "Microsoft.Azure.Cosmos.Fluent.FullTextIndexDefinition`1;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:True;IsSerializable:False": { + "Subclasses": {}, + "Members": { + "Microsoft.Azure.Cosmos.Fluent.FullTextIndexDefinition`1[T] Path(System.String)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.FullTextIndexDefinition`1[T] Path(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "T Attach()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "T Attach();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void .ctor(T, System.Action`1[Microsoft.Azure.Cosmos.FullTextIndexPath])": { + "Type": "Constructor", + "Attributes": [], + "MethodInfo": "[Void .ctor(T, System.Action`1[Microsoft.Azure.Cosmos.FullTextIndexPath]), Void .ctor(T, System.Action`1[Microsoft.Azure.Cosmos.FullTextIndexPath])]" + } + }, + "NestedTypes": {} + }, + "Microsoft.Azure.Cosmos.Fluent.FullTextPolicyDefinition;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { + "Subclasses": {}, + "Members": { + "Microsoft.Azure.Cosmos.Fluent.ContainerBuilder Attach()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.ContainerBuilder Attach();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void .ctor(Microsoft.Azure.Cosmos.Fluent.ContainerBuilder, System.String, System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath], System.Action`1[Microsoft.Azure.Cosmos.FullTextPolicy])": { + "Type": "Constructor", + "Attributes": [], + "MethodInfo": "[Void .ctor(Microsoft.Azure.Cosmos.Fluent.ContainerBuilder, System.String, System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath], System.Action`1[Microsoft.Azure.Cosmos.FullTextPolicy]), Void .ctor(Microsoft.Azure.Cosmos.Fluent.ContainerBuilder, System.String, System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath], System.Action`1[Microsoft.Azure.Cosmos.FullTextPolicy])]" + } + }, + "NestedTypes": {} + }, "Microsoft.Azure.Cosmos.Fluent.IndexingPolicyDefinition`1;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:True;IsSerializable:False": { "Subclasses": {}, "Members": { @@ -5144,6 +5233,11 @@ "Attributes": [], "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.CompositeIndexDefinition`1[Microsoft.Azure.Cosmos.Fluent.IndexingPolicyDefinition`1[T]] WithCompositeIndex();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "Microsoft.Azure.Cosmos.Fluent.FullTextIndexDefinition`1[Microsoft.Azure.Cosmos.Fluent.IndexingPolicyDefinition`1[T]] WithFullTextIndex()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.FullTextIndexDefinition`1[Microsoft.Azure.Cosmos.Fluent.IndexingPolicyDefinition`1[T]] WithFullTextIndex();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Microsoft.Azure.Cosmos.Fluent.IndexingPolicyDefinition`1[T] WithAutomaticIndexing(Boolean)": { "Type": "Method", "Attributes": [], @@ -5277,6 +5371,150 @@ }, "NestedTypes": {} }, + "Microsoft.Azure.Cosmos.FullTextIndexPath;System.Object;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { + "Subclasses": {}, + "Members": { + "System.String get_Path()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.String get_Path();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String Path[Newtonsoft.Json.JsonPropertyAttribute(PropertyName = \"path\")]": { + "Type": "Property", + "Attributes": [ + "JsonPropertyAttribute" + ], + "MethodInfo": "System.String Path;CanRead:True;CanWrite:True;System.String get_Path();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_Path(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void .ctor()": { + "Type": "Constructor", + "Attributes": [], + "MethodInfo": "[Void .ctor(), Void .ctor()]" + }, + "Void set_Path(System.String)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_Path(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + } + }, + "NestedTypes": {} + }, + "Microsoft.Azure.Cosmos.FullTextPath;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { + "Subclasses": {}, + "Members": { + "Boolean Equals(Microsoft.Azure.Cosmos.FullTextPath)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Boolean Equals(Microsoft.Azure.Cosmos.FullTextPath);IsAbstract:False;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:True;" + }, + "System.String get_Language()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.String get_Language();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String get_Path()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.String get_Path();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String Language[Newtonsoft.Json.JsonPropertyAttribute(NullValueHandling = 1, PropertyName = \"language\")]": { + "Type": "Property", + "Attributes": [ + "JsonPropertyAttribute" + ], + "MethodInfo": "System.String Language;CanRead:True;CanWrite:True;System.String get_Language();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_Language(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String Path[Newtonsoft.Json.JsonPropertyAttribute(PropertyName = \"path\")]": { + "Type": "Property", + "Attributes": [ + "JsonPropertyAttribute" + ], + "MethodInfo": "System.String Path;CanRead:True;CanWrite:True;System.String get_Path();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_Path(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void .ctor()": { + "Type": "Constructor", + "Attributes": [], + "MethodInfo": "[Void .ctor(), Void .ctor()]" + }, + "Void set_Language(System.String)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_Language(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_Path(System.String)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_Path(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void ValidateFullTextPath()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Void ValidateFullTextPath();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + } + }, + "NestedTypes": {} + }, + "Microsoft.Azure.Cosmos.FullTextPolicy;System.Object;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { + "Subclasses": {}, + "Members": { + "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath] FullTextPaths[Newtonsoft.Json.JsonIgnoreAttribute()]": { + "Type": "Property", + "Attributes": [ + "JsonIgnoreAttribute" + ], + "MethodInfo": "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath] FullTextPaths;CanRead:True;CanWrite:True;System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath] get_FullTextPaths();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_FullTextPaths(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath] get_FullTextPaths()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath] get_FullTextPaths();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String DefaultLanguage[Newtonsoft.Json.JsonPropertyAttribute(NullValueHandling = 1, PropertyName = \"defaultLanguage\")]": { + "Type": "Property", + "Attributes": [ + "JsonPropertyAttribute" + ], + "MethodInfo": "System.String DefaultLanguage;CanRead:True;CanWrite:True;System.String get_DefaultLanguage();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_DefaultLanguage(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String get_DefaultLanguage()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.String get_DefaultLanguage();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void .ctor()": { + "Type": "Constructor", + "Attributes": [], + "MethodInfo": "[Void .ctor(), Void .ctor()]" + }, + "Void set_DefaultLanguage(System.String)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_DefaultLanguage(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_FullTextPaths(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath])": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Void set_FullTextPaths(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextPath]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + } + }, + "NestedTypes": {} + }, "Microsoft.Azure.Cosmos.GeospatialConfig;System.Object;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { @@ -5629,6 +5867,20 @@ ], "MethodInfo": "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.ExcludedPath] get_ExcludedPaths();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextIndexPath] FullTextIndexes[Newtonsoft.Json.JsonPropertyAttribute(NullValueHandling = 1, PropertyName = \"fullTextIndexes\")]": { + "Type": "Property", + "Attributes": [ + "JsonPropertyAttribute" + ], + "MethodInfo": "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextIndexPath] FullTextIndexes;CanRead:True;CanWrite:True;System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextIndexPath] get_FullTextIndexes();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_FullTextIndexes(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextIndexPath]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextIndexPath] get_FullTextIndexes()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextIndexPath] get_FullTextIndexes();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.IncludedPath] get_IncludedPaths()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { "Type": "Method", "Attributes": [ @@ -5697,6 +5949,13 @@ ], "MethodInfo": "Void set_Automatic(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "Void set_FullTextIndexes(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextIndexPath])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_FullTextIndexes(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.FullTextIndexPath]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Void set_IndexingMode(Microsoft.Azure.Cosmos.IndexingMode)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { "Type": "Method", "Attributes": [ @@ -6100,6 +6359,39 @@ ], "MethodInfo": "Boolean RegexMatch(System.Object, System.String);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "Double FullTextScore[TSource](TSource, System.String[])[System.Runtime.CompilerServices.ExtensionAttribute()]": { + "Type": "Method", + "Attributes": [ + "ExtensionAttribute" + ], + "MethodInfo": "Double FullTextScore[TSource](TSource, System.String[]);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:True;IsConstructor:False;IsFinal:False;" + }, + "Double RRF(Double[])": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Double RRF(Double[]);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Double VectorDistance(Byte[], Byte[], Boolean, VectorDistanceOptions)[System.Runtime.CompilerServices.ExtensionAttribute()]": { + "Type": "Method", + "Attributes": [ + "ExtensionAttribute" + ], + "MethodInfo": "Double VectorDistance(Byte[], Byte[], Boolean, VectorDistanceOptions);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Double VectorDistance(SByte[], SByte[], Boolean, VectorDistanceOptions)[System.Runtime.CompilerServices.ExtensionAttribute()]": { + "Type": "Method", + "Attributes": [ + "ExtensionAttribute" + ], + "MethodInfo": "Double VectorDistance(SByte[], SByte[], Boolean, VectorDistanceOptions);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Double VectorDistance(Single[], Single[], Boolean, VectorDistanceOptions)[System.Runtime.CompilerServices.ExtensionAttribute()]": { + "Type": "Method", + "Attributes": [ + "ExtensionAttribute" + ], + "MethodInfo": "Double VectorDistance(Single[], Single[], Boolean, VectorDistanceOptions);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Int32 DocumentId(System.Object)[System.Runtime.CompilerServices.ExtensionAttribute()]": { "Type": "Method", "Attributes": [ @@ -6121,6 +6413,11 @@ ], "MethodInfo": "Microsoft.Azure.Cosmos.FeedIterator`1[T] ToFeedIterator[T](System.Linq.IQueryable`1[T]);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:True;IsConstructor:False;IsFinal:False;" }, + "Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions+VectorDistanceOptions": { + "Type": "NestedType", + "Attributes": [], + "MethodInfo": null + }, "Microsoft.Azure.Cosmos.QueryDefinition ToQueryDefinition[T](System.Linq.IQueryable`1[T])[System.Runtime.CompilerServices.ExtensionAttribute()]": { "Type": "Method", "Attributes": [ @@ -6128,6 +6425,13 @@ ], "MethodInfo": "Microsoft.Azure.Cosmos.QueryDefinition ToQueryDefinition[T](System.Linq.IQueryable`1[T]);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:True;IsConstructor:False;IsFinal:False;" }, + "System.Linq.IOrderedQueryable`1[TSource] OrderByRank[TSource,TKey](System.Linq.IQueryable`1[TSource], System.Linq.Expressions.Expression`1[System.Func`2[TSource,TKey]])[System.Runtime.CompilerServices.ExtensionAttribute()]": { + "Type": "Method", + "Attributes": [ + "ExtensionAttribute" + ], + "MethodInfo": "System.Linq.IOrderedQueryable`1[TSource] OrderByRank[TSource,TKey](System.Linq.IQueryable`1[TSource], System.Linq.Expressions.Expression`1[System.Func`2[TSource,TKey]]);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:True;IsConstructor:False;IsFinal:False;" + }, "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.Response`1[System.Decimal]] AverageAsync(System.Linq.IQueryable`1[System.Decimal], System.Threading.CancellationToken)[System.Runtime.CompilerServices.ExtensionAttribute()]": { "Type": "Method", "Attributes": [ @@ -6290,6 +6594,155 @@ "MethodInfo": "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.Response`1[TSource]] MinAsync[TSource](System.Linq.IQueryable`1[TSource], System.Threading.CancellationToken);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:True;IsConstructor:False;IsFinal:False;" } }, + "NestedTypes": { + "Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions+VectorDistanceOptions;System.Object;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:True;IsGenericType:False;IsSerializable:False": { + "Subclasses": {}, + "Members": { + "System.Nullable`1[Microsoft.Azure.Cosmos.DistanceFunction] DistanceFunction[System.Text.Json.Serialization.JsonPropertyNameAttribute(\"distanceFunction\")]": { + "Type": "Property", + "Attributes": [ + "JsonPropertyNameAttribute" + ], + "MethodInfo": "System.Nullable`1[Microsoft.Azure.Cosmos.DistanceFunction] DistanceFunction;CanRead:True;CanWrite:True;System.Nullable`1[Microsoft.Azure.Cosmos.DistanceFunction] get_DistanceFunction();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_DistanceFunction(System.Nullable`1[Microsoft.Azure.Cosmos.DistanceFunction]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Nullable`1[Microsoft.Azure.Cosmos.DistanceFunction] get_DistanceFunction()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.Nullable`1[Microsoft.Azure.Cosmos.DistanceFunction] get_DistanceFunction();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Nullable`1[Microsoft.Azure.Cosmos.VectorDataType] DataType[System.Text.Json.Serialization.JsonPropertyNameAttribute(\"dataType\")]": { + "Type": "Property", + "Attributes": [ + "JsonPropertyNameAttribute" + ], + "MethodInfo": "System.Nullable`1[Microsoft.Azure.Cosmos.VectorDataType] DataType;CanRead:True;CanWrite:True;System.Nullable`1[Microsoft.Azure.Cosmos.VectorDataType] get_DataType();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_DataType(System.Nullable`1[Microsoft.Azure.Cosmos.VectorDataType]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Nullable`1[Microsoft.Azure.Cosmos.VectorDataType] get_DataType()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.Nullable`1[Microsoft.Azure.Cosmos.VectorDataType] get_DataType();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Nullable`1[System.Int32] get_SearchListSizeMultiplier()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.Nullable`1[System.Int32] get_SearchListSizeMultiplier();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Nullable`1[System.Int32] SearchListSizeMultiplier[System.Text.Json.Serialization.JsonPropertyNameAttribute(\"searchListSizeMultiplier\")]": { + "Type": "Property", + "Attributes": [ + "JsonPropertyNameAttribute" + ], + "MethodInfo": "System.Nullable`1[System.Int32] SearchListSizeMultiplier;CanRead:True;CanWrite:True;System.Nullable`1[System.Int32] get_SearchListSizeMultiplier();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_SearchListSizeMultiplier(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void .ctor()": { + "Type": "Constructor", + "Attributes": [], + "MethodInfo": "[Void .ctor(), Void .ctor()]" + }, + "Void set_DataType(System.Nullable`1[Microsoft.Azure.Cosmos.VectorDataType])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_DataType(System.Nullable`1[Microsoft.Azure.Cosmos.VectorDataType]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_DistanceFunction(System.Nullable`1[Microsoft.Azure.Cosmos.DistanceFunction])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_DistanceFunction(System.Nullable`1[Microsoft.Azure.Cosmos.DistanceFunction]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_SearchListSizeMultiplier(System.Nullable`1[System.Int32])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_SearchListSizeMultiplier(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + } + }, + "NestedTypes": {} + } + } + }, + "Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions+VectorDistanceOptions;System.Object;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:True;IsGenericType:False;IsSerializable:False": { + "Subclasses": {}, + "Members": { + "System.Nullable`1[Microsoft.Azure.Cosmos.DistanceFunction] DistanceFunction[System.Text.Json.Serialization.JsonPropertyNameAttribute(\"distanceFunction\")]": { + "Type": "Property", + "Attributes": [ + "JsonPropertyNameAttribute" + ], + "MethodInfo": "System.Nullable`1[Microsoft.Azure.Cosmos.DistanceFunction] DistanceFunction;CanRead:True;CanWrite:True;System.Nullable`1[Microsoft.Azure.Cosmos.DistanceFunction] get_DistanceFunction();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_DistanceFunction(System.Nullable`1[Microsoft.Azure.Cosmos.DistanceFunction]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Nullable`1[Microsoft.Azure.Cosmos.DistanceFunction] get_DistanceFunction()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.Nullable`1[Microsoft.Azure.Cosmos.DistanceFunction] get_DistanceFunction();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Nullable`1[Microsoft.Azure.Cosmos.VectorDataType] DataType[System.Text.Json.Serialization.JsonPropertyNameAttribute(\"dataType\")]": { + "Type": "Property", + "Attributes": [ + "JsonPropertyNameAttribute" + ], + "MethodInfo": "System.Nullable`1[Microsoft.Azure.Cosmos.VectorDataType] DataType;CanRead:True;CanWrite:True;System.Nullable`1[Microsoft.Azure.Cosmos.VectorDataType] get_DataType();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_DataType(System.Nullable`1[Microsoft.Azure.Cosmos.VectorDataType]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Nullable`1[Microsoft.Azure.Cosmos.VectorDataType] get_DataType()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.Nullable`1[Microsoft.Azure.Cosmos.VectorDataType] get_DataType();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Nullable`1[System.Int32] get_SearchListSizeMultiplier()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.Nullable`1[System.Int32] get_SearchListSizeMultiplier();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Nullable`1[System.Int32] SearchListSizeMultiplier[System.Text.Json.Serialization.JsonPropertyNameAttribute(\"searchListSizeMultiplier\")]": { + "Type": "Property", + "Attributes": [ + "JsonPropertyNameAttribute" + ], + "MethodInfo": "System.Nullable`1[System.Int32] SearchListSizeMultiplier;CanRead:True;CanWrite:True;System.Nullable`1[System.Int32] get_SearchListSizeMultiplier();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_SearchListSizeMultiplier(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void .ctor()": { + "Type": "Constructor", + "Attributes": [], + "MethodInfo": "[Void .ctor(), Void .ctor()]" + }, + "Void set_DataType(System.Nullable`1[Microsoft.Azure.Cosmos.VectorDataType])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_DataType(System.Nullable`1[Microsoft.Azure.Cosmos.VectorDataType]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_DistanceFunction(System.Nullable`1[Microsoft.Azure.Cosmos.DistanceFunction])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_DistanceFunction(System.Nullable`1[Microsoft.Azure.Cosmos.DistanceFunction]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_SearchListSizeMultiplier(System.Nullable`1[System.Int32])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_SearchListSizeMultiplier(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + } + }, "NestedTypes": {} }, "Microsoft.Azure.Cosmos.OperationKind;System.Enum;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:True;IsClass:False;IsValueType:True;IsNested:False;IsGenericType:False;IsSerializable:True": { @@ -7134,11 +7587,23 @@ ], "MethodInfo": "System.Nullable`1[System.Boolean] get_PopulateIndexMetrics();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "System.Nullable`1[System.Boolean] get_PopulateQueryAdvice()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.Nullable`1[System.Boolean] get_PopulateQueryAdvice();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "System.Nullable`1[System.Boolean] PopulateIndexMetrics": { "Type": "Property", "Attributes": [], "MethodInfo": "System.Nullable`1[System.Boolean] PopulateIndexMetrics;CanRead:True;CanWrite:True;System.Nullable`1[System.Boolean] get_PopulateIndexMetrics();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_PopulateIndexMetrics(System.Nullable`1[System.Boolean]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "System.Nullable`1[System.Boolean] PopulateQueryAdvice": { + "Type": "Property", + "Attributes": [], + "MethodInfo": "System.Nullable`1[System.Boolean] PopulateQueryAdvice;CanRead:True;CanWrite:True;System.Nullable`1[System.Boolean] get_PopulateQueryAdvice();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_PopulateQueryAdvice(System.Nullable`1[System.Boolean]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "System.Nullable`1[System.Int32] get_MaxBufferedItemCount()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { "Type": "Method", "Attributes": [ @@ -7272,6 +7737,13 @@ ], "MethodInfo": "Void set_PopulateIndexMetrics(System.Nullable`1[System.Boolean]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "Void set_PopulateQueryAdvice(System.Nullable`1[System.Boolean])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_PopulateQueryAdvice(System.Nullable`1[System.Boolean]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Void set_QueryTextMode(Microsoft.Azure.Cosmos.QueryTextMode)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { "Type": "Method", "Attributes": [ @@ -7515,6 +7987,11 @@ "Attributes": [], "MethodInfo": "System.String EastUS2EUAP;IsInitOnly:False;IsStatic:True;" }, + "System.String EastUS3": { + "Type": "Field", + "Attributes": [], + "MethodInfo": "System.String EastUS3;IsInitOnly:False;IsStatic:True;" + }, "System.String EastUSSLV": { "Type": "Field", "Attributes": [], @@ -8325,11 +8802,23 @@ ], "MethodInfo": "System.Nullable`1[System.Boolean] get_PopulateIndexMetrics();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "System.Nullable`1[System.Boolean] get_PopulateQueryAdvice()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.Nullable`1[System.Boolean] get_PopulateQueryAdvice();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "System.Nullable`1[System.Boolean] PopulateIndexMetrics": { "Type": "Property", "Attributes": [], "MethodInfo": "System.Nullable`1[System.Boolean] PopulateIndexMetrics;CanRead:True;CanWrite:True;System.Nullable`1[System.Boolean] get_PopulateIndexMetrics();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_PopulateIndexMetrics(System.Nullable`1[System.Boolean]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "System.Nullable`1[System.Boolean] PopulateQueryAdvice": { + "Type": "Property", + "Attributes": [], + "MethodInfo": "System.Nullable`1[System.Boolean] PopulateQueryAdvice;CanRead:True;CanWrite:True;System.Nullable`1[System.Boolean] get_PopulateQueryAdvice();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_PopulateQueryAdvice(System.Nullable`1[System.Boolean]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "System.Nullable`1[System.Int32] get_MaxBufferedItemCount()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { "Type": "Method", "Attributes": [ @@ -8463,6 +8952,13 @@ ], "MethodInfo": "Void set_PopulateIndexMetrics(System.Nullable`1[System.Boolean]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "Void set_PopulateQueryAdvice(System.Nullable`1[System.Boolean])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_PopulateQueryAdvice(System.Nullable`1[System.Boolean]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Void set_QueryTextMode(Microsoft.Azure.Cosmos.QueryTextMode)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { "Type": "Method", "Attributes": [ @@ -9175,6 +9671,36 @@ "Attributes": [], "MethodInfo": "Microsoft.Azure.Cosmos.FeedIterator`1[T] GetUserDefinedFunctionQueryIterator[T](System.String, System.String, Microsoft.Azure.Cosmos.QueryRequestOptions);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:True;IsConstructor:False;IsFinal:False;" }, + "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] CreateStoredProcedureStreamAsync(Microsoft.Azure.Cosmos.Scripts.StoredProcedureProperties, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] CreateStoredProcedureStreamAsync(Microsoft.Azure.Cosmos.Scripts.StoredProcedureProperties, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] CreateTriggerStreamAsync(Microsoft.Azure.Cosmos.Scripts.TriggerProperties, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] CreateTriggerStreamAsync(Microsoft.Azure.Cosmos.Scripts.TriggerProperties, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] CreateUserDefinedFunctionStreamAsync(Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionProperties, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] CreateUserDefinedFunctionStreamAsync(Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionProperties, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] DeleteStoredProcedureStreamAsync(System.String, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] DeleteStoredProcedureStreamAsync(System.String, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] DeleteTriggerStreamAsync(System.String, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] DeleteTriggerStreamAsync(System.String, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] DeleteUserDefinedFunctionStreamAsync(System.String, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] DeleteUserDefinedFunctionStreamAsync(System.String, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] ExecuteStoredProcedureStreamAsync(System.String, Microsoft.Azure.Cosmos.PartitionKey, System.Object[], Microsoft.Azure.Cosmos.Scripts.StoredProcedureRequestOptions, System.Threading.CancellationToken)": { "Type": "Method", "Attributes": [], @@ -9185,6 +9711,36 @@ "Attributes": [], "MethodInfo": "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] ExecuteStoredProcedureStreamAsync(System.String, System.IO.Stream, Microsoft.Azure.Cosmos.PartitionKey, Microsoft.Azure.Cosmos.Scripts.StoredProcedureRequestOptions, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] ReadStoredProcedureStreamAsync(System.String, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] ReadStoredProcedureStreamAsync(System.String, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] ReadTriggerStreamAsync(System.String, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] ReadTriggerStreamAsync(System.String, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] ReadUserDefinedFunctionStreamAsync(System.String, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] ReadUserDefinedFunctionStreamAsync(System.String, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] ReplaceStoredProcedureStreamAsync(Microsoft.Azure.Cosmos.Scripts.StoredProcedureProperties, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] ReplaceStoredProcedureStreamAsync(Microsoft.Azure.Cosmos.Scripts.StoredProcedureProperties, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] ReplaceTriggerStreamAsync(Microsoft.Azure.Cosmos.Scripts.TriggerProperties, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] ReplaceTriggerStreamAsync(Microsoft.Azure.Cosmos.Scripts.TriggerProperties, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] ReplaceUserDefinedFunctionStreamAsync(Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionProperties, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] ReplaceUserDefinedFunctionStreamAsync(Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionProperties, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.Scripts.StoredProcedureExecuteResponse`1[TOutput]] ExecuteStoredProcedureAsync[TOutput](System.String, Microsoft.Azure.Cosmos.PartitionKey, System.Object[], Microsoft.Azure.Cosmos.Scripts.StoredProcedureRequestOptions, System.Threading.CancellationToken)": { "Type": "Method", "Attributes": [], diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosAuthorizationTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosAuthorizationTests.cs index bdf4fcbe29..2ec6e1f8b9 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosAuthorizationTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosAuthorizationTests.cs @@ -85,7 +85,8 @@ public async Task ResourceTokenAsync() public async Task TokenAuthAsync() { LocalEmulatorTokenCredential simpleEmulatorTokenCredential = new LocalEmulatorTokenCredential( - "VGhpcyBpcyBhIHNhbXBsZSBzdHJpbmc=", + expectedScope: "https://127.0.0.1/.default", + masterKey: "VGhpcyBpcyBhIHNhbXBsZSBzdHJpbmc=", defaultDateTime: new DateTime(2030, 9, 21, 9, 9, 9, DateTimeKind.Utc)); using AuthorizationTokenProvider cosmosAuthorization = new AuthorizationTokenProviderTokenCredential( @@ -103,7 +104,7 @@ public async Task TokenAuthAsync() AuthorizationTokenType.PrimaryMasterKey); Assert.AreEqual( - "type%3daad%26ver%3d1.0%26sig%3dew0KICAgICAgICAgICAgICAgICJhbGciOiJSUzI1NiIsDQogICAgICAgICAgICAgICAgImtpZCI6InhfOUtTdXNLVTVZY0hmNCIsDQogICAgICAgICAgICAgICAgInR5cCI6IkpXVCINCiAgICAgICAgICAgIH0.ew0KICAgICAgICAgICAgICAgICJvaWQiOiI5NjMxMzAzNC00NzM5LTQzY2ItOTNjZC03NDE5M2FkYmU1YjYiLA0KICAgICAgICAgICAgICAgICJ0aWQiOiI3YjE5OTlhMS1kZmQ3LTQ0MGUtODIwNC0wMDE3MDk3OWI5ODQiLA0KICAgICAgICAgICAgICAgICJzY3AiOiJ1c2VyX2ltcGVyc29uYXRpb24iLA0KICAgICAgICAgICAgICAgICJncm91cHMiOlsNCiAgICAgICAgICAgICAgICAgICAgIjdjZTFkMDAzLTRjYjMtNDg3OS1iN2M1LTc0MDYyYTM1YzY2ZSIsDQogICAgICAgICAgICAgICAgICAgICJlOTlmZjMwYy1jMjI5LTRjNjctYWIyOS0zMGE2YWViYzNlNTgiLA0KICAgICAgICAgICAgICAgICAgICAiNTU0OWJiNjItYzc3Yi00MzA1LWJkYTktOWVjNjZiODVkOWU0IiwNCiAgICAgICAgICAgICAgICAgICAgImM0NGZkNjg1LTVjNTgtNDUyYy1hYWY3LTEzY2U3NTE4NGY2NSIsDQogICAgICAgICAgICAgICAgICAgICJiZTg5NTIxNS1lYWI1LTQzYjctOTUzNi05ZWY4ZmUxMzAzMzAiDQogICAgICAgICAgICAgICAgXSwNCiAgICAgICAgICAgICAgICAibmJmIjoxOTE2MjEyMTQ5LA0KICAgICAgICAgICAgICAgICJleHAiOjE5MTYyMTU3NDksDQogICAgICAgICAgICAgICAgImlhdCI6MTU5NjU5MjMzNSwNCiAgICAgICAgICAgICAgICAiaXNzIjoiaHR0cHM6Ly9zdHMuZmFrZS1pc3N1ZXIubmV0LzdiMTk5OWExLWRmZDctNDQwZS04MjA0LTAwMTcwOTc5Yjk4NCIsDQogICAgICAgICAgICAgICAgImF1ZCI6Imh0dHBzOi8vbG9jYWxob3N0LmxvY2FsaG9zdCINCiAgICAgICAgICAgIH0.VkdocGN5QnBjeUJoSUhOaGJYQnNaU0J6ZEhKcGJtYz0", + "type%3daad%26ver%3d1.0%26sig%3dewogICAgICAgICAgICAgICAgImFsZyI6IlJTMjU2IiwKICAgICAgICAgICAgICAgICJraWQiOiJ4XzlLU3VzS1U1WWNIZjQiLAogICAgICAgICAgICAgICAgInR5cCI6IkpXVCIKICAgICAgICAgICAgfQ.ewogICAgICAgICAgICAgICAgIm9pZCI6Ijk2MzEzMDM0LTQ3MzktNDNjYi05M2NkLTc0MTkzYWRiZTViNiIsCiAgICAgICAgICAgICAgICAidGlkIjoiN2IxOTk5YTEtZGZkNy00NDBlLTgyMDQtMDAxNzA5NzliOTg0IiwKICAgICAgICAgICAgICAgICJzY3AiOiJ1c2VyX2ltcGVyc29uYXRpb24iLAogICAgICAgICAgICAgICAgImdyb3VwcyI6WwogICAgICAgICAgICAgICAgICAgICI3Y2UxZDAwMy00Y2IzLTQ4NzktYjdjNS03NDA2MmEzNWM2NmUiLAogICAgICAgICAgICAgICAgICAgICJlOTlmZjMwYy1jMjI5LTRjNjctYWIyOS0zMGE2YWViYzNlNTgiLAogICAgICAgICAgICAgICAgICAgICI1NTQ5YmI2Mi1jNzdiLTQzMDUtYmRhOS05ZWM2NmI4NWQ5ZTQiLAogICAgICAgICAgICAgICAgICAgICJjNDRmZDY4NS01YzU4LTQ1MmMtYWFmNy0xM2NlNzUxODRmNjUiLAogICAgICAgICAgICAgICAgICAgICJiZTg5NTIxNS1lYWI1LTQzYjctOTUzNi05ZWY4ZmUxMzAzMzAiCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgIm5iZiI6MTkxNjIxMjE0OSwKICAgICAgICAgICAgICAgICJleHAiOjE5MTYyMTU3NDksCiAgICAgICAgICAgICAgICAiaWF0IjoxNTk2NTkyMzM1LAogICAgICAgICAgICAgICAgImlzcyI6Imh0dHBzOi8vc3RzLmZha2UtaXNzdWVyLm5ldC83YjE5OTlhMS1kZmQ3LTQ0MGUtODIwNC0wMDE3MDk3OWI5ODQiLAogICAgICAgICAgICAgICAgImF1ZCI6Imh0dHBzOi8vbG9jYWxob3N0LmxvY2FsaG9zdCIKICAgICAgICAgICAgfQ.VkdocGN5QnBjeUJoSUhOaGJYQnNaU0J6ZEhKcGJtYz0", token); Assert.IsNull(payload); } @@ -118,7 +119,7 @@ public async Task TokenAuthAsync() AuthorizationTokenType.PrimaryMasterKey); Assert.AreEqual( - "type%3daad%26ver%3d1.0%26sig%3dew0KICAgICAgICAgICAgICAgICJhbGciOiJSUzI1NiIsDQogICAgICAgICAgICAgICAgImtpZCI6InhfOUtTdXNLVTVZY0hmNCIsDQogICAgICAgICAgICAgICAgInR5cCI6IkpXVCINCiAgICAgICAgICAgIH0.ew0KICAgICAgICAgICAgICAgICJvaWQiOiI5NjMxMzAzNC00NzM5LTQzY2ItOTNjZC03NDE5M2FkYmU1YjYiLA0KICAgICAgICAgICAgICAgICJ0aWQiOiI3YjE5OTlhMS1kZmQ3LTQ0MGUtODIwNC0wMDE3MDk3OWI5ODQiLA0KICAgICAgICAgICAgICAgICJzY3AiOiJ1c2VyX2ltcGVyc29uYXRpb24iLA0KICAgICAgICAgICAgICAgICJncm91cHMiOlsNCiAgICAgICAgICAgICAgICAgICAgIjdjZTFkMDAzLTRjYjMtNDg3OS1iN2M1LTc0MDYyYTM1YzY2ZSIsDQogICAgICAgICAgICAgICAgICAgICJlOTlmZjMwYy1jMjI5LTRjNjctYWIyOS0zMGE2YWViYzNlNTgiLA0KICAgICAgICAgICAgICAgICAgICAiNTU0OWJiNjItYzc3Yi00MzA1LWJkYTktOWVjNjZiODVkOWU0IiwNCiAgICAgICAgICAgICAgICAgICAgImM0NGZkNjg1LTVjNTgtNDUyYy1hYWY3LTEzY2U3NTE4NGY2NSIsDQogICAgICAgICAgICAgICAgICAgICJiZTg5NTIxNS1lYWI1LTQzYjctOTUzNi05ZWY4ZmUxMzAzMzAiDQogICAgICAgICAgICAgICAgXSwNCiAgICAgICAgICAgICAgICAibmJmIjoxOTE2MjEyMTQ5LA0KICAgICAgICAgICAgICAgICJleHAiOjE5MTYyMTU3NDksDQogICAgICAgICAgICAgICAgImlhdCI6MTU5NjU5MjMzNSwNCiAgICAgICAgICAgICAgICAiaXNzIjoiaHR0cHM6Ly9zdHMuZmFrZS1pc3N1ZXIubmV0LzdiMTk5OWExLWRmZDctNDQwZS04MjA0LTAwMTcwOTc5Yjk4NCIsDQogICAgICAgICAgICAgICAgImF1ZCI6Imh0dHBzOi8vbG9jYWxob3N0LmxvY2FsaG9zdCINCiAgICAgICAgICAgIH0.VkdocGN5QnBjeUJoSUhOaGJYQnNaU0J6ZEhKcGJtYz0", token); + "type%3daad%26ver%3d1.0%26sig%3dewogICAgICAgICAgICAgICAgImFsZyI6IlJTMjU2IiwKICAgICAgICAgICAgICAgICJraWQiOiJ4XzlLU3VzS1U1WWNIZjQiLAogICAgICAgICAgICAgICAgInR5cCI6IkpXVCIKICAgICAgICAgICAgfQ.ewogICAgICAgICAgICAgICAgIm9pZCI6Ijk2MzEzMDM0LTQ3MzktNDNjYi05M2NkLTc0MTkzYWRiZTViNiIsCiAgICAgICAgICAgICAgICAidGlkIjoiN2IxOTk5YTEtZGZkNy00NDBlLTgyMDQtMDAxNzA5NzliOTg0IiwKICAgICAgICAgICAgICAgICJzY3AiOiJ1c2VyX2ltcGVyc29uYXRpb24iLAogICAgICAgICAgICAgICAgImdyb3VwcyI6WwogICAgICAgICAgICAgICAgICAgICI3Y2UxZDAwMy00Y2IzLTQ4NzktYjdjNS03NDA2MmEzNWM2NmUiLAogICAgICAgICAgICAgICAgICAgICJlOTlmZjMwYy1jMjI5LTRjNjctYWIyOS0zMGE2YWViYzNlNTgiLAogICAgICAgICAgICAgICAgICAgICI1NTQ5YmI2Mi1jNzdiLTQzMDUtYmRhOS05ZWM2NmI4NWQ5ZTQiLAogICAgICAgICAgICAgICAgICAgICJjNDRmZDY4NS01YzU4LTQ1MmMtYWFmNy0xM2NlNzUxODRmNjUiLAogICAgICAgICAgICAgICAgICAgICJiZTg5NTIxNS1lYWI1LTQzYjctOTUzNi05ZWY4ZmUxMzAzMzAiCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgIm5iZiI6MTkxNjIxMjE0OSwKICAgICAgICAgICAgICAgICJleHAiOjE5MTYyMTU3NDksCiAgICAgICAgICAgICAgICAiaWF0IjoxNTk2NTkyMzM1LAogICAgICAgICAgICAgICAgImlzcyI6Imh0dHBzOi8vc3RzLmZha2UtaXNzdWVyLm5ldC83YjE5OTlhMS1kZmQ3LTQ0MGUtODIwNC0wMDE3MDk3OWI5ODQiLAogICAgICAgICAgICAgICAgImF1ZCI6Imh0dHBzOi8vbG9jYWxob3N0LmxvY2FsaG9zdCIKICAgICAgICAgICAgfQ.VkdocGN5QnBjeUJoSUhOaGJYQnNaU0J6ZEhKcGJtYz0", token); Assert.IsNull(payload); } @@ -132,11 +133,55 @@ public async Task TokenAuthAsync() AuthorizationTokenType.PrimaryMasterKey); Assert.AreEqual( - "type%3daad%26ver%3d1.0%26sig%3dew0KICAgICAgICAgICAgICAgICJhbGciOiJSUzI1NiIsDQogICAgICAgICAgICAgICAgImtpZCI6InhfOUtTdXNLVTVZY0hmNCIsDQogICAgICAgICAgICAgICAgInR5cCI6IkpXVCINCiAgICAgICAgICAgIH0.ew0KICAgICAgICAgICAgICAgICJvaWQiOiI5NjMxMzAzNC00NzM5LTQzY2ItOTNjZC03NDE5M2FkYmU1YjYiLA0KICAgICAgICAgICAgICAgICJ0aWQiOiI3YjE5OTlhMS1kZmQ3LTQ0MGUtODIwNC0wMDE3MDk3OWI5ODQiLA0KICAgICAgICAgICAgICAgICJzY3AiOiJ1c2VyX2ltcGVyc29uYXRpb24iLA0KICAgICAgICAgICAgICAgICJncm91cHMiOlsNCiAgICAgICAgICAgICAgICAgICAgIjdjZTFkMDAzLTRjYjMtNDg3OS1iN2M1LTc0MDYyYTM1YzY2ZSIsDQogICAgICAgICAgICAgICAgICAgICJlOTlmZjMwYy1jMjI5LTRjNjctYWIyOS0zMGE2YWViYzNlNTgiLA0KICAgICAgICAgICAgICAgICAgICAiNTU0OWJiNjItYzc3Yi00MzA1LWJkYTktOWVjNjZiODVkOWU0IiwNCiAgICAgICAgICAgICAgICAgICAgImM0NGZkNjg1LTVjNTgtNDUyYy1hYWY3LTEzY2U3NTE4NGY2NSIsDQogICAgICAgICAgICAgICAgICAgICJiZTg5NTIxNS1lYWI1LTQzYjctOTUzNi05ZWY4ZmUxMzAzMzAiDQogICAgICAgICAgICAgICAgXSwNCiAgICAgICAgICAgICAgICAibmJmIjoxOTE2MjEyMTQ5LA0KICAgICAgICAgICAgICAgICJleHAiOjE5MTYyMTU3NDksDQogICAgICAgICAgICAgICAgImlhdCI6MTU5NjU5MjMzNSwNCiAgICAgICAgICAgICAgICAiaXNzIjoiaHR0cHM6Ly9zdHMuZmFrZS1pc3N1ZXIubmV0LzdiMTk5OWExLWRmZDctNDQwZS04MjA0LTAwMTcwOTc5Yjk4NCIsDQogICAgICAgICAgICAgICAgImF1ZCI6Imh0dHBzOi8vbG9jYWxob3N0LmxvY2FsaG9zdCINCiAgICAgICAgICAgIH0.VkdocGN5QnBjeUJoSUhOaGJYQnNaU0J6ZEhKcGJtYz0", token); + "type%3daad%26ver%3d1.0%26sig%3dewogICAgICAgICAgICAgICAgImFsZyI6IlJTMjU2IiwKICAgICAgICAgICAgICAgICJraWQiOiJ4XzlLU3VzS1U1WWNIZjQiLAogICAgICAgICAgICAgICAgInR5cCI6IkpXVCIKICAgICAgICAgICAgfQ.ewogICAgICAgICAgICAgICAgIm9pZCI6Ijk2MzEzMDM0LTQ3MzktNDNjYi05M2NkLTc0MTkzYWRiZTViNiIsCiAgICAgICAgICAgICAgICAidGlkIjoiN2IxOTk5YTEtZGZkNy00NDBlLTgyMDQtMDAxNzA5NzliOTg0IiwKICAgICAgICAgICAgICAgICJzY3AiOiJ1c2VyX2ltcGVyc29uYXRpb24iLAogICAgICAgICAgICAgICAgImdyb3VwcyI6WwogICAgICAgICAgICAgICAgICAgICI3Y2UxZDAwMy00Y2IzLTQ4NzktYjdjNS03NDA2MmEzNWM2NmUiLAogICAgICAgICAgICAgICAgICAgICJlOTlmZjMwYy1jMjI5LTRjNjctYWIyOS0zMGE2YWViYzNlNTgiLAogICAgICAgICAgICAgICAgICAgICI1NTQ5YmI2Mi1jNzdiLTQzMDUtYmRhOS05ZWM2NmI4NWQ5ZTQiLAogICAgICAgICAgICAgICAgICAgICJjNDRmZDY4NS01YzU4LTQ1MmMtYWFmNy0xM2NlNzUxODRmNjUiLAogICAgICAgICAgICAgICAgICAgICJiZTg5NTIxNS1lYWI1LTQzYjctOTUzNi05ZWY4ZmUxMzAzMzAiCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgIm5iZiI6MTkxNjIxMjE0OSwKICAgICAgICAgICAgICAgICJleHAiOjE5MTYyMTU3NDksCiAgICAgICAgICAgICAgICAiaWF0IjoxNTk2NTkyMzM1LAogICAgICAgICAgICAgICAgImlzcyI6Imh0dHBzOi8vc3RzLmZha2UtaXNzdWVyLm5ldC83YjE5OTlhMS1kZmQ3LTQ0MGUtODIwNC0wMDE3MDk3OWI5ODQiLAogICAgICAgICAgICAgICAgImF1ZCI6Imh0dHBzOi8vbG9jYWxob3N0LmxvY2FsaG9zdCIKICAgICAgICAgICAgfQ.VkdocGN5QnBjeUJoSUhOaGJYQnNaU0J6ZEhKcGJtYz0", token); Assert.IsNull(payload); } } + [DataTestMethod] + [DataRow("https://env-override/.default", "https://env-override/.default", DisplayName = "EnvVarOverride")] + [DataRow("https://cosmos.azure.com/.default", "https://cosmos.azure.com/.default", DisplayName = "EnvVarOverride_Fabric")] + [DataRow(null, "https://anyhost.documents.azure.com/.default", DisplayName = "NoEnvVar_DefaultScope")] + public async Task TokenCredentialCache_SetsCorrectScope_EnvOverrideOrDefault(string envVarValue, string expectedScope) + { + Environment.SetEnvironmentVariable("AZURE_COSMOS_AAD_SCOPE_OVERRIDE", envVarValue); + + try + { + string anyHost = "anyhost.documents.azure.com"; + Uri anyUri = new Uri($"https://{anyHost}"); + + LocalEmulatorTokenCredential credential = new LocalEmulatorTokenCredential( + masterKey: "testkey", + expectedScope: expectedScope); + + using (AuthorizationTokenProvider authorization = new AuthorizationTokenProviderTokenCredential( + credential, + anyUri, + backgroundTokenCredentialRefreshInterval: TimeSpan.FromSeconds(1))) + { + StoreResponseNameValueCollection headers = new StoreResponseNameValueCollection(); + (string token, string payload) = await authorization.GetUserAuthorizationAsync( + "dbs\\test", + ResourceType.Database.ToResourceTypeString(), + "GET", + headers, + AuthorizationTokenType.PrimaryMasterKey); + + Assert.IsFalse(string.IsNullOrEmpty(token)); + Assert.IsNull(payload); + } + } + catch (Exception ex) + { + Assert.Fail($"Test failed with exception: {ex}"); + } + finally + { + Environment.SetEnvironmentVariable("AZURE_COSMOS_AAD_SCOPE_OVERRIDE", null); + } + } + [TestMethod] public void TestTokenCredentialCacheMaxAndMinValues() { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientOptionsUnitTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientOptionsUnitTests.cs index 47c006e70e..fc2108e9b5 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientOptionsUnitTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientOptionsUnitTests.cs @@ -87,7 +87,7 @@ public void VerifyCosmosConfigurationPropertiesGetUpdated() Assert.IsNull(clientOptions.HttpClientFactory); Assert.AreNotEqual(consistencyLevel, clientOptions.ConsistencyLevel); Assert.AreNotEqual(priorityLevel, clientOptions.PriorityLevel); - Assert.IsFalse(clientOptions.EnablePartitionLevelFailover); + Assert.IsFalse(clientOptions.EnablePartitionLevelCircuitBreaker); Assert.IsFalse(clientOptions.EnableAdvancedReplicaSelectionForTcp.HasValue); Assert.AreNotEqual(throughputBucket, clientOptions.ThroughputBucket); @@ -149,7 +149,7 @@ public void VerifyCosmosConfigurationPropertiesGetUpdated() Assert.IsTrue(clientOptions.AllowBulkExecution); Assert.AreEqual(consistencyLevel, clientOptions.ConsistencyLevel); Assert.AreEqual(priorityLevel, clientOptions.PriorityLevel); - Assert.IsFalse(clientOptions.EnablePartitionLevelFailover); + Assert.IsFalse(clientOptions.EnablePartitionLevelCircuitBreaker); Assert.IsTrue(clientOptions.EnableAdvancedReplicaSelectionForTcp.HasValue && clientOptions.EnableAdvancedReplicaSelectionForTcp.Value); Assert.AreEqual(throughputBucket, clientOptions.ThroughputBucket); @@ -227,20 +227,15 @@ public void VerifyCosmosConfigurationPropertiesGetUpdated() /// /// Test to validate that when the partition level failover is enabled with the preferred regions list is missing, then the client - /// initialization should throw an argument exception and fail. This should hold true for both environment variable and CosmosClientOptions. + /// initialization should succeed. This should hold true for both environment variable and CosmosClientOptions. /// [TestMethod] [Owner("dkunda")] - [DataRow(true, DisplayName = "Validate that when environment variable is used to enable PPAF, the outcome of the test should be same.")] - [DataRow(false, DisplayName = "Validate that when CosmosClientOptions is used to enable PPAF, the outcome of the test should be same.")] - public void CosmosClientOptions_WhenPartitionLevelFailoverEnabledAndPreferredRegionsNotSet_ShouldThrowArgumentException(bool useEnvironmentVariable) + public void CosmosClientOptions_WhenPartitionLevelFailoverEnabledAndPreferredRegionsNotSet_ShouldInitializeCosmosClientSuccessfully() { try { - if (useEnvironmentVariable) - { - Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelFailoverEnabled, "True"); - } + Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelFailoverEnabled, "True"); string endpoint = AccountEndpoint; string key = MockCosmosUtil.RandomInvalidCorrectlyFormatedAuthKey; @@ -276,17 +271,10 @@ public void CosmosClientOptions_WhenPartitionLevelFailoverEnabledAndPreferredReg .WithPriorityLevel(priorityLevel) .WithThroughputBucket(throughputBucket); - if (!useEnvironmentVariable) - { - cosmosClientBuilder - .WithPartitionLevelFailoverEnabled(); - } - - ArgumentException exception = Assert.ThrowsException(() => cosmosClientBuilder.Build()); + CosmosClient cosmosClient = cosmosClientBuilder.Build(); - Assert.AreEqual( - expected: "ApplicationPreferredRegions or ApplicationRegion is required when EnablePartitionLevelFailover is enabled.", - actual: exception.Message); + Assert.IsNotNull(cosmosClient, + message: "ApplicationPreferredRegions or ApplicationRegion is no longer mandatory fields, hence the client initialization should succeed."); } finally { @@ -300,16 +288,11 @@ public void CosmosClientOptions_WhenPartitionLevelFailoverEnabledAndPreferredReg /// [TestMethod] [Owner("dkunda")] - [DataRow(true, DisplayName = "Validate that when enevironment variable is used to enable PPAF, the outcome of the test should be same.")] - [DataRow(false, DisplayName = "Validate that when CosmosClientOptions is used to enable PPAF, the outcome of the test should be same.")] - public void CosmosClientOptions_WhenPartitionLevelFailoverEnabledAndPreferredRegionsSet_ShouldInitializeSuccessfully(bool useEnvironmentVariable) + public void CosmosClientOptions_WhenPartitionLevelFailoverEnabledAndPreferredRegionsSet_ShouldInitializeSuccessfully() { try { - if (useEnvironmentVariable) - { - Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelFailoverEnabled, "True"); - } + Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelFailoverEnabled, "True"); string endpoint = AccountEndpoint; string key = MockCosmosUtil.RandomInvalidCorrectlyFormatedAuthKey; @@ -342,7 +325,6 @@ public void CosmosClientOptions_WhenPartitionLevelFailoverEnabledAndPreferredReg .WithSerializerOptions(cosmosSerializerOptions) .WithConsistencyLevel(consistencyLevel) .WithPriorityLevel(priorityLevel) - .WithPartitionLevelFailoverEnabled() .WithThroughputBucket(throughputBucket) .WithApplicationPreferredRegions( new List() @@ -373,7 +355,6 @@ public void CosmosClientOptions_WhenPartitionLevelFailoverEnabledAndPreferredReg Assert.AreEqual(cosmosSerializerOptions.Indented, clientOptions.SerializerOptions.Indented); Assert.IsFalse(clientOptions.AllowBulkExecution); Assert.AreEqual(consistencyLevel, clientOptions.ConsistencyLevel); - Assert.IsTrue(clientOptions.EnablePartitionLevelFailover); Assert.IsNotNull(clientOptions.ApplicationPreferredRegions); Assert.IsNotNull(clientOptions.AccountInitializationCustomEndpoints); } @@ -511,6 +492,105 @@ public void UserAgentContainsEnvironmentInformation() Assert.IsTrue(connectionPolicy.UserAgentContainer.UserAgent.EndsWith(userAgentSuffix)); } + [TestMethod] + [Owner("ntripician")] + [DataRow(true, false, true, false, false, "F2", DisplayName = "With PPCB and ApplicationName")] + [DataRow(true, true, true, false, false, "F3", DisplayName = "With PPAF and ApplicationName")] + [DataRow(false, false, true, false, false, "F2", DisplayName = "With PPCB and Without ApplicationName")] + [DataRow(true, false, false, false, true, "F4", DisplayName = "With Thin Client and ApplicationName")] + [DataRow(true, false, false, true, false, "F8", DisplayName = "With Binary Encoding and ApplicationName")] + [DataRow(true, false, false, true, true, "FC", DisplayName = "With Thin Client, Binary Encoding and ApplicationName")] + [DataRow(true, false, true, true, true, "FE", DisplayName = "With PPCB, Thin Client, Binary Encoding and ApplicationName")] + [DataRow(true, true, true, true, true, "FF", DisplayName = "With PPAF, PPCB, Thin Client, Binary Encoding and ApplicationName")] + [DataRow(false, false, false, false, false, "", DisplayName = "Without Any Features and ApplicationName")] + public void UserAgentContainsPPAFInformation( + bool appName, + bool ppaf, + bool ppcb, + bool binaryEncoding, + bool thinClient, + string expectedHexStringPostFix) + { + try + { + if (binaryEncoding) + { + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, "True"); + } + + if (thinClient) + { + Environment.SetEnvironmentVariable(ConfigurationManager.ThinClientModeEnabled, "True"); + } + + EnvironmentInformation environmentInformation = new EnvironmentInformation(); + string expectedValue = "cosmos-netstandard-sdk/" + environmentInformation.ClientVersion; + string userAgentSuffix = "testSuffix"; + + string endpoint = AccountEndpoint; + string key = MockCosmosUtil.RandomInvalidCorrectlyFormatedAuthKey; + + CosmosClientBuilder cosmosClientBuilder = new CosmosClientBuilder( + accountEndpoint: endpoint, + authKeyOrResourceToken: key); + + if (appName) + { + cosmosClientBuilder.WithApplicationName(userAgentSuffix); + } + + ConnectionPolicy policy = new ConnectionPolicy() + { + EnablePartitionLevelCircuitBreaker = ppcb, + EnablePartitionLevelFailover = ppaf + }; + + CosmosClient cosmosClient = cosmosClientBuilder.Build(new MockDocumentClient(policy)); + + CosmosClientOptions cosmosClientOptions = cosmosClient.ClientOptions; + + if (appName) + { + Assert.AreEqual(userAgentSuffix, cosmosClientOptions.ApplicationName); + cosmosClient.DocumentClient.ConnectionPolicy.UserAgentContainer.AppendFeatures(cosmosClientOptions.ApplicationName); + } + else + { + Assert.IsNull(cosmosClientOptions.ApplicationName); + } + + cosmosClient.DocumentClient.ConnectionPolicy.UserAgentContainer.AppendFeatures(cosmosClient.DocumentClient.GetUserAgentFeatures()); + + string userAgent = cosmosClient.DocumentClient.ConnectionPolicy.UserAgentContainer.UserAgent; + Console.WriteLine(userAgent); + if (appName) + { + Assert.IsTrue(userAgent.EndsWith(userAgentSuffix)); + } + else + { + Assert.IsTrue(userAgent.EndsWith(expectedHexStringPostFix)); + } + + Assert.IsTrue(userAgent.StartsWith(expectedValue)); + Assert.IsTrue(userAgent.Contains(expectedHexStringPostFix)); + + if (appName) + { + Assert.IsTrue(userAgent.EndsWith(userAgentSuffix)); + } + else + { + Assert.IsTrue(userAgent.EndsWith(expectedHexStringPostFix)); + } + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.BinaryEncodingEnabled, null); + Environment.SetEnvironmentVariable(ConfigurationManager.ThinClientModeEnabled, null); + } + } + [TestMethod] public void ValidateThatCustomSerializerGetsOverriddenWhenSTJSerializerEnabled() { @@ -1134,61 +1214,6 @@ public void TestServerCertificatesValidationWithDisableSSLFlagTrue(string connSt #nullable disable } - [TestMethod] - public void PPAFClientApplicationRegionCreationTest() - { - CosmosClientOptions cosmosClientOptions = new CosmosClientOptions - { - ApplicationRegion = Regions.WestUS2, - EnablePartitionLevelFailover = true - }; - - CosmosClient cosmosClient = new CosmosClient(ConnectionString, cosmosClientOptions); - Assert.AreEqual(Regions.WestUS2, cosmosClient.ClientOptions.ApplicationRegion); - Assert.IsTrue(cosmosClient.ClientOptions.EnablePartitionLevelFailover); - } - - [TestMethod] - public void PPAFClientApplicationPreferredRegionCreationTest() - { - CosmosClientOptions cosmosClientOptions = new CosmosClientOptions - { - ApplicationPreferredRegions = new List { Regions.WestUS2, Regions.EastUS2 }, - EnablePartitionLevelFailover = true - }; - - CosmosClient cosmosClient = new CosmosClient(ConnectionString, cosmosClientOptions); - Assert.AreEqual(Regions.WestUS2, cosmosClient.ClientOptions.ApplicationPreferredRegions[0]); - Assert.AreEqual(Regions.EastUS2, cosmosClient.ClientOptions.ApplicationPreferredRegions[1]); - Assert.IsTrue(cosmosClient.ClientOptions.EnablePartitionLevelFailover); - } - - [TestMethod] - [ExpectedException(typeof(ArgumentException))] - public void PPAFClientAppRegionAndAppPreferredRegionTest() - { - CosmosClientOptions cosmosClientOptions = new CosmosClientOptions - { - EnablePartitionLevelFailover = true, - ApplicationPreferredRegions = new List { Regions.WestUS2, Regions.EastUS2 }, - ApplicationRegion = Regions.AustraliaCentral - }; - - _ = new CosmosClient(ConnectionString, cosmosClientOptions); - } - - [TestMethod] - [ExpectedException(typeof(ArgumentException))] - public void PPAFClientNoRegionsTest() - { - CosmosClientOptions cosmosClientOptions = new CosmosClientOptions - { - EnablePartitionLevelFailover = true - }; - - _ = new CosmosClient(ConnectionString, cosmosClientOptions); - } - private class TestWebProxy : IWebProxy { public ICredentials Credentials { get; set; } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientResourceUnitTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientResourceUnitTests.cs index 37bbc821aa..45fe126abe 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientResourceUnitTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientResourceUnitTests.cs @@ -6,6 +6,7 @@ namespace Microsoft.Azure.Cosmos.Core.Tests { using System; using System.Collections.Generic; + using System.Globalization; using System.Net.Http; using System.Net.Security; using System.Security.Cryptography; @@ -13,6 +14,7 @@ namespace Microsoft.Azure.Cosmos.Core.Tests using System.Threading.Tasks; using Microsoft.Azure.Cosmos.Tests; using Microsoft.Azure.Documents; + using Microsoft.Azure.Documents.Collections; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientTests.cs index 559aa6b37f..fb23dce2c4 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientTests.cs @@ -83,7 +83,6 @@ public async Task TestDispose() string exceptionString = e.ToString(); Assert.IsTrue(exceptionString.Contains(diagnostics)); Assert.IsTrue(exceptionString.Contains(e.Message)); - Assert.IsTrue(exceptionString.Contains(e.StackTrace)); } } } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosContainerSettingsTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosContainerSettingsTests.cs index a10d520959..65f14d567c 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosContainerSettingsTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosContainerSettingsTests.cs @@ -14,6 +14,7 @@ namespace Microsoft.Azure.Cosmos.Tests using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json; using Newtonsoft.Json.Linq; + using FullTextPath = Microsoft.Azure.Cosmos.FullTextPath; [TestClass] public class CosmosContainerSettingsTests @@ -272,6 +273,212 @@ public void ValidateVectorEmbeddingsAndIndexes() CollectionAssert.AreEqual(new string[] { "/ZipCode" }, vectorIndexes[2].VectorIndexShardKey); } + [TestMethod] + public void ValidateFullTextPathsAndIndexes() + { + string defaultLanguage = "en-US", fullTextPath1 = "/fts1", fullTextPath2 = "/fts2", fullTextPath3 = "/fts3"; + + Collection fullTextPaths = new Collection() + { + new Cosmos.FullTextPath() + { + Path = fullTextPath1, + Language = "en-US", + }, + new Cosmos.FullTextPath() + { + Path = fullTextPath2, + Language = "en-US", + }, + new Cosmos.FullTextPath() + { + Path = fullTextPath3 + }, + }; + + ContainerProperties containerSettings = new ContainerProperties(id: "TestContainer", partitionKeyPath: "/partitionKey") + { + FullTextPolicy = new() + { + DefaultLanguage = defaultLanguage, + FullTextPaths = fullTextPaths + }, + IndexingPolicy = new Cosmos.IndexingPolicy() + { + FullTextIndexes = new() + { + new Cosmos.FullTextIndexPath() + { + Path = fullTextPath1, + }, + new Cosmos.FullTextIndexPath() + { + Path = fullTextPath2, + }, + new Cosmos.FullTextIndexPath() + { + Path = fullTextPath3, + } + }, + }, + }; + + Assert.IsNotNull(containerSettings.IndexingPolicy); + Assert.IsNotNull(containerSettings.FullTextPolicy); + Assert.IsNotNull(containerSettings.IndexingPolicy.FullTextIndexes); + + Cosmos.FullTextPolicy fullTextPolicy = containerSettings.FullTextPolicy; + Assert.IsNotNull(fullTextPolicy.FullTextPaths); + Assert.AreEqual(fullTextPaths.Count, fullTextPolicy.FullTextPaths.Count()); + Assert.AreEqual(fullTextPaths[0].Path, fullTextPolicy.FullTextPaths[0].Path); + Assert.AreEqual(fullTextPaths[0].Language, fullTextPolicy.FullTextPaths[0].Language); + Assert.AreEqual(fullTextPaths[1].Path, fullTextPolicy.FullTextPaths[1].Path); + Assert.AreEqual(fullTextPaths[1].Language, fullTextPolicy.FullTextPaths[1].Language); + Assert.AreEqual(fullTextPaths[2].Path, fullTextPolicy.FullTextPaths[2].Path); + Assert.AreEqual(fullTextPaths[2].Language, fullTextPolicy.FullTextPaths[2].Language); + + CollectionAssert.AreEquivalent(fullTextPaths, fullTextPolicy.FullTextPaths.ToList()); + + Collection fullTextIndexes = containerSettings.IndexingPolicy.FullTextIndexes; + Assert.AreEqual("/fts1", fullTextIndexes[0].Path); + Assert.AreEqual("/fts2", fullTextIndexes[1].Path); + Assert.AreEqual("/fts3", fullTextIndexes[2].Path); + Assert.AreEqual("en-US", fullTextPolicy.FullTextPaths[0].Language); + Assert.AreEqual("en-US", fullTextPolicy.FullTextPaths[1].Language); + Assert.IsNull(fullTextPolicy.FullTextPaths[2].Language); + } + + [TestMethod] + public void ValidateFullTextLanguagesOptional() + { + string fullTextPath1 = "/fts1", fullTextPath2 = "/fts2"; + + Collection fullTextPaths = new Collection() + { + new Cosmos.FullTextPath() + { + Path = fullTextPath1 + }, + new Cosmos.FullTextPath() + { + Path = fullTextPath2, + Language = "de-DE", + } + }; + + ContainerProperties containerSettings = new ContainerProperties(id: "TestContainer", partitionKeyPath: "/partitionKey") + { + FullTextPolicy = new() + { + FullTextPaths = fullTextPaths + }, + IndexingPolicy = new Cosmos.IndexingPolicy() + { + FullTextIndexes = new() + { + new Cosmos.FullTextIndexPath() + { + Path = fullTextPath1, + }, + new Cosmos.FullTextIndexPath() + { + Path = fullTextPath2, + } + }, + }, + }; + + Assert.IsNotNull(containerSettings.IndexingPolicy); + Assert.IsNotNull(containerSettings.FullTextPolicy); + Assert.IsNotNull(containerSettings.IndexingPolicy.FullTextIndexes); + + Cosmos.FullTextPolicy fullTextPolicy = containerSettings.FullTextPolicy; + Assert.IsNull(fullTextPolicy.DefaultLanguage); + Assert.IsNotNull(fullTextPolicy.FullTextPaths); + Assert.AreEqual(fullTextPaths.Count, fullTextPolicy.FullTextPaths.Count()); + Assert.AreEqual(fullTextPaths[0].Path, fullTextPolicy.FullTextPaths[0].Path); + Assert.AreEqual(fullTextPaths[0].Language, fullTextPolicy.FullTextPaths[0].Language); + Assert.AreEqual(fullTextPaths[1].Path, fullTextPolicy.FullTextPaths[1].Path); + Assert.AreEqual(fullTextPaths[1].Language, fullTextPolicy.FullTextPaths[1].Language); + + CollectionAssert.AreEquivalent(fullTextPaths, fullTextPolicy.FullTextPaths.ToList()); + + Collection fullTextIndexes = containerSettings.IndexingPolicy.FullTextIndexes; + Assert.AreEqual("/fts1", fullTextIndexes[0].Path); + Assert.AreEqual("/fts2", fullTextIndexes[1].Path); + Assert.IsNull(fullTextPolicy.FullTextPaths[0].Language); + Assert.AreEqual("de-DE", fullTextPolicy.FullTextPaths[1].Language); + + string serialized = this.Serialize(containerSettings); + Assert.AreEqual(@"{""indexingPolicy"":{""automatic"":true,""indexingMode"":""Consistent"",""includedPaths"":[],""excludedPaths"":[],""compositeIndexes"":[],""spatialIndexes"":[],""vectorIndexes"":[],""fullTextIndexes"":[{""path"":""/fts1""},{""path"":""/fts2""}]},""fullTextPolicy"":{""fullTextPaths"":[{""path"":""/fts1""},{""path"":""/fts2"",""language"":""de-DE""}]},""id"":""TestContainer"",""partitionKey"":{""paths"":[""/partitionKey""],""kind"":""Hash""}}", serialized); + } + + private string Serialize(ContainerProperties containerProperties) + { + using (MemoryStream ms = new MemoryStream()) + { + using (StreamWriter streamWriter = new StreamWriter(ms)) + { + JsonSerializer jsonSerializer = new JsonSerializer(); + using (JsonWriter jsonWriter = new JsonTextWriter(streamWriter)) + { + jsonSerializer.Serialize(jsonWriter, containerProperties); + jsonWriter.Flush(); + + ms.Position = 0; + using (StreamReader streamReader = new StreamReader(ms)) + { + return streamReader.ReadToEnd(); + } + } + } + } + } + + [TestMethod] + public void ValidateFullTextPathsAndIndexesWithDefaultLanguage() + { + string defaultLanguage = "en-US", fullTextPath1 = "/fts1", fullTextPath2 = "/fts2", fullTextPath3 = "/fts3"; + ContainerProperties containerSettings = new ContainerProperties(id: "TestContainer", partitionKeyPath: "/partitionKey") + { + FullTextPolicy = new() + { + DefaultLanguage = defaultLanguage, + FullTextPaths = new Collection() + }, + IndexingPolicy = new Cosmos.IndexingPolicy() + { + FullTextIndexes = new() + { + new Cosmos.FullTextIndexPath() + { + Path = fullTextPath1, + }, + new Cosmos.FullTextIndexPath() + { + Path = fullTextPath2, + }, + new Cosmos.FullTextIndexPath() + { + Path = fullTextPath3, + } + }, + }, + }; + + Assert.IsNotNull(containerSettings.IndexingPolicy); + Assert.IsNotNull(containerSettings.FullTextPolicy); + Assert.IsNotNull(containerSettings.IndexingPolicy.FullTextIndexes); + + Cosmos.FullTextPolicy fullTextPolicy = containerSettings.FullTextPolicy; + Assert.AreEqual(0, fullTextPolicy.FullTextPaths.Count); + + Collection fullTextIndexes = containerSettings.IndexingPolicy.FullTextIndexes; + Assert.AreEqual("/fts1", fullTextIndexes[0].Path); + Assert.AreEqual("/fts2", fullTextIndexes[1].Path); + Assert.AreEqual("/fts3", fullTextIndexes[2].Path); + } + private static string SerializeDocumentCollection(DocumentCollection collection) { using (MemoryStream ms = new MemoryStream()) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosHttpClientCoreTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosHttpClientCoreTests.cs index 53f392933f..9411ade3eb 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosHttpClientCoreTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosHttpClientCoreTests.cs @@ -488,6 +488,115 @@ public void CreateHttpClientHandlerCreatesCorrectValueType() Assert.IsFalse(clientHandler.ServerCertificateCustomValidationCallback.Invoke(new HttpRequestMessage(), x509Certificate2, x509Chain, sslPolicyErrors)); } + [TestMethod] + public async Task HttpTimeoutPolicyForThinClientOn503TestAsync() + { + + async Task TestScenarioAsync(HttpMethod method, ResourceType resourceType, HttpTimeoutPolicy timeoutPolicy, Type expectedException, int expectedNumberOfRetrys) + { + int count = 0; + Task sendFunc(HttpRequestMessage request, CancellationToken cancellationToken) + { + count++; + + throw new OperationCanceledException("API with exception"); + + } + + DocumentClientEventSource eventSource = DocumentClientEventSource.Instance; + HttpMessageHandler messageHandler = new MockMessageHandler(sendFunc); + using CosmosHttpClient cosmoshttpClient = MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler)); + + try + { + using (ITrace trace = Trace.GetRootTrace(nameof(NoRetryOnNoRetryPolicyTestAsync))) + { + HttpResponseMessage responseMessage1 = await cosmoshttpClient.SendHttpAsync(() => + new ValueTask( + result: new HttpRequestMessage(method, new Uri("http://localhost"))), + resourceType: resourceType, + timeoutPolicy: timeoutPolicy, + clientSideRequestStatistics: new ClientSideRequestStatisticsTraceDatum(DateTime.UtcNow, trace), + cancellationToken: default); + } + } + catch (Exception e) + { + Assert.AreEqual(expectedNumberOfRetrys, count, "Should retry 3 times for read methods, for writes should only be tried once"); + Assert.AreEqual(e.GetType(), expectedException); + + if (e.GetType() == typeof(CosmosException)) + { + CosmosException cosmosException = (CosmosException)e; + Assert.AreEqual(cosmosException.StatusCode, System.Net.HttpStatusCode.ServiceUnavailable); + Assert.AreEqual((int)cosmosException.SubStatusCode, (int)SubStatusCodes.TransportGenerated503); + + Assert.IsNotNull(cosmosException.Trace); + Assert.AreNotEqual(cosmosException.Trace, NoOpTrace.Singleton); + } + } + + } + + //Data plane read + await TestScenarioAsync( + method: HttpMethod.Get, + resourceType: ResourceType.Document, + timeoutPolicy: HttpTimeoutPolicy.GetTimeoutPolicy( + documentServiceRequest: CosmosHttpClientCoreTests.CreateDocumentServiceRequestByOperation(ResourceType.Document, OperationType.Read), + isPartitionLevelFailoverEnabled: false, + isThinClientEnabled: true), + expectedException: typeof(CosmosException), + expectedNumberOfRetrys: 3); + + //Data plane query + await TestScenarioAsync( + method: HttpMethod.Get, + resourceType: ResourceType.Document, + timeoutPolicy: HttpTimeoutPolicy.GetTimeoutPolicy( + documentServiceRequest: CosmosHttpClientCoreTests.CreateDocumentServiceRequestByOperation(ResourceType.Document, OperationType.Query), + isPartitionLevelFailoverEnabled: false, + isThinClientEnabled: true), + expectedException: typeof(CosmosException), + expectedNumberOfRetrys: 3); + + ////Data plane write + await TestScenarioAsync( + method: HttpMethod.Post, + resourceType: ResourceType.Document, + timeoutPolicy: HttpTimeoutPolicy.GetTimeoutPolicy( + documentServiceRequest: CosmosHttpClientCoreTests.CreateDocumentServiceRequestByOperation(ResourceType.Document, OperationType.Create), + isPartitionLevelFailoverEnabled: false, + isThinClientEnabled: true), + expectedException: typeof(CosmosException), + expectedNumberOfRetrys: 1); + + ////Meta data read + await TestScenarioAsync( + method: HttpMethod.Get, + resourceType: ResourceType.Database, + timeoutPolicy: HttpTimeoutPolicy.GetTimeoutPolicy( + documentServiceRequest: CosmosHttpClientCoreTests.CreateDocumentServiceRequestByOperation(ResourceType.Database, OperationType.Read), + isPartitionLevelFailoverEnabled: false, + isThinClientEnabled: true), + expectedException: typeof(CosmosException), + expectedNumberOfRetrys: 3); + } + + private static DocumentServiceRequest CreateDocumentServiceRequestByOperation( + ResourceType resourceType, + OperationType operationType) + { + string path = $"dbs/dummy_db_id/colls/dummy_ct_id"; + return new DocumentServiceRequest( + operationType, + resourceType, + path, + body: null, + AuthorizationTokenType.PrimaryMasterKey, + headers: null); + } + private class MockMessageHandler : HttpMessageHandler { private readonly Func> sendFunc; diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosJsonSerializerUnitTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosJsonSerializerUnitTests.cs index e664746a04..1ebff95eec 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosJsonSerializerUnitTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosJsonSerializerUnitTests.cs @@ -55,7 +55,7 @@ public void ValidatePropertySerialization() string id = "testId"; this.TestProperty( id, - $@"{{""id"":""{id}"",""writableLocations"":[],""readableLocations"":[],""userConsistencyPolicy"":null,""addresses"":null,""userReplicationPolicy"":null,""systemReplicationPolicy"":null,""readPolicy"":null,""queryEngineConfiguration"":null,""enableMultipleWriteLocations"":false}}"); + $@"{{""id"":""{id}"",""writableLocations"":[],""readableLocations"":[],""userConsistencyPolicy"":null,""addresses"":null,""userReplicationPolicy"":null,""systemReplicationPolicy"":null,""readPolicy"":null,""queryEngineConfiguration"":null,""enableMultipleWriteLocations"":false,""enablePerPartitionFailoverBehavior"":null}}"); this.TestProperty( id, diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosSerializerCoreTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosSerializerCoreTests.cs index 9c748eb790..7b18b25518 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosSerializerCoreTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosSerializerCoreTests.cs @@ -143,7 +143,7 @@ public void ValidateCustomSerializerNotUsedForInternalTypes() this.TestProperty( serializerCore, id, - $@"{{""id"":""{id}"",""writableLocations"":[],""readableLocations"":[],""userConsistencyPolicy"":null,""addresses"":null,""userReplicationPolicy"":null,""systemReplicationPolicy"":null,""readPolicy"":null,""queryEngineConfiguration"":null,""enableMultipleWriteLocations"":false}}"); + $@"{{""id"":""{id}"",""writableLocations"":[],""readableLocations"":[],""userConsistencyPolicy"":null,""addresses"":null,""userReplicationPolicy"":null,""systemReplicationPolicy"":null,""readPolicy"":null,""queryEngineConfiguration"":null,""enableMultipleWriteLocations"":false,""enablePerPartitionFailoverBehavior"":null}}"); this.TestProperty( serializerCore, diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ExceptionHandlingUtilityTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ExceptionHandlingUtilityTests.cs new file mode 100644 index 0000000000..8320ba66be --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ExceptionHandlingUtilityTests.cs @@ -0,0 +1,136 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Tests +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Reflection.Metadata; + using System.Text; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos.Diagnostics; + using Microsoft.Azure.Cosmos.Query.Core.Exceptions; + using Microsoft.Azure.Cosmos.Resource.CosmosExceptions; + using Microsoft.Azure.Cosmos.Tracing; + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class ExceptionHandlingUtilityTests + { + [TestMethod] + [DynamicData(nameof(GetTestData), DynamicDataSourceType.Method)] + public void CloneAndRethrow_OperationCanceledExceptionTypes(OperationCanceledException original) + { + // Act & Assert + bool result = ExceptionHandlingUtility.TryCloneException(original, out Exception ex); + + // Assert + Assert.IsTrue(result, "Expected exception to be cloned."); + Assert.IsNotNull(ex, "Expected cloned exception to be not null."); + Assert.IsTrue(ex.GetType() == original.GetType(), $"Expected cloned exception to be of type : '{original.GetType()}'"); + Assert.IsFalse(Object.ReferenceEquals(original, ex)); // Ensure a new exception was created + Assert.AreEqual(original.ToString(), ex.InnerException.ToString()); + Assert.AreEqual(original.Message, ex.Message); + } + + [TestMethod] + [DynamicData(nameof(GetTestData), DynamicDataSourceType.Method)] + public void CloneAndRethrow_CosmosOperationCanceledExceptionTypes(OperationCanceledException original) + { + CosmosOperationCanceledException cosmosOperationCanceledException = new CosmosOperationCanceledException(original, new CosmosTraceDiagnostics(NoOpTrace.Singleton)); + bool result = ExceptionHandlingUtility.TryCloneException(cosmosOperationCanceledException, out Exception cloneResult); + + // Assert + Assert.IsTrue(result, "Expected exception to be cloned."); + Assert.IsNotNull(cloneResult, "Expected cloned exception to be not null."); + Assert.IsTrue(cloneResult.GetType() == cosmosOperationCanceledException.GetType(), $"Expected cloned exception to be of type : '{cosmosOperationCanceledException.GetType()}'"); + Assert.IsFalse(Object.ReferenceEquals(original, cloneResult)); // Ensure a new exception was created + Assert.AreEqual(cosmosOperationCanceledException.ToString(), cloneResult.ToString()); // IClonable + Assert.AreEqual(cosmosOperationCanceledException.Message, cloneResult.Message); + + //Assert: Shallow copy + Assert.IsTrue(object.ReferenceEquals(cosmosOperationCanceledException.InnerException, cloneResult.InnerException)); + } + + private static IEnumerable GetTestData() + { + return new List + { + new object[] { new TaskCanceledException("Task was canceled.", new TaskCanceledException("inner")) }, + new object[] { new OperationCanceledException("Operation was canceled.", new OperationCanceledException("inner")) }, + }; + } + + [TestMethod] + [ExpectedException(typeof(TaskCanceledException))] + public void CloneAndRethrow_TaskCanceledException() + { + // Arrange + TaskCanceledException originalException = new TaskCanceledException("Task was canceled.", new TaskCanceledException("inner exception")); + + // Act & Assert + bool result = ExceptionHandlingUtility.TryCloneException(originalException, out Exception ex); + + Assert.IsTrue(result, "Expected exception to be cloned."); + Assert.IsNotNull(ex, "Expected cloned exception to be not null."); + Assert.IsTrue(ex is TaskCanceledException, "Expected cloned exception to be of type TaskCanceledException."); + Assert.IsFalse(Object.ReferenceEquals(originalException, ex)); // Ensure a new exception was created + Assert.AreEqual(originalException.ToString(), ex.InnerException.ToString()); + Assert.AreEqual(originalException.Message, ex.Message); + throw ex; + } + + [TestMethod] + [ExpectedException(typeof(TimeoutException))] + public void CloneAndRethrow_TimeoutException() + { + // Arrange + TimeoutException originalException = new TimeoutException("Operation timed out.", new TimeoutException("inner exception")); + + // Act & Assert + bool result = ExceptionHandlingUtility.TryCloneException(originalException, out Exception ex); + + Assert.IsTrue(result, "Expected exception to be cloned."); + Assert.IsNotNull(ex, "Expected cloned exception to be not null."); + Assert.IsTrue(ex is TimeoutException, "Expected cloned exception to be of type TimeoutException."); + Assert.IsFalse(Object.ReferenceEquals(originalException, ex)); // Ensure a new exception was created + Assert.AreEqual(originalException.ToString(), ex.InnerException.ToString()); + Assert.AreEqual(originalException.Message, ex.Message); + throw ex; + } + + [TestMethod] + [ExpectedException(typeof(CosmosException))] + public void CloneAndRethrow_CosmosException() + { + // Arrange + CosmosException originalException = CosmosExceptionFactory.CreateInternalServerErrorException("something's broken", new Headers()); + + // Act & Assert + bool result = ExceptionHandlingUtility.TryCloneException(originalException, out Exception ex); + + Assert.IsTrue(result, "Expected exception to be cloned."); + Assert.IsNotNull(ex, "Expected cloned exception to be not null."); + Assert.IsTrue(ex is CosmosException, "Expected cloned exception to be of type CosmosException."); + Assert.IsFalse(Object.ReferenceEquals(originalException, ex)); // Ensure a new exception was created + Assert.AreEqual(originalException.ToString(), ex.ToString()); + Assert.AreEqual(originalException.Message, ex.Message); + throw ex; + } + + [TestMethod] + public void DoNotClone_And_Rethrow_OtherException() + { + // Arrange + MalformedContinuationTokenException originalException = + new MalformedContinuationTokenException("malformed continuation token", new MalformedContinuationTokenException("Inner")); + + // Act & Assert + bool result = ExceptionHandlingUtility.TryCloneException(originalException, out _); + + Assert.IsFalse(result, "Expected exception to not be cloned."); + } + } +} diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ExceptionlessTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ExceptionlessTests.cs index 4db6fe3130..b9539ef8c4 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ExceptionlessTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ExceptionlessTests.cs @@ -320,7 +320,8 @@ private static GatewayStoreModel MockGatewayStoreModel(Func new HttpClient(messageHandler))); + MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler)), + GlobalPartitionEndpointManagerNoOp.Instance); } private static Mock GetMockAddressCache(AddressInformation[] addressInformation) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Fluent/ContainerDefinitionForCreateTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Fluent/ContainerDefinitionForCreateTests.cs index 01b54f33b3..7d4c20cc71 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Fluent/ContainerDefinitionForCreateTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Fluent/ContainerDefinitionForCreateTests.cs @@ -357,8 +357,7 @@ public async Task ValidateFullTextPolicyAndIndexUsingContainerBuilder() }, new Cosmos.FullTextPath() { - Path = fullTextPath3, - Language = "en-US", + Path = fullTextPath3 }, }; @@ -412,7 +411,7 @@ public async Task ValidateFullTextPolicyAndIndexUsingContainerBuilder() && fullTextPath2.Equals(settings.FullTextPolicy.FullTextPaths[1].Path) && "en-US".Equals(settings.FullTextPolicy.FullTextPaths[1].Language) && fullTextPath3.Equals(settings.FullTextPolicy.FullTextPaths[2].Path) - && "en-US".Equals(settings.FullTextPolicy.FullTextPaths[2].Language) + && (settings.FullTextPolicy.FullTextPaths[2].Language == null) && fullTextPath1.Equals(settings.IndexingPolicy.FullTextIndexes[0].Path) && fullTextPath2.Equals(settings.IndexingPolicy.FullTextIndexes[1].Path) && fullTextPath3.Equals(settings.IndexingPolicy.FullTextIndexes[2].Path)), @@ -421,6 +420,66 @@ public async Task ValidateFullTextPolicyAndIndexUsingContainerBuilder() It.IsAny()), Times.Once); } + [TestMethod] + public async Task ValidateFullTextPolicyAndIndexUsingContainerBuilderOptionalLanguage() + { + string fullTextPath1 = "/fts1"; + + Collection fullTextPaths = new Collection() + { + new Cosmos.FullTextPath() + { + Path = fullTextPath1 + }, + }; + + Mock mockContainerResponse = new Mock(); + mockContainerResponse + .Setup(x => x.StatusCode) + .Returns(HttpStatusCode.Created); + + Mock mockContainers = new Mock(); + Mock mockClient = new Mock(); + mockContainers.Setup(m => m.Client).Returns(mockClient.Object); + mockContainers + .Setup(c => c.CreateContainerAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(mockContainerResponse.Object); + mockContainers + .Setup(c => c.Id) + .Returns(Guid.NewGuid().ToString()); + + ContainerBuilder containerFluentDefinitionForCreate = new ContainerBuilder( + mockContainers.Object, + containerName, + partitionKey); + + ContainerResponse response = await containerFluentDefinitionForCreate + .WithFullTextPolicy( + defaultLanguage: null, + fullTextPaths: fullTextPaths) + .Attach() + .WithIndexingPolicy() + .WithFullTextIndex() + .Path(fullTextPath1) + .Attach() + .Attach() + .CreateAsync(); + + Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); + mockContainers.Verify(c => c.CreateContainerAsync( + It.Is((settings) => settings.FullTextPolicy.FullTextPaths.Count == 1 + && (settings.FullTextPolicy.DefaultLanguage == null) + && fullTextPath1.Equals(settings.FullTextPolicy.FullTextPaths[0].Path) + && (settings.FullTextPolicy.FullTextPaths[0].Language == null)), + It.IsAny(), + It.IsAny(), + It.IsAny()), Times.Once); + } + [TestMethod] public async Task ValidateVectorEmbeddingsAndIndexingPolicyUsingContainerBuilder() { @@ -490,7 +549,7 @@ public async Task ValidateVectorEmbeddingsAndIndexingPolicyUsingContainerBuilder .WithVectorIndex() .Path(vector3Path, VectorIndexType.DiskANN) .WithQuantizationByteSize(2) - .WithIndexingSearchListSize(5) + .WithIndexingSearchListSize(35) .WithVectorIndexShardKey(new string[] { "/ZipCode" }) .Attach() .Attach() diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayAddressCacheTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayAddressCacheTests.cs index b2a60c2892..aa088340fd 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayAddressCacheTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayAddressCacheTests.cs @@ -60,7 +60,7 @@ public GatewayAddressCacheTests() } }; - this.partitionKeyRangeCache = new Mock(null, null, null, null); + this.partitionKeyRangeCache = new Mock(null, null, null, null, false); this.partitionKeyRangeCache .Setup(m => m.TryGetOverlappingRangesAsync( It.IsAny(), @@ -311,7 +311,7 @@ public void GlobalAddressResolverUpdateAsyncSynchronizationTest() IConnectionStateListener connectionStateListener = new ConnectionStateMuxListener(true); GlobalAddressResolver globalAddressResolver = new GlobalAddressResolver( endpointManager: globalEndpointManager, - null, + partitionKeyRangeLocationCache, Protocol.Tcp, this.mockTokenProvider.Object, null, @@ -528,6 +528,76 @@ await cache.OpenConnectionsAsync( expectedTotalSuccessAddressesToOpenCount: 0); } + /// + /// Test to validate that when is called with a valid open connection handler + /// and a cancellation token that will expire with a pre-configured time, the handler method is indeed invoked and the open connection + /// operation gets cancelled successfully, if the cancellation token expires. The open connection operation succeeds if the operation + /// is finished before the cancellation token expiry time. + /// + [TestMethod] + [Owner("dkunda")] + [DataRow(1, 2, 1, 0, 3, 0, true, DisplayName = "Validate that when the cancellation token expiry time (i.e. 1 sec) is smaller than the open connection opperation duration (i.e. 2 sec)," + + "the open connection operation gets cancelled and the cancellation token is indeed respected and eventually cancelled.")] + [DataRow(3, 1, 1, 0, 3, 3, false, DisplayName = "Validate that when the cancellation token expiry time (i.e. 3 sec) is larger than the open connection opperation duration (i.e. 1 sec)," + + "the open connection operation completes successfully and the cancellation token is not cancelled.")] + public async Task OpenConnectionsAsync_WithValidOpenConnectionHandlerAndCancellationTokenExpires_ShouldInvokeHandlerMethodAndCancelToken( + int cancellationTokenTimeoutInSeconds, + int openConnectionDelayInSeconds, + int expectedTotalHandlerInvocationCount, + int expectedTotalFailedAddressesToOpenCount, + int expectedTotalReceivedAddressesCount, + int expectedTotalSuccessAddressesToOpenCount, + bool shouldCancelToken) + { + // Arrange. + FakeMessageHandler messageHandler = new(); + FakeOpenConnectionHandler fakeOpenConnectionHandler = new( + failingIndexes: new HashSet(), + openConnectionDelayInSeconds: openConnectionDelayInSeconds); + + ContainerProperties containerProperties = ContainerProperties.CreateWithResourceId("ccZ1ANCszwk="); + containerProperties.Id = "TestId"; + containerProperties.PartitionKeyPath = "/pk"; + HttpClient httpClient = new(messageHandler) + { + Timeout = TimeSpan.FromSeconds(120) + }; + + CancellationTokenSource cts = new(TimeSpan.FromSeconds(cancellationTokenTimeoutInSeconds)); + CancellationToken token = cts.Token; + + GatewayAddressCache cache = new( + new Uri(GatewayAddressCacheTests.DatabaseAccountApiEndpoint), + Protocol.Tcp, + this.mockTokenProvider.Object, + this.mockServiceConfigReader.Object, + MockCosmosUtil.CreateCosmosHttpClient(() => httpClient), + openConnectionsHandler: fakeOpenConnectionHandler, + connectionStateListener: Mock.Of(), + suboptimalPartitionForceRefreshIntervalInSeconds: 2); + + // Act. + await cache.OpenConnectionsAsync( + databaseName: "test-database", + collection: containerProperties, + partitionKeyRangeIdentities: new List() + { + this.testPartitionKeyRangeIdentity + }, + shouldOpenRntbdChannels: true, + cancellationToken: token); + + // Assert. + GatewayAddressCacheTests.AssertOpenConnectionHandlerAttributes( + fakeOpenConnectionHandler: fakeOpenConnectionHandler, + expectedTotalFailedAddressesToOpenCount: expectedTotalFailedAddressesToOpenCount, + expectedTotalHandlerInvocationCount: expectedTotalHandlerInvocationCount, + expectedTotalReceivedAddressesCount: expectedTotalReceivedAddressesCount, + expectedTotalSuccessAddressesToOpenCount: expectedTotalSuccessAddressesToOpenCount); + + Assert.AreEqual(shouldCancelToken, token.IsCancellationRequested); + } + /// /// Test to validate that when is called with a /// valid open connection handler, the handler method is indeed invoked and an attempt is made to open @@ -566,7 +636,7 @@ public async Task GlobalAddressResolver_OpenConnectionsToAllReplicasAsync_WithVa containerProperties.Id = "TestId"; containerProperties.PartitionKeyPath = "/pk"; - Mock mockCollectionCahce = new(MockBehavior.Strict); + Mock mockCollectionCahce = new(MockBehavior.Strict, false); mockCollectionCahce .Setup(x => x.ResolveByNameAsync( It.IsAny(), @@ -645,7 +715,7 @@ public async Task GlobalAddressResolver_OpenConnectionsToAllReplicasAsync_WhenHa containerProperties.Id = "TestId"; containerProperties.PartitionKeyPath = "/pk"; - Mock mockCollectionCahce = new(MockBehavior.Strict); + Mock mockCollectionCahce = new(MockBehavior.Strict, false); mockCollectionCahce .Setup(x => x.ResolveByNameAsync( It.IsAny(), @@ -724,7 +794,7 @@ public async Task GlobalAddressResolver_OpenConnectionsToAllReplicasAsync_WhenIn containerProperties.Id = "TestId"; containerProperties.PartitionKeyPath = "/pk"; - Mock mockCollectionCahce = new(MockBehavior.Strict); + Mock mockCollectionCahce = new(MockBehavior.Strict, false); mockCollectionCahce .Setup(x => x.ResolveByNameAsync( It.IsAny(), @@ -736,7 +806,7 @@ public async Task GlobalAddressResolver_OpenConnectionsToAllReplicasAsync_WhenIn .Returns(Task.FromResult(containerProperties)); string exceptionMessage = "Failed to lookup partition key ranges."; - Mock partitionKeyRangeCache = new(null, null, null, null); + Mock partitionKeyRangeCache = new(null, null, null, null, false); partitionKeyRangeCache .Setup(m => m.TryGetOverlappingRangesAsync( It.IsAny(), @@ -812,7 +882,7 @@ public async Task GlobalAddressResolver_OpenConnectionsToAllReplicasAsync_WhenNu RequestTimeout = TimeSpan.FromSeconds(120) }; - Mock mockCollectionCahce = new(MockBehavior.Strict); + Mock mockCollectionCahce = new(MockBehavior.Strict, false); mockCollectionCahce .Setup(x => x.ResolveByNameAsync( It.IsAny(), @@ -1027,10 +1097,11 @@ public async Task TryGetAddressesAsync_WhenReplicaVlidationEnabled_ShouldValidat Assert.AreEqual(0, addressInfo.AllAddresses.Count(x => x.PhysicalUri == newAddress)); // Because force refresh is requested, an unhealthy replica is added to the failed endpoint so that it's status could be validted. - request.RequestContext.FailedEndpoints.Value.Add( - new TransportAddressUri( + request.RequestContext.FailedEndpoints.Value.TryAdd( + key: new TransportAddressUri( addressUri: new Uri( - uriString: addressTobeMarkedUnhealthy))); + uriString: addressTobeMarkedUnhealthy)), + value: true); addressInfo = await cache.TryGetAddressesAsync( request: request, @@ -1180,10 +1251,11 @@ public async Task TryGetAddressesAsync_WhenReplicaVlidationEnabledAndUnhealthyUr Assert.AreEqual(0, addressInfo.AllAddresses.Count(x => x.PhysicalUri == newAddress)); // Because force refresh is requested, an unhealthy replica is added to the failed endpoint so that it's health status could be validted. - request.RequestContext.FailedEndpoints.Value.Add( - new TransportAddressUri( + request.RequestContext.FailedEndpoints.Value.TryAdd( + key: new TransportAddressUri( addressUri: new Uri( - uriString: addressTobeMarkedUnhealthy))); + uriString: addressTobeMarkedUnhealthy)), + value: true); addressInfo = await cache.TryGetAddressesAsync( request: request, @@ -1229,7 +1301,7 @@ public async Task TryGetAddressesAsync_WhenReplicaVlidationEnabledAndUnhealthyUr // A delay of 2 minute was added to make the replica unhealthy for more than one minute. This // will make sure the unhealthy replica gets a chance to re-validate it's health status. - ReflectionUtils.AddMinuteToDateTimeFieldUsingReflection( + TestUtils.AddMinuteToDateTimeFieldUsingReflection( objectName: refreshedUri.GetCurrentHealthState(), fieldName: "lastUnhealthyTimestamp", delayInMinutes: -2); @@ -1380,7 +1452,7 @@ await cache.MarkAddressesToUnhealthyAsync( .ReplicaTransportAddressUris .Single(x => x.ToString().Equals(addressTobeMarkedUnhealthy)); - ReflectionUtils.AddMinuteToDateTimeFieldUsingReflection( + TestUtils.AddMinuteToDateTimeFieldUsingReflection( objectName: refreshedUri.GetCurrentHealthState(), fieldName: "lastUnhealthyTimestamp", delayInMinutes: -2 * iterationIndex); @@ -1484,10 +1556,11 @@ public async Task TryGetAddressesAsync_WhenReplicaVlidationDisabled_ShouldNotVal Assert.AreEqual(0, addressInfo.AllAddresses.Count(x => x.PhysicalUri == newAddress)); // Because force refresh is requested, an unhealthy replica is added to the failed endpoint so that it's status could be validted. - request.RequestContext.FailedEndpoints.Value.Add( - new TransportAddressUri( + request.RequestContext.FailedEndpoints.Value.TryAdd( + key: new TransportAddressUri( addressUri: new Uri( - uriString: addressTobeMarkedUnhealthy))); + uriString: addressTobeMarkedUnhealthy)), + value: true); addressInfo = await cache.TryGetAddressesAsync( request: request, @@ -1519,6 +1592,118 @@ public async Task TryGetAddressesAsync_WhenReplicaVlidationDisabled_ShouldNotVal expectedTotalSuccessAddressesToOpenCount: 0); } + /// + /// Test to validate that when is called with a + /// valid open connection handler, the handler method is indeed invoked and an attempt is made to open the connections to the backend replicas. + /// + [TestMethod] + [Owner("dkunda")] + [DataRow(true, DisplayName = "Scenario when pk range to address mapping is populated")] + [DataRow(false, DisplayName = "Scenario when pk range to address mapping is missing")] + public async Task GlobalAddressResolver_TryOpenConnectionToUnhealthyEndpointsAsync_WithValidHandler_ShouldOpenConnectionsAndMarkThemAsConnected( + bool shouldPopulatePkRangeToAddressMapping) + { + // Arrange. + FakeOpenConnectionHandler fakeOpenConnectionHandler = new(failingIndexes: new HashSet()); + UserAgentContainer container = new(clientId: 0); + FakeMessageHandler messageHandler = new(); + AccountProperties databaseAccount = new AccountProperties() + { + EnableMultipleWriteLocations = false, + ReadLocationsInternal = new Collection() + { + { new AccountRegion() { Name = "location1", Endpoint = new Uri("https://location1.documents.azure.com").ToString() } }, + { new AccountRegion() { Name = "location2", Endpoint = new Uri("https://location2.documents.azure.com").ToString() } }, + { new AccountRegion() { Name = "location3", Endpoint = new Uri("https://location3.documents.azure.com").ToString() } }, + }, + WriteLocationsInternal = new Collection() + { + { new AccountRegion() { Name = "location1", Endpoint = new Uri("https://location1.documents.azure.com").ToString() } }, + { new AccountRegion() { Name = "location2", Endpoint = new Uri("https://location2.documents.azure.com").ToString() } }, + { new AccountRegion() { Name = "location3", Endpoint = new Uri("https://location3.documents.azure.com").ToString() } }, + } + }; + + Mock mockDocumentClient = new(); + mockDocumentClient + .Setup(owner => owner.ServiceEndpoint) + .Returns(new Uri("https://location1.documents.azure.com")); + + mockDocumentClient + .Setup(owner => owner.GetDatabaseAccountInternalAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(databaseAccount); + + GlobalEndpointManager globalEndpointManager = new( + mockDocumentClient.Object, + new ConnectionPolicy()); + GlobalPartitionEndpointManager partitionKeyRangeLocationCache = new GlobalPartitionEndpointManagerCore(globalEndpointManager); + + ConnectionPolicy connectionPolicy = new() + { + RequestTimeout = TimeSpan.FromSeconds(120) + }; + + ContainerProperties containerProperties = ContainerProperties.CreateWithResourceId("ccZ1ANCszwk="); + containerProperties.Id = "TestId"; + containerProperties.PartitionKeyPath = "/pk"; + + Mock mockCollectionCahce = new(MockBehavior.Strict, false); + mockCollectionCahce + .Setup(x => x.ResolveByNameAsync( + It.IsAny(), + It.IsAny(), + false, + It.IsAny(), + It.IsAny(), + It.IsAny())) + .Returns(Task.FromResult(containerProperties)); + + GlobalAddressResolver globalAddressResolver = new( + endpointManager: globalEndpointManager, + partitionKeyRangeLocationCache: partitionKeyRangeLocationCache, + protocol: Protocol.Tcp, + tokenProvider: this.mockTokenProvider.Object, + collectionCache: mockCollectionCahce.Object, + routingMapProvider: this.partitionKeyRangeCache.Object, + serviceConfigReader: this.mockServiceConfigReader.Object, + connectionPolicy: connectionPolicy, + connectionStateListener: Mock.Of(), + httpClient: MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler))); + + globalAddressResolver.SetOpenConnectionsHandler( + openConnectionsHandler: fakeOpenConnectionHandler); + + // Act. + const string suffix = "-FF-FF-FF-FF-FF-FF-FF-FF-FF-FF-FF-FF-FF-FF-FF"; + PartitionKeyRange pkRange = new () { Id = "YxM9ANCZIwABAAAAAAAAAA==", MinInclusive = "3F" + suffix, MaxExclusive = "5F" + suffix }; + + Dictionary> pkRangeToEndpointMappings = new(); + + if (shouldPopulatePkRangeToAddressMapping) + { + pkRangeToEndpointMappings.Add( + key: pkRange, + value: new Tuple( + containerProperties.ResourceId, + new Uri("https://location1.documents.azure.com"), + TransportAddressHealthState.HealthStatus.Unhealthy)); + } + + await globalAddressResolver.TryOpenConnectionToUnhealthyEndpointsAsync(pkRangeToEndpointMappings); + + // Assert. + int totalHandlerInvocationCount = shouldPopulatePkRangeToAddressMapping ? 1 : 0; + int totalReceivedAddressesCount = shouldPopulatePkRangeToAddressMapping ? 3 : 0; + int totalSuccessAddressesToOpenCount = shouldPopulatePkRangeToAddressMapping ? 3 : 0; + + GatewayAddressCacheTests.AssertOpenConnectionHandlerAttributes( + fakeOpenConnectionHandler: fakeOpenConnectionHandler, + expectedTotalFailedAddressesToOpenCount: 0, + expectedTotalHandlerInvocationCount: totalHandlerInvocationCount, + expectedTotalReceivedAddressesCount: totalReceivedAddressesCount, + expectedTotalSuccessAddressesToOpenCount: totalSuccessAddressesToOpenCount); + } + /// /// Blocks the current thread until a completion signal on the ManualResetEvent /// is received. A timeout of 5 seconds is added to avoid any thread starvation. diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayStoreClientTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayStoreClientTests.cs index 98a54c40f2..8da257bc5c 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayStoreClientTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayStoreClientTests.cs @@ -246,6 +246,38 @@ public async Task TestCreateDocumentClientExceptionWhenMediaTypeIsApplicationJso Assert.IsNotNull(value: documentClientException.Error.Message); } + /// + /// Test to verify the fix for the stream consumption issue when JSON deserialization fails. + /// This reproduces the scenario where a 403 response has application/json content type + /// but invalid JSON content, which would previously cause "stream already consumed" exception. + /// Fixes issue #5243. + /// + [TestMethod] + [Owner("copilot")] + public async Task TestStreamConsumptionBugFixWhenJsonDeserializationFails() + { + // Create invalid JSON content that will fail deserialization but has application/json content type + string invalidJson = "{ \"error\": invalid json content that will fail parsing }"; + + HttpResponseMessage responseMessage = new HttpResponseMessage(HttpStatusCode.Forbidden) + { + RequestMessage = new HttpRequestMessage(HttpMethod.Get, "https://test.com/dbs/db1/colls/coll1/docs/doc1"), + Content = new StringContent(invalidJson, Encoding.UTF8, "application/json") + }; + + IClientSideRequestStatistics requestStatistics = GatewayStoreClientTests.CreateClientSideRequestStatistics(); + + // This should NOT throw an InvalidOperationException about stream being consumed + DocumentClientException exception = await GatewayStoreClient.CreateDocumentClientExceptionAsync( + responseMessage: responseMessage, + requestStatistics: requestStatistics); + + // Verify the exception was created successfully with fallback logic + Assert.IsNotNull(exception); + Assert.AreEqual(HttpStatusCode.Forbidden, exception.StatusCode); + Assert.IsTrue(exception.Message.Contains(invalidJson), "Exception message should contain the original invalid JSON content"); + } + private static IClientSideRequestStatistics CreateClientSideRequestStatistics() { return new ClientSideRequestStatisticsTraceDatum( diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayStoreModelTest.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayStoreModelTest.cs index c7e248a9d2..f5e9a95cea 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayStoreModelTest.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayStoreModelTest.cs @@ -146,7 +146,10 @@ public async Task TestRetries() ConsistencyLevel.Eventual, eventSource, null, - MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler))); + MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler)), + GlobalPartitionEndpointManagerNoOp.Instance); + + TestUtils.SetupCachesInGatewayStoreModel(storeModel, endpointManager); using (new ActivityScope(Guid.NewGuid())) { @@ -205,7 +208,10 @@ public async Task PassesPropertiesFromDocumentServiceRequest() ConsistencyLevel.Eventual, eventSource, null, - MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler))); + MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler)), + GlobalPartitionEndpointManagerNoOp.Instance); + + TestUtils.SetupCachesInGatewayStoreModel(storeModel, endpointManager); using (new ActivityScope(Guid.NewGuid())) { @@ -280,8 +286,8 @@ await GatewayStoreModel.ApplySessionTokenAsync( dsr, ConsistencyLevel.Session, new Mock().Object, - partitionKeyRangeCache: new Mock(null, null, null, null).Object, - clientCollectionCache: new Mock(new SessionContainer("testhost"), gatewayStoreModel, null, null, null).Object, + partitionKeyRangeCache: new Mock(null, null, null, null, false).Object, + clientCollectionCache: new Mock(new SessionContainer("testhost"), gatewayStoreModel, null, null, null, false).Object, globalEndpointManager: Mock.Of()); Assert.IsNull(dsr.Headers[HttpConstants.HttpHeaders.SessionToken]); @@ -307,8 +313,8 @@ await GatewayStoreModel.ApplySessionTokenAsync( dsrQueryPlan, ConsistencyLevel.Session, new Mock().Object, - partitionKeyRangeCache: new Mock(null, null, null, null).Object, - clientCollectionCache: new Mock(new SessionContainer("testhost"), gatewayStoreModel, null, null, null).Object, + partitionKeyRangeCache: new Mock(null, null, null, null, false).Object, + clientCollectionCache: new Mock(new SessionContainer("testhost"), gatewayStoreModel, null, null, null, false).Object, globalEndpointManager: Mock.Of()); Assert.IsNull(dsrQueryPlan.Headers[HttpConstants.HttpHeaders.SessionToken]); @@ -361,8 +367,8 @@ await GatewayStoreModel.ApplySessionTokenAsync( dsr, ConsistencyLevel.Session, new Mock().Object, - partitionKeyRangeCache: new Mock(null, null, null, null).Object, - clientCollectionCache: new Mock(new SessionContainer("testhost"), gatewayStoreModel, null, null, null).Object, + partitionKeyRangeCache: new Mock(null, null, null, null, false).Object, + clientCollectionCache: new Mock(new SessionContainer("testhost"), gatewayStoreModel, null, null, null, false).Object, globalEndpointManager: Mock.Of()); Assert.AreEqual(dsrSessionToken, dsr.Headers[HttpConstants.HttpHeaders.SessionToken]); @@ -391,8 +397,8 @@ await GatewayStoreModel.ApplySessionTokenAsync( dsrNoSessionToken, ConsistencyLevel.Session, sessionContainer, - partitionKeyRangeCache: new Mock(null, null, null, null).Object, - clientCollectionCache: new Mock(new SessionContainer("testhost"), gatewayStoreModel, null, null, null).Object, + partitionKeyRangeCache: new Mock(null, null, null, null, false).Object, + clientCollectionCache: new Mock(new SessionContainer("testhost"), gatewayStoreModel, null, null, null, false).Object, globalEndpointManager: globalEndpointManager.Object); if (dsrNoSessionToken.IsReadOnlyRequest || dsrNoSessionToken.OperationType == OperationType.Batch || multiMaster) @@ -426,13 +432,13 @@ await GatewayStoreModel.ApplySessionTokenAsync( containerProperties.Id = "TestId"; containerProperties.PartitionKeyPath = "/pk"; - Mock mockCollectionCahce = new Mock(MockBehavior.Strict); + Mock mockCollectionCahce = new Mock(MockBehavior.Strict, false); mockCollectionCahce.Setup(x => x.ResolveCollectionAsync( dsr, It.IsAny(), NoOpTrace.Singleton)).Returns(Task.FromResult(containerProperties)); - Mock mockPartitionKeyRangeCache = new Mock(MockBehavior.Strict, null, null, null, null); + Mock mockPartitionKeyRangeCache = new Mock(MockBehavior.Strict, null, null, null, null, false); mockPartitionKeyRangeCache.Setup(x => x.TryGetPartitionKeyRangeByIdAsync( containerProperties.ResourceId, partitionKeyRangeId, @@ -479,8 +485,8 @@ await GatewayStoreModel.ApplySessionTokenAsync( dsrSprocExecute, ConsistencyLevel.Session, new Mock().Object, - partitionKeyRangeCache: new Mock(null, null, null, null).Object, - clientCollectionCache: new Mock(new SessionContainer("testhost"), gatewayStoreModel, null, null, null).Object, + partitionKeyRangeCache: new Mock(null, null, null, null, false).Object, + clientCollectionCache: new Mock(new SessionContainer("testhost"), gatewayStoreModel, null, null, null, false).Object, globalEndpointManager: Mock.Of()); Assert.AreEqual(sessionToken, dsrSprocExecute.Headers[HttpConstants.HttpHeaders.SessionToken]); @@ -518,8 +524,8 @@ await GatewayStoreModel.ApplySessionTokenAsync( dsrNoSessionToken, ConsistencyLevel.Session, sessionContainer, - partitionKeyRangeCache: new Mock(null, null, null, null).Object, - clientCollectionCache: new Mock(new SessionContainer("testhost"), gatewayStoreModel, null, null, null).Object, + partitionKeyRangeCache: new Mock(null, null, null, null, false).Object, + clientCollectionCache: new Mock(new SessionContainer("testhost"), gatewayStoreModel, null, null, null, false).Object, globalEndpointManager: globalEndpointManager.Object); if (isWriteRequest && multiMaster) @@ -553,7 +559,10 @@ public async Task TestErrorResponsesProvideBody() ConsistencyLevel.Eventual, eventSource, null, - MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler))); + MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler)), + GlobalPartitionEndpointManagerNoOp.Instance); + + TestUtils.SetupCachesInGatewayStoreModel(storeModel, endpointManager); using (new ActivityScope(Guid.NewGuid())) { @@ -612,7 +621,10 @@ private async Task GatewayStoreModel_Exception_UpdateSessionTokenOnKnownExceptio ConsistencyLevel.Eventual, eventSource, null, - MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler))); + MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler)), + GlobalPartitionEndpointManagerNoOp.Instance); + + TestUtils.SetupCachesInGatewayStoreModel(storeModel, endpointManager); INameValueCollection headers = new RequestNameValueCollection(); headers.Set(HttpConstants.HttpHeaders.ConsistencyLevel, ConsistencyLevel.Session.ToString()); @@ -673,7 +685,8 @@ private async Task GatewayStoreModel_Exception_NotUpdateSessionTokenOnKnownExcep ConsistencyLevel.Eventual, eventSource, null, - MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler))); + MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler)), + GlobalPartitionEndpointManagerNoOp.Instance); INameValueCollection headers = new RequestNameValueCollection(); headers.Set(HttpConstants.HttpHeaders.ConsistencyLevel, ConsistencyLevel.Session.ToString()); @@ -821,8 +834,10 @@ private async Task GatewayStoreModel_Exceptionless_UpdateSessionTokenOnKnownResp ConsistencyLevel.Eventual, eventSource, null, - MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler))); + MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler)), + GlobalPartitionEndpointManagerNoOp.Instance); + TestUtils.SetupCachesInGatewayStoreModel(storeModel, endpointManager); INameValueCollection headers = new RequestNameValueCollection(); headers.Set(HttpConstants.HttpHeaders.ConsistencyLevel, ConsistencyLevel.Session.ToString()); headers.Set(HttpConstants.HttpHeaders.SessionToken, originalSessionToken); @@ -928,8 +943,10 @@ private async Task GatewayStoreModel_Exceptionless_NotUpdateSessionTokenOnKnownR ConsistencyLevel.Eventual, eventSource, null, - MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler))); + MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler)), + GlobalPartitionEndpointManagerNoOp.Instance); + TestUtils.SetupCachesInGatewayStoreModel(storeModel, endpointManager); INameValueCollection headers = new RequestNameValueCollection(); headers.Set(HttpConstants.HttpHeaders.ConsistencyLevel, ConsistencyLevel.Session.ToString()); headers.Set(HttpConstants.HttpHeaders.SessionToken, originalSessionToken); @@ -967,9 +984,10 @@ public async Task GatewayStoreModel_AvoidGlobalSessionToken() ConsistencyLevel.Session, eventSource, null, - MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient())); - Mock clientCollectionCache = new Mock(new SessionContainer("testhost"), storeModel, null, null, null); - Mock partitionKeyRangeCache = new Mock(null, storeModel, clientCollectionCache.Object, endpointManager); + MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient()), + GlobalPartitionEndpointManagerNoOp.Instance); + Mock clientCollectionCache = new Mock(new SessionContainer("testhost"), storeModel, null, null, null, false); + Mock partitionKeyRangeCache = new Mock(null, storeModel, clientCollectionCache.Object, endpointManager, false); sessionContainer.SetSessionToken( ResourceId.NewDocumentCollectionId(42, 129).DocumentCollectionId.ToString(), @@ -1061,11 +1079,12 @@ Task sendFunc(HttpRequestMessage request) ConsistencyLevel.Session, eventSource, null, - MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler))); + MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler)), + GlobalPartitionEndpointManagerNoOp.Instance); - Mock clientCollectionCache = new Mock(new SessionContainer("testhost"), storeModel, null, null, null); + Mock clientCollectionCache = new Mock(new SessionContainer("testhost"), storeModel, null, null, null, false); - Mock partitionKeyRangeCache = new Mock(null, storeModel, clientCollectionCache.Object, endpointManager); + Mock partitionKeyRangeCache = new Mock(null, storeModel, clientCollectionCache.Object, endpointManager, false); storeModel.SetCaches(partitionKeyRangeCache.Object, clientCollectionCache.Object); INameValueCollection headers = new RequestNameValueCollection(); @@ -1133,8 +1152,8 @@ await GatewayStoreModel.ApplySessionTokenAsync( documentServiceRequestToChild, ConsistencyLevel.Session, sessionContainer, - partitionKeyRangeCache: new Mock(null, null, null, null).Object, - clientCollectionCache: new Mock(sessionContainer, gatewayStoreModel, null, null, null).Object, + partitionKeyRangeCache: new Mock(null, null, null, null, false).Object, + clientCollectionCache: new Mock(sessionContainer, gatewayStoreModel, null, null, null, false).Object, globalEndpointManager: globalEndpointManager.Object); Assert.AreEqual($"{childPKRangeId}:{parentSession}", documentServiceRequestToChild.Headers[HttpConstants.HttpHeaders.SessionToken]); @@ -1199,8 +1218,8 @@ await GatewayStoreModel.ApplySessionTokenAsync( documentServiceRequestToChild, ConsistencyLevel.Session, sessionContainer, - partitionKeyRangeCache: new Mock(null, null, null, null).Object, - clientCollectionCache: new Mock(sessionContainer, gatewayStoreModel, null, null, null).Object, + partitionKeyRangeCache: new Mock(null, null, null, null, false).Object, + clientCollectionCache: new Mock(sessionContainer, gatewayStoreModel, null, null, null, false).Object, globalEndpointManager: globalEndpointManager.Object); Assert.AreEqual($"{childPKRangeId}:{tokenWithAllMax}", documentServiceRequestToChild.Headers[HttpConstants.HttpHeaders.SessionToken]); @@ -1267,10 +1286,11 @@ static async Task messageHandler(HttpRequestMessage request ConsistencyLevel.Eventual, eventSource, null, - MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(httpMessageHandler))); + MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(httpMessageHandler)), + GlobalPartitionEndpointManagerNoOp.Instance); - ClientCollectionCache clientCollectionCache = new Mock(new SessionContainer("testhost"), storeModel, null, null, null).Object; - PartitionKeyRangeCache partitionKeyRangeCache = new Mock(null, storeModel, clientCollectionCache, endpointManager).Object; + ClientCollectionCache clientCollectionCache = new Mock(new SessionContainer("testhost"), storeModel, null, null, null, false).Object; + PartitionKeyRangeCache partitionKeyRangeCache = new Mock(null, storeModel, clientCollectionCache, endpointManager, false).Object; storeModel.SetCaches(partitionKeyRangeCache, clientCollectionCache); await executeWithGatewayStoreModel(storeModel); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GlobalEndpointManagerTest.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GlobalEndpointManagerTest.cs index 2299bb9a27..3e9b22bd83 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GlobalEndpointManagerTest.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GlobalEndpointManagerTest.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.Cosmos using Microsoft.Azure.Documents; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; + using Newtonsoft.Json.Linq; /// /// Tests for @@ -684,6 +685,89 @@ void TraceHandler(string message) Environment.SetEnvironmentVariable("MinimumIntervalForNonForceRefreshLocationInMS", originalConfigValue); } + [TestMethod] + public async Task ThinClientEndpoints_ParsesAndResolves() + { + // Arrange + Collection readableLocations = new Collection + { + new AccountRegion { Name = "ReadLocation", Endpoint = "https://readlocation.documents.azure.com" } + }; + Collection writeableLocations = new Collection + { + new AccountRegion { Name = "WriteLocation", Endpoint = "https://writelocation.documents.azure.com" } + }; + + AccountProperties accountProperties = new AccountProperties + { + ReadLocationsInternal = readableLocations, + WriteLocationsInternal = writeableLocations, + AdditionalProperties = new Dictionary + { + { + "thinClientWritableLocations", + JArray.Parse(@"[ + { 'name': 'ThinClientRegionWrite', 'databaseAccountEndpoint': 'https://thinclientwrite.documents.azure.com:10650/' } + ]") + }, + { + "thinClientReadableLocations", + JArray.Parse(@"[ + { 'name': 'ThinClientRegionRead', 'databaseAccountEndpoint': 'https://thinclientread.documents.azure.com:10650/' } + ]") + } + } + }; + + Mock mockOwner = new Mock(); + mockOwner.Setup(owner => owner.ServiceEndpoint).Returns(new Uri("https://defaultendpoint.net/")); + + // Returning updated accountProperties + mockOwner.Setup(owner => owner.GetDatabaseAccountInternalAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(accountProperties); + + ConnectionPolicy connectionPolicy = new ConnectionPolicy + { + EnableEndpointDiscovery = true, + UseMultipleWriteLocations = false, + }; + + GlobalEndpointManager gem = new GlobalEndpointManager(mockOwner.Object, connectionPolicy); + try + { + // Act: Initialize once + gem.InitializeAccountPropertiesAndStartBackgroundRefresh(accountProperties); + + // Forcibly refresh + await gem.RefreshLocationAsync(forceRefresh: true); + + // Create a test DocumentServiceRequest that is read + DocumentServiceRequest readRequest = DocumentServiceRequest.Create( + OperationType.Read, + ResourceType.Document, + AuthorizationTokenType.PrimaryMasterKey); + + Uri thinClientReadEndpoint = gem.ResolveThinClientEndpoint(readRequest); + + // Create a test DocumentServiceRequest that is write + DocumentServiceRequest writeRequest = DocumentServiceRequest.Create( + OperationType.Create, + ResourceType.Document, + AuthorizationTokenType.PrimaryMasterKey); + + Uri thinClientWriteEndpoint = gem.ResolveThinClientEndpoint(writeRequest); + + // Assert: + Assert.AreEqual("https://thinclientread.documents.azure.com:10650/", thinClientReadEndpoint.AbsoluteUri); + + Assert.AreEqual("https://thinclientwrite.documents.azure.com:10650/", thinClientWriteEndpoint.AbsoluteUri); + } + finally + { + gem.Dispose(); + } + } + private class TestTraceListener : TraceListener { public Action Callback { get; set; } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GlobalSuppressions.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GlobalSuppressions.cs new file mode 100644 index 0000000000..801839b2c5 --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GlobalSuppressions.cs @@ -0,0 +1,18 @@ +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. + +using System.Diagnostics.CodeAnalysis; + +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Client.Tests.ClientRetryPolicyTests.MockServiceConfigurationReader.DatabaseAccountId")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Client.Tests.ClientRetryPolicyTests.MockServiceConfigurationReader.DefaultConsistencyLevel")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Client.Tests.ClientRetryPolicyTests.MockServiceConfigurationReader.PrimaryMasterKey")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Client.Tests.ClientRetryPolicyTests.MockServiceConfigurationReader.PrimaryReadonlyMasterKey")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Client.Tests.ClientRetryPolicyTests.MockServiceConfigurationReader.ReadPolicy")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Client.Tests.ClientRetryPolicyTests.MockServiceConfigurationReader.ResourceSeedKey")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Client.Tests.ClientRetryPolicyTests.MockServiceConfigurationReader.SecondaryMasterKey")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Client.Tests.ClientRetryPolicyTests.MockServiceConfigurationReader.SecondaryReadonlyMasterKey")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Client.Tests.ClientRetryPolicyTests.MockServiceConfigurationReader.SubscriptionId")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Client.Tests.ClientRetryPolicyTests.MockServiceConfigurationReader.SystemReplicationPolicy")] +[assembly: SuppressMessage("Style", "IDE0025:Use expression body for property", Justification = "", Scope = "member", Target = "~P:Microsoft.Azure.Cosmos.Client.Tests.ClientRetryPolicyTests.MockServiceConfigurationReader.UserReplicationPolicy")] diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonNavigatorTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonNavigatorTests.cs index f1fbd1b270..137670de99 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonNavigatorTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonNavigatorTests.cs @@ -12,7 +12,6 @@ namespace Microsoft.Azure.Cosmos.Tests.Json using System.Text; using Microsoft.Azure.Cosmos.CosmosElements; using Microsoft.Azure.Cosmos.Json; - using Microsoft.Azure.Cosmos.Tests; using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json.Linq; @@ -518,8 +517,22 @@ private static void VerifyNavigator( byte[] binaryInput = JsonTestUtils.ConvertTextToBinary(input); IJsonNavigator binaryNavigator = JsonNavigator.Create(binaryInput); + // Test binary + empty user string dictionary + IJsonStringDictionary jsonStringDictionary = new JsonStringDictionary(new List()); + byte[] binaryWithEmptyUserStringEncodingInput = JsonTestUtils.ConvertTextToBinary(input, jsonStringDictionary); + Assert.IsTrue(binaryWithEmptyUserStringEncodingInput.SequenceEqual(binaryInput), "Binary data should be the same with empty readonly JSON dictionary."); + + // Test binary + user string encoding + byte[] binaryWithUserStringEncodingInput = JsonTestUtils.ConvertTextToBinary(input, out jsonStringDictionary); + if (jsonStringDictionary.TryGetString(stringId: 0, value: out _)) + { + Assert.IsFalse(binaryWithUserStringEncodingInput.SequenceEqual(binaryInput), "Binary data should be different with user string encoding."); + } + + IJsonNavigator binaryNavigatorWithUserStringEncoding = JsonNavigator.Create(binaryInput, jsonStringDictionary); + // Test - foreach (IJsonNavigator jsonNavigator in new IJsonNavigator[] { textNavigator, binaryNavigator }) + foreach (IJsonNavigator jsonNavigator in new IJsonNavigator[] { textNavigator, binaryNavigator, binaryNavigatorWithUserStringEncoding }) { IJsonNavigatorNode rootNode = jsonNavigator.GetRootNode(); JsonToken[] tokensFromNavigator = JsonNavigatorTests.GetTokensFromNode(rootNode, jsonNavigator, performExtraChecks); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonReaderTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonReaderTests.cs index e0d33c2513..c35b903aa5 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonReaderTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonReaderTests.cs @@ -13,6 +13,7 @@ namespace Microsoft.Azure.Cosmos.Tests.Json using Microsoft.Azure.Cosmos.Core.Utf8; using Microsoft.Azure.Cosmos.Json; using Microsoft.VisualStudio.TestTools.UnitTesting; + using static Microsoft.Azure.Cosmos.Json.JsonBinaryEncoding; /// /// Tests for JsonReader. @@ -621,6 +622,128 @@ public void SystemStringTest() } } + [TestMethod] + [Owner("mayapainter")] + public void MultiByteUserStringDictionaryTest() + { + // Object with 33 field names. This creates a user string with 2 byte type marker. + List expectedTokens = new List() { JsonToken.ObjectStart() }; + + StringBuilder textInput = new(); + textInput.Append("{"); + + List binaryInput = new List() { BinaryFormat, JsonBinaryEncoding.TypeMarker.ObjL1, }; + List binaryInputWithEncoding = new List() { BinaryFormat, JsonBinaryEncoding.TypeMarker.ObjL1 }; + + const byte OneByteCount = JsonBinaryEncoding.TypeMarker.UserString1ByteLengthMax - JsonBinaryEncoding.TypeMarker.UserString1ByteLengthMin; + for (int i = 0; i < OneByteCount + 1; i++) + { + string userEncodedString = "a" + i.ToString(); + + expectedTokens.Add(JsonToken.FieldName(userEncodedString)); + expectedTokens.Add(JsonToken.String(userEncodedString)); + + if (i > 0) + { + textInput.Append(","); + } + + textInput.Append($@"""{userEncodedString}"":""{userEncodedString}"""); + + for (int j = 0; j < 2; j++) + { + binaryInput.Add((byte)(JsonBinaryEncoding.TypeMarker.EncodedStringLengthMin + userEncodedString.Length)); + binaryInput.AddRange(Encoding.UTF8.GetBytes(userEncodedString)); + } + + if (i < OneByteCount) + { + binaryInputWithEncoding.Add((byte)(JsonBinaryEncoding.TypeMarker.UserString1ByteLengthMin + i)); + } + else + { + int twoByteOffset = i - OneByteCount; + binaryInputWithEncoding.Add((byte)((twoByteOffset / 256) + JsonBinaryEncoding.TypeMarker.UserString2ByteLengthMin)); + binaryInputWithEncoding.Add((byte)(twoByteOffset % 256)); + } + + binaryInputWithEncoding.Add((byte)(JsonBinaryEncoding.TypeMarker.EncodedStringLengthMin + userEncodedString.Length)); + binaryInputWithEncoding.AddRange(Encoding.UTF8.GetBytes(userEncodedString)); + } + + expectedTokens.Add(JsonToken.ObjectEnd()); + textInput.Append("}"); + binaryInput.Insert(2, (byte)(binaryInput.Count() - 2)); + binaryInputWithEncoding.Insert(2, (byte)(binaryInputWithEncoding.Count() - 2)); + + this.VerifyReader(textInput.ToString(), expectedTokens.ToArray()); + this.VerifyReader(binaryInput.ToArray(), expectedTokens.ToArray()); + + List userStrings = new(); + for (int i = 0; i < OneByteCount + 1; i++) + { + userStrings.Add("a" + i.ToString()); + } + + JsonStringDictionary jsonStringDictionary = new JsonStringDictionary(userStrings); + + this.VerifyReader(binaryInputWithEncoding.ToArray(), expectedTokens.ToArray(), jsonStringDictionary); + } + + [TestMethod] + [Owner("mayapainter")] + public void MaxSizeUserStringDictionaryTest() + { + List expectedTokens = new List() { JsonToken.ObjectStart() }; + + StringBuilder textInput = new(); + textInput.Append("{"); + + List binaryInput = new List() { BinaryFormat, JsonBinaryEncoding.TypeMarker.ObjL1, }; + List binaryInputWithEncoding = new List() { BinaryFormat, JsonBinaryEncoding.TypeMarker.ObjL1 }; + + int stringId = JsonStringDictionary.MaxDictionaryEncodedStrings - 1; + string userEncodedString = "a" + stringId.ToString(); + + expectedTokens.Add(JsonToken.FieldName(userEncodedString)); + expectedTokens.Add(JsonToken.String(userEncodedString)); + + textInput.Append($@"""{userEncodedString}"":""{userEncodedString}"""); + + for (int i = 0; i < 2; i++) + { + binaryInput.Add((byte)(JsonBinaryEncoding.TypeMarker.EncodedStringLengthMin + userEncodedString.Length)); + binaryInput.AddRange(Encoding.UTF8.GetBytes(userEncodedString)); + } + + byte oneByteCount = TypeMarker.UserString1ByteLengthMax - TypeMarker.UserString1ByteLengthMin; + int twoByteOffset = stringId - oneByteCount; + + binaryInputWithEncoding.Add((byte)((twoByteOffset / 256) + JsonBinaryEncoding.TypeMarker.UserString2ByteLengthMin)); + binaryInputWithEncoding.Add((byte)(twoByteOffset % 256)); + + binaryInputWithEncoding.Add((byte)(JsonBinaryEncoding.TypeMarker.EncodedStringLengthMin + userEncodedString.Length)); + binaryInputWithEncoding.AddRange(Encoding.UTF8.GetBytes(userEncodedString)); + + expectedTokens.Add(JsonToken.ObjectEnd()); + textInput.Append("}"); + binaryInput.Insert(2, (byte)(binaryInput.Count() - 2)); + binaryInputWithEncoding.Insert(2, (byte)(binaryInputWithEncoding.Count() - 2)); + + this.VerifyReader(textInput.ToString(), expectedTokens.ToArray()); + this.VerifyReader(binaryInput.ToArray(), expectedTokens.ToArray()); + + List userStrings = new(); + for (int i = 0; i <= stringId; i++) + { + userStrings.Add("a" + i.ToString()); + } + + JsonStringDictionary jsonStringDictionary = new JsonStringDictionary(userStrings); + + this.VerifyReader(binaryInputWithEncoding.ToArray(), expectedTokens.ToArray(), jsonStringDictionary); + } + [TestMethod] [Owner("mayapainter")] public void NumberAsStringTest() @@ -2305,6 +2428,8 @@ public void SimpleObjectTest() this.VerifyReader(input, expectedTokens); this.VerifyReader(binaryInput, expectedTokens); + IJsonStringDictionary jsonStringDictionary = new JsonStringDictionary(new List { "GlossDiv", "title" }); + this.VerifyReader(binaryInputWithEncoding, expectedTokens, jsonStringDictionary); } [TestMethod] @@ -2408,22 +2533,22 @@ public void AllPrimitivesObjectTest() new byte[] { (byte)JsonBinaryEncoding.TypeMarker.UserString1ByteLengthMin }, new byte[] { JsonBinaryEncoding.TypeMarker.NumberDouble, 0x98, 0x8B, 0x30, 0xE3, 0xCB, 0x45, 0xC8, 0x3F }, - new byte[] { (byte)(JsonBinaryEncoding.TypeMarker.UserString1ByteLengthMin + 1) }, + new byte[] { (byte)(JsonBinaryEncoding.TypeMarker.EncodedStringLengthMin + "int".Length), 105, 110, 116 }, new byte[] { JsonBinaryEncoding.TypeMarker.NumberInt32, 0x19, 0xDF, 0xB6, 0xB0 }, - new byte[] { (byte)(JsonBinaryEncoding.TypeMarker.UserString1ByteLengthMin + 2) }, + new byte[] { (byte)(JsonBinaryEncoding.TypeMarker.UserString1ByteLengthMin + 1) }, new byte[] { (byte)(JsonBinaryEncoding.TypeMarker.EncodedStringLengthMin + "XCPCFXPHHF".Length), 88, 67, 80, 67, 70, 88, 80, 72, 72, 70 }, - new byte[] { (byte)(JsonBinaryEncoding.TypeMarker.UserString1ByteLengthMin + 3) }, + new byte[] { (byte)(JsonBinaryEncoding.TypeMarker.UserString1ByteLengthMin + 2) }, new byte[] { JsonBinaryEncoding.TypeMarker.True }, - new byte[] { (byte)(JsonBinaryEncoding.TypeMarker.UserString1ByteLengthMin + 4) }, + new byte[] { (byte)(JsonBinaryEncoding.TypeMarker.UserString1ByteLengthMin + 3) }, new byte[] { JsonBinaryEncoding.TypeMarker.Null }, - new byte[] { (byte)(JsonBinaryEncoding.TypeMarker.UserString1ByteLengthMin + 5) }, + new byte[] { (byte)(JsonBinaryEncoding.TypeMarker.UserString1ByteLengthMin + 4) }, new byte[] { (byte)(JsonBinaryEncoding.TypeMarker.EncodedStringLengthMin + "2526-07-11T18:18:16.4520716".Length), 50, 53, 50, 54, 45, 48, 55, 45, 49, 49, 84, 49, 56, 58, 49, 56, 58, 49, 54, 46, 52, 53, 50, 48, 55, 49, 54 }, - new byte[] { (byte)(JsonBinaryEncoding.TypeMarker.UserString1ByteLengthMin + 6) } + new byte[] { (byte)(JsonBinaryEncoding.TypeMarker.UserString1ByteLengthMin + 5) } }; List innerObjectElements = new List @@ -2447,7 +2572,7 @@ public void AllPrimitivesObjectTest() elements.Add(new byte[] { JsonBinaryEncoding.TypeMarker.ObjL1, (byte)innerObjectElementsBytes.Length }); elements.Add(innerObjectElementsBytes); - elements.Add(new byte[] { (byte)(JsonBinaryEncoding.TypeMarker.UserString1ByteLengthMin + 7) }); + elements.Add(new byte[] { (byte)(JsonBinaryEncoding.TypeMarker.UserString1ByteLengthMin + 6) }); elements.Add(new byte[] { JsonBinaryEncoding.TypeMarker.StrL1, (byte)"tiger diamond newbrunswick snowleopard chocolate dog snowleopard turtle cat sapphire peach sapphire vancouver white chocolate horse diamond lion superlongcolourname ruby".Length, 116, 105, 103, 101, 114, 32, 100, 105, 97, 109, 111, 110, 100, 32, 110, 101, 119, 98, 114, 117, 110, 115, 119, 105, 99, 107, 32, 115, 110, 111, 119, 108, 101, 111, 112, 97, 114, 100, 32, 99, 104, 111, 99, 111, 108, 97, 116, 101, 32, 100, 111, 103, 32, 115, 110, 111, 119, 108, 101, 111, 112, 97, 114, 100, 32, 116, 117, 114, 116, 108, 101, 32, 99, 97, 116, 32, 115, 97, 112, 112, 104, 105, 114, 101, 32, 112, 101, 97, 99, 104, 32, 115, 97, 112, 112, 104, 105, 114, 101, 32, 118, 97, 110, 99, 111, 117, 118, 101, 114, 32, 119, 104, 105, 116, 101, 32, 99, 104, 111, 99, 111, 108, 97, 116, 101, 32, 104, 111, 114, 115, 101, 32, 100, 105, 97, 109, 111, 110, 100, 32, 108, 105, 111, 110, 32, 115, 117, 112, 101, 114, 108, 111, 110, 103, 99, 111, 108, 111, 117, 114, 110, 97, 109, 101, 32, 114, 117, 98, 121 }); byte[] elementsBytes = elements.SelectMany(x => x).ToArray(); @@ -2501,6 +2626,9 @@ public void AllPrimitivesObjectTest() this.VerifyReader(input, expectedTokens); this.VerifyReader(binaryInput, expectedTokens); + + IJsonStringDictionary jsonStringDictionary = new JsonStringDictionary(new List { "double", "string", "boolean", "null", "datetime", "spatialPoint", "text" }); + this.VerifyReader(binaryInputWithEncoding, expectedTokens, jsonStringDictionary); } [TestMethod] @@ -3142,10 +3270,10 @@ private void VerifyReader(string input, JsonToken[] expectedTokens, Exception ex expectedException); } - private void VerifyReader(ReadOnlyMemory input, JsonToken[] expectedTokens, Exception expectedException = null) + private void VerifyReader(ReadOnlyMemory input, JsonToken[] expectedTokens, IJsonStringDictionary jsonStringDictionary = null, Exception expectedException = null) { // Test binary reader created with the array API - this.VerifyReader(() => JsonReader.Create(input), expectedTokens, expectedException); + this.VerifyReader(() => JsonReader.Create(input, jsonStringDictionary), expectedTokens, expectedException); } /// diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonRoundtripTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonRoundtripTests.cs index df38deaebe..78aa476735 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonRoundtripTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonRoundtripTests.cs @@ -6,7 +6,6 @@ namespace Microsoft.Azure.Cosmos.Tests.Json { using System; - using System.Collections; using System.Diagnostics; using System.Text; using Microsoft.Azure.Cosmos.Json; @@ -615,7 +614,8 @@ private static void MultiSerializationRoundTrip(JsonToken[] inputTokens, string { SerializationSpec.Text(JsonWriteOptions.None), SerializationSpec.Binary(JsonWriteOptions.None), - SerializationSpec.Binary(JsonWriteOptions.EnableNumberArrays | JsonWriteOptions.EnableUInt64Values) + SerializationSpec.Binary(JsonWriteOptions.EnableNumberArrays | JsonWriteOptions.EnableUInt64Values), + SerializationSpec.Binary(JsonWriteOptions.None, userStringEncoded: true), }; RewriteScenario[] rewriteScenarios = diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonStringDictionaryTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonStringDictionaryTests.cs new file mode 100644 index 0000000000..094d72aaaf --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonStringDictionaryTests.cs @@ -0,0 +1,119 @@ +namespace Microsoft.Azure.Cosmos.Tests.Json +{ + using System; + using System.Collections.Generic; + using Microsoft.Azure.Cosmos.Json; + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class JsonStringDictionaryTests + { + [TestMethod] + [Owner("mayapainter")] + public void TestBasicCase() + { + List strings = new List { "test0", "test1", "test2", "test3", "test4", "test5" }; + JsonStringDictionary stringDictionary = new JsonStringDictionary(strings); + Assert.AreEqual(6, stringDictionary.GetCount()); + + for (int i = 0; i < stringDictionary.GetCount(); i++) + { + Assert.IsTrue(stringDictionary.TryGetString(i, out UtfAllString value)); + Assert.AreEqual(strings[i], value.Utf16String); + + Assert.IsTrue(stringDictionary.TryGetStringId(value.Utf8String.Span, out int stringId)); + Assert.AreEqual(i, stringId); + } + } + + [TestMethod] + [Owner("mayapainter")] + public void TestDuplicatesCase() + { + List strings = new List { "test0", "test1", "test2", "test0", "test4", "test5" }; + List indexes = new List { 3, 1, 2, 3, 4, 5 }; + + this.ExecuteDuplicatesTest(strings, indexes); + + strings = new List { "test0", "test0", "test0", "test1", "test1", "test1" }; + indexes = new List { 2, 2, 2, 5, 5, 5 }; + + this.ExecuteDuplicatesTest(strings, indexes); + + strings = new(); + indexes = new(); + for (int i = 0; i < JsonStringDictionary.MaxDictionaryEncodedStrings; i++) + { + strings.Add("test"); + indexes.Add(JsonStringDictionary.MaxDictionaryEncodedStrings - 1); + } + + this.ExecuteDuplicatesTest(strings, indexes); + } + + [TestMethod] + [Owner("mayapainter")] + public void TestDictionarySize() + { + List strings = new(); + for (int i = 0; i < JsonStringDictionary.MaxDictionaryEncodedStrings; i++) + { + strings.Add("test" + i); + } + + JsonStringDictionary jsonStringDictionary0 = new JsonStringDictionary(strings); + Assert.AreEqual(JsonStringDictionary.MaxDictionaryEncodedStrings, jsonStringDictionary0.GetCount()); + + strings.Add("testString"); + + // Allow larger dictionaries than can be utilized by the encoding. + JsonStringDictionary jsonStringDictionary1 = new JsonStringDictionary(strings); + Assert.AreEqual(JsonStringDictionary.MaxDictionaryEncodedStrings + 1, jsonStringDictionary1.GetCount()); + } + + [TestMethod] + [Owner("mayapainter")] + public void TestDictionaryComparison() + { + IJsonStringDictionary stringDictionary0 = new JsonStringDictionary(); + + // Null comparison and reference-equals comparison + Assert.IsFalse(stringDictionary0.Equals(null)); + Assert.IsTrue(stringDictionary0.Equals(stringDictionary0)); + + // Subset comparison + IJsonStringDictionary stringDictionary1 = new JsonStringDictionary(new List { "test0", "test1", "test2" }); + IJsonStringDictionary stringDictionary2 = new JsonStringDictionary(new List { "test0", "test1" }); + Assert.IsFalse(stringDictionary1.Equals(stringDictionary2)); + + // Value-equals comparison + IJsonStringDictionary stringDictionary3 = new JsonStringDictionary(new List { "test0", "test1", "test2" }); + Assert.IsTrue(stringDictionary1.Equals(stringDictionary3)); + + // Superset comparison + IJsonStringDictionary stringDictionary4 = new JsonStringDictionary(new List { "test0", "test1", "test2", "test3" }); + Assert.IsFalse(stringDictionary1.Equals(stringDictionary4)); + + // Order-sensitive comparison + IJsonStringDictionary stringDictionary5 = new JsonStringDictionary(new List { "test1", "test0", "test2" }); + Assert.IsFalse(stringDictionary1.Equals(stringDictionary5)); + } + + private void ExecuteDuplicatesTest(List strings, List indexes) + { + IJsonStringDictionary dictionary = new JsonStringDictionary(strings); + Assert.AreEqual(indexes.Count, dictionary.GetCount()); + + for (int i = 0; i < dictionary.GetCount(); i++) + { + Assert.IsTrue(dictionary.TryGetString(i, out UtfAllString value)); + Assert.AreEqual(strings[i], value.Utf16String); + + Assert.IsTrue(dictionary.TryGetStringId(value.Utf8String.Span, out int stringId)); + + // For duplicate strings the ID from the last occurrence will be used. + Assert.AreEqual(indexes[i], stringId); + } + } + } +} diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonTestUtils.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonTestUtils.cs index 1e7f4f6616..5203355f74 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonTestUtils.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonTestUtils.cs @@ -6,8 +6,6 @@ using System.IO; using System.Linq; using System.Text; - using System.Threading.Tasks; - using Microsoft.Azure.Cosmos.Core; using Microsoft.Azure.Cosmos.Core.Utf8; using Microsoft.Azure.Cosmos.Json; using Microsoft.Azure.Cosmos.Json.Interop; @@ -15,22 +13,79 @@ internal class JsonTestUtils { - public static byte[] ConvertTextToBinary(string text) + public static byte[] ConvertTextToBinary(string text, out IJsonStringDictionary jsonStringDictionary) { - IJsonWriter binaryWriter = JsonWriter.Create(JsonSerializationFormat.Binary); + IJsonStringDictionary stringDictionary = JsonTestUtils.PopulateStringDictionary(text); + IJsonWriter binaryWriter = JsonWriter.Create(JsonSerializationFormat.Binary, jsonStringDictionary: stringDictionary); + IJsonReader textReader = JsonReader.Create(Encoding.UTF8.GetBytes(text)); + textReader.WriteAll(binaryWriter); + + jsonStringDictionary = stringDictionary; + return binaryWriter.GetResult().ToArray(); + } + + public static byte[] ConvertTextToBinary(string text, IJsonStringDictionary jsonStringDictionary = null) + { + IJsonWriter binaryWriter = JsonWriter.Create(JsonSerializationFormat.Binary, jsonStringDictionary: jsonStringDictionary); IJsonReader textReader = JsonReader.Create(Encoding.UTF8.GetBytes(text)); textReader.WriteAll(binaryWriter); return binaryWriter.GetResult().ToArray(); } - public static string ConvertBinaryToText(ReadOnlyMemory binary) + public static string ConvertBinaryToText(ReadOnlyMemory binary, IJsonStringDictionary jsonStringDictionary = null) { - IJsonReader binaryReader = JsonReader.Create(binary); + IJsonReader binaryReader = JsonReader.Create(binary, jsonStringDictionary); IJsonWriter textWriter = JsonWriter.Create(JsonSerializationFormat.Text); binaryReader.WriteAll(textWriter); return Encoding.UTF8.GetString(textWriter.GetResult().ToArray()); } + public static IJsonStringDictionary PopulateStringDictionary(string text) + { + IJsonNavigator navigator = JsonNavigator.Create(Encoding.UTF8.GetBytes(text)); + IJsonNavigatorNode rootNode = navigator.GetRootNode(); + + HashSet strings = new(); + JsonNodeType nodeType = navigator.GetNodeType(rootNode); + if (nodeType == JsonNodeType.Object) + { + GetAllProperties(navigator, rootNode, strings); + } + + return new JsonStringDictionary(strings.ToList()); + } + + private static void GetAllProperties(IJsonNavigator navigator, IJsonNavigatorNode node, HashSet strings) + { + IEnumerable properties = navigator.GetObjectProperties(node); + foreach (ObjectProperty property in properties) + { + string propertyName = navigator.GetStringValue(property.NameNode); + if (!JsonBinaryEncoding.SystemStrings.Strings.Contains(UtfAllString.Create(propertyName))) + { + strings.Add(propertyName); + } + + JsonNodeType nodeType = navigator.GetNodeType(property.ValueNode); + if (nodeType == JsonNodeType.Array) + { + IJsonNavigatorNode[] arrayItems = navigator.GetArrayItems(property.ValueNode).ToArray(); + foreach(IJsonNavigatorNode arrayNode in arrayItems) + { + if (navigator.GetNodeType(arrayNode) == JsonNodeType.Object) + { + GetAllProperties(navigator, arrayNode, strings); + } + } + } + + if(nodeType == JsonNodeType.Object) + { + GetAllProperties(navigator, property.ValueNode, strings); + } + } + } + public static string LoadJsonCuratedDocument(string filename) { string path = string.Format("TestJsons/{0}", filename); @@ -320,9 +375,12 @@ public static RoundTripResult VerifyJsonRoundTrip( (newtonsoftNavigatorCreate != null ? newtonsoftNavigatorCreate(inputJson) : null) : JsonNavigator.Create(inputResult); + IJsonStringDictionary jsonStringDictionary = new JsonStringDictionary(); Func createWriter = (SerializationSpec spec) => spec.IsNewtonsoft ? NewtonsoftToCosmosDBWriter.CreateTextWriter() : - JsonWriter.Create(spec.SerializationFormat, spec.WriteOptions); + spec.UserStringEncoded ? + JsonWriter.Create(spec.SerializationFormat, spec.WriteOptions, jsonStringDictionary: jsonStringDictionary) : + JsonWriter.Create(spec.SerializationFormat, spec.WriteOptions); Stopwatch timer = Stopwatch.StartNew(); @@ -409,18 +467,20 @@ public static RoundTripResult VerifyJsonRoundTrip( StringBuilder verboseOutput = new StringBuilder(); if (!identical && - (strictComparison || !CompareResults(inputBytes, outputBytes, verboseWriter: new StringWriter(verboseOutput)))) + (strictComparison || !CompareResults(inputBytes, outputBytes, verboseWriter: new StringWriter(verboseOutput), jsonStringDictionary))) { string[] inputTextLines = SerializeResultBuffer(inputBytes, inputSpec.SerializationFormat); string[] outputTextLines = SerializeResultBuffer(outputBytes, outputSpec.SerializationFormat); Console.WriteLine($"Rewriting JSON document failed for rewrite scenario '{rewriteScenario}'."); Console.WriteLine(); - Console.WriteLine($" Input Format : {inputSpec.SerializationFormatToString()}"); - Console.WriteLine($" Input Write Options : {inputSpec.WriteOptions}"); + Console.WriteLine($" Input Format : {inputSpec.SerializationFormatToString()}"); + Console.WriteLine($" Input Write Options : {inputSpec.WriteOptions}"); + Console.WriteLine($" Input User String Encoding Enabled : {inputSpec.UserStringEncoded}"); Console.WriteLine(); - Console.WriteLine($" Output Format : {outputSpec.SerializationFormatToString()}"); - Console.WriteLine($" Output Write Options: {outputSpec.WriteOptions}"); + Console.WriteLine($" Output Format : {outputSpec.SerializationFormatToString()}"); + Console.WriteLine($" Output Write Options : {outputSpec.WriteOptions}"); + Console.WriteLine($" Input User String Encoding Enabled : {inputSpec.UserStringEncoded}"); Console.WriteLine(); Console.WriteLine($"Comparison Errors:"); Console.WriteLine(verboseOutput.ToString()); @@ -455,7 +515,8 @@ public static RoundTripResult VerifyJsonRoundTrip( public static bool CompareResults( byte[] resultBuffer1, byte[] resultBuffer2, - TextWriter verboseWriter = null) + TextWriter verboseWriter = null, + IJsonStringDictionary jsonStringDictionary = null) { Assert.IsNotNull(resultBuffer1); Assert.IsNotNull(resultBuffer2); @@ -463,8 +524,8 @@ public static bool CompareResults( // Fast check for identical buffers if (resultBuffer1.Equals(resultBuffer2)) return true; - IJsonReader reader1 = JsonReader.Create(resultBuffer1); - IJsonReader reader2 = JsonReader.Create(resultBuffer2); + IJsonReader reader1 = JsonReader.Create(resultBuffer1, jsonStringDictionary); + IJsonReader reader2 = JsonReader.Create(resultBuffer2, jsonStringDictionary); int tokenCount = 0; while (true) @@ -797,26 +858,27 @@ public enum RewriteScenario public class SerializationSpec { - private SerializationSpec(JsonSerializationFormat serializationFormat, JsonWriteOptions writeOptions, bool isNewtonsoft) + private SerializationSpec(JsonSerializationFormat serializationFormat, JsonWriteOptions writeOptions, bool isNewtonsoft, bool userStringEncoded) { this.SerializationFormat = serializationFormat; this.WriteOptions = writeOptions; this.IsNewtonsoft = isNewtonsoft; + this.UserStringEncoded = userStringEncoded; } public static SerializationSpec Text(JsonWriteOptions writeOptions = JsonWriteOptions.None) { - return new SerializationSpec(JsonSerializationFormat.Text, writeOptions, false); + return new SerializationSpec(JsonSerializationFormat.Text, writeOptions, false, false); } - public static SerializationSpec Binary(JsonWriteOptions writeOptions = JsonWriteOptions.None) + public static SerializationSpec Binary(JsonWriteOptions writeOptions = JsonWriteOptions.None, bool userStringEncoded = false) { - return new SerializationSpec(JsonSerializationFormat.Binary, writeOptions, false); + return new SerializationSpec(JsonSerializationFormat.Binary, writeOptions, false, userStringEncoded); } public static SerializationSpec Newtonsoft() { - return new SerializationSpec(JsonSerializationFormat.Text, JsonWriteOptions.None, true); + return new SerializationSpec(JsonSerializationFormat.Text, JsonWriteOptions.None, true, false); } public string SerializationFormatToString() @@ -827,6 +889,7 @@ public string SerializationFormatToString() public JsonSerializationFormat SerializationFormat { get; } public JsonWriteOptions WriteOptions { get; } public bool IsNewtonsoft { get; } + public bool UserStringEncoded { get; } } public class RoundTripBaseline diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonWriterTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonWriterTests.cs index 32c108cafc..8f546ce37d 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonWriterTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonWriterTests.cs @@ -8,7 +8,6 @@ using System.Text; using Microsoft.Azure.Cosmos.Json; using Microsoft.VisualStudio.TestTools.UnitTesting; - using Newtonsoft.Json.Linq; using static Microsoft.Azure.Cosmos.Tests.Json.JsonTestUtils; [TestClass] @@ -35,6 +34,7 @@ public void TrueTest() this.VerifyWriter(tokensToWrite, expectedString); this.VerifyWriter(tokensToWrite, binaryOutput); + this.VerifyWriter(tokensToWrite, binaryOutput, new JsonStringDictionary()); } [TestMethod] @@ -55,6 +55,7 @@ public void FalseTest() this.VerifyWriter(tokensToWrite, expectedString); this.VerifyWriter(tokensToWrite, binaryOutput); + this.VerifyWriter(tokensToWrite, binaryOutput, new JsonStringDictionary()); } [TestMethod] @@ -75,6 +76,7 @@ public void NullTest() this.VerifyWriter(tokensToWrite, expectedString); this.VerifyWriter(tokensToWrite, binaryOutput); + this.VerifyWriter(tokensToWrite, binaryOutput, new JsonStringDictionary()); } #endregion @@ -99,6 +101,7 @@ public void IntegerTest() this.VerifyWriter(tokensToWrite, expectedString); this.VerifyWriter(tokensToWrite, binaryOutput); + this.VerifyWriter(tokensToWrite, binaryOutput, new JsonStringDictionary()); } [TestMethod] @@ -121,6 +124,7 @@ public void DoubleTest() this.VerifyWriter(tokensToWrite, expectedString); this.VerifyWriter(tokensToWrite, binaryOutput); + this.VerifyWriter(tokensToWrite, binaryOutput, new JsonStringDictionary()); } [TestMethod] @@ -143,6 +147,7 @@ public void NaNTest() this.VerifyWriter(tokensToWrite, expectedString); this.VerifyWriter(tokensToWrite, binaryOutput); + this.VerifyWriter(tokensToWrite, binaryOutput, new JsonStringDictionary()); } [TestMethod] @@ -165,6 +170,7 @@ public void PositiveInfinityTest() this.VerifyWriter(tokensToWrite, expectedString); this.VerifyWriter(tokensToWrite, binaryOutput); + this.VerifyWriter(tokensToWrite, binaryOutput, new JsonStringDictionary()); } [TestMethod] @@ -187,6 +193,7 @@ public void NegativeInfinityTest() this.VerifyWriter(tokensToWrite, expectedString); this.VerifyWriter(tokensToWrite, binaryOutput); + this.VerifyWriter(tokensToWrite, binaryOutput, new JsonStringDictionary()); } [TestMethod] @@ -209,6 +216,7 @@ public void NegativeNumberTest() this.VerifyWriter(tokensToWrite, expectedString); this.VerifyWriter(tokensToWrite, binaryOutput); + this.VerifyWriter(tokensToWrite, binaryOutput, new JsonStringDictionary()); } [TestMethod] @@ -231,6 +239,7 @@ public void NumberWithScientificNotationTest() this.VerifyWriter(tokensToWrite, expectedString); this.VerifyWriter(tokensToWrite, binaryOutput); + this.VerifyWriter(tokensToWrite, binaryOutput, new JsonStringDictionary()); } [TestMethod] @@ -256,6 +265,7 @@ public void NumberRegressionTest() this.VerifyWriter(tokensToWrite, numberValueString); this.VerifyWriter(tokensToWrite, binaryOutput); + this.VerifyWriter(tokensToWrite, binaryOutput, new JsonStringDictionary()); } [TestMethod] @@ -291,6 +301,7 @@ public void NumberPrecisionTest() this.VerifyWriter(tokensToWrite, expectedString); this.VerifyWriter(tokensToWrite, binaryOutput); + this.VerifyWriter(tokensToWrite, binaryOutput, new JsonStringDictionary()); } [TestMethod] @@ -558,6 +569,7 @@ public void EmptyStringTest() this.VerifyWriter(tokensToWrite, expectedString); this.VerifyWriter(tokensToWrite, binaryOutput); + this.VerifyWriter(tokensToWrite, binaryOutput, new JsonStringDictionary()); } [TestMethod] @@ -580,6 +592,7 @@ public void StringTest() this.VerifyWriter(tokensToWrite, expectedString); this.VerifyWriter(tokensToWrite, binaryOutput); + this.VerifyWriter(tokensToWrite, binaryOutput, new JsonStringDictionary()); } [TestMethod] @@ -608,10 +621,61 @@ public void SystemStringTest() this.VerifyWriter(tokensToWrite, expectedString); this.VerifyWriter(tokensToWrite, binaryOutput); + this.VerifyWriter(tokensToWrite, binaryOutput, new JsonStringDictionary()); systemStringId++; } } + [TestMethod] + [Owner("mayapainter")] + public void UserStringTest() + { + IJsonStringDictionary jsonStringDictionary = + new JsonStringDictionary(new List { "double", "string", "boolean", "null", "datetime", "spatialPoint", "text" }); + + int userStringId = 0; + while (jsonStringDictionary.TryGetString(userStringId, out UtfAllString userString)) + { + string expectedString = "{\"" + userString.Utf16String + "\":\"\"}"; + // remove formatting on the json and also replace "/" with "\/". + expectedString = Newtonsoft.Json.Linq.JToken + .Parse(expectedString) + .ToString(Newtonsoft.Json.Formatting.None); + + int utf8Length = userString.Utf8String.Span.Length; + byte typeMarker = (byte)(JsonBinaryEncoding.TypeMarker.EncodedStringLengthMin + utf8Length); + + byte[] binaryOutput = new byte[4 + utf8Length]; + + binaryOutput[0] = BinaryFormat; + binaryOutput[1] = JsonBinaryEncoding.TypeMarker.Obj1; + binaryOutput[2] = typeMarker; + userString.Utf8String.Span.Span.CopyTo(binaryOutput.AsSpan(3)); + binaryOutput[3 + utf8Length] = BinaryFormat; + + byte[] binaryOutputUserStrings = + { + BinaryFormat, + JsonBinaryEncoding.TypeMarker.Obj1, + (byte)(JsonBinaryEncoding.TypeMarker.UserString1ByteLengthMin + ((int)userStringId)), + BinaryFormat + }; + + JsonToken[] tokensToWrite = + { + JsonToken.ObjectStart(), + JsonToken.FieldName(userString.Utf16String), + JsonToken.String(""), + JsonToken.ObjectEnd() + }; + + this.VerifyWriter(tokensToWrite, expectedString); + this.VerifyWriter(tokensToWrite, binaryOutput); + this.VerifyWriter(tokensToWrite, binaryOutputUserStrings, jsonStringDictionary); + userStringId++; + } + } + [TestMethod] [Owner("mayapainter")] public void DateTimeStringsTest() @@ -8008,6 +8072,7 @@ public void EmptyObjectTest() this.VerifyWriter(tokensToWrite, expectedString); this.VerifyWriter(tokensToWrite, binaryOutput); + this.VerifyWriter(tokensToWrite, binaryOutput, new JsonStringDictionary()); } [TestMethod] @@ -8075,6 +8140,9 @@ public void SimpleObjectTest() this.VerifyWriter(tokensToWrite, expectedString); this.VerifyWriter(tokensToWrite, binaryOutput); + + IJsonStringDictionary jsonStringDictionary = JsonTestUtils.PopulateStringDictionary(expectedString); + this.VerifyWriter(tokensToWrite, binaryOutputWithEncoding, jsonStringDictionary); } [TestMethod] @@ -8277,6 +8345,9 @@ public void AllPrimitivesObjectTest() this.VerifyWriter(tokensToWrite, expectedString); this.VerifyWriter(tokensToWrite, binaryOutput); + + IJsonStringDictionary jsonStringDictionary = JsonTestUtils.PopulateStringDictionary(expectedString); + this.VerifyWriter(tokensToWrite, binaryOutputWithEncoding, jsonStringDictionary); } #endregion @@ -8700,6 +8771,15 @@ private void VerifyWriter(JsonToken[] tokensToWrite, byte[] binaryOutput, Except } } + private void VerifyWriter(JsonToken[] tokensToWrite, byte[] binaryOutput, IJsonStringDictionary jsonStringDictionary, Exception expectedException = null) + { + foreach (bool writeAsUtf8String in new bool[] { false, true }) + { + IJsonWriter jsonWriter = JsonWriter.Create(JsonSerializationFormat.Binary, jsonStringDictionary: jsonStringDictionary); + this.VerifyWriter(jsonWriter, tokensToWrite, binaryOutput, JsonSerializationFormat.Binary, writeAsUtf8String, expectedException); + } + } + private void VerifyWriter( IJsonWriter jsonWriter, JsonToken[] tokensToWrite, diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/NewtonsoftInteropTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/NewtonsoftInteropTests.cs index 177da4f929..42ef816e19 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/NewtonsoftInteropTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/NewtonsoftInteropTests.cs @@ -202,7 +202,7 @@ public void AllPrimitivesObjectTest() new JProperty("string", "XCPCFXPHHF"), new JProperty("boolean", true), new JProperty("null", null), - new JProperty("datetime", "2526-07-11T18:18:16.4520716"), + new JProperty("datetime", DateTime.Parse("2526-07-11T18:18:16.4520716")), new JProperty("spatialPoint", new JObject( new JProperty("type", "Point"), new JProperty("coordinate", new double[] { 118.9897, -46.6781 }))), @@ -210,6 +210,68 @@ public void AllPrimitivesObjectTest() NewtonsoftInteropTests.VerifyNewtonsoftInterop(value); } + [TestMethod] + [Owner("dkunda")] + public void AllDatetimeVariationsTest() + { + // Arrange + JObject jsonObject = new JObject(); + + // 1. Current UTC DateTime using JProperty + DateTime utcNow = DateTime.UtcNow; + JProperty utcNowProperty = new JProperty("currentUtcDateTime", utcNow); + jsonObject.Add(utcNowProperty); + + // 2. Current Local DateTime using JProperty + DateTime localNow = DateTime.Now; + JProperty localNowProperty = new JProperty("currentLocalDateTime", localNow); + jsonObject.Add(localNowProperty); + + // 3. Date Only (formatted as string) using JProperty + DateTime dateOnly = new DateTime(2023, 10, 26, 0, 0, 0, DateTimeKind.Unspecified); + JProperty dateOnlyProperty = new JProperty("specificDateOnly", dateOnly.ToString("yyyy-MM-dd")); + jsonObject.Add(dateOnlyProperty); + + // 4. Time Only (formatted as string) using JProperty + DateTime timeOnly = new DateTime(1, 1, 1, 14, 30, 0, DateTimeKind.Unspecified); + JProperty timeOnlyProperty = new JProperty("specificTimeOnly", timeOnly.ToString("HH:mm:ss")); + jsonObject.Add(timeOnlyProperty); + + // 5. DateTime with milliseconds using JProperty + DateTime preciseDateTime = new DateTime(2024, 5, 29, 10, 15, 30, 123, DateTimeKind.Local); + JProperty preciseDateTimeProperty = new JProperty("preciseDateTime", preciseDateTime); + jsonObject.Add(preciseDateTimeProperty); + + // 6. DateTime in ISO 8601 format (UTC) using JProperty + DateTime isoUtcDateTime = new DateTime(2025, 1, 15, 8, 0, 0, DateTimeKind.Utc); + JProperty isoUtcDateTimeProperty = new JProperty("isoUtcDateTime", isoUtcDateTime.ToString("o", CultureInfo.InvariantCulture)); + jsonObject.Add(isoUtcDateTimeProperty); + + // 7. DateTime in custom format using JProperty + DateTime customFormattedDateTime = new DateTime(2022, 7, 1, 9, 45, 10, DateTimeKind.Local); + JProperty customFormattedDateTimeProperty = new JProperty("customFormattedDateTime", customFormattedDateTime.ToString("MM/dd/yyyy HH:mm:ss")); + jsonObject.Add(customFormattedDateTimeProperty); + + // 8. Nullable DateTime (representing a missing or optional date) using JProperty + DateTime? nullableDateTime = null; + JProperty nullableDateTimeProperty = new JProperty("nullableDateTime", nullableDateTime); + jsonObject.Add(nullableDateTimeProperty); + + // 9. MinValue DateTime using JProperty + JProperty minDateTimeProperty = new JProperty("minDateTime", DateTime.MinValue); + jsonObject.Add(minDateTimeProperty); + + // 10. MaxValue DateTime using JProperty + JProperty maxDateTimeProperty = new JProperty("maxDateTime", DateTime.MaxValue); + jsonObject.Add(maxDateTimeProperty); + + // 11. MaxValue DateTime using JProperty + JProperty exactDateTimeProperty = new JProperty("exactDateTime", DateTime.Parse("2025-03-26T20:22:20Z")); + jsonObject.Add(exactDateTimeProperty); + + NewtonsoftInteropTests.VerifyNewtonsoftInterop(jsonObject); + } + public enum Day { Sun, Mon, Tue, Wed, Thu, Fri, Sat }; public sealed class ObjectWithAttributes diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/LocationCacheTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/LocationCacheTests.cs index 6d43d10198..22290256f6 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/LocationCacheTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/LocationCacheTests.cs @@ -197,7 +197,7 @@ private ClientRetryPolicy CreateClientRetryPolicy( this.partitionKeyRangeLocationCache, new RetryOptions(), enableEndpointDiscovery, - isPertitionLevelFailoverEnabled: partitionLevelFailoverEnabled); + isPartitionLevelFailoverEnabled: partitionLevelFailoverEnabled); } [TestMethod] @@ -945,7 +945,8 @@ await BackoffRetryUtility.ExecuteAsync( Assert.IsNotNull(this.cache.EffectivePreferredLocations); Assert.AreEqual(this.cache.EffectivePreferredLocations.Count, 1); - expectedEndpoint = LocationCacheTests.EndpointByLocation[availableWriteLocations[1]]; + //If the defaut endpoint is a regional endpoint, it will be the only vaild read region for read only requests + expectedEndpoint = LocationCacheTests.EndpointByLocation[availableWriteLocations[0]]; } else { @@ -1433,6 +1434,127 @@ public void VerifyRegionExcludedTest( } + [TestMethod] + public void ValidateThinClientReadFallbackToWriteEndpointTest() + { + // Arrange: + Collection normalReads = new Collection() + { + new AccountRegion { Name = "ReadLocation", Endpoint = "https://readlocation.documents.azure.com" } + }; + + Collection normalWrites = new Collection() + { + new AccountRegion { Name = "WriteLocation", Endpoint = "https://writelocation.documents.azure.com" } + }; + + Collection thinClientReads = new Collection(); // 👈 simulate NO thin client read locations + + Collection thinClientWrites = new Collection() + { + new AccountRegion { Name = "ThinClientWriteLocation", Endpoint = "https://thinclient-write.documents.azure.com:10650/" } + }; + + AccountProperties accountProps = new AccountProperties + { + ReadLocationsInternal = normalReads, + WriteLocationsInternal = normalWrites, + ThinClientReadableLocationsInternal = thinClientReads, + ThinClientWritableLocationsInternal = thinClientWrites, + EnableMultipleWriteLocations = false + }; + + LocationCache cache = new LocationCache( + preferredLocations: new ReadOnlyCollection(new List()), + defaultEndpoint: new Uri("https://defaultendpoint.documents.azure.com"), + enableEndpointDiscovery: true, + connectionLimit: 50, + useMultipleWriteLocations: false); + + cache.OnDatabaseAccountRead(accountProps); + + // Act: + using (DocumentServiceRequest readRequest = DocumentServiceRequest.Create(OperationType.Read, ResourceType.Document, AuthorizationTokenType.PrimaryMasterKey)) + { + Uri resolvedReadEndpoint = cache.ResolveThinClientEndpoint(readRequest, isReadRequest: true); + + // Assert: + Assert.AreEqual("https://thinclient-write.documents.azure.com:10650/", resolvedReadEndpoint.AbsoluteUri, + "Read request should fallback to thin client write endpoint when no thin client read endpoint is available."); + } + } + + [TestMethod] + public void ValidateThinClientLocationCacheFlowTest() + { + // Arrange: + Collection normalReads = new Collection() + { + new AccountRegion { Name = "ReadLocation", Endpoint = "https://readlocation.documents.azure.com" } + }; + + Collection normalWrites = new Collection() + { + new AccountRegion { Name = "WriteLocation", Endpoint = "https://writelocation.documents.azure.com" } + }; + + Collection thinClientReads = new Collection() + { + new AccountRegion { Name = "ThinClientReadLocation", Endpoint = "https://thinclient-read.documents.azure.com:10650/" } + }; + + Collection thinClientWrites = new Collection() + { + new AccountRegion { Name = "ThinClientWriteLocation", Endpoint = "https://thinclient-write.documents.azure.com:10650/" } + }; + + AccountProperties accountProps = new AccountProperties + { + ReadLocationsInternal = normalReads, + WriteLocationsInternal = normalWrites, + ThinClientReadableLocationsInternal = thinClientReads, + ThinClientWritableLocationsInternal = thinClientWrites, + EnableMultipleWriteLocations = false + }; + + LocationCache cache = new LocationCache( + preferredLocations: new ReadOnlyCollection(new List()), + defaultEndpoint: new Uri("https://defaultendpoint.documents.azure.com"), + enableEndpointDiscovery: true, + connectionLimit: 50, + useMultipleWriteLocations: false); + + // Act: + cache.OnDatabaseAccountRead(accountProps); + + // Create a read request + DocumentServiceRequest readRequest = DocumentServiceRequest.Create( + OperationType.Read, + ResourceType.Document, + AuthorizationTokenType.PrimaryMasterKey); + + Uri resolvedThinRead = cache.ResolveThinClientEndpoint(readRequest, isReadRequest: true); + + // Create a write request + DocumentServiceRequest writeRequest = DocumentServiceRequest.Create( + OperationType.Create, + ResourceType.Document, + AuthorizationTokenType.PrimaryMasterKey); + + Uri resolvedThinWrite = cache.ResolveThinClientEndpoint(writeRequest, isReadRequest: false); + + // Assert: + Assert.AreEqual("https://thinclient-read.documents.azure.com:10650/", resolvedThinRead.AbsoluteUri, + "ThinClient read endpoint must match the one we provided in ThinClientReadableLocationsInternal"); + + Assert.AreEqual("https://thinclient-write.documents.azure.com:10650/", resolvedThinWrite.AbsoluteUri, + "ThinClient write endpoint must match the one we provided in ThinClientWritableLocationsInternal"); + + Assert.AreEqual("https://readlocation.documents.azure.com/", cache.ReadEndpoints[0].AbsoluteUri); + Assert.AreEqual("https://writelocation.documents.azure.com/", cache.WriteEndpoints[0].AbsoluteUri); + } + + private ReadOnlyCollection GetApplicableRegions(bool isReadRequest, bool useMultipleWriteLocations, bool usesPreferredLocations, List excludeRegions, bool isDefaultEndpointARegionalEndpoint) { // exclusion of write region for single-write maps to first available write region @@ -1511,19 +1633,9 @@ private ReadOnlyCollection GetApplicableRegions(bool isReadRequest, bool us private static AccountProperties CreateDatabaseAccount( bool useMultipleWriteLocations, - bool enforceSingleMasterSingleWriteLocation, - bool isExcludeRegionsTest = false) + bool enforceSingleMasterSingleWriteLocation) { - Collection writeLocations = isExcludeRegionsTest ? - - new Collection() - { - { new AccountRegion() { Name = "default", Endpoint = LocationCacheTests.DefaultEndpoint.ToString() } }, - { new AccountRegion() { Name = "location1", Endpoint = LocationCacheTests.Location1Endpoint.ToString() } }, - { new AccountRegion() { Name = "location2", Endpoint = LocationCacheTests.Location2Endpoint.ToString() } }, - { new AccountRegion() { Name = "location3", Endpoint = LocationCacheTests.Location3Endpoint.ToString() } }, - } : - new Collection() + Collection writeLocations = new Collection() { { new AccountRegion() { Name = "location1", Endpoint = LocationCacheTests.Location1Endpoint.ToString() } }, { new AccountRegion() { Name = "location2", Endpoint = LocationCacheTests.Location2Endpoint.ToString() } }, @@ -1571,8 +1683,7 @@ private GlobalEndpointManager Initialize( { this.databaseAccount = LocationCacheTests.CreateDatabaseAccount( useMultipleWriteLocations, - enforceSingleMasterSingleWriteLocation, - isExcludeRegionsTest); + enforceSingleMasterSingleWriteLocation); if (isPreferredLocationsListEmpty) { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/MetadataRequestThrottleRetryPolicyTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/MetadataRequestThrottleRetryPolicyTests.cs index 7f3fe7cdc9..6e3486e3c7 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/MetadataRequestThrottleRetryPolicyTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/MetadataRequestThrottleRetryPolicyTests.cs @@ -24,13 +24,10 @@ public class MetadataRequestThrottleRetryPolicyTests { [TestMethod] [Owner("dkunda")] - [DataRow(true, true, DisplayName = "Test when a response message with a valid substatus code was used.")] - [DataRow(false, true, DisplayName = "Test when an exception was thrown with a valid substatus code.")] - [DataRow(true, false, DisplayName = "Test when a response message with an invalid substatus code was used.")] - [DataRow(false, false, DisplayName = "Test when an exception was thrown with an invalid substatus code.")] + [DataRow(true, DisplayName = "Test when a response message.")] + [DataRow(false, DisplayName = "Test when an exception was thrown.")] public async Task ShouldRetryAsync_WithValidAndInvalidSubStatusCodes_ShouldIncrementLocationIndexOrSkip( - bool useResponseMessage, - bool isValidSubStatusCode) + bool useResponseMessage) { // Arrange. ShouldRetryResult retryResult; @@ -54,7 +51,7 @@ public async Task ShouldRetryAsync_WithValidAndInvalidSubStatusCodes_ShouldIncre mockedGlobalEndpointManager .SetupSequence(gem => gem.ResolveServiceEndpoint(It.IsAny())) .Returns(primaryServiceEndpoint) - .Returns(isValidSubStatusCode ? routedServiceEndpoint : primaryServiceEndpoint); + .Returns(routedServiceEndpoint); MetadataRequestThrottleRetryPolicy policy = new(mockedGlobalEndpointManager.Object, 0); policy.OnBeforeSendRequest(request); @@ -66,9 +63,7 @@ public async Task ShouldRetryAsync_WithValidAndInvalidSubStatusCodes_ShouldIncre { Headers responseHeaders = new() { - SubStatusCode = isValidSubStatusCode - ? SubStatusCodes.TransportGenerated503 - : SubStatusCodes.BWTermCountLimitExceeded + SubStatusCode = SubStatusCodes.TransportGenerated503 }; ResponseMessage responseMessage = new( @@ -87,9 +82,7 @@ public async Task ShouldRetryAsync_WithValidAndInvalidSubStatusCodes_ShouldIncre headers: new Headers() { ActivityId = System.Diagnostics.Trace.CorrelationManager.ActivityId.ToString(), - SubStatusCode = isValidSubStatusCode - ? SubStatusCodes.TransportGenerated503 - : SubStatusCodes.BWTermCountLimitExceeded + SubStatusCode = SubStatusCodes.TransportGenerated503 }, trace: NoOpTrace.Singleton, innerException: null); @@ -112,18 +105,9 @@ public async Task ShouldRetryAsync_WithValidAndInvalidSubStatusCodes_ShouldIncre obj: policy); Assert.IsNotNull(retryResult); - if (isValidSubStatusCode) - { - Assert.AreEqual(true, retryResult.ShouldRetry, "MetadataRequestThrottleRetryPolicy should return true since the sub status code indicates to retry the request in the next preferred read region."); - Assert.AreEqual(1, retryContext.RetryLocationIndex, "Indicates that the retry location index was incremented."); - Assert.AreEqual(routedServiceEndpoint, request.RequestContext.LocationEndpointToRoute); - } - else - { - Assert.AreEqual(false, retryResult.ShouldRetry, "ResourceThrottleRetryPolicy should return false since the status code does not indicate the request was throttled."); - Assert.AreEqual(0, retryContext.RetryLocationIndex, "Indicates that the retry location index remain unchanged."); - Assert.AreEqual(primaryServiceEndpoint, request.RequestContext.LocationEndpointToRoute); - } + Assert.AreEqual(true, retryResult.ShouldRetry, "MetadataRequestThrottleRetryPolicy should return true since the sub status code indicates to retry the request in the next preferred read region."); + Assert.AreEqual(1, retryContext.RetryLocationIndex, "Indicates that the retry location index was incremented."); + Assert.AreEqual(routedServiceEndpoint, request.RequestContext.LocationEndpointToRoute); } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Microsoft.Azure.Cosmos.Tests.csproj b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Microsoft.Azure.Cosmos.Tests.csproj index 791c1f3b89..f441862c30 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Microsoft.Azure.Cosmos.Tests.csproj +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Microsoft.Azure.Cosmos.Tests.csproj @@ -70,9 +70,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest @@ -115,6 +112,12 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + PreserveNewest @@ -415,6 +418,12 @@ + + + PreserveNewest + + + PreserveNewest diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Pagination/InMemoryContainer.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Pagination/InMemoryContainer.cs index e51b1adf03..ac63a64b15 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Pagination/InMemoryContainer.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Pagination/InMemoryContainer.cs @@ -541,7 +541,7 @@ public virtual Task> MonadicQueryAsync( SqlOrderByItem orderByItem = sqlQuery.OrderByClause.OrderByItems[0]; CosmosObject parsedContinuationToken = CosmosObject.Parse(((CosmosString)feedRangeState.State.Value).Value); SqlBinaryScalarExpression resumeFilter = SqlBinaryScalarExpression.Create( - orderByItem.IsDescending ? SqlBinaryScalarOperatorKind.LessThan : SqlBinaryScalarOperatorKind.GreaterThan, + orderByItem.IsDescending.GetValueOrDefault() ? SqlBinaryScalarOperatorKind.LessThan : SqlBinaryScalarOperatorKind.GreaterThan, orderByItem.Expression, parsedContinuationToken["orderByItem"].Accept(CosmosElementToSqlScalarExpressionVisitor.Singleton)); @@ -588,7 +588,7 @@ public virtual Task> MonadicQueryAsync( if (sortOrderCompare != 0) { - sortOrderCompare = orderByItem.IsDescending ? -sortOrderCompare : sortOrderCompare; + sortOrderCompare = orderByItem.IsDescending.GetValueOrDefault() ? -sortOrderCompare : sortOrderCompare; } if (sortOrderCompare < 0) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeCacheTest.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeCacheTest.cs index d7ecbe9201..41b53d293a 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeCacheTest.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeCacheTest.cs @@ -72,7 +72,7 @@ public async Task TryGetOverlappingRangesAsync_WithFreshContainer_ShouldNotAddSa using (ITrace trace = Trace.GetRootTrace(this.TestContext.TestName, TraceComponent.Unknown, TraceLevel.Info)) { Mock mockStoreModel = new(); - Mock mockCollectioNCache = new(); + Mock mockCollectioNCache = new(false); Mock mockTokenProvider = new(); NameValueCollectionWrapper headers = new() { @@ -98,7 +98,7 @@ public async Task TryGetOverlappingRangesAsync_WithFreshContainer_ShouldNotAddSa .Returns(new ValueTask(authToken)); // Act. - PartitionKeyRangeCache partitionKeyRangeCache = new(mockTokenProvider.Object, mockStoreModel.Object, mockCollectioNCache.Object, endpointManager); + PartitionKeyRangeCache partitionKeyRangeCache = new(mockTokenProvider.Object, mockStoreModel.Object, mockCollectioNCache.Object, endpointManager, enableAsyncCacheExceptionNoSharing: false); IReadOnlyList partitionKeyRanges = await partitionKeyRangeCache.TryGetOverlappingRangesAsync( containerRId, FeedRangeEpk.FullRange.Range, @@ -147,7 +147,7 @@ public async Task TryGetOverlappingRangesAsync_WhenGatewayThrowsServiceUnavailab using (ITrace trace = Trace.GetRootTrace(this.TestContext.TestName, TraceComponent.Unknown, TraceLevel.Info)) { Mock mockStoreModel = new(); - Mock mockCollectioNCache = new(); + Mock mockCollectioNCache = new(false); Mock mockTokenProvider = new(); NameValueCollectionWrapper headers = new() { @@ -207,7 +207,7 @@ public async Task TryGetOverlappingRangesAsync_WhenGatewayThrowsServiceUnavailab mockTokenProvider.Setup(x => x.GetUserAuthorizationTokenAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) .Returns(new ValueTask(authToken)); - PartitionKeyRangeCache partitionKeyRangeCache = new(mockTokenProvider.Object, mockStoreModel.Object, mockCollectioNCache.Object, mockedEndpointManager.Object); + PartitionKeyRangeCache partitionKeyRangeCache = new(mockTokenProvider.Object, mockStoreModel.Object, mockCollectioNCache.Object, mockedEndpointManager.Object, enableAsyncCacheExceptionNoSharing: false); if (shouldSucceed) { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeFailoverTests/GlobalPartitionEndpointManagerTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeFailoverTests/GlobalPartitionEndpointManagerTests.cs index f1d483888a..519f8ac757 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeFailoverTests/GlobalPartitionEndpointManagerTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeFailoverTests/GlobalPartitionEndpointManagerTests.cs @@ -24,6 +24,7 @@ public class GlobalPartitionEndpointManagerTests public async Task TestWriteForbiddenScenarioAsync() { GlobalPartitionEndpointManagerTests.SetupAccountAndCacheOperations( + shouldEnablePPAF: true, out string secondaryRegionNameForUri, out string globalEndpoint, out string secondaryRegionEndpiont, @@ -57,13 +58,12 @@ public async Task TestWriteForbiddenScenarioAsync() CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() { - EnablePartitionLevelFailover = true, ConsistencyLevel = Cosmos.ConsistencyLevel.Strong, ApplicationPreferredRegions = new List() - { - Regions.EastUS, - Regions.WestUS - }, + { + Regions.EastUS, + Regions.WestUS + }, HttpClientFactory = () => new HttpClient(new HttpHandlerHelper(mockHttpHandler.Object)), TransportClientHandlerFactory = (original) => mockTransport.Object, }; @@ -115,6 +115,7 @@ public async Task TestWriteForbiddenScenarioAsync() public async Task CreateItemAsync_WithPreferredRegionsAndServiceUnavailableForFirstPreferredRegion_ShouldRetryAndSucceedToTheNextPreferredRegion() { GlobalPartitionEndpointManagerTests.SetupAccountAndCacheOperations( + shouldEnablePPAF: true, out string secondaryRegionNameForUri, out string globalEndpoint, out string secondaryRegionEndpiont, @@ -148,21 +149,20 @@ public async Task CreateItemAsync_WithPreferredRegionsAndServiceUnavailableForFi CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() { - EnablePartitionLevelFailover = true, ConsistencyLevel = Cosmos.ConsistencyLevel.Strong, ApplicationPreferredRegions = new List() - { - Regions.EastUS, - Regions.WestUS - }, + { + Regions.EastUS, + Regions.WestUS + }, HttpClientFactory = () => new HttpClient(new HttpHandlerHelper(mockHttpHandler.Object)), TransportClientHandlerFactory = (original) => mockTransport.Object, }; using CosmosClient customClient = new CosmosClient( - globalEndpoint, - Convert.ToBase64String(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())), - cosmosClientOptions); + globalEndpoint, + Convert.ToBase64String(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())), + cosmosClientOptions); Container container = customClient.GetContainer(databaseName, containerName); @@ -200,12 +200,19 @@ public async Task CreateItemAsync_WithPreferredRegionsAndServiceUnavailableForFi /// /// Test to validate that when the partition level failover is enabled with the preferred regions list is missing, then the client - /// initialization should throw an argument exception and fail. + /// initialization should succeed without throwing any argument exception. /// [TestMethod] - public void CreateItemAsync_WithNoPreferredRegionsAndServiceUnavailable_ShouldThrowArgumentException() + [DataRow(true, DisplayName = "Validate that when an explict availability strategy is provided, the same will be honored by bypassing the default one, when PPAF is enabled.")] + [DataRow(false, DisplayName = "Validate that when no explict availability strategy is provided, a default availability strategy will be applied, when PPAF is enabled.")] + public void CreateItemAsync_WithNoPreferredRegionsAndServiceUnavailable_ShouldNotThrowArgumentException( + bool isExplictAvailabilityStrategyProvided) { + TimeSpan explictAvailabilityStrategyThreshold = TimeSpan.FromMilliseconds(2000); + TimeSpan explictAvailabilityStrategyThresholdStep = TimeSpan.FromMilliseconds(500); + GlobalPartitionEndpointManagerTests.SetupAccountAndCacheOperations( + shouldEnablePPAF: true, out string secondaryRegionNameForUri, out string globalEndpoint, out string secondaryRegionEndpiont, @@ -241,20 +248,44 @@ public void CreateItemAsync_WithNoPreferredRegionsAndServiceUnavailable_ShouldTh CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() { - EnablePartitionLevelFailover = true, ConsistencyLevel = Cosmos.ConsistencyLevel.Strong, HttpClientFactory = () => new HttpClient(new HttpHandlerHelper(mockHttpHandler.Object)), TransportClientHandlerFactory = (original) => mockTransport.Object, }; - ArgumentException exception = Assert.ThrowsException(() => new CosmosClient( - globalEndpoint, - Convert.ToBase64String(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())), - cosmosClientOptions)); + if (isExplictAvailabilityStrategyProvided) + { + cosmosClientOptions.AvailabilityStrategy = AvailabilityStrategy.CrossRegionHedgingStrategy( + threshold: explictAvailabilityStrategyThreshold, + thresholdStep: explictAvailabilityStrategyThresholdStep); + } + + CosmosClient cosmosClient = new CosmosClient( + globalEndpoint, + Convert.ToBase64String(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())), + cosmosClientOptions); + + Assert.IsNotNull(cosmosClient, + message: "ApplicationPreferredRegions or ApplicationRegion is no longer mandatory fields, hence the client initialization should succeed."); + + Assert.IsNotNull(cosmosClient.DocumentClient.ConnectionPolicy.AvailabilityStrategy); + + CrossRegionHedgingAvailabilityStrategy crossRegionHedgingStrategy = (CrossRegionHedgingAvailabilityStrategy)cosmosClient.DocumentClient.ConnectionPolicy.AvailabilityStrategy; + + Assert.IsNotNull(crossRegionHedgingStrategy); - Assert.AreEqual( - expected: "ApplicationPreferredRegions or ApplicationRegion is required when EnablePartitionLevelFailover is enabled.", - actual: exception.Message); + if (isExplictAvailabilityStrategyProvided) + { + // Explict availability strategy values. + Assert.AreEqual(explictAvailabilityStrategyThreshold, crossRegionHedgingStrategy.Threshold); + Assert.AreEqual(explictAvailabilityStrategyThresholdStep, crossRegionHedgingStrategy.ThresholdStep); + } + else + { + // Default availability strategy values. + Assert.AreEqual(TimeSpan.FromMilliseconds(1000), crossRegionHedgingStrategy.Threshold); + Assert.AreEqual(TimeSpan.FromMilliseconds(500), crossRegionHedgingStrategy.ThresholdStep); + } } [TestMethod] @@ -262,6 +293,7 @@ public void CreateItemAsync_WithNoPreferredRegionsAndServiceUnavailable_ShouldTh public async Task TestRequestTimeoutExceptionScenarioAsync() { GlobalPartitionEndpointManagerTests.SetupAccountAndCacheOperations( + shouldEnablePPAF: true, out string secondaryRegionNameForUri, out string globalEndpoint, out string secondaryRegionEndpiont, @@ -295,13 +327,12 @@ public async Task TestRequestTimeoutExceptionScenarioAsync() CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() { - EnablePartitionLevelFailover = true, ConsistencyLevel = Cosmos.ConsistencyLevel.Strong, ApplicationPreferredRegions = new List() - { - Regions.EastUS, - Regions.WestUS - }, + { + Regions.EastUS, + Regions.WestUS + }, HttpClientFactory = () => new HttpClient(new HttpHandlerHelper(mockHttpHandler.Object)), TransportClientHandlerFactory = (original) => mockTransport.Object, }; @@ -354,7 +385,123 @@ public async Task TestRequestTimeoutExceptionScenarioAsync() Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); } + [TestMethod] + [Timeout(20000)] + [Owner("dkunda")] + [DataRow(true, null, DisplayName = "Scenario when PPAF is enabled at client level and not set at the service level.")] + [DataRow(false, null, DisplayName = "Scenario when PPAF is disabled at client level and not set at the service level.")] + [DataRow(true, true, DisplayName = "Scenario when PPAF is enabled at client level and enabled at service level.")] + [DataRow(false, true, DisplayName = "Scenario when PPAF is disabled at client level and enabled at service level.")] + [DataRow(true, false, DisplayName = "Scenario when PPAF is enabled at client level and disabled at service level.")] + [DataRow(false, false, DisplayName = "Scenario when PPAF is disabled at client level and disabled at service level.")] + public async Task TestPPAFClientAndServerEnablementCombinationScenariosAsync( + bool ppafEnabledFromClient, + bool? ppafEnabledFromService) + { + if (ppafEnabledFromClient) + { + Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelFailoverEnabled, "True"); + } + + try + { + GlobalPartitionEndpointManagerTests.SetupAccountAndCacheOperations( + shouldEnablePPAF: ppafEnabledFromService, + out string secondaryRegionNameForUri, + out string globalEndpoint, + out string secondaryRegionEndpiont, + out string databaseName, + out string containerName, + out ResourceId containerResourceId, + out Mock mockHttpHandler, + out IReadOnlyList primaryRegionPartitionKeyRangeIds, + out TransportAddressUri primaryRegionprimaryReplicaUri); + + Mock mockTransport = new Mock(MockBehavior.Strict); + + MockSetupsHelper.SetupServiceUnavailableException( + mockTransport, + primaryRegionprimaryReplicaUri); + + // Partition key ranges are the same in both regions so the SDK + // does not need to go the secondary to get the partition key ranges. + // Only the addresses need to be mocked on the secondary + MockSetupsHelper.SetupAddresses( + mockHttpHandler: mockHttpHandler, + partitionKeyRangeId: primaryRegionPartitionKeyRangeIds.First(), + regionEndpoint: secondaryRegionEndpiont, + regionName: secondaryRegionNameForUri, + containerResourceId: containerResourceId, + primaryReplicaUri: out TransportAddressUri secondaryRegionPrimaryReplicaUri); + + MockSetupsHelper.SetupCreateItemResponse( + mockTransport, + secondaryRegionPrimaryReplicaUri); + + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConsistencyLevel = Cosmos.ConsistencyLevel.Strong, + ApplicationPreferredRegions = new List() + { + Regions.EastUS, + Regions.WestUS + }, + HttpClientFactory = () => new HttpClient(new HttpHandlerHelper(mockHttpHandler.Object)), + TransportClientHandlerFactory = (original) => mockTransport.Object, + }; + + using CosmosClient customClient = new CosmosClient( + globalEndpoint, + Convert.ToBase64String(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())), + cosmosClientOptions); + + Container container = customClient.GetContainer(databaseName, containerName); + + ToDoActivity toDoActivity = new ToDoActivity() + { + Id = "TestItem", + Pk = "TestPk" + }; + + if ((!ppafEnabledFromService.HasValue && ppafEnabledFromClient) + || (ppafEnabledFromService.HasValue && ppafEnabledFromService.Value)) + { + ItemResponse response = await container.CreateItemAsync(toDoActivity, new Cosmos.PartitionKey(toDoActivity.Pk)); + + Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); + Assert.IsTrue(response.Diagnostics.GetContactedRegions().Count > 1); + + mockTransport.VerifyAll(); + mockHttpHandler.VerifyAll(); + } + else + { + try + { + await container.CreateItemAsync(toDoActivity, new Cosmos.PartitionKey(toDoActivity.Pk)); + Assert.Fail("Should throw an exception"); + } + catch (CosmosException ce) + { + // Clears all the setups. No network calls should be done on the next operation. + Assert.IsNotNull(ce); + Assert.AreEqual(HttpStatusCode.ServiceUnavailable, ce.StatusCode); + } + } + + mockHttpHandler.Reset(); + mockTransport.Reset(); + mockTransport.Setup(x => x.Dispose()); + } + finally + { + // Reset the environment variable to avoid affecting other tests. + Environment.SetEnvironmentVariable(ConfigurationManager.PartitionLevelFailoverEnabled, null); + } + } + private static void SetupAccountAndCacheOperations( + bool? shouldEnablePPAF, out string secondaryRegionNameForUri, out string globalEndpoint, out string secondaryRegionEndpiont, @@ -408,7 +555,8 @@ private static void SetupAccountAndCacheOperations( endpoint: globalEndpointUri.ToString(), accountName: accountName, writeRegions: writeRegion, - readRegions: readRegions); + readRegions: readRegions, + shouldEnablePPAF: shouldEnablePPAF); MockSetupsHelper.SetupContainerProperties( mockHttpHandler: mockHttpHandler, diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeFailoverTests/GlobalPartitionEndpointManagerUnitTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeFailoverTests/GlobalPartitionEndpointManagerUnitTests.cs index 5497d87094..dc702d37f4 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeFailoverTests/GlobalPartitionEndpointManagerUnitTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeFailoverTests/GlobalPartitionEndpointManagerUnitTests.cs @@ -8,10 +8,8 @@ namespace Microsoft.Azure.Cosmos.Tests using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; - using System.Net; - using System.Net.Http; - using System.Text; using System.Threading.Tasks; + using System.Threading; using Microsoft.Azure.Cosmos.Routing; using Microsoft.Azure.Documents; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -25,7 +23,7 @@ public class GlobalPartitionEndpointManagerUnitTests public void TestSingleReadRegionScenario() { Mock mockEndpointManager = new Mock(MockBehavior.Strict); - GlobalPartitionEndpointManagerCore failoverManager = new GlobalPartitionEndpointManagerCore(mockEndpointManager.Object); + GlobalPartitionEndpointManagerCore failoverManager = new GlobalPartitionEndpointManagerCore(mockEndpointManager.Object, isPartitionLevelFailoverEnabled: true); mockEndpointManager.Setup(x => x.ReadEndpoints).Returns(() => new ReadOnlyCollection(new List() { new Uri("https://localhost:443/") })); @@ -72,7 +70,10 @@ public void VerifyAllReadRegionsAreVisited(int numOfReadRegions) { Mock mockEndpointManager = new Mock(MockBehavior.Strict); - GlobalPartitionEndpointManagerCore failoverManager = new GlobalPartitionEndpointManagerCore(mockEndpointManager.Object); + GlobalPartitionEndpointManagerCore failoverManager = new GlobalPartitionEndpointManagerCore( + mockEndpointManager.Object, + isPartitionLevelFailoverEnabled: true); + List readRegions = new(), writeRegions = new(); for (int i = 0; i < numOfReadRegions; i++) { @@ -102,7 +103,7 @@ public void VerifyAllReadRegionsAreVisited(int numOfReadRegions) createRequest.RequestContext.ResolvedPartitionKeyRange = partitionKeyRange; createRequest.RequestContext.RouteToLocation(readRegions.First()); - mockEndpointManager.Setup(x => x.CanUseMultipleWriteLocations(createRequest)).Returns(false); + mockEndpointManager.Setup(x => x.CanSupportMultipleWriteLocations(It.IsAny(), It.IsAny())).Returns(false); foreach (Uri region in readRegions) { @@ -124,5 +125,283 @@ public void VerifyAllReadRegionsAreVisited(int numOfReadRegions) } } } + + [TestMethod] + [Owner("dkunda")] + [DataRow(false, true, DisplayName = "Scenario when PPAF is disabled and circuit breaker is enabled.")] + [DataRow(true, false, DisplayName = "Scenario when PPAF is enabled and circuit breaker is disabled.")] + [DataRow(true, true, DisplayName = "Scenario when PPAF is enabled and circuit breaker is enabled.")] + [DataRow(false, false, DisplayName = "Scenario when PPAF is disabled and circuit breaker is disabled.")] + [Timeout(10000)] + public void TryMarkEndpointUnavailableForPartitionKeyRange_WithSingleMasterWriteAccount_WritesShouldNotAddOverrideWhenCircuitBreakerEnabled( + bool ppafEnabled, + bool ppcbEnabled) + { + Mock mockEndpointManager = new Mock(MockBehavior.Strict); + + List readRegions = new(), writeRegions = new(); + for (int i = 0; i < 3; i++) + { + readRegions.Add(new Uri($"https://localhost:{i}/")); + } + + mockEndpointManager.Setup(x => x.ReadEndpoints).Returns(() => new ReadOnlyCollection(readRegions)); + mockEndpointManager.Setup(x => x.AccountReadEndpoints).Returns(() => new ReadOnlyCollection(readRegions)); + mockEndpointManager.Setup(x => x.WriteEndpoints).Returns(() => new ReadOnlyCollection(readRegions)); + mockEndpointManager.Setup(x => x.CanSupportMultipleWriteLocations(It.IsAny(), It.IsAny())).Returns(false); + + GlobalPartitionEndpointManagerCore failoverManager = new GlobalPartitionEndpointManagerCore( + mockEndpointManager.Object, + isPartitionLevelFailoverEnabled: ppafEnabled, + isPartitionLevelCircuitBreakerEnabled: ppcbEnabled); + + PartitionKeyRange partitionKeyRange = new PartitionKeyRange() + { + Id = "0", + MinInclusive = "", + MaxExclusive = "FF" + }; + + Uri routeToLocation = new Uri("https://localhost:443/"); + using DocumentServiceRequest readRequest = DocumentServiceRequest.Create(OperationType.Read, ResourceType.Document, AuthorizationTokenType.PrimaryMasterKey); + readRequest.RequestContext.ResolvedPartitionKeyRange = partitionKeyRange; + readRequest.RequestContext.RouteToLocation(routeToLocation); + + // Simulate 11 consecutive failures. + GlobalPartitionEndpointManagerUnitTests.SimulateConsecutiveFailures(failoverManager, readRequest); + + if (ppcbEnabled) + { + Assert.IsTrue(failoverManager.TryMarkEndpointUnavailableForPartitionKeyRange( + readRequest)); + Assert.IsTrue(failoverManager.TryAddPartitionLevelLocationOverride( + readRequest)); + } + else + { + Assert.IsFalse(failoverManager.TryMarkEndpointUnavailableForPartitionKeyRange( + readRequest)); + Assert.IsFalse(failoverManager.TryAddPartitionLevelLocationOverride( + readRequest)); + } + + using DocumentServiceRequest createRequest = DocumentServiceRequest.Create(OperationType.Create, ResourceType.Document, AuthorizationTokenType.PrimaryMasterKey); + createRequest.RequestContext.ResolvedPartitionKeyRange = partitionKeyRange; + createRequest.RequestContext.RouteToLocation(routeToLocation); + + if (ppafEnabled) + { + Assert.IsTrue(failoverManager.TryMarkEndpointUnavailableForPartitionKeyRange( + createRequest)); + Assert.IsTrue(failoverManager.TryAddPartitionLevelLocationOverride( + createRequest)); + } + else + { + Assert.IsFalse(failoverManager.TryMarkEndpointUnavailableForPartitionKeyRange( + createRequest)); + Assert.IsFalse(failoverManager.TryAddPartitionLevelLocationOverride( + createRequest)); + } + } + + [TestMethod] + [Owner("dkunda")] + [DataRow(true, DisplayName = "Scenario when circuit breaker is enabled.")] + [DataRow(false, DisplayName = "Scenario when circuit breaker is disabled.")] + [Timeout(10000)] + public void TryMarkEndpointUnavailableForPartitionKeyRange_WithMultiMasterWriteAccount_WritesShouldAddOverrideWhenCircuitBreakerEnabled( + bool circuitBreakerEnabled) + { + Mock mockEndpointManager = new Mock(MockBehavior.Strict); + + List readRegions = new(), writeRegions = new(); + for (int i = 0; i < 3; i++) + { + readRegions.Add(new Uri($"https://localhost:{i}/")); + } + + mockEndpointManager.Setup(x => x.ReadEndpoints).Returns(() => new ReadOnlyCollection(readRegions)); + mockEndpointManager.Setup(x => x.AccountReadEndpoints).Returns(() => new ReadOnlyCollection(readRegions)); + mockEndpointManager.Setup(x => x.WriteEndpoints).Returns(() => new ReadOnlyCollection(readRegions)); + mockEndpointManager.Setup(x => x.CanSupportMultipleWriteLocations(ResourceType.Document, OperationType.Create)).Returns(true); + + GlobalPartitionEndpointManagerCore failoverManager = new GlobalPartitionEndpointManagerCore( + mockEndpointManager.Object, + isPartitionLevelFailoverEnabled: false, + isPartitionLevelCircuitBreakerEnabled: circuitBreakerEnabled); + + PartitionKeyRange partitionKeyRange = new PartitionKeyRange() + { + Id = "0", + MinInclusive = "", + MaxExclusive = "FF" + }; + + Uri routeToLocation = new Uri("https://localhost:443/"); + using DocumentServiceRequest createRequest = DocumentServiceRequest.Create(OperationType.Create, ResourceType.Document, AuthorizationTokenType.PrimaryMasterKey); + createRequest.RequestContext.ResolvedPartitionKeyRange = partitionKeyRange; + createRequest.RequestContext.RouteToLocation(routeToLocation); + + // Simulate 11 consecutive failures. + GlobalPartitionEndpointManagerUnitTests.SimulateConsecutiveFailures(failoverManager, createRequest); + + if (circuitBreakerEnabled) + { + Assert.IsTrue(failoverManager.TryMarkEndpointUnavailableForPartitionKeyRange( + createRequest)); + Assert.IsTrue(failoverManager.TryAddPartitionLevelLocationOverride( + createRequest)); + } + else + { + Assert.IsFalse(failoverManager.TryMarkEndpointUnavailableForPartitionKeyRange( + createRequest)); + Assert.IsFalse(failoverManager.TryAddPartitionLevelLocationOverride( + createRequest)); + } + } + + [TestMethod] + [Owner("dkunda")] + [DataRow(6, DisplayName = "Scenario when request failure counter is lesser than the default threshold of 10.")] + [DataRow(11, DisplayName = "Scenario when request failure counter is higher than the default threshold of 10.")] + [Timeout(10000)] + public void IncrementRequestFailureCounterAndCheckIfPartitionCanFailover_WithSingleMasterWriteAccount_ShouldReturnTrueWhenCounterReachesDefaultThreshold( + int failureCount) + { + Mock mockEndpointManager = new Mock(MockBehavior.Strict); + + List readRegions = new(), writeRegions = new(); + for (int i = 0; i < 3; i++) + { + readRegions.Add(new Uri($"https://localhost:{i}/")); + } + + mockEndpointManager.Setup(x => x.ReadEndpoints).Returns(() => new ReadOnlyCollection(readRegions)); + mockEndpointManager.Setup(x => x.AccountReadEndpoints).Returns(() => new ReadOnlyCollection(readRegions)); + mockEndpointManager.Setup(x => x.WriteEndpoints).Returns(() => new ReadOnlyCollection(readRegions)); + mockEndpointManager.Setup(x => x.CanSupportMultipleWriteLocations(ResourceType.Document, OperationType.Create)).Returns(true); + + GlobalPartitionEndpointManagerCore failoverManager = new GlobalPartitionEndpointManagerCore( + mockEndpointManager.Object, + isPartitionLevelFailoverEnabled: false, + isPartitionLevelCircuitBreakerEnabled: true); + + PartitionKeyRange partitionKeyRange = new PartitionKeyRange() + { + Id = "0", + MinInclusive = "", + MaxExclusive = "FF" + }; + + Uri routeToLocation = new Uri("https://localhost:443/"); + using DocumentServiceRequest createRequest = DocumentServiceRequest.Create(OperationType.Create, ResourceType.Document, AuthorizationTokenType.PrimaryMasterKey); + createRequest.RequestContext.ResolvedPartitionKeyRange = partitionKeyRange; + createRequest.RequestContext.RouteToLocation(routeToLocation); + + bool shouldPartitionFailOver = false; + for(int i=0; i<=failureCount; i++) + { + shouldPartitionFailOver = failoverManager.IncrementRequestFailureCounterAndCheckIfPartitionCanFailover(createRequest); + } + + // The default value for the write threshold is 5. + if (failureCount < 5) + { + Assert.IsFalse(shouldPartitionFailOver); + } + else + { + Assert.IsTrue(shouldPartitionFailOver); + } + } + + [TestMethod] + [Owner("dkunda")] + [Timeout(10000)] + public async Task InitializeAndStartCircuitBreakerFailbackBackgroundRefresh_WithCircuitBreakerEnabled_ShouldValidateUnhealthyEndpoints() + { + Environment.SetEnvironmentVariable(ConfigurationManager.StalePartitionUnavailabilityRefreshIntervalInSeconds, "1"); + Environment.SetEnvironmentVariable(ConfigurationManager.AllowedPartitionUnavailabilityDurationInSeconds, "1"); + try + { + string collectionRid = "test-collection-1"; + Mock mockEndpointManager = new Mock(MockBehavior.Strict); + + List readRegions = new(), writeRegions = new(); + for (int i = 1; i <= 3; i++) + { + readRegions.Add(new Uri($"https://localhost:{i}/")); + } + + mockEndpointManager.Setup(x => x.ReadEndpoints).Returns(() => new ReadOnlyCollection(readRegions)); + mockEndpointManager.Setup(x => x.AccountReadEndpoints).Returns(() => new ReadOnlyCollection(readRegions)); + mockEndpointManager.Setup(x => x.WriteEndpoints).Returns(() => new ReadOnlyCollection(readRegions)); + mockEndpointManager.Setup(x => x.CanSupportMultipleWriteLocations(ResourceType.Document, OperationType.Create)).Returns(true); + + GlobalPartitionEndpointManagerCore failoverManager = new GlobalPartitionEndpointManagerCore( + mockEndpointManager.Object, + isPartitionLevelFailoverEnabled: false, + isPartitionLevelCircuitBreakerEnabled: true); + + failoverManager.SetBackgroundConnectionPeriodicRefreshTask(this.OpenConnectionToUnhealthyEndpointsAsync); + + PartitionKeyRange partitionKeyRange = new PartitionKeyRange() + { + Id = "0", + MinInclusive = "", + MaxExclusive = "FF" + }; + + Uri routeToLocation = new Uri("https://localhost:0/"); + + using DocumentServiceRequest createRequest = DocumentServiceRequest.Create(OperationType.Create, ResourceType.Document, AuthorizationTokenType.PrimaryMasterKey); + createRequest.RequestContext.ResolvedPartitionKeyRange = partitionKeyRange; + createRequest.RequestContext.RouteToLocation(routeToLocation); + createRequest.RequestContext.ResolvedCollectionRid = collectionRid; + + // Simulate 11 consecutive failures. + GlobalPartitionEndpointManagerUnitTests.SimulateConsecutiveFailures(failoverManager, createRequest); + + Assert.IsTrue(failoverManager.TryMarkEndpointUnavailableForPartitionKeyRange(createRequest)); + Assert.IsTrue(failoverManager.TryAddPartitionLevelLocationOverride(createRequest)); + Assert.AreEqual(new Uri("https://localhost:1"), createRequest.RequestContext.LocationEndpointToRoute); + + // Wait for 3 seconds for the background task to finish execution. + await Task.Delay(TimeSpan.FromSeconds(3)); + + Assert.IsFalse(failoverManager.TryAddPartitionLevelLocationOverride(createRequest)); + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.AllowedPartitionUnavailabilityDurationInSeconds, null); + Environment.SetEnvironmentVariable(ConfigurationManager.StalePartitionUnavailabilityRefreshIntervalInSeconds, null); + } + } + + private async Task OpenConnectionToUnhealthyEndpointsAsync( + Dictionary> pkRangeUriMappings) + { + foreach (PartitionKeyRange pkRange in pkRangeUriMappings.Keys) + { + string collectionRid = pkRangeUriMappings[pkRange].Item1; + Uri originalFailedLocation = pkRangeUriMappings[pkRange].Item2; + + await Task.Delay(TimeSpan.FromMilliseconds(1)); + + pkRangeUriMappings[pkRange] = new Tuple(collectionRid, originalFailedLocation, TransportAddressHealthState.HealthStatus.Connected); + } + } + + private static void SimulateConsecutiveFailures( + GlobalPartitionEndpointManagerCore failoverManager, + DocumentServiceRequest requestMessage) + { + for (int i = 0; i < 11; i++) + { + failoverManager.IncrementRequestFailureCounterAndCheckIfPartitionCanFailover(requestMessage); + } + } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeFailoverTests/MockSetupsHelper.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeFailoverTests/MockSetupsHelper.cs index 160ed58548..b6cecf5c65 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeFailoverTests/MockSetupsHelper.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeFailoverTests/MockSetupsHelper.cs @@ -29,12 +29,14 @@ public static void SetupStrongAccountProperties( string accountName, string endpoint, IList writeRegions, - IList readRegions) + IList readRegions, + bool? shouldEnablePPAF) { HttpResponseMessage httpResponseMessage = MockSetupsHelper.CreateStrongAccount( accountName, writeRegions, - readRegions); + readRegions, + shouldEnablePPAF: shouldEnablePPAF); Uri endpointUri = new Uri(endpoint); mockHttpClientHandler.Setup(x => x.SendAsync( @@ -106,7 +108,9 @@ public static Uri SetupSingleRegionAccount( public static HttpResponseMessage CreateStrongAccount( string accountName, IList writeRegions, - IList readRegions) + IList readRegions, + bool shouldEnableThinClient = false, + bool? shouldEnablePPAF = null) { AccountProperties accountProperties = new AccountProperties() { @@ -114,6 +118,7 @@ public static HttpResponseMessage CreateStrongAccount( WriteLocationsInternal = new Collection(writeRegions), ReadLocationsInternal = new Collection(readRegions), EnableMultipleWriteLocations = writeRegions.Count > 1, + EnablePartitionLevelFailover = shouldEnablePPAF, Consistency = new AccountConsistency() { DefaultConsistencyLevel = Cosmos.ConsistencyLevel.Strong @@ -133,9 +138,29 @@ public static HttpResponseMessage CreateStrongAccount( AsyncReplication = false, MinReplicaSetSize = 3, MaxReplicaSetSize = 4 - } + }, }; + if (shouldEnableThinClient) + { + accountProperties.AdditionalProperties = new Dictionary + { + { + "thinClientWritableLocations", + JArray.Parse(@"[ + { 'name': 'East US', 'databaseAccountEndpoint': 'https://thinclientwrite-eastus.documents.azure.com:10650/' } + ]") + }, + { + "thinClientReadableLocations", + JArray.Parse(@"[ + { 'name': 'East US', 'databaseAccountEndpoint': 'https://thinclientread-eastus.documents.azure.com:10650/' }, + { 'name': 'West US', 'databaseAccountEndpoint': 'https://thinclientread-westus.documents.azure.com:10650/' } + ]") + } + }; + } + return new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeFailoverTests/RegionFailoverTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeFailoverTests/RegionFailoverTests.cs index dfd5a0c23a..3532b608aa 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeFailoverTests/RegionFailoverTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeFailoverTests/RegionFailoverTests.cs @@ -6,12 +6,16 @@ namespace Microsoft.Azure.Cosmos.Tests { using System; using System.Collections.Generic; + using System.IO; using System.Linq; using System.Net; using System.Net.Http; + using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; + using Microsoft.Azure.Cosmos.Diagnostics; + using Microsoft.Azure.Cosmos.Routing; using Microsoft.Azure.Documents; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -31,7 +35,7 @@ public async Task TestHttpRequestExceptionScenarioAsync() string globalEndpoint = $"https://{accountName}.documents.azure.com:443/"; Uri globalEndpointUri = new Uri(globalEndpoint); string primaryRegionEndpoint = $"https://{accountName}-{primaryRegionNameForUri}.documents.azure.com"; - string secondaryRegionEndpiont = $"https://{accountName}-{secondaryRegionNameForUri}.documents.azure.com"; + string secondaryRegionEndpoint = $"https://{accountName}-{secondaryRegionNameForUri}.documents.azure.com"; string databaseName = "testDb"; string containerName = "testContainer"; string containerRid = "ccZ1ANCszwk="; @@ -56,7 +60,7 @@ public async Task TestHttpRequestExceptionScenarioAsync() new AccountRegion() { Name = "West US", - Endpoint = $"{secondaryRegionEndpiont}:443/" + Endpoint = $"{secondaryRegionEndpoint}:443/" } }; @@ -65,7 +69,7 @@ public async Task TestHttpRequestExceptionScenarioAsync() new AccountRegion() { Name = "West US", - Endpoint = $"{secondaryRegionEndpiont}:443/" + Endpoint = $"{secondaryRegionEndpoint}:443/" } }; @@ -75,7 +79,7 @@ public async Task TestHttpRequestExceptionScenarioAsync() new AccountRegion() { Name = "West US", - Endpoint = $"{secondaryRegionEndpiont}:443/" + Endpoint = $"{secondaryRegionEndpoint}:443/" }, new AccountRegion() { @@ -95,7 +99,7 @@ public async Task TestHttpRequestExceptionScenarioAsync() int count = 0; mockHttpHandler.Setup(x => x.SendAsync( - It.Is(x => x.RequestUri == new Uri(secondaryRegionEndpiont)), + It.Is(x => x.RequestUri == new Uri(secondaryRegionEndpoint)), It.IsAny())) .Returns((request, cancellationToken) => { @@ -103,32 +107,32 @@ public async Task TestHttpRequestExceptionScenarioAsync() count++; if (count < 2) { - return Task.FromResult(MockSetupsHelper.CreateStrongAccount(accountName, writeRegion, readRegions)); + return Task.FromResult(MockSetupsHelper.CreateStrongAccount(accountName, writeRegion, readRegions, shouldEnablePPAF: true)); } else { - return Task.FromResult(MockSetupsHelper.CreateStrongAccount(accountName, writeRegionFailedOver, readRegionsFailedOver)); + return Task.FromResult(MockSetupsHelper.CreateStrongAccount(accountName, writeRegionFailedOver, readRegionsFailedOver, shouldEnablePPAF: true)); } }); MockSetupsHelper.SetupContainerProperties( mockHttpHandler: mockHttpHandler, - regionEndpoint: secondaryRegionEndpiont, + regionEndpoint: secondaryRegionEndpoint, databaseName: databaseName, containerName: containerName, containerRid: containerRid); MockSetupsHelper.SetupPartitionKeyRanges( mockHttpHandler: mockHttpHandler, - regionEndpoint: secondaryRegionEndpiont, + regionEndpoint: secondaryRegionEndpoint, containerResourceId: containerResourceId, partitionKeyRangeIds: out IReadOnlyList secondaryRegionPartitionKeyRangeIds); MockSetupsHelper.SetupAddresses( mockHttpHandler: mockHttpHandler, partitionKeyRangeId: secondaryRegionPartitionKeyRangeIds.First(), - regionEndpoint: secondaryRegionEndpiont, + regionEndpoint: secondaryRegionEndpoint, regionName: secondaryRegionNameForUri, containerResourceId: containerResourceId, primaryReplicaUri: out TransportAddressUri secondaryRegionprimaryReplicaUri); @@ -145,7 +149,7 @@ public async Task TestHttpRequestExceptionScenarioAsync() MockSetupsHelper.SetupAddresses( mockHttpHandler: mockHttpHandler, partitionKeyRangeId: secondaryRegionPartitionKeyRangeIds.First(), - regionEndpoint: secondaryRegionEndpiont, + regionEndpoint: secondaryRegionEndpoint, regionName: secondaryRegionNameForUri, containerResourceId: containerResourceId, primaryReplicaUri: out TransportAddressUri secondaryRegionPrimaryReplicaUri); @@ -156,7 +160,6 @@ public async Task TestHttpRequestExceptionScenarioAsync() CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() { - EnablePartitionLevelFailover = true, ConsistencyLevel = Cosmos.ConsistencyLevel.Strong, ApplicationPreferredRegions = new List() { @@ -209,5 +212,442 @@ public async Task TestHttpRequestExceptionScenarioAsync() await Task.Delay(TimeSpan.FromMinutes(2)); } + + [TestMethod] + [Owner("dkunda")] + [DataRow(false, DisplayName = "Read Item Scenario without PPAF and PPCB.")] + [DataRow(true, DisplayName = "Read Item Scenario with PPAF and PPCB.")] + public async Task ReadItemAsync_WithThinClientEnabledAndServiceUnavailableReceived_ShouldRetryOnNextPreferredRegions( + bool enablePartitionLevelFailover) + { + try + { + Environment.SetEnvironmentVariable(ConfigurationManager.ThinClientModeEnabled, "True"); + string accountName = nameof(TestHttpRequestExceptionScenarioAsync); + string primaryRegionNameForUri = "eastus"; + string secondaryRegionNameForUri = "westus"; + string globalEndpoint = $"https://{accountName}.documents.azure.com:443/"; + Uri globalEndpointUri = new Uri(globalEndpoint); + string primaryRegionEndpoint = $"https://{accountName}-{primaryRegionNameForUri}.documents.azure.com"; + string secondaryRegionEndpoint = $"https://{accountName}-{secondaryRegionNameForUri}.documents.azure.com"; + string databaseName = "testDb"; + string containerName = "testContainer"; + string containerRid = "ccZ1ANCszwk="; + ResourceId containerResourceId = ResourceId.Parse(containerRid); + + List writeRegion = new List() + { + new AccountRegion() + { + Name = "East US", + Endpoint = $"{primaryRegionEndpoint}:443/" + } + }; + + List readRegions = new List() + { + new AccountRegion() + { + Name = "East US", + Endpoint = $"{primaryRegionEndpoint}:443/" + }, + new AccountRegion() + { + Name = "West US", + Endpoint = $"{secondaryRegionEndpoint}:443/" + } + }; + + // Create a mock http handler to inject proxy responses. + // MockBehavior.Strict ensures that only the mocked APIs get called + List regionsVisited = new List(); + Mock mockHttpHandler = new Mock(MockBehavior.Strict); + string readResponseHexStringWith503Status = "2a000000F70100000000000000000000000000000000000035000201000000000000011c000200000000480000007b22636f6465223a2022343039222c226d657373616765223a2022416e206572726f72206f63637572726564207768696c6520726f7574696e67207468652072657175657374227d"; + string readResponseHexStringWith200Status = "2a000000C80000000000000000000000000000000000000035000201000000000000011c000200000000480000007b22636f6465223a2022343039222c226d657373616765223a2022416e206572726f72206f63637572726564207768696c6520726f7574696e67207468652072657175657374227d"; + mockHttpHandler.Setup(x => x.SendAsync( + It.Is(m => m.RequestUri == globalEndpointUri || m.RequestUri.ToString().Contains(primaryRegionNameForUri) || m.RequestUri.ToString().Contains(secondaryRegionNameForUri)), + It.IsAny())) + .Returns((request, cancellationToken) => + { + if (request.Version == new Version(2, 0)) + { + if (request.RequestUri.ToString().Contains("eastus")) + { + regionsVisited.Add(Regions.EastUS); + return Task.FromResult(new HttpResponseMessage(HttpStatusCode.ServiceUnavailable) + { + RequestMessage = request, + Content = new StreamContent(new MemoryStream(Convert.FromHexString(readResponseHexStringWith503Status))) + }); + } + else if (request.RequestUri.ToString().Contains("westus")) + { + regionsVisited.Add(Regions.WestUS); + return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK) + { + RequestMessage = request, + Content = new StreamContent(new MemoryStream(Convert.FromHexString(readResponseHexStringWith200Status))) + }); + } + } + + return Task.FromResult(MockSetupsHelper.CreateStrongAccount(accountName, writeRegion, readRegions, shouldEnableThinClient: true, shouldEnablePPAF: enablePartitionLevelFailover)); + }); + + MockSetupsHelper.SetupContainerProperties( + mockHttpHandler: mockHttpHandler, + regionEndpoint: primaryRegionEndpoint, + databaseName: databaseName, + containerName: containerName, + containerRid: containerRid); + + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConsistencyLevel = Cosmos.ConsistencyLevel.Strong, + ApplicationPreferredRegions = new List() + { + Regions.EastUS, + Regions.WestUS + }, + ConnectionMode = ConnectionMode.Gateway, + HttpClientFactory = () => new HttpClient(new HttpHandlerHelper(mockHttpHandler.Object)), + }; + + using (CosmosClient customClient = new CosmosClient( + globalEndpoint, + Convert.ToBase64String(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())), + cosmosClientOptions)) + { + Container container = customClient.GetContainer(databaseName, containerName); + + ToDoActivity toDoActivity = new ToDoActivity() + { + Id = "TestItem", + Pk = "TestPk" + }; + + ItemResponse readResponse = await container.ReadItemAsync(toDoActivity.Id, new Cosmos.PartitionKey(toDoActivity.Pk)); + Assert.AreEqual(HttpStatusCode.OK, readResponse.StatusCode); + Assert.IsTrue(regionsVisited.Count == 2); + Assert.AreEqual(Regions.EastUS, regionsVisited[0]); + Assert.AreEqual(Regions.WestUS, regionsVisited[1]); + + CosmosTraceDiagnostics traceDiagnostic = readResponse.Diagnostics as CosmosTraceDiagnostics; + Assert.IsNotNull(traceDiagnostic); + + traceDiagnostic.Value.Data.TryGetValue("Hedge Context", out object hedgeContext); + + if (enablePartitionLevelFailover) + { + Assert.IsNotNull(hedgeContext); + List hedgedRegions = ((IEnumerable)hedgeContext).ToList(); + + Assert.IsTrue(hedgedRegions.Count >= 1, "Since the first region is not available, the request should atleast hedge to the next region."); + Assert.IsTrue(hedgedRegions.Contains(Regions.EastUS)); + } + else + { + Assert.IsNull(hedgeContext); + } + + mockHttpHandler.VerifyAll(); + } + } + finally + { + // Reset the environment variable to avoid impacting other tests. + Environment.SetEnvironmentVariable(ConfigurationManager.ThinClientModeEnabled, null); + } + } + + [TestMethod] + [Owner("dkunda")] + public async Task ReadItemAsync_WithThinClientEnabledAndHttpRequestExceptionReceived_ShouldMarkEndpointUnavailable() + { + try + { + // testhost.dll.config sets it to 2 seconds which causes it to always expire before retrying. Remove the override. + System.Configuration.ConfigurationManager.AppSettings["UnavailableLocationsExpirationTimeInSeconds"] = "500"; + + Environment.SetEnvironmentVariable(ConfigurationManager.ThinClientModeEnabled, "True"); + string accountName = nameof(TestHttpRequestExceptionScenarioAsync); + string primaryRegionNameForUri = "eastus"; + string secondaryRegionNameForUri = "westus"; + string globalEndpoint = $"https://{accountName}.documents.azure.com:443/"; + Uri globalEndpointUri = new Uri(globalEndpoint); + string primaryRegionEndpoint = $"https://{accountName}-{primaryRegionNameForUri}.documents.azure.com"; + string secondaryRegionEndpoint = $"https://{accountName}-{secondaryRegionNameForUri}.documents.azure.com"; + string databaseName = "testDb"; + string containerName = "testContainer"; + string containerRid = "ccZ1ANCszwk="; + ResourceId containerResourceId = ResourceId.Parse(containerRid); + + List writeRegion = new List() + { + new AccountRegion() + { + Name = "East US", + Endpoint = $"{primaryRegionEndpoint}:443/" + } + }; + + List readRegions = new List() + { + new AccountRegion() + { + Name = "East US", + Endpoint = $"{primaryRegionEndpoint}:443/" + }, + new AccountRegion() + { + Name = "West US", + Endpoint = $"{secondaryRegionEndpoint}:443/" + } + }; + + // Create a mock http handler to inject proxy responses. + // MockBehavior.Strict ensures that only the mocked APIs get called + List regionsVisited = new List(); + Mock mockHttpHandler = new Mock(MockBehavior.Strict); + string readResponseHexStringWith200Status = "2a000000C80000000000000000000000000000000000000035000201000000000000011c000200000000480000007b22636f6465223a2022343039222c226d657373616765223a2022416e206572726f72206f63637572726564207768696c6520726f7574696e67207468652072657175657374227d"; + mockHttpHandler.Setup(x => x.SendAsync( + It.Is(m => m.RequestUri == globalEndpointUri || m.RequestUri.ToString().Contains(primaryRegionNameForUri) || m.RequestUri.ToString().Contains(secondaryRegionNameForUri)), + It.IsAny())) + .Returns((request, cancellationToken) => + { + if (request.Version == new Version(2, 0)) + { + if (request.RequestUri.ToString().Contains("eastus")) + { + throw new HttpRequestException(); + } + else if (request.RequestUri.ToString().Contains("westus")) + { + regionsVisited.Add(Regions.WestUS); + return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK) + { + RequestMessage = request, + Content = new StreamContent(new MemoryStream(Convert.FromHexString(readResponseHexStringWith200Status))) + }); + } + } + + return Task.FromResult(MockSetupsHelper.CreateStrongAccount(accountName, writeRegion, readRegions, shouldEnableThinClient: true, shouldEnablePPAF: false)); + }); + + MockSetupsHelper.SetupContainerProperties( + mockHttpHandler: mockHttpHandler, + regionEndpoint: primaryRegionEndpoint, + databaseName: databaseName, + containerName: containerName, + containerRid: containerRid); + + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConsistencyLevel = Cosmos.ConsistencyLevel.Strong, + ApplicationPreferredRegions = new List() + { + Regions.EastUS, + Regions.WestUS + }, + ConnectionMode = ConnectionMode.Gateway, + HttpClientFactory = () => new HttpClient(new HttpHandlerHelper(mockHttpHandler.Object)), + }; + + using (CosmosClient customClient = new CosmosClient( + globalEndpoint, + Convert.ToBase64String(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())), + cosmosClientOptions)) + { + Container container = customClient.GetContainer(databaseName, containerName); + ToDoActivity toDoActivity = new ToDoActivity() + { + Id = "TestItem", + Pk = "TestPk" + }; + + ItemResponse readResponse = await container.ReadItemAsync(toDoActivity.Id, new Cosmos.PartitionKey(toDoActivity.Pk)); + Console.WriteLine($"{readResponse.Diagnostics}"); + Assert.AreEqual(HttpStatusCode.OK, readResponse.StatusCode); + Assert.IsTrue(regionsVisited.Count == 1); + Assert.AreEqual(Regions.WestUS, regionsVisited[0]); + + GlobalEndpointManager endpointManager = customClient.DocumentClient.GlobalEndpointManager; + + FieldInfo fieldInfo = endpointManager + .GetType() + .GetField( + name: "locationCache", + bindingAttr: BindingFlags.Instance | BindingFlags.NonPublic); + + LocationCache locationCache = (LocationCache)fieldInfo + .GetValue( + obj: endpointManager); + + MethodInfo method = locationCache.GetType().GetMethod("IsEndpointUnavailable", BindingFlags.NonPublic | BindingFlags.Instance); + + if (method != null) + { + bool isEastUsAvailable = (bool)method.Invoke(locationCache, new object[] { endpointManager.ThinClientReadEndpoints[0], OperationType.Read }); + bool isWestUsAvailable = (bool)method.Invoke(locationCache, new object[] { endpointManager.ThinClientReadEndpoints[1], OperationType.Read }); + + Assert.IsTrue(isWestUsAvailable, "Since West US was never marked unavailable, this endpoint is expected to be available."); + Assert.IsFalse(isEastUsAvailable, "Since East US was marked unavailable, this endpoint is expected to be unavailable."); + } + + mockHttpHandler.VerifyAll(); + } + } + finally + { + // Reset the environment variable to avoid impacting other tests. + Environment.SetEnvironmentVariable(ConfigurationManager.ThinClientModeEnabled, null); + } + } + + [TestMethod] + [Owner("dkunda")] + [DataRow(false, DisplayName = "When PPAF is disabled, Create Item Scenario should not retry on other regions on a single master write account.")] + public async Task CreateItemAsync_WithThinClientEnabledAndServiceUnavailableReceived_ShouldNotRetryOnOtherRegions( + bool enablePartitionLevelFailover) + { + try + { + Environment.SetEnvironmentVariable(ConfigurationManager.ThinClientModeEnabled, "True"); + string accountName = nameof(TestHttpRequestExceptionScenarioAsync); + string primaryRegionNameForUri = "eastus"; + string secondaryRegionNameForUri = "westus"; + string globalEndpoint = $"https://{accountName}.documents.azure.com:443/"; + Uri globalEndpointUri = new Uri(globalEndpoint); + string primaryRegionEndpoint = $"https://{accountName}-{primaryRegionNameForUri}.documents.azure.com"; + string secondaryRegionEndpoint = $"https://{accountName}-{secondaryRegionNameForUri}.documents.azure.com"; + string databaseName = "testDb"; + string containerName = "testContainer"; + string containerRid = "ccZ1ANCszwk="; + ResourceId containerResourceId = ResourceId.Parse(containerRid); + + List writeRegion = new List() + { + new AccountRegion() + { + Name = "East US", + Endpoint = $"{primaryRegionEndpoint}:443/" + } + }; + + List readRegions = new List() + { + new AccountRegion() + { + Name = "East US", + Endpoint = $"{primaryRegionEndpoint}:443/" + }, + new AccountRegion() + { + Name = "West US", + Endpoint = $"{secondaryRegionEndpoint}:443/" + } + }; + + // Create a mock http handler to inject gateway responses. + // MockBehavior.Strict ensures that only the mocked APIs get called + List regionsVisited = new List(); + Mock mockHttpHandler = new Mock(MockBehavior.Strict); + string writeResponseHexStringWith503Status = "2a000000F70100000000000000000000000000000000000035000201000000000000011c000200000000480000007b22636f6465223a2022343039222c226d657373616765223a2022416e206572726f72206f63637572726564207768696c6520726f7574696e67207468652072657175657374227d"; + string writeResponseHexStringWith201Status = "2a000000C90000000000000000000000000000000000000035000201000000000000011c000200000000480000007b22636f6465223a2022343039222c226d657373616765223a2022416e206572726f72206f63637572726564207768696c6520726f7574696e67207468652072657175657374227d"; + mockHttpHandler.Setup(x => x.SendAsync( + It.Is(m => m.RequestUri == globalEndpointUri || m.RequestUri.ToString().Contains(primaryRegionNameForUri) || m.RequestUri.ToString().Contains(secondaryRegionNameForUri)), + It.IsAny())) + .Returns((request, cancellationToken) => + { + if (request.Version == new Version(2, 0)) + { + if (request.RequestUri.ToString().Contains("eastus")) + { + regionsVisited.Add(Regions.EastUS); + return Task.FromResult(new HttpResponseMessage(HttpStatusCode.ServiceUnavailable) + { + RequestMessage = request, + Content = new StreamContent(new MemoryStream(Convert.FromHexString(writeResponseHexStringWith503Status))) + }); + } + else if (request.RequestUri.ToString().Contains("westus")) + { + regionsVisited.Add(Regions.WestUS); + return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK) + { + RequestMessage = request, + Content = new StreamContent(new MemoryStream(Convert.FromHexString(writeResponseHexStringWith201Status))) + }); + } + } + + return Task.FromResult(MockSetupsHelper.CreateStrongAccount(accountName, writeRegion, readRegions, shouldEnableThinClient: true, shouldEnablePPAF: enablePartitionLevelFailover)); + }); + + MockSetupsHelper.SetupContainerProperties( + mockHttpHandler: mockHttpHandler, + regionEndpoint: primaryRegionEndpoint, + databaseName: databaseName, + containerName: containerName, + containerRid: containerRid); + + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions() + { + ConsistencyLevel = Cosmos.ConsistencyLevel.Strong, + ApplicationPreferredRegions = new List() + { + Regions.EastUS, + Regions.WestUS + }, + ConnectionMode = ConnectionMode.Gateway, + HttpClientFactory = () => new HttpClient(new HttpHandlerHelper(mockHttpHandler.Object)), + }; + + using (CosmosClient customClient = new CosmosClient( + globalEndpoint, + Convert.ToBase64String(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())), + cosmosClientOptions)) + { + Container container = customClient.GetContainer(databaseName, containerName); + + ToDoActivity toDoActivity = new ToDoActivity() + { + Id = "TestItem", + Pk = "TestPk" + }; + + if (enablePartitionLevelFailover) + { + ItemResponse createItemResponse = await container.CreateItemAsync(toDoActivity, new Cosmos.PartitionKey(toDoActivity.Pk)); + Console.WriteLine($"{createItemResponse.Diagnostics}"); + Assert.AreEqual(HttpStatusCode.OK, createItemResponse.StatusCode); + Assert.IsTrue(regionsVisited.Count == 2); + Assert.AreEqual(Regions.EastUS, regionsVisited[0]); + Assert.AreEqual(Regions.WestUS, regionsVisited[1]); + + CosmosTraceDiagnostics traceDiagnostic = createItemResponse.Diagnostics as CosmosTraceDiagnostics; + Assert.IsNotNull(traceDiagnostic); + + traceDiagnostic.Value.Data.TryGetValue("Hedge Context", out object hedgeContext); + Assert.IsNull(hedgeContext); + } + else + { + CosmosException exception = await Assert.ThrowsExceptionAsync( + () => container.CreateItemAsync(toDoActivity, new Cosmos.PartitionKey(toDoActivity.Pk))); + + Assert.AreEqual(HttpStatusCode.ServiceUnavailable, exception.StatusCode); + } + + mockHttpHandler.VerifyAll(); + } + } + finally + { + // Reset the environment variable to avoid impacting other tests. + Environment.SetEnvironmentVariable(ConfigurationManager.ThinClientModeEnabled, null); + } + } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeHandlerTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeHandlerTests.cs index ea924a0b89..e2a83f73aa 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeHandlerTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeHandlerTests.cs @@ -656,7 +656,7 @@ public async Task PartitionKeyRangeGoneTracePlumbingTest() using GlobalEndpointManager endpointManager = new(mockDocumentClient.Object, new ConnectionPolicy()); - Mock collectionCache = new Mock(MockBehavior.Strict); + Mock collectionCache = new Mock(MockBehavior.Strict, false); collectionCache.Setup(c => c.ResolveCollectionAsync(It.IsAny(), default, trace)) .ReturnsAsync(containerProperties); @@ -666,7 +666,8 @@ public async Task PartitionKeyRangeGoneTracePlumbingTest() new Mock().Object, new Mock().Object, collectionCache.Object, - endpointManager); + endpointManager, + false); partitionKeyRangeCache.Setup(c => c.TryLookupAsync(collectionRid, null, It.IsAny(), trace)) .ReturnsAsync(collectionRoutingMap); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/OfflineEngine/SqlInterpreter.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/OfflineEngine/SqlInterpreter.cs index e0d02d45c5..875b08eeaa 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/OfflineEngine/SqlInterpreter.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/OfflineEngine/SqlInterpreter.cs @@ -286,7 +286,7 @@ private static IEnumerable ExecuteOrderByClause( element) is not CosmosUndefined); } - IOrderedEnumerable orderedDataSource = firstItem.IsDescending + IOrderedEnumerable orderedDataSource = firstItem.IsDescending.GetValueOrDefault() ? dataSource.OrderByDescending( element => firstItem.Expression.Accept( ScalarExpressionEvaluator.Singleton, @@ -297,7 +297,7 @@ private static IEnumerable ExecuteOrderByClause( element)); foreach (SqlOrderByItem sqlOrderByItem in sqlOrderByClause.OrderByItems.Skip(1)) { - orderedDataSource = sqlOrderByItem.IsDescending + orderedDataSource = sqlOrderByItem.IsDescending.GetValueOrDefault() ? orderedDataSource.ThenByDescending( element => sqlOrderByItem.Expression.Accept( ScalarExpressionEvaluator.Singleton, @@ -319,7 +319,7 @@ private static IEnumerable ExecuteOrderByClause( StringComparer.Ordinal); // Break all final ties within partition by document id - orderedDataSource = firstItem.IsDescending + orderedDataSource = firstItem.IsDescending.GetValueOrDefault() ? orderedDataSource .ThenByDescending(element => ResourceId.Parse(((CosmosString)((CosmosObject)element)["_rid"]).Value).Document) : orderedDataSource diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/OptimisticDirectExecutionQueryBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/OptimisticDirectExecutionQueryBaselineTests.cs index 48c033b0e3..931b2e3a96 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/OptimisticDirectExecutionQueryBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/OptimisticDirectExecutionQueryBaselineTests.cs @@ -827,6 +827,7 @@ internal static Tuple Get allowNonValueAggregateQuery: true, hasLogicalPartitionKey: false, allowDCount: true, + hybridSearchSkipOrderByRewrite: false, useSystemPrefix: false, geospatialType: Cosmos.GeospatialType.Geography); @@ -1027,7 +1028,7 @@ private static IQueryPipelineStage CreateQueryPipelineStage( partitionedQueryExecutionInfo: null, returnResultsInDeterministicOrder: null, enableOptimisticDirectExecution: queryRequestOptions.EnableOptimisticDirectExecution, - isNonStreamingOrderByQueryFeatureDisabled: queryRequestOptions.IsNonStreamingOrderByQueryFeatureDisabled, + isHybridSearchQueryPlanOptimizationDisabled: queryRequestOptions.IsHybridSearchQueryPlanOptimizationDisabled, enableDistributedQueryGatewayMode: queryRequestOptions.EnableDistributedQueryGatewayMode, testInjections: queryRequestOptions.TestSettings); @@ -1357,6 +1358,7 @@ public override Task> TryGetPartitionedQ bool allowNonValueAggregateQuery, bool hasLogicalPartitionKey, bool allowDCount, + bool hybridSearchQuerySkipOrderByRewrite, bool useSystemPrefix, Cosmos.GeospatialType geospatialType, CancellationToken cancellationToken) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Parser/OrderByClauseSqlParserBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Parser/OrderByClauseSqlParserBaselineTests.cs index bc576b27d7..01247405ff 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Parser/OrderByClauseSqlParserBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Parser/OrderByClauseSqlParserBaselineTests.cs @@ -46,6 +46,45 @@ public void MultiOrderBy() this.ExecuteTestSuite(inputs); } + [TestMethod] + public void SingleOrderByRank() + { + List inputs = new List() + { + // Positive + CreateInput(description: "Basic", orderByClause: "ORDER BY RANK FullTextScore(c.text, [\"keyword\"])"), + CreateInput(description: "Ascending", orderByClause: "ORDER BY RANK FullTextScore(c.text, [\"keyword\"]) ASC"), + CreateInput(description: "Descending", orderByClause: "ORDER BY RANK FullTextScore(c.text, [\"keyword\"]) DESC"), + CreateInput(description: "Case Insensitive", orderByClause: "OrDeR By rANk FullTextScore(c.text, [\"keyword\"]) DeSc"), + + // Negative + CreateInput(description: "No spaces", orderByClause: "ORDERBYRANK FullTextScore(c.text, [\"keyword\"])"), + CreateInput(description: "Wrong Keyword", orderByClause: "ORDER BY RANKS FullTextScore(c.text, [\"keyword\"])"), + CreateInput(description: "Not a function call", orderByClause: "ORDER BY RANK 1") + }; + + this.ExecuteTestSuite(inputs); + } + + [TestMethod] + public void MultiOrderByRank() + { + List inputs = new List() + { + // Positive + CreateInput(description: "Basic", orderByClause: "ORDER BY RANK FullTextScore(c.text, [\"keyword\"]), FullTextScore(c.text2, [\"keyword\"]), FullTextScore(c.text3, [\"keyword\"])"), + CreateInput(description: "Only one sort order", orderByClause: "ORDER BY RANK FullTextScore(c.text, [\"keyword\"]) ASC, FullTextScore(c.text2, [\"keyword\"]) ASC, FullTextScore(c.text3, [\"keyword\"]) ASC"), + CreateInput(description: "All sort order", orderByClause: "ORDER BY RANK FullTextScore(c.text, [\"keyword\"]) ASC, FullTextScore(c.text2, [\"keyword\"]) DESC, FullTextScore(c.text3, [\"keyword\"]) ASC"), + + // Negative + CreateInput(description: "Trailing comma", orderByClause: "ORDER BY RANK FullTextScore(c.text, [\"keyword\"]) ASC,"), + CreateInput(description: "All fields not function call", orderByClause: "ORDER BY RANK 1, 2, 3"), + CreateInput(description: "Some fields not function call", orderByClause: "ORDER BY RANK RANK FullTextScore(c.text, [\"keyword\"]) ASC, 2, 3 ASC") + }; + + this.ExecuteTestSuite(inputs); + } + public static SqlParserBaselineTestInput CreateInput(string description, string orderByClause) { return new SqlParserBaselineTestInput(description, $"SELECT * {orderByClause}"); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Pipeline/FullPipelineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Pipeline/FullPipelineTests.cs index 9d92b084e2..4ef83ab057 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Pipeline/FullPipelineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Pipeline/FullPipelineTests.cs @@ -338,7 +338,7 @@ private static IQueryPipelineStage CreateQueryPipelineStage( partitionedQueryExecutionInfo: null, returnResultsInDeterministicOrder: null, enableOptimisticDirectExecution: queryRequestOptions.EnableOptimisticDirectExecution, - isNonStreamingOrderByQueryFeatureDisabled: queryRequestOptions.IsNonStreamingOrderByQueryFeatureDisabled, + isHybridSearchQueryPlanOptimizationDisabled: queryRequestOptions.IsHybridSearchQueryPlanOptimizationDisabled, enableDistributedQueryGatewayMode: queryRequestOptions.EnableDistributedQueryGatewayMode, testInjections: queryRequestOptions.TestSettings); @@ -378,6 +378,7 @@ private static IQueryPipelineStage CreateQueryPipelineStage( It.IsAny(), It.IsAny(), It.IsAny(), + It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) @@ -392,6 +393,7 @@ private static IQueryPipelineStage CreateQueryPipelineStage( bool hasLogicalPartitionKey, bool allowDCount, bool useSystemPrefix, + bool isHybridSearchQueryPlanOptimizationDisabled, Cosmos.GeospatialType geospatialType, CancellationToken cancellationToken) => { @@ -634,7 +636,8 @@ private static QueryInfo GetQueryPlan(string query) isContinuationExpected: false, allowNonValueAggregateQuery: true, allowDCount: true, - hasLogicalPartitionKey: false, + hasLogicalPartitionKey: false, + hybridSearchSkipOrderByRewrite: false, useSystemPrefix: false, geospatialType: Cosmos.GeospatialType.Geography); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Pipeline/NonStreamingOrderByQueryTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Pipeline/NonStreamingOrderByQueryTests.cs index 8b577b5bdb..f9645ef2a5 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Pipeline/NonStreamingOrderByQueryTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Pipeline/NonStreamingOrderByQueryTests.cs @@ -321,6 +321,195 @@ public async Task HybridSearchTests() } } + [TestMethod] + public async Task HybridSearchSkipOrderByRewriteTests() + { + IReadOnlyList testCases = new List + { + MakeHybridSearchSkipOrderByRewriteTest( + leafPageCount: 4, + backendPageSize: 10, + requiresGlobalStatistics: false, + skip: null, + take: 100, + pageSize: 1000), + MakeHybridSearchSkipOrderByRewriteTest( + leafPageCount: 4, + backendPageSize: 10, + requiresGlobalStatistics: false, + skip: 20, + take: 100, + pageSize: 1000), + MakeHybridSearchSkipOrderByRewriteTest( + leafPageCount: 4, + backendPageSize: 10, + requiresGlobalStatistics: true, + skip: 20, + take: 100, + pageSize: 1000), + MakeHybridSearchSkipOrderByRewriteTest( + leafPageCount: 4, + backendPageSize: 10, + requiresGlobalStatistics: true, + skip: 20, + take: 100, + pageSize: 10), + MakeHybridSearchSkipOrderByRewriteTest( + leafPageCount: 10, + backendPageSize: 10, + requiresGlobalStatistics: true, + skip: 20, + take: 100, + pageSize: 10), + MakeHybridSearchSkipOrderByRewriteTest( + leafPageCount: 4, + backendPageSize: 100, + requiresGlobalStatistics: true, + skip: 7, + take: 10, + pageSize: 1), + MakeHybridSearchSkipOrderByRewriteTest( + leafPageCount: 0, + backendPageSize: 10, + requiresGlobalStatistics: true, + skip: 0, + take: 10, + pageSize: 10, + returnEmptyGlobalStatistics: true), + }; + + foreach (HybridSearchTest testCase in testCases) + { + await RunHybridSearchTest(testCase); + } + } + + [TestMethod] + public async Task HybridSearchWeightedRRFTests() + { + IReadOnlyList testCases = new List + { + MakeHybridSearchTest( + leafPageCount: 4, + backendPageSize: 10, + requiresGlobalStatistics: false, + skip: null, + take: 100, + weights: new double[] { 1.0, 1.0 }, + pageSize: 1000), + MakeHybridSearchTest( + leafPageCount: 4, + backendPageSize: 10, + requiresGlobalStatistics: false, + skip: 20, + take: 100, + weights: new double[] { 0.25, 2.1 }, + pageSize: 1000), + MakeHybridSearchTest( + leafPageCount: 0, + backendPageSize: 10, + requiresGlobalStatistics: true, + skip: 0, + take: 10, + weights: new double[] { 1.25, 2.0 }, + pageSize: 10, + returnEmptyGlobalStatistics: true), + MakeHybridSearchTest( + leafPageCount: 4, + backendPageSize: 10, + requiresGlobalStatistics: false, + skip: null, + take: 100, + weights: new double[] { -1.0, -1.0 }, + pageSize: 1000), + MakeHybridSearchTest( + leafPageCount: 4, + backendPageSize: 100, + requiresGlobalStatistics: true, + skip: 7, + take: 10, + weights: new double[] { -1.33, -0.45 }, + pageSize: 1), + MakeHybridSearchTest( + leafPageCount: 0, + backendPageSize: 10, + requiresGlobalStatistics: true, + skip: 0, + take: 10, + weights: new double[] { -1.25, -2.0 }, + pageSize: 10, + returnEmptyGlobalStatistics: true), + }; + + foreach (HybridSearchTest testCase in testCases) + { + await RunHybridSearchTest(testCase); + } + } + + [TestMethod] + public async Task HybridSearchSkipOrderByRewriteWeightedRRFTests() + { + IReadOnlyList testCases = new List + { + MakeHybridSearchSkipOrderByRewriteTest( + leafPageCount: 4, + backendPageSize: 10, + requiresGlobalStatistics: false, + skip: null, + take: 100, + weights: new double[] { 1.0, 1.0 }, + pageSize: 1000), + MakeHybridSearchSkipOrderByRewriteTest( + leafPageCount: 4, + backendPageSize: 10, + requiresGlobalStatistics: false, + skip: 20, + take: 100, + weights: new double[] { 0.25, 2.1 }, + pageSize: 1000), + MakeHybridSearchSkipOrderByRewriteTest( + leafPageCount: 0, + backendPageSize: 10, + requiresGlobalStatistics: true, + skip: 0, + take: 10, + weights: new double[] { 1.25, 2.0 }, + pageSize: 10, + returnEmptyGlobalStatistics: true), + MakeHybridSearchSkipOrderByRewriteTest( + leafPageCount: 4, + backendPageSize: 10, + requiresGlobalStatistics: false, + skip: null, + take: 100, + weights: new double[] { -1.0, -1.0 }, + pageSize: 1000), + MakeHybridSearchSkipOrderByRewriteTest( + leafPageCount: 4, + backendPageSize: 100, + requiresGlobalStatistics: true, + skip: 7, + take: 10, + weights: new double[] { -1.33, -0.45 }, + pageSize: 1), + MakeHybridSearchSkipOrderByRewriteTest( + leafPageCount: 0, + backendPageSize: 10, + requiresGlobalStatistics: true, + skip: 0, + take: 10, + weights: new double[] { -1.25, -2.0 }, + pageSize: 10, + returnEmptyGlobalStatistics: true), + }; + + foreach (HybridSearchTest testCase in testCases) + { + await RunHybridSearchTest(testCase); + } + } + private static async Task RunHybridSearchTest(HybridSearchTest testCase) { IReadOnlyList ranges = new List @@ -340,6 +529,28 @@ private static async Task RunHybridSearchTest(HybridSearchTest testCase) .Range(0, documentCount) .Reverse(); + PartitionedFeedMode[] feedModes = new PartitionedFeedMode[] + { + PartitionedFeedMode.NonStreamingReversed, + PartitionedFeedMode.NonStreamingReversed, + }; + + if (testCase.Weights != null) + { + Assert.IsTrue(testCase.Weights.All(x => x >= 0) || testCase.Weights.All(x => x <= 0)); + + if (testCase.Weights[0] <= 0) + { + expectedIndices = expectedIndices.Reverse(); + + PartitionedFeedMode feedMode = testCase.SkipOrderByRewrite? + PartitionedFeedMode.NonStreamingReversed | PartitionedFeedMode.NegateScores: + PartitionedFeedMode.NonStreaming; + + feedModes = new PartitionedFeedMode[] { feedMode, feedMode }; + } + } + if (testCase.Skip.HasValue) { expectedIndices = expectedIndices.Skip(testCase.Skip.Value); @@ -350,13 +561,13 @@ private static async Task RunHybridSearchTest(HybridSearchTest testCase) expectedIndices = expectedIndices.Take(testCase.Take.Value); } - MockDocumentContainer nonStreamingDocumentContainer = MockDocumentContainer.Create( + MockDocumentContainer nonStreamingDocumentContainer = MockDocumentContainer.CreateHybridSearchContainer( ranges, - PartitionedFeedMode.NonStreamingReversed, - componentCount: 2, + feedModes, leafPageCount: testCase.LeafPageCount, backendPageSize: testCase.BackendPageSize, - returnEmptyGlobalStatistics: testCase.ReturnEmptyGlobalStatistics); + returnEmptyGlobalStatistics: testCase.ReturnEmptyGlobalStatistics, + skipOrderByRewrite: testCase.SkipOrderByRewrite); (IReadOnlyList results, double requestCharge) = await CreateAndRunHybridSearchQueryPipelineStage( documentContainer: nonStreamingDocumentContainer, @@ -364,7 +575,9 @@ private static async Task RunHybridSearchTest(HybridSearchTest testCase) requiresGlobalStatistics: testCase.RequiresGlobalStatistics, pageSize: testCase.PageSize, skip: (uint?)testCase.Skip, - take: (uint?)testCase.Take); + take: (uint?)testCase.Take, + weights: testCase.Weights, + skipOrderByRewrite: testCase.SkipOrderByRewrite); Assert.AreEqual(expectedIndices.Count(), results.Count); @@ -448,15 +661,21 @@ private static async Task RunParityTests( bool requiresGlobalStatistics, int pageSize, uint? skip, - uint? take) + uint? take, + double[] weights, + bool skipOrderByRewrite) { + HybridSearchQueryInfo hybridSearchQueryInfo = skipOrderByRewrite ? + Create2ItemHybridSearchSkipOrderByRewriteQueryInfo(requiresGlobalStatistics, skip, take, weights) : + Create2ItemHybridSearchQueryInfo(requiresGlobalStatistics, skip, take, weights); + TryCatch tryCreatePipeline = PipelineFactory.MonadicCreate( documentContainer, Create2ItemSqlQuerySpec(), ranges, partitionKey: null, queryInfo: null, - Create2ItemHybridSearchQueryInfo(requiresGlobalStatistics, skip, take), + hybridSearchQueryInfo: hybridSearchQueryInfo, maxItemCount: pageSize, new ContainerQueryProperties(), ranges, @@ -628,6 +847,28 @@ public TestCase( } private static HybridSearchTest MakeHybridSearchTest( + int leafPageCount, + int backendPageSize, + bool requiresGlobalStatistics, + int? skip, + int? take, + int pageSize, + bool returnEmptyGlobalStatistics = false, + bool skipOrderByRewrite = false) + { + return new HybridSearchTest( + leafPageCount, + backendPageSize, + requiresGlobalStatistics, + skip, + take, + weights: null, + pageSize, + returnEmptyGlobalStatistics, + skipOrderByRewrite); + } + + private static HybridSearchTest MakeHybridSearchSkipOrderByRewriteTest( int leafPageCount, int backendPageSize, bool requiresGlobalStatistics, @@ -636,7 +877,61 @@ private static HybridSearchTest MakeHybridSearchTest( int pageSize, bool returnEmptyGlobalStatistics = false) { - return new HybridSearchTest(leafPageCount, backendPageSize, requiresGlobalStatistics, skip, take, pageSize, returnEmptyGlobalStatistics); + return new HybridSearchTest( + leafPageCount, + backendPageSize, + requiresGlobalStatistics, + skip, + take, + weights: null, + pageSize, + returnEmptyGlobalStatistics, + skipOrderByRewrite: true); + } + + private static HybridSearchTest MakeHybridSearchTest( + int leafPageCount, + int backendPageSize, + bool requiresGlobalStatistics, + int? skip, + int? take, + double[] weights, + int pageSize, + bool returnEmptyGlobalStatistics = false, + bool skipOrderByRewrite = false) + { + return new HybridSearchTest( + leafPageCount, + backendPageSize, + requiresGlobalStatistics, + skip, + take, + weights, + pageSize, + returnEmptyGlobalStatistics, + skipOrderByRewrite); + } + + private static HybridSearchTest MakeHybridSearchSkipOrderByRewriteTest( + int leafPageCount, + int backendPageSize, + bool requiresGlobalStatistics, + int? skip, + int? take, + double[] weights, + int pageSize, + bool returnEmptyGlobalStatistics = false) + { + return new HybridSearchTest( + leafPageCount, + backendPageSize, + requiresGlobalStatistics, + skip, + take, + weights, + pageSize, + returnEmptyGlobalStatistics, + skipOrderByRewrite: true); } private class HybridSearchTest @@ -651,26 +946,34 @@ private class HybridSearchTest public int? Take { get; } + public double[] Weights { get; } + public int PageSize { get; } public bool ReturnEmptyGlobalStatistics { get; } + public bool SkipOrderByRewrite { get; } + public HybridSearchTest( int leafPageCount, int backendPageSize, bool requiresGlobalStatistics, int? skip, int? take, + double[] weights, int pageSize, - bool returnEmptyGlobalStatistics) + bool returnEmptyGlobalStatistics, + bool skipOrderByRewrite) { this.LeafPageCount = leafPageCount; this.BackendPageSize = backendPageSize; this.RequiresGlobalStatistics = requiresGlobalStatistics; this.Skip = skip; this.Take = take; + this.Weights = weights; this.PageSize = pageSize; this.ReturnEmptyGlobalStatistics = returnEmptyGlobalStatistics; + this.SkipOrderByRewrite = skipOrderByRewrite; } } @@ -846,7 +1149,7 @@ public async Task> MonadicQueryAsync( } QueryPage page = queryPage.Result; - DebugTraceHelpers.TraceBackendResponse(page); + DebugTraceHelpers.TraceBackendResponse(feedRangeState.FeedRange, page); return TryCatch.FromResult(new QueryPage( page.Documents, @@ -993,11 +1296,11 @@ public static void TracePipelineStagePage(QueryPage page) } [Conditional("DEBUG")] - public static void TraceBackendResponse(QueryPage page) + public static void TraceBackendResponse(FeedRangeInternal feedRange, QueryPage page) { if (Enabled) { - System.Diagnostics.Trace.WriteLine("Serving query from backend: "); + System.Diagnostics.Trace.WriteLine($"Serving query from backend: {feedRange}"); TracePage(page); } } @@ -1008,6 +1311,7 @@ public static void TracePage(QueryPage page) if (Enabled) { System.Diagnostics.Trace.WriteLine("Page:"); + System.Diagnostics.Trace.WriteLine($" State: {page.State?.Value}"); System.Diagnostics.Trace.WriteLine($" ActivityId: {page.ActivityId}"); System.Diagnostics.Trace.WriteLine($" RequestCharge: {page.RequestCharge}"); System.Diagnostics.Trace.WriteLine($" ActivityId: {page.ActivityId}"); @@ -1064,24 +1368,26 @@ public double TotalRequestCharge } } - public static MockDocumentContainer Create( + public static MockDocumentContainer CreateHybridSearchContainer( IReadOnlyList feedRanges, - PartitionedFeedMode feedMode, - int componentCount, + PartitionedFeedMode[] feedModes, int leafPageCount, int backendPageSize, - bool returnEmptyGlobalStatistics) + bool returnEmptyGlobalStatistics, + bool skipOrderByRewrite) { + Assert.IsTrue(feedModes.All(x => x.HasFlag(PartitionedFeedMode.NonStreaming)) || feedModes.All(x => !x.HasFlag(PartitionedFeedMode.NonStreaming))); + IReadOnlyList>>> pages = CreateHybridSearchPartitionedFeed( - componentCount, feedRanges, - feedMode, + feedModes, leafPageCount, - backendPageSize); + backendPageSize, + skipOrderByRewrite); return new MockDocumentContainer( pages, - streaming: !feedMode.HasFlag(PartitionedFeedMode.NonStreaming), + streaming: !feedModes[0].HasFlag(PartitionedFeedMode.NonStreaming), componentSelector: GetOrderByScoreKind, isGlobalStatisticsQuery: IsGlobalStatisticsQuery, totalRequestCharge: 0, @@ -1219,7 +1525,7 @@ public Task> MonadicQueryAsync(SqlQuerySpec sqlQuerySpec, Fe state: state, streaming: this.streaming); - DebugTraceHelpers.TraceBackendResponse(queryPage); + DebugTraceHelpers.TraceBackendResponse(feedRangeState.FeedRange, queryPage); Interlocked.Increment(ref this.queryCount); return Task.FromResult(TryCatch.FromResult(queryPage)); @@ -1279,6 +1585,8 @@ enum PartitionedFeedMode NonStreaming = 1, Reversed = 2, + NegateScores = 4, + StreamingReversed = Streaming | Reversed, NonStreamingReversed = NonStreaming | Reversed, } @@ -1331,12 +1639,13 @@ private static IReadOnlyList>>> CreateHybridSearchPartitionedFeed( - int componentCount, IReadOnlyList feedRanges, - PartitionedFeedMode feedMode, + PartitionedFeedMode[] feedModes, int leafPageCount, - int pageSize) + int pageSize, + bool skipOrderByRewrite) { + int componentCount = feedModes.Length; List>>> componentPages = new List>>>(componentCount); for (int componentIndex = 0; componentIndex < componentCount; ++componentIndex) { @@ -1344,9 +1653,14 @@ private static IReadOnlyList CreateHybridSearchDocument(componentCount, index, componentIndex)); + (componentIndex, index) => CreateHybridSearchDocument( + componentCount: componentCount, + index: index, + componentIndex: componentIndex, + skipOrderByRewrite: skipOrderByRewrite, + negateScores: feedModes[componentIndex].HasFlag(PartitionedFeedMode.NegateScores))); componentPages.Add(pages); } @@ -1476,15 +1790,16 @@ private static CosmosElement CreateHybridSearchGlobalStatistics() return globalStatistics; } - private static CosmosElement CreateHybridSearchDocument(int componentCount, int index, int componentIndex) + private static CosmosElement CreateHybridSearchDocument(int componentCount, int index, int componentIndex, bool skipOrderByRewrite, bool negateScores) { CosmosElement indexElement = CosmosNumber64.Create(index); CosmosElement indexStringElement = CosmosString.Create(index.ToString("D4")); double[] scores = new double[componentCount]; double delta = 0.1; + double factor = negateScores ? -1.0 : 1.0; for (int scoreIndex = 0; scoreIndex < componentCount; ++scoreIndex) { - scores[scoreIndex] = index + ((1 + scoreIndex) * delta); + scores[scoreIndex] = factor * (index + ((1 + scoreIndex) * delta)); } List orderByItems = new List @@ -1510,13 +1825,21 @@ private static CosmosElement CreateHybridSearchDocument(int componentCount, int (ulong)index, Documents.ResourceType.Document); - CosmosElement document = CosmosObject.Create(new Dictionary + if (skipOrderByRewrite) { - [RId] = CosmosString.Create(resourceId.ToString()), - [OrderByItems] = CosmosArray.Create(orderByItems), - [Payload] = CosmosObject.Create(payload) - }); + payload.Add(RId, CosmosString.Create(resourceId.ToString())); + } + else + { + payload = new Dictionary + { + [RId] = CosmosString.Create(resourceId.ToString()), + [OrderByItems] = CosmosArray.Create(orderByItems), + [Payload] = CosmosObject.Create(payload) + }; + } + CosmosElement document = CosmosObject.Create(payload); return document; } @@ -1583,8 +1906,22 @@ private static void FischerYatesShuffle(IList list) } } - private static HybridSearchQueryInfo Create2ItemHybridSearchQueryInfo(bool requiresGlobalStatistics, uint? skip, uint? take) + private static HybridSearchQueryInfo Create2ItemHybridSearchQueryInfo(bool requiresGlobalStatistics, uint? skip, uint? take, double[] weights) { + SortOrder[] sortOrders = new SortOrder[] { SortOrder.Descending, SortOrder.Descending }; + string[] sortOrderText = new string[] { "DESC", "DESC" }; + if (weights != null) + { + Assert.AreEqual(2, weights.Length); + + for (int i = 0; i < weights.Length; ++i) + { + sortOrders[i] = weights[i] < 0 ? SortOrder.Ascending : SortOrder.Descending; + sortOrderText[i] = weights[i] < 0 ? "ASC" : "DESC"; + weights[i] = Math.Abs(weights[i]); + } + } + return new HybridSearchQueryInfo { GlobalStatisticsQuery = @" @@ -1613,7 +1950,7 @@ ] AS fullTextStatistics { DistinctType = DistinctQueryType.None, Top = 200, - OrderBy = new List{ SortOrder.Descending }, + OrderBy = new List{ sortOrders[0] }, OrderByExpressions = new List { "_FullTextScore(c.text, [\"swim\", \"run\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})", @@ -1639,7 +1976,7 @@ SELECT TOP 200 } AS payload FROM c WHERE {documentdb-formattableorderbyquery-filter} - ORDER BY _FullTextScore(c.text, [""swim"", ""run""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC", + ORDER BY _FullTextScore(c.text, [""swim"", ""run""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) " + sortOrderText[0], HasNonStreamingOrderBy = true, }, @@ -1647,7 +1984,7 @@ ORDER BY _FullTextScore(c.text, [""swim"", ""run""], {documentdb-formattablehybr { DistinctType = DistinctQueryType.None, Top = 200, - OrderBy = new List{ SortOrder.Descending }, + OrderBy = new List{ sortOrders[1] }, OrderByExpressions = new List { "_FullTextScore(c.abstract, [\"energy\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-1}, {documentdb-formattablehybridsearchquery-hitcountsarray-1})", @@ -1673,19 +2010,120 @@ SELECT TOP 200 } AS payload FROM c WHERE {documentdb-formattableorderbyquery-filter} - ORDER BY _FullTextScore(c.abstract, [""energy""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-1}, {documentdb-formattablehybridsearchquery-hitcountsarray-1}) DESC", + ORDER BY _FullTextScore(c.abstract, [""energy""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-1}, {documentdb-formattablehybridsearchquery-hitcountsarray-1}) " + sortOrderText[1], HasNonStreamingOrderBy = true, }, }, Skip = skip, Take = take, + ComponentWeights = weights?.Select(x => x).ToList(), + RequiresGlobalStatistics = requiresGlobalStatistics, + }; + } + + private static HybridSearchQueryInfo Create2ItemHybridSearchSkipOrderByRewriteQueryInfo(bool requiresGlobalStatistics, uint? skip, uint? take, double[] weights) + { + if (weights != null) + { + Assert.AreEqual(2, weights.Length); + + for (int i = 0; i < weights.Length; ++i) + { + weights[i] = Math.Abs(weights[i]); + } + } + + return new HybridSearchQueryInfo + { + GlobalStatisticsQuery = @" + SELECT + COUNT(1) AS documentCount, + [ + { + totalWordCount: SUM(_FullTextWordCount(c.text)), + hitCounts: [ + COUNTIF(FullTextContains(c.text, ""swim"")), + COUNTIF(FullTextContains(c.text, ""run"")) + ] + }, + { + totalWordCount: SUM(_FullTextWordCount(c.abstract)), + hitCounts: [ + COUNTIF(FullTextContains(c.abstract, ""energy"")) + ] + } + ] AS fullTextStatistics + FROM c", + + ComponentQueryInfos = new List + { + new QueryInfo + { + DistinctType = DistinctQueryType.None, + HasSelectValue = false, + RewrittenQuery = @" + SELECT TOP 200 + c._rid, + { + text: c.text, + abstract: c.abstract + } AS payload, + [ + (_FullTextScore(c.text, [""swim"", ""run""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1), + (_FullTextScore(c.abstract, [""energy""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-1}, {documentdb-formattablehybridsearchquery-hitcountsarray-1}) ?? -1) + ] AS componentScores + FROM c + ORDER BY _FullTextScore(c.text, [""swim"", ""run""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC", + HasNonStreamingOrderBy = false, + }, + + new QueryInfo + { + DistinctType = DistinctQueryType.None, + HasSelectValue = false, + RewrittenQuery = @" + SELECT TOP 200 + c._rid, + { + text: c.text, + abstract: c.abstract + } AS payload, + [ + (_FullTextScore(c.text, [""swim"", ""run""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1), + (_FullTextScore(c.abstract, [""energy""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-1}, {documentdb-formattablehybridsearchquery-hitcountsarray-1}) ?? -1) + ] AS componentScores + FROM c + ORDER BY _FullTextScore(c.abstract, [""energy""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-1}, {documentdb-formattablehybridsearchquery-hitcountsarray-1}) DESC", + HasNonStreamingOrderBy = false, + }, + }, + + Skip = skip, + Take = take, + ComponentWeights = weights?.ToList(), RequiresGlobalStatistics = requiresGlobalStatistics, }; } - private static SqlQuerySpec Create2ItemSqlQuerySpec() + private static SqlQuerySpec Create2ItemSqlQuerySpec(double[] weights = null) { + if (weights != null) + { + Assert.AreEqual(2, weights.Length); + + CosmosArray weightsArray = CosmosArray.Create(new List + { + CosmosNumber64.Create(weights[0]), + CosmosNumber64.Create(weights[1]), + }); + + return new SqlQuerySpec(@$" + SELECT TOP 100 c.text, c.abstract + FROM c + ORDER BY RANK RRF(FullTextScore(c.text, ['swim', 'run']), FullTextScore(c.abstract, ['energy']), {weightsArray})"); + } + return new SqlQuerySpec(@" SELECT TOP 100 c.text, c.abstract FROM c diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/QueryPartitionProviderTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/QueryPartitionProviderTests.cs index 2c5dbfa04b..4859320467 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/QueryPartitionProviderTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/QueryPartitionProviderTests.cs @@ -39,7 +39,8 @@ public void TestQueryPartitionProviderUpdate() isContinuationExpected: false, allowNonValueAggregateQuery: true, hasLogicalPartitionKey: false, - allowDCount: true, + allowDCount: true, + hybridSearchSkipOrderByRewrite: false, useSystemPrefix: false, geospatialType: Cosmos.GeospatialType.Geography); @@ -57,6 +58,7 @@ public void TestQueryPartitionProviderUpdate() allowNonValueAggregateQuery: true, hasLogicalPartitionKey: false, allowDCount: true, + hybridSearchSkipOrderByRewrite: false, useSystemPrefix: false, geospatialType: Cosmos.GeospatialType.Geography); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/QueryPlanBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/QueryPlanBaselineTests.cs index f6207fd291..3b12b2f4ba 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/QueryPlanBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/QueryPlanBaselineTests.cs @@ -1696,7 +1696,8 @@ public override QueryPlanBaselineTestOutput ExecuteTest(QueryPlanBaselineTestInp isContinuationExpected: false, allowNonValueAggregateQuery: true, hasLogicalPartitionKey: false, - allowDCount: true, + allowDCount: true, + hybridSearchSkipOrderByRewrite: false, useSystemPrefix: false, geospatialType: input.GeospatialType ?? Cosmos.GeospatialType.Geography); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/QueryPlanRetrieverTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/QueryPlanRetrieverTests.cs index 7dd2de521d..6c4c376276 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/QueryPlanRetrieverTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/QueryPlanRetrieverTests.cs @@ -1,135 +1,585 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Tests.Query -{ - using System; - using System.Collections.ObjectModel; - using System.Net; - using System.Threading; - using System.Threading.Tasks; - using Microsoft.Azure.Cosmos.Query.Core; - using Microsoft.Azure.Cosmos.Query.Core.Exceptions; - using Microsoft.Azure.Cosmos.Query.Core.Monads; - using Microsoft.Azure.Cosmos.Query.Core.QueryClient; - using Microsoft.Azure.Cosmos.Query.Core.QueryPlan; - using Microsoft.Azure.Cosmos.Tracing; - using Microsoft.Azure.Documents; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using Moq; - - [TestClass] - public class QueryPlanRetrieverTests - { - [TestMethod] - public async Task ServiceInterop_BadRequestContainsInnerException() - { - ExpectedQueryPartitionProviderException innerException = new ExpectedQueryPartitionProviderException("some parsing error"); - Mock queryClient = new Mock(); - - queryClient.Setup(c => c.TryGetPartitionedQueryExecutionInfoAsync( - It.IsAny(), - It.IsAny(), +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Tests.Query +{ + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.IO; + using System.Linq; + using System.Net; + using System.Threading; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos.Query.Core; + using Microsoft.Azure.Cosmos.Query.Core.Exceptions; + using Microsoft.Azure.Cosmos.Query.Core.Monads; + using Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination; + using Microsoft.Azure.Cosmos.Query.Core.QueryClient; + using Microsoft.Azure.Cosmos.Query.Core.QueryPlan; + using Microsoft.Azure.Cosmos.Tracing; + using Microsoft.Azure.Documents; + using Microsoft.Azure.Documents.Routing; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Newtonsoft.Json; + + [TestClass] + public class QueryPlanRetrieverTests + { + private static readonly IDictionary DefaultQueryEngineConfiguration = + new Dictionary() + { + {"maxSqlQueryInputLength", 30720}, + {"maxJoinsPerSqlQuery", 5}, + {"maxLogicalAndPerSqlQuery", 200}, + {"maxLogicalOrPerSqlQuery", 200}, + {"maxUdfRefPerSqlQuery", 6}, + {"maxInExpressionItemsCount", 8000}, + {"queryMaxInMemorySortDocumentCount", 500}, + {"maxQueryRequestTimeoutFraction", 0.90}, + {"sqlAllowNonFiniteNumbers", false}, + {"sqlAllowAggregateFunctions", true}, + {"sqlAllowSubQuery", false}, + {"allowNewKeywords", true}, + {"sqlAllowLike", true}, + {"sqlAllowGroupByClause", false}, + {"queryEnableMongoNativeRegex", true}, + {"queryEnableDynamicDataMasking", true}, + {"maxSpatialQueryCells", 12}, + {"spatialMaxGeometryPointCount", 256}, + {"sqlDisableOptimizationFlags", 0}, + {"sqlQueryILDisableOptimizationFlags", 0}, + {"sqlEnableParameterExpansionCheck", true}, + {"clientDisableOptimisticDirectExecution", false}, + {"queryEnableFullText", true} + }; + + private static readonly PartitionKeyDefinition PartitionKeyDefinition = new PartitionKeyDefinition + { + Paths = new Collection { "/id" }, + Kind = PartitionKind.Hash, + Version = PartitionKeyDefinitionVersion.V2 + }; + + [TestMethod] + public async Task ServiceInterop_BadRequestContainsInnerException() + { + ExpectedQueryPartitionProviderException innerException = new ExpectedQueryPartitionProviderException("some parsing error"); + Mock queryClient = new Mock(); + + queryClient.Setup(c => c.TryGetPartitionedQueryExecutionInfoAsync( + It.IsAny(), + It.IsAny(), It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny())).ReturnsAsync(TryCatch.FromException(innerException)); - - CosmosException cosmosException = await Assert.ThrowsExceptionAsync(() => QueryPlanRetriever.GetQueryPlanWithServiceInteropAsync( - queryClient.Object, - new SqlQuerySpec("selectttttt * from c"), - ResourceType.Document, + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny())).ReturnsAsync(TryCatch.FromException(innerException)); + + CosmosException cosmosException = await Assert.ThrowsExceptionAsync(() => QueryPlanRetriever.GetQueryPlanWithServiceInteropAsync( + queryClient.Object, + new SqlQuerySpec("selectttttt * from c"), + ResourceType.Document, new Documents.PartitionKeyDefinition() { Paths = new Collection() { "/id" } }, - vectorEmbeddingPolicy:null, - hasLogicalPartitionKey: false, - geospatialType: Cosmos.GeospatialType.Geography, - useSystemPrefix: false, - NoOpTrace.Singleton)); - - Assert.AreEqual(HttpStatusCode.BadRequest, cosmosException.StatusCode); - Assert.AreEqual(innerException, cosmosException.InnerException); - Assert.IsNotNull(cosmosException.Trace); - Assert.IsNotNull(cosmosException.Diagnostics); - } - - [TestMethod] - public async Task ServiceInterop_BadRequestContainsOriginalCosmosException() - { - CosmosException expectedException = new CosmosException("Some message", (HttpStatusCode)429, (int)Documents.SubStatusCodes.Unknown, Guid.NewGuid().ToString(), 0); - Mock queryClient = new Mock(); - - queryClient.Setup(c => c.TryGetPartitionedQueryExecutionInfoAsync( - It.IsAny(), - It.IsAny(), + vectorEmbeddingPolicy:null, + hasLogicalPartitionKey: false, + geospatialType: Cosmos.GeospatialType.Geography, + useSystemPrefix: false, + isHybridSearchQueryPlanOptimizationDisabled: false, + NoOpTrace.Singleton)); + + Assert.AreEqual(HttpStatusCode.BadRequest, cosmosException.StatusCode); + Assert.AreEqual(innerException, cosmosException.InnerException); + Assert.IsNotNull(cosmosException.Trace); + Assert.IsNotNull(cosmosException.Diagnostics); + } + + [TestMethod] + public async Task ServiceInterop_BadRequestContainsOriginalCosmosException() + { + CosmosException expectedException = new CosmosException("Some message", (HttpStatusCode)429, (int)Documents.SubStatusCodes.Unknown, Guid.NewGuid().ToString(), 0); + Mock queryClient = new Mock(); + + queryClient.Setup(c => c.TryGetPartitionedQueryExecutionInfoAsync( + It.IsAny(), + It.IsAny(), It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny())).ReturnsAsync(TryCatch.FromException(expectedException)); - - Mock trace = new Mock(); - CosmosException cosmosException = await Assert.ThrowsExceptionAsync(() => QueryPlanRetriever.GetQueryPlanWithServiceInteropAsync( - queryClient.Object, - new SqlQuerySpec("selectttttt * from c"), - ResourceType.Document, + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny())).ReturnsAsync(TryCatch.FromException(expectedException)); + + Mock trace = new Mock(); + CosmosException cosmosException = await Assert.ThrowsExceptionAsync(() => QueryPlanRetriever.GetQueryPlanWithServiceInteropAsync( + queryClient.Object, + new SqlQuerySpec("selectttttt * from c"), + ResourceType.Document, new Documents.PartitionKeyDefinition() { Paths = new Collection() { "/id" } }, - vectorEmbeddingPolicy: null, - hasLogicalPartitionKey: false, - geospatialType: Cosmos.GeospatialType.Geography, - useSystemPrefix: false, - trace.Object, - default)); - - Assert.AreEqual(expectedException, cosmosException); - } - - [TestMethod] - public async Task ServiceInterop_E_UNEXPECTED() - { - UnexpectedQueryPartitionProviderException innerException = new UnexpectedQueryPartitionProviderException("E_UNEXPECTED"); - Mock queryClient = new Mock(); - - queryClient.Setup(c => c.TryGetPartitionedQueryExecutionInfoAsync( - It.IsAny(), - It.IsAny(), + vectorEmbeddingPolicy: null, + hasLogicalPartitionKey: false, + geospatialType: Cosmos.GeospatialType.Geography, + useSystemPrefix: false, + isHybridSearchQueryPlanOptimizationDisabled: false, + trace.Object, + default)); + + Assert.AreEqual(expectedException, cosmosException); + } + + [TestMethod] + public async Task ServiceInterop_E_UNEXPECTED() + { + UnexpectedQueryPartitionProviderException innerException = new UnexpectedQueryPartitionProviderException("E_UNEXPECTED"); + Mock queryClient = new Mock(); + + queryClient.Setup(c => c.TryGetPartitionedQueryExecutionInfoAsync( + It.IsAny(), + It.IsAny(), It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny())).ReturnsAsync(TryCatch.FromException(innerException)); - - CosmosException cosmosException = await Assert.ThrowsExceptionAsync(() => QueryPlanRetriever.GetQueryPlanWithServiceInteropAsync( - queryClient.Object, - new SqlQuerySpec("Super secret query that triggers bug"), - ResourceType.Document, - new Documents.PartitionKeyDefinition() { Paths = new Collection() { "/id" } }, - vectorEmbeddingPolicy: null, + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny())).ReturnsAsync(TryCatch.FromException(innerException)); + + CosmosException cosmosException = await Assert.ThrowsExceptionAsync(() => QueryPlanRetriever.GetQueryPlanWithServiceInteropAsync( + queryClient.Object, + new SqlQuerySpec("Super secret query that triggers bug"), + ResourceType.Document, + new Documents.PartitionKeyDefinition() { Paths = new Collection() { "/id" } }, + vectorEmbeddingPolicy: null, + hasLogicalPartitionKey: false, + geospatialType: Cosmos.GeospatialType.Geography, + useSystemPrefix: false, + isHybridSearchQueryPlanOptimizationDisabled: false, + NoOpTrace.Singleton)); + + Assert.AreEqual(HttpStatusCode.InternalServerError, cosmosException.StatusCode); + Assert.AreEqual(innerException, cosmosException.InnerException); + Assert.IsNotNull(cosmosException.Trace); + Assert.IsNotNull(cosmosException.Diagnostics); + } + + [TestMethod] + public async Task SanityTests() + { + TestCase[] testCases = new TestCase[] + { + MakeTest( + query: "SELECT * FROM c ORDER BY c.id", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[""Ascending""],""orderByExpressions"":[""c.id""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT c._rid, [{\""item\"": c.id}] AS orderByItems, c AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY c.id"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), + MakeTest( + query: "SELECT c.id FROM c GROUP BY c.id", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[""c.id""],""groupByAliases"":[""id""],""aggregates"":[],""groupByAliasToAggregateType"":{""id"":null},""rewrittenQuery"":""SELECT [{\""item\"": c.id}] AS groupByItems, {\""id\"": c.id} AS payload\nFROM c\nGROUP BY c.id"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), + MakeTest( + query: "SELECT DISTINCT VALUE c.id FROM c", + expected: @"{""distinctType"":""Unordered"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":"""",""hasSelectValue"":true,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), + MakeTest( + query: "SELECT c.id, VectorDistance([-0.008861,0.097097,0.100236,0.070044,-0.079279,0.000923,-0.012829,0.064301,-0.029405], c.vector1, true, {dataType:'Float32', distanceFunction:'DotProduct'}) AS VectorDistance" + + " FROM c" + + " ORDER BY VectorDistance([-0.008861,0.097097,0.100236,0.070044,-0.079279,0.000923,-0.012829,0.064301,-0.029405], c.vector1, true, {dataType:'Float32', distanceFunction:'DotProduct'})", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""VectorDistance([-0.008861, 0.097097, 0.100236, 0.070044, -0.079279, 0.000923, -0.012829, 0.064301, -0.029405], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""DotProduct\""})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT c._rid, [{\""item\"": VectorDistance([-0.008861, 0.097097, 0.100236, 0.070044, -0.079279, 0.000923, -0.012829, 0.064301, -0.029405], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""DotProduct\""})}] AS orderByItems, {\""id\"": c.id, \""VectorDistance\"": VectorDistance([-0.008861, 0.097097, 0.100236, 0.070044, -0.079279, 0.000923, -0.012829, 0.064301, -0.029405], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""DotProduct\""})} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY VectorDistance([-0.008861, 0.097097, 0.100236, 0.070044, -0.079279, 0.000923, -0.012829, 0.064301, -0.029405], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""DotProduct\""})"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}"), + MakeTest( + query: "SELECT c._ts" + + " FROM c" + + " ORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {dataType:'Float32', distanceFunction:'DotProduct'})", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""DotProduct\""})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT c._rid, [{\""item\"": VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""DotProduct\""})}] AS orderByItems, {\""_ts\"": c._ts} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""DotProduct\""})"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}"), + MakeTest( + query: "SELECT c._ts" + + " FROM c" + + " ORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {dataType:'Float32', distanceFunction:'Euclidean'})", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[""Ascending""],""orderByExpressions"":[""VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""Euclidean\""})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT c._rid, [{\""item\"": VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""Euclidean\""})}] AS orderByItems, {\""_ts\"": c._ts} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""Euclidean\""})"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}"), + MakeTest( + query: "SELECT c._ts" + + " FROM c" + + " ORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {dataType:'Float32', distanceFunction:'DotProduct'})" + + " OFFSET 5 LIMIT 7", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":5,""limit"":7,""orderBy"":[""Descending""],""orderByExpressions"":[""VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""DotProduct\""})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT c._rid, [{\""item\"": VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""DotProduct\""})}] AS orderByItems, {\""_ts\"": c._ts} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""DotProduct\""})\nOFFSET 0 LIMIT 12"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}"), + MakeTest( + query: "SELECT c._ts" + + " FROM c" + + " ORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {dataType:'Float32', distanceFunction:'Euclidean'})" + + " OFFSET 5 LIMIT 7", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":5,""limit"":7,""orderBy"":[""Ascending""],""orderByExpressions"":[""VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""Euclidean\""})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT c._rid, [{\""item\"": VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""Euclidean\""})}] AS orderByItems, {\""_ts\"": c._ts} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""Euclidean\""})\nOFFSET 0 LIMIT 12"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}"), + MakeTest( + query: "SELECT TOP 10 c._ts" + + " FROM c" + + " ORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {dataType:'Float32', distanceFunction:'DotProduct'})", + expected: @"{""distinctType"":""None"",""top"":10,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""DotProduct\""})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 10 c._rid, [{\""item\"": VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""DotProduct\""})}] AS orderByItems, {\""_ts\"": c._ts} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""DotProduct\""})"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}"), + MakeTest( + query: "SELECT TOP 10 c._ts" + + " FROM c" + + " ORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {dataType:'Float32', distanceFunction:'Euclidean'})", + expected: @"{""distinctType"":""None"",""top"":10,""offset"":null,""limit"":null,""orderBy"":[""Ascending""],""orderByExpressions"":[""VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""Euclidean\""})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 10 c._rid, [{\""item\"": VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""Euclidean\""})}] AS orderByItems, {\""_ts\"": c._ts} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""Euclidean\""})"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}"), + MakeTest( + query: "SELECT TOP 10 c._ts" + + " FROM c" + + " ORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {dataType:'Float32'})", + @"{""vectorEmbeddings"": [{""path"": ""/vector1"", ""dataType"": ""float32"", ""dimensions"": 128, ""distanceFunction"": ""euclidean"" }]}", + expected: @"{""distinctType"":""None"",""top"":10,""offset"":null,""limit"":null,""orderBy"":[""Ascending""],""orderByExpressions"":[""VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\""})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 10 c._rid, [{\""item\"": VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\""})}] AS orderByItems, {\""_ts\"": c._ts} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\""})"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}"), + MakeTest( + query: "SELECT TOP 10 c._ts" + + " FROM c" + + " ORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {dataType:'Float32'})", + @"{""vectorEmbeddings"": [{""path"": ""/vector1"", ""dataType"": ""float32"", ""dimensions"": 128, ""distanceFunction"": ""cosine"" }]}", + expected: @"{""distinctType"":""None"",""top"":10,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\""})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 10 c._rid, [{\""item\"": VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\""})}] AS orderByItems, {\""_ts\"": c._ts} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\""})"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}"), + MakeTest( + query: "SELECT TOP 10 c._ts" + + " FROM c" + + " ORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {dataType:'Float32'})", + @"{""vectorEmbeddings"": [{""path"": ""/vector1"", ""dataType"": ""float32"", ""dimensions"": 128, ""distanceFunction"": ""dotproduct"" }]}", + expected: @"{""distinctType"":""None"",""top"":10,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\""})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 10 c._rid, [{\""item\"": VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\""})}] AS orderByItems, {\""_ts\"": c._ts} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\""})"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}"), + MakeTest( + query: "SELECT TOP 10 c._ts" + + " FROM c" + + " ORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {dataType:'Float32', distanceFunction:'Cosine'})", + @"{""vectorEmbeddings"": [{""path"": ""/vector1"", ""dataType"": ""float32"", ""dimensions"": 128, ""distanceFunction"": ""euclidean"" }]}", + expected: @"{""distinctType"":""None"",""top"":10,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""Cosine\""})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 10 c._rid, [{\""item\"": VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""Cosine\""})}] AS orderByItems, {\""_ts\"": c._ts} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""Cosine\""})"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}"), + MakeTest( + query: "SELECT TOP 10 c._ts" + + " FROM c" + + " ORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {dataType:'Float32', distanceFunction:'DotProduct'})", + @"{""vectorEmbeddings"": [{""path"": ""/vector1"", ""dataType"": ""float32"", ""dimensions"": 128, ""distanceFunction"": ""euclidean"" }]}", + expected: @"{""distinctType"":""None"",""top"":10,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""DotProduct\""})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 10 c._rid, [{\""item\"": VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""DotProduct\""})}] AS orderByItems, {\""_ts\"": c._ts} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""DotProduct\""})"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}"), + MakeTest( + query: "SELECT TOP 10 c._ts" + + " FROM c" + + " ORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {dataType:'Float32', distanceFunction:'Euclidean'})", + @"{""vectorEmbeddings"": [{""path"": ""/vector1"", ""dataType"": ""float32"", ""dimensions"": 128, ""distanceFunction"": ""dotproduct"" }]}", + expected: @"{""distinctType"":""None"",""top"":10,""offset"":null,""limit"":null,""orderBy"":[""Ascending""],""orderByExpressions"":[""VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""Euclidean\""})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 10 c._rid, [{\""item\"": VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""Euclidean\""})}] AS orderByItems, {\""_ts\"": c._ts} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY VectorDistance([0.66178012, -0.37191326, 0.97474534, -0.07378916, 0.19075451], c.vector1, true, {\""dataType\"": \""Float32\"", \""distanceFunction\"": \""Euclidean\""})"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}"), + MakeTest( + query: "SELECT VALUE MAKELIST(c.id) FROM c", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[""MakeList""],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT VALUE [{\""item\"": MAKELIST(c.id)}]\nFROM c"",""hasSelectValue"":true,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), + MakeTest( + query: "SELECT VALUE MAKESET(c.id) FROM c", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[""MakeSet""],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT VALUE [{\""item\"": MAKESET(c.id)}]\nFROM c"",""hasSelectValue"":true,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), + MakeTest( + query: "SELECT MAKELIST(c.id) FROM c", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[""$1""],""aggregates"":[],""groupByAliasToAggregateType"":{""$1"":""MakeList""},""rewrittenQuery"":""SELECT {\""$1\"": {\""item\"": MAKELIST(c.id)}} AS payload\nFROM c"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), + MakeTest( + query: "SELECT MAKESET(c.id) FROM c", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[""$1""],""aggregates"":[],""groupByAliasToAggregateType"":{""$1"":""MakeSet""},""rewrittenQuery"":""SELECT {\""$1\"": {\""item\"": MAKESET(c.id)}} AS payload\nFROM c"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), + MakeTest( + query: "SELECT MAKELIST(c.id) FROM c GROUP BY c.zipcode", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[""c.zipcode""],""groupByAliases"":[""$1""],""aggregates"":[],""groupByAliasToAggregateType"":{""$1"":""MakeList""},""rewrittenQuery"":""SELECT [{\""item\"": c.zipcode}] AS groupByItems, {\""$1\"": {\""item\"": MAKELIST(c.id)}} AS payload\nFROM c\nGROUP BY c.zipcode"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), + MakeTest( + query: "SELECT MAKESET(c.id) FROM c GROUP BY c.zipcode", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[""c.zipcode""],""groupByAliases"":[""$1""],""aggregates"":[],""groupByAliasToAggregateType"":{""$1"":""MakeSet""},""rewrittenQuery"":""SELECT [{\""item\"": c.zipcode}] AS groupByItems, {\""$1\"": {\""item\"": MAKESET(c.id)}} AS payload\nFROM c\nGROUP BY c.zipcode"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), + MakeTest( + query: "SELECT c.zipcode, MAX(c.age) FROM c GROUP BY c.zipcode", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[""c.zipcode""],""groupByAliases"":[""zipcode"",""$1""],""aggregates"":[],""groupByAliasToAggregateType"":{""$1"":""Max"",""zipcode"":null},""rewrittenQuery"":""SELECT [{\""item\"": c.zipcode}] AS groupByItems, {\""zipcode\"": c.zipcode, \""$1\"": {\""item\"": MAX(c.age), \""item2\"": {\""max\"": MAX(c.age), \""count\"": COUNT(c.age)}}} AS payload\nFROM c\nGROUP BY c.zipcode"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), + MakeTest( + query: "SELECT c.region, c.zipcode, MIN(c.age) AS min_age, MAX(c.age) AS max_age FROM c GROUP BY c.region, c.zipcode", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[""c.region"",""c.zipcode""],""groupByAliases"":[""region"",""zipcode"",""min_age"",""max_age""],""aggregates"":[],""groupByAliasToAggregateType"":{""min_age"":""Min"",""max_age"":""Max"",""region"":null,""zipcode"":null},""rewrittenQuery"":""SELECT [{\""item\"": c.region}, {\""item\"": c.zipcode}] AS groupByItems, {\""region\"": c.region, \""zipcode\"": c.zipcode, \""min_age\"": {\""item\"": MIN(c.age), \""item2\"": {\""min\"": MIN(c.age), \""count\"": COUNT(c.age)}}, \""max_age\"": {\""item\"": MAX(c.age), \""item2\"": {\""max\"": MAX(c.age), \""count\"": COUNT(c.age)}}} AS payload\nFROM c\nGROUP BY c.region, c.zipcode"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), + MakeTest( + query: "SELECT c.zipcode FROM c GROUP BY c.zipcode", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[""c.zipcode""],""groupByAliases"":[""zipcode""],""aggregates"":[],""groupByAliasToAggregateType"":{""zipcode"":null},""rewrittenQuery"":""SELECT [{\""item\"": c.zipcode}] AS groupByItems, {\""zipcode\"": c.zipcode} AS payload\nFROM c\nGROUP BY c.zipcode"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), + MakeTest( + query: "SELECT VALUE COUNTIF(c.valid) FROM c", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[""CountIf""],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT VALUE [{\""item\"": COUNTIF(c.valid)}]\nFROM c"",""hasSelectValue"":true,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), + MakeTest( + query: "SELECT COUNTIF(c.valid) FROM c", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[""$1""],""aggregates"":[],""groupByAliasToAggregateType"":{""$1"":""CountIf""},""rewrittenQuery"":""SELECT {\""$1\"": {\""item\"": COUNTIF(c.valid)}} AS payload\nFROM c"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), + MakeTest( + query: "SELECT COUNTIF(c.valid) FROM c GROUP BY c.zipcode", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[""c.zipcode""],""groupByAliases"":[""$1""],""aggregates"":[],""groupByAliasToAggregateType"":{""$1"":""CountIf""},""rewrittenQuery"":""SELECT [{\""item\"": c.zipcode}] AS groupByItems, {\""$1\"": {\""item\"": COUNTIF(c.valid)}} AS payload\nFROM c\nGROUP BY c.zipcode"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), + MakeTest( + query: "SELECT c.zipcode, COUNTIF(c.valid) AS valid_count FROM c GROUP BY c.zipcode", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[""c.zipcode""],""groupByAliases"":[""zipcode"",""valid_count""],""aggregates"":[],""groupByAliasToAggregateType"":{""zipcode"":null,""valid_count"":""CountIf""},""rewrittenQuery"":""SELECT [{\""item\"": c.zipcode}] AS groupByItems, {\""zipcode\"": c.zipcode, \""valid_count\"": {\""item\"": COUNTIF(c.valid)}} AS payload\nFROM c\nGROUP BY c.zipcode"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), + MakeTest( + query: "SELECT TOP 10 * FROM c ORDER BY RANK FullTextScore(c.text, ['swim', 'run'])", + expected: @"{""globalStatisticsQuery"":""SELECT COUNT(1) AS documentCount, [{\""totalWordCount\"": SUM(_FullTextWordCount(c.text)), \""hitCounts\"": [COUNTIF(FullTextContains(c.text, \""swim\"")), COUNTIF(FullTextContains(c.text, \""run\""))]}] AS fullTextStatistics\nFROM c"",""componentQueryInfos"":[{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}],""componentWithoutPayloadQueryInfos"":[],""projectionQueryInfo"":null,""componentWeights"":[],""skip"":null,""take"":10,""requiresGlobalStatistics"":true}"), + MakeTest( + query: "SELECT TOP 10 * FROM c ORDER BY RANK RRF(FullTextScore(c.text, ['swim', 'run']), VectorDistance(c.image, [1, 2, 3]))", + expected: @"{""globalStatisticsQuery"":""SELECT COUNT(1) AS documentCount, [{\""totalWordCount\"": SUM(_FullTextWordCount(c.text)), \""hitCounts\"": [COUNTIF(FullTextContains(c.text, \""swim\"")), COUNTIF(FullTextContains(c.text, \""run\""))]}] AS fullTextStatistics\nFROM c"",""componentQueryInfos"":[{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1), (_VectorScore(c.image, [1, 2, 3]) ?? -1.79769e+308)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true},{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_VectorScore(c.image, [1, 2, 3])""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _VectorScore(c.image, [1, 2, 3])}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1), (_VectorScore(c.image, [1, 2, 3]) ?? -1.79769e+308)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _VectorScore(c.image, [1, 2, 3])"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}],""componentWithoutPayloadQueryInfos"":[],""projectionQueryInfo"":null,""componentWeights"":[],""skip"":null,""take"":10,""requiresGlobalStatistics"":true}"), + MakeTest( + query: "SELECT TOP 10 * FROM c ORDER BY RANK RRF(VectorDistance(c.backup_image, [0.5, 0.2, 0.33]), VectorDistance(c.image, [1, 2, 3]))", + expected: @"{""globalStatisticsQuery"":""SELECT COUNT(1) AS documentCount, [] AS fullTextStatistics\nFROM c"",""componentQueryInfos"":[{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_VectorScore(c.backup_image, [0.5, 0.2, 0.33])""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _VectorScore(c.backup_image, [0.5, 0.2, 0.33])}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_VectorScore(c.backup_image, [0.5, 0.2, 0.33]) ?? -1.79769e+308), (_VectorScore(c.image, [1, 2, 3]) ?? -1.79769e+308)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _VectorScore(c.backup_image, [0.5, 0.2, 0.33])"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true},{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_VectorScore(c.image, [1, 2, 3])""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _VectorScore(c.image, [1, 2, 3])}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_VectorScore(c.backup_image, [0.5, 0.2, 0.33]) ?? -1.79769e+308), (_VectorScore(c.image, [1, 2, 3]) ?? -1.79769e+308)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _VectorScore(c.image, [1, 2, 3])"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}],""componentWithoutPayloadQueryInfos"":[],""projectionQueryInfo"":null,""componentWeights"":[],""skip"":null,""take"":10,""requiresGlobalStatistics"":false}"), + MakeTest( + query: "SELECT * FROM c WHERE FullTextContains(c.abstract, 'calculation')", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":"""",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), + MakeTest( + query: "SELECT COUNTIF(_FullTextWordCount(c.abstract) > 10), COUNTIF(FullTextContains(c.abstract, 'inspiration')) FROM c", + expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[""$1"",""$2""],""aggregates"":[],""groupByAliasToAggregateType"":{""$1"":""CountIf"",""$2"":""CountIf""},""rewrittenQuery"":""SELECT {\""$1\"": {\""item\"": COUNTIF((_FullTextWordCount(c.abstract) > 10))}, \""$2\"": {\""item\"": COUNTIF(FullTextContains(c.abstract, \""inspiration\""))}} AS payload\nFROM c"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), + MakeHybridSearchOptimizationTest( + query: "SELECT TOP 10 * FROM c ORDER BY RANK FullTextScore(c.text, 'swim', 'run')", + expected: @"{""globalStatisticsQuery"":""SELECT COUNT(1) AS documentCount, [{\""totalWordCount\"": SUM(_FullTextWordCount(c.text)), \""hitCounts\"": [COUNTIF(FullTextContains(c.text, \""swim\"")), COUNTIF(FullTextContains(c.text, \""run\""))]}] AS fullTextStatistics\nFROM c"",""componentQueryInfos"":[{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\""payload\"": c, \""componentScores\"": []} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}],""componentWithoutPayloadQueryInfos"":[],""projectionQueryInfo"":null,""componentWeights"":[],""skip"":null,""take"":10,""requiresGlobalStatistics"":true}"), + MakeHybridSearchOptimizationTest( + query: "SELECT TOP 10 * FROM c ORDER BY RANK RRF(FullTextScore(c.text, 'swim', 'run'), VectorDistance(c.image, [1, 2, 3]))", + expected: @"{""globalStatisticsQuery"":""SELECT COUNT(1) AS documentCount, [{\""totalWordCount\"": SUM(_FullTextWordCount(c.text)), \""hitCounts\"": [COUNTIF(FullTextContains(c.text, \""swim\"")), COUNTIF(FullTextContains(c.text, \""run\""))]}] AS fullTextStatistics\nFROM c"",""componentQueryInfos"":[{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, c AS payload, [(_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1), (_VectorScore(c.image, [1, 2, 3]) ?? -1.79769e+308)] AS componentScores\nFROM c\nORDER BY _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false},{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, c AS payload, [(_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1), (_VectorScore(c.image, [1, 2, 3]) ?? -1.79769e+308)] AS componentScores\nFROM c\nORDER BY _VectorScore(c.image, [1, 2, 3])"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}],""componentWithoutPayloadQueryInfos"":[],""projectionQueryInfo"":null,""componentWeights"":[],""skip"":null,""take"":10,""requiresGlobalStatistics"":true}"), + MakeTest( + query: "SELECT TOP 10 * FROM c ORDER BY RANK RRF(VectorDistance(c.backup_image, [0.5, 0.2, 0.33]), VectorDistance(c.image, [1, 2, 3]), [1, -0.3])", + expected: @"{""globalStatisticsQuery"":""SELECT COUNT(1) AS documentCount, [] AS fullTextStatistics\nFROM c"",""componentQueryInfos"":[{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_VectorScore(c.backup_image, [0.5, 0.2, 0.33])""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _VectorScore(c.backup_image, [0.5, 0.2, 0.33])}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_VectorScore(c.backup_image, [0.5, 0.2, 0.33]) ?? -1.79769e+308), (_VectorScore(c.image, [1, 2, 3]) ?? 1.79769e+308)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _VectorScore(c.backup_image, [0.5, 0.2, 0.33])"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true},{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Ascending""],""orderByExpressions"":[""_VectorScore(c.image, [1, 2, 3])""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _VectorScore(c.image, [1, 2, 3])}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_VectorScore(c.backup_image, [0.5, 0.2, 0.33]) ?? -1.79769e+308), (_VectorScore(c.image, [1, 2, 3]) ?? 1.79769e+308)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _VectorScore(c.image, [1, 2, 3]) ASC"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}],""componentWithoutPayloadQueryInfos"":[],""projectionQueryInfo"":null,""componentWeights"":[1.0,0.3],""skip"":null,""take"":10,""requiresGlobalStatistics"":false}"), + MakeHybridSearchOptimizationTest( + query: "SELECT TOP 10 * FROM c ORDER BY RANK RRF(VectorDistance(c.backup_image, [0.5, 0.2, 0.33]), VectorDistance(c.image, [1, 2, 3]), [1, -0.3])", + expected: @"{""globalStatisticsQuery"":""SELECT COUNT(1) AS documentCount, [] AS fullTextStatistics\nFROM c"",""componentQueryInfos"":[{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, c AS payload, [(_VectorScore(c.backup_image, [0.5, 0.2, 0.33]) ?? -1.79769e+308), (-1 * (_VectorScore(c.image, [1, 2, 3]) ?? 1.79769e+308))] AS componentScores\nFROM c\nORDER BY _VectorScore(c.backup_image, [0.5, 0.2, 0.33])"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false},{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, c AS payload, [(_VectorScore(c.backup_image, [0.5, 0.2, 0.33]) ?? -1.79769e+308), (-1 * (_VectorScore(c.image, [1, 2, 3]) ?? 1.79769e+308))] AS componentScores\nFROM c\nORDER BY _VectorScore(c.image, [1, 2, 3]) ASC"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}],""componentWithoutPayloadQueryInfos"":[],""projectionQueryInfo"":null,""componentWeights"":[1.0,0.3],""skip"":null,""take"":10,""requiresGlobalStatistics"":false}"), + }; + + QueryPartitionProvider queryPartitionProvider = new QueryPartitionProvider(DefaultQueryEngineConfiguration); + CosmosQueryClient queryClient = new MockCosmosQueryClient(queryPartitionProvider); + + foreach (TestCase testCase in testCases) + { + await RunTestAsync(queryClient, testCase); + } + } + + private static async Task RunTestAsync(CosmosQueryClient queryClient, TestCase testCase) + { + DebugTraceHelper.Trace(testCase); + + Cosmos.VectorEmbeddingPolicy vectorEmbeddingPolicy = testCase.VectorEmbeddingPolicy != null ? + JsonConvert.DeserializeObject(testCase.VectorEmbeddingPolicy) : + new Cosmos.VectorEmbeddingPolicy(new Collection()); + + PartitionedQueryExecutionInfo partitionedQueryExecutionInfo = await QueryPlanRetriever.GetQueryPlanWithServiceInteropAsync( + queryClient, + testCase.Query, + ResourceType.Document, + PartitionKeyDefinition, + vectorEmbeddingPolicy, + testCase.HasLogicalPartitionKey, + Cosmos.GeospatialType.Geography, + useSystemPrefix: false, + isHybridSearchQueryPlanOptimizationDisabled: testCase.HybridSearchQueryPlanOptimizationDisabled, + NoOpTrace.Singleton); + + JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings + { + Formatting = Formatting.None, + }; + string queryPlan = partitionedQueryExecutionInfo.QueryInfo != null ? + JsonConvert.SerializeObject(partitionedQueryExecutionInfo.QueryInfo, jsonSerializerSettings) : + JsonConvert.SerializeObject(partitionedQueryExecutionInfo.HybridSearchQueryInfo, jsonSerializerSettings); + DebugTraceHelper.TraceQueryPlan(queryPlan); + + Assert.AreEqual(testCase.ExpectedQueryPlan, queryPlan); + } + + private static TestCase MakeTest( + string query, + string expected) + { + return new TestCase( + new SqlQuerySpec(query), + hasLogicalPartitionKey: false, + vectorEmbeddingPolicy: null, + hybridSearchQueryPlanOptimizationDisabled: true, + expected); + } + + private static TestCase MakeHybridSearchOptimizationTest( + string query, + string expected) + { + return new TestCase( + new SqlQuerySpec(query), + hasLogicalPartitionKey: false, + vectorEmbeddingPolicy: null, + hybridSearchQueryPlanOptimizationDisabled: false, + expected); + } + + private static TestCase MakeTest( + string query, + string vectorEmbeddingPolicy, + string expected) + { + return new TestCase( + new SqlQuerySpec(query), hasLogicalPartitionKey: false, - geospatialType: Cosmos.GeospatialType.Geography, - useSystemPrefix: false, - NoOpTrace.Singleton)); - - Assert.AreEqual(HttpStatusCode.InternalServerError, cosmosException.StatusCode); - Assert.AreEqual(innerException, cosmosException.InnerException); - Assert.IsNotNull(cosmosException.Trace); - Assert.IsNotNull(cosmosException.Diagnostics); - } - } -} + vectorEmbeddingPolicy, + hybridSearchQueryPlanOptimizationDisabled: true, + expected); + } + + private sealed class TestCase + { + public SqlQuerySpec Query { get; } + + public bool HasLogicalPartitionKey { get; } + + public string VectorEmbeddingPolicy { get; } + + public bool HybridSearchQueryPlanOptimizationDisabled { get; } + + public string ExpectedQueryPlan { get; } + + public TestCase( + SqlQuerySpec query, + bool hasLogicalPartitionKey, + string vectorEmbeddingPolicy, + bool hybridSearchQueryPlanOptimizationDisabled, + string expectedQueryPlan) + { + this.Query = query ?? throw new ArgumentNullException(nameof(query)); + this.HasLogicalPartitionKey = hasLogicalPartitionKey; + this.VectorEmbeddingPolicy = vectorEmbeddingPolicy; + this.HybridSearchQueryPlanOptimizationDisabled = hybridSearchQueryPlanOptimizationDisabled; + this.ExpectedQueryPlan = expectedQueryPlan; + } + } + + private static class DebugTraceHelper + { + private const bool Enabled = true; + +#pragma warning disable CS0162 // Unreachable code detected + public static void Trace(TestCase testCase) + { + if (Enabled) + { + System.Diagnostics.Trace.WriteLine(Environment.NewLine); + System.Diagnostics.Trace.WriteLine("Executing test case:"); + System.Diagnostics.Trace.WriteLine(" Query: " + testCase.Query.QueryText); + System.Diagnostics.Trace.WriteLine(" HasLogicalPartitionKey: " + testCase.HasLogicalPartitionKey); + System.Diagnostics.Trace.WriteLine(" VectorEmbeddingPolicy: " + testCase.VectorEmbeddingPolicy); + System.Diagnostics.Trace.WriteLine(" HybridSearchQueryPlanOptimizationDisabled: " + testCase.HybridSearchQueryPlanOptimizationDisabled); + System.Diagnostics.Trace.WriteLine(" ExpectedQueryPlan: " + testCase.ExpectedQueryPlan); + } + } + + public static void TraceQueryPlan(string actualQueryPlan) + { + if (Enabled) + { + System.Diagnostics.Trace.WriteLine("QueryPlan: "+ actualQueryPlan); + } + } + + public static void TraceException(CosmosException exception) + { + if (Enabled) + { + System.Diagnostics.Trace.WriteLine("Encountered Exception:"); + System.Diagnostics.Trace.WriteLine(" " + exception.Message); + } + } +#pragma warning restore CS0162 // Unreachable code detected + } + + private class MockCosmosQueryClient : CosmosQueryClient + { + private readonly QueryPartitionProvider queryPartitionProvider; + + private readonly CosmosSerializerCore serializer = new CosmosSerializerCore(); + + public MockCosmosQueryClient(QueryPartitionProvider queryPartitionProvider) + { + this.queryPartitionProvider = queryPartitionProvider ?? throw new ArgumentNullException(nameof(queryPartitionProvider)); + } + + public override Action OnExecuteScalarQueryCallback => throw new NotImplementedException(); + + public override bool BypassQueryParsing() + { + return false; + } + + public override void ClearSessionTokenCache(string collectionFullName) + { + throw new NotImplementedException(); + } + + public override Task> ExecuteItemQueryAsync(string resourceUri, ResourceType resourceType, OperationType operationType, Cosmos.FeedRange feedRange, QueryRequestOptions requestOptions, AdditionalRequestHeaders additionalRequestHeaders, SqlQuerySpec sqlQuerySpec, string continuationToken, int pageSize, ITrace trace, CancellationToken cancellationToken) + { + throw new NotImplementedException(); + } + + public override Task ExecuteQueryPlanRequestAsync(string resourceUri, ResourceType resourceType, OperationType operationType, SqlQuerySpec sqlQuerySpec, Cosmos.PartitionKey? partitionKey, string supportedQueryFeatures, Guid clientQueryCorrelationId, ITrace trace, CancellationToken cancellationToken) + { + throw new NotImplementedException(); + } + + public override Task ForceRefreshCollectionCacheAsync(string collectionLink, CancellationToken cancellationToken) + { + throw new NotImplementedException(); + } + + public override Task GetCachedContainerQueryPropertiesAsync(string containerLink, Cosmos.PartitionKey? partitionKey, ITrace trace, CancellationToken cancellationToken) + { + throw new NotImplementedException(); + } + + public override Task GetClientDisableOptimisticDirectExecutionAsync() + { + throw new NotImplementedException(); + } + + public override Task> GetTargetPartitionKeyRangeByFeedRangeAsync(string resourceLink, string collectionResourceId, PartitionKeyDefinition partitionKeyDefinition, FeedRangeInternal feedRangeInternal, bool forceRefresh, ITrace trace) + { + throw new NotImplementedException(); + } + + public override Task> GetTargetPartitionKeyRangesAsync(string resourceLink, string collectionResourceId, IReadOnlyList> providedRanges, bool forceRefresh, ITrace trace) + { + throw new NotImplementedException(); + } + + public override Task> TryGetOverlappingRangesAsync(string collectionResourceId, Range range, bool forceRefresh = false) + { + throw new NotImplementedException(); + } + + public override Task> TryGetPartitionedQueryExecutionInfoAsync( + SqlQuerySpec sqlQuerySpec, + ResourceType resourceType, + PartitionKeyDefinition partitionKeyDefinition, + Cosmos.VectorEmbeddingPolicy vectorEmbeddingPolicy, + bool requireFormattableOrderByQuery, + bool isContinuationExpected, + bool allowNonValueAggregateQuery, + bool hasLogicalPartitionKey, + bool allowDCount, + bool useSystemPrefix, + bool isHybridSearchQueryPlanOptimizationDisabled, + Cosmos.GeospatialType geospatialType, + CancellationToken cancellationToken) + { + string queryString = null; + if (sqlQuerySpec != null) + { + using (Stream stream = this.serializer.ToStreamSqlQuerySpec(sqlQuerySpec, resourceType)) + { + using (StreamReader reader = new StreamReader(stream)) + { + queryString = reader.ReadToEnd(); + } + } + } + + return Task.FromResult(this.queryPartitionProvider.TryGetPartitionedQueryExecutionInfo( + querySpecJsonString: queryString, + partitionKeyDefinition: partitionKeyDefinition, + vectorEmbeddingPolicy: vectorEmbeddingPolicy, + requireFormattableOrderByQuery: requireFormattableOrderByQuery, + isContinuationExpected: isContinuationExpected, + allowNonValueAggregateQuery: allowNonValueAggregateQuery, + hasLogicalPartitionKey: hasLogicalPartitionKey, + allowDCount: allowDCount, + useSystemPrefix: useSystemPrefix, + hybridSearchSkipOrderByRewrite: !isHybridSearchQueryPlanOptimizationDisabled, + geospatialType: geospatialType)); + } + } + } +} diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/SubpartitionTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/SubpartitionTests.cs index 2cdaedfc37..01648d77d4 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/SubpartitionTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/SubpartitionTests.cs @@ -136,7 +136,7 @@ private static IQueryPipelineStage CreateQueryPipelineStage( partitionedQueryExecutionInfo: null, returnResultsInDeterministicOrder: null, enableOptimisticDirectExecution: queryRequestOptions.EnableOptimisticDirectExecution, - isNonStreamingOrderByQueryFeatureDisabled: queryRequestOptions.IsNonStreamingOrderByQueryFeatureDisabled, + isHybridSearchQueryPlanOptimizationDisabled: queryRequestOptions.IsHybridSearchQueryPlanOptimizationDisabled, enableDistributedQueryGatewayMode: queryRequestOptions.EnableDistributedQueryGatewayMode, testInjections: queryRequestOptions.TestSettings); @@ -183,7 +183,8 @@ internal static Tuple Get isContinuationExpected: true, allowNonValueAggregateQuery: true, hasLogicalPartitionKey: false, - allowDCount: true, + allowDCount: true, + hybridSearchSkipOrderByRewrite: false, useSystemPrefix: false, geospatialType: Cosmos.GeospatialType.Geography); @@ -368,6 +369,7 @@ public override Task> TryGetPartitionedQ bool hasLogicalPartitionKey, bool allowDCount, bool useSystemPrefix, + bool isHybridSearchQueryPlanOptimizationDisabled, Cosmos.GeospatialType geospatialType, CancellationToken cancellationToken) { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/RetryHandlerTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/RetryHandlerTests.cs index dd771fac1a..ca52e5d356 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/RetryHandlerTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/RetryHandlerTests.cs @@ -5,11 +5,16 @@ namespace Microsoft.Azure.Cosmos.Tests { using System; + using System.Collections.Generic; + using System.IO; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; + using global::Azure; using Microsoft.Azure.Cosmos.Handlers; + using Microsoft.Azure.Cosmos.Routing; + using Microsoft.Azure.Cosmos.Tracing; using Microsoft.Azure.Documents; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -18,6 +23,139 @@ namespace Microsoft.Azure.Cosmos.Tests public class RetryHandlerTests { private static readonly Uri TestUri = new Uri("https://dummy.documents.azure.com:443/dbs"); + [TestMethod] + public async Task ValidateQueryPlanDoesNotThrowExceptionForOverlappingRanges() + { + await this.ValidateOverlappingRangesBehaviorAsync( + operationType: OperationType.QueryPlan, + shouldThrowGoneException: false); + } + + [TestMethod] + public async Task ValidateQueryThrowsGoneExceptionForOverlappingRanges() + { + await this.ValidateOverlappingRangesBehaviorAsync( + operationType: OperationType.Query, + shouldThrowGoneException: true); + } + + private async Task ValidateOverlappingRangesBehaviorAsync( + OperationType operationType, + bool shouldThrowGoneException) + { + // Create overlapping ranges for the test + List overlappingRanges = new List + { + new PartitionKeyRange { Id = "0", MinInclusive = "0D4DC2CD8F49C65A8E0C5306B61B4343", MaxExclusive = "0DCEB8CE51C6BFE84F4BD9409F69B9BB2164DEBD78C50C850E0C1E3E3F0579ED" }, + new PartitionKeyRange { Id = "1", MinInclusive = "0DCEB8CE51C6BFE84F4BD9409F69B9BB2164DEBD78C50C850E0C1E3E3F0579ED", MaxExclusive = "1080F600C27CF98DC13F8639E94E7676" } + }; + + // Create a custom document client with our TestPartitionKeyRangeCache + var testPartitionKeyRangeCache = new TestPartitionKeyRangeCache(overlappingRanges); + var customDocClient = new CustomMockDocumentClient(testPartitionKeyRangeCache); + + // Create CosmosClient with our custom document client + using CosmosClient client = new CosmosClient( + "https://localhost:8081", + MockCosmosUtil.RandomInvalidCorrectlyFormatedAuthKey, + new CosmosClientOptions(), + customDocClient); + + // Create mock container + Mock containerMock = MockCosmosUtil.CreateMockContainer("testDb", "testColl"); + + // Setup container properties + ContainerProperties containerProps = new ContainerProperties("testColl", "/pk"); + var resourceIdProperty = typeof(ContainerProperties).GetProperty( + "ResourceId", + System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + resourceIdProperty.SetValue(containerProps, "testCollRid"); + + // Set up additional mocks as needed + containerMock.Setup(c => c.GetCachedContainerPropertiesAsync( + It.IsAny(), It.IsAny(), It.IsAny())) + .ReturnsAsync(containerProps); + + Mock databaseMock = new Mock(); + databaseMock.Setup(d => d.Id).Returns("testDb"); + containerMock.Setup(c => c.Database).Returns(databaseMock.Object); + + // FeedRangeEpk for the test - use a range that overlaps both partition key ranges + FeedRangeEpk feedRange = new FeedRangeEpk(new Documents.Routing.Range( + "0DCEB8CE51C6BFE84F4BD9409F69B9BB", + "0DCEB8CE51C6BFE84F4BD9409F69B9BBFF", + true, false)); + + RequestInvokerHandler invoker = new RequestInvokerHandler(client, null, null, null) + { + InnerHandler = new TestHandler((request, token) => TestHandler.ReturnSuccess()) + }; + + // Act + ResponseMessage response = await invoker.SendAsync( + "dbs/testDb/colls/testColl", + ResourceType.Document, + operationType, + null, + containerMock.Object, + feedRange, + null, + null, + NoOpTrace.Singleton, + CancellationToken.None); + + // Assert + Assert.IsNotNull(response, "Response should not be null."); + + if (shouldThrowGoneException) + { + Assert.IsFalse(response.IsSuccessStatusCode, "Expected a failure status code for Query operation."); + Assert.AreEqual(HttpStatusCode.Gone, response.StatusCode, "Expected a 410 Gone status code."); + Assert.AreEqual((int)SubStatusCodes.PartitionKeyRangeGone, (int)response.Headers.SubStatusCode, "Expected PartitionKeyRangeGone sub-status code."); + } + else + { + Assert.IsTrue(response.IsSuccessStatusCode, $"Expected a successful status code, but got {response.StatusCode}."); + } + } + + // Custom MockDocumentClient that allows injecting our TestPartitionKeyRangeCache + private class CustomMockDocumentClient : MockDocumentClient + { + private readonly TestPartitionKeyRangeCache testPartitionKeyRangeCache; + + public CustomMockDocumentClient(TestPartitionKeyRangeCache testPartitionKeyRangeCache) + : base(new ConnectionPolicy()) + { + this.testPartitionKeyRangeCache = testPartitionKeyRangeCache; + } + + internal override Task GetPartitionKeyRangeCacheAsync(ITrace trace) + { + return Task.FromResult(this.testPartitionKeyRangeCache); + } + } + + private class TestPartitionKeyRangeCache : PartitionKeyRangeCache + { + private readonly IReadOnlyList overlappingRanges; + + public TestPartitionKeyRangeCache(IReadOnlyList overlappingRanges) + : base(null, null, null, null) // Pass nulls or mocks as needed for base constructor + { + this.overlappingRanges = overlappingRanges; + } + + public override Task> TryGetOverlappingRangesAsync( + string collectionRid, + Documents.Routing.Range range, + ITrace trace, + bool forceRefresh) + { + return Task.FromResult(this.overlappingRanges); + } + } + [TestMethod] public async Task RetryHandlerDoesNotRetryOnSuccess() diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Routing/AsyncCacheNonBlockingTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Routing/AsyncCacheNonBlockingTests.cs index bbdcc90127..8f716618a9 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Routing/AsyncCacheNonBlockingTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Routing/AsyncCacheNonBlockingTests.cs @@ -28,7 +28,7 @@ public class AsyncCacheNonBlockingTests [ExpectedException(typeof(NotFoundException))] public async Task ValidateNegativeScenario(bool forceRefresh) { - AsyncCacheNonBlocking asyncCache = new AsyncCacheNonBlocking(); + AsyncCacheNonBlocking asyncCache = new AsyncCacheNonBlocking(enableAsyncCacheExceptionNoSharing: false); await asyncCache.GetAsync( "test", async (_) => @@ -42,7 +42,7 @@ await asyncCache.GetAsync( [TestMethod] public async Task ValidateMultipleBackgroundRefreshesScenario() { - AsyncCacheNonBlocking asyncCache = new AsyncCacheNonBlocking(); + AsyncCacheNonBlocking asyncCache = new AsyncCacheNonBlocking(enableAsyncCacheExceptionNoSharing: false); string expectedValue = "ResponseValue"; string response = await asyncCache.GetAsync( @@ -75,7 +75,7 @@ public async Task ValidateMultipleBackgroundRefreshesScenario() [ExpectedException(typeof(NotFoundException))] public async Task ValidateNegativeNotAwaitedScenario() { - AsyncCacheNonBlocking asyncCache = new AsyncCacheNonBlocking(); + AsyncCacheNonBlocking asyncCache = new AsyncCacheNonBlocking(enableAsyncCacheExceptionNoSharing: false); Task task1 = asyncCache.GetAsync( "test", async (_) => @@ -105,7 +105,7 @@ await asyncCache.GetAsync( public async Task ValidateNotFoundOnBackgroundRefreshRemovesFromCacheScenario() { string value1 = "Response1Value"; - AsyncCacheNonBlocking asyncCache = new AsyncCacheNonBlocking(); + AsyncCacheNonBlocking asyncCache = new AsyncCacheNonBlocking(enableAsyncCacheExceptionNoSharing: false); string response1 = await asyncCache.GetAsync( "test", async (_) => @@ -171,7 +171,7 @@ await asyncCache.GetAsync( [Owner("jawilley")] public async Task ValidateAsyncCacheNonBlocking() { - AsyncCacheNonBlocking asyncCache = new AsyncCacheNonBlocking(); + AsyncCacheNonBlocking asyncCache = new AsyncCacheNonBlocking(enableAsyncCacheExceptionNoSharing: false); string result = await asyncCache.GetAsync( "test", (_) => Task.FromResult("test2"), @@ -212,7 +212,7 @@ public async Task ValidateAsyncCacheNonBlocking() [Owner("jawilley")] public async Task ValidateCacheValueIsRemovedAfterException() { - AsyncCacheNonBlocking asyncCache = new AsyncCacheNonBlocking(); + AsyncCacheNonBlocking asyncCache = new AsyncCacheNonBlocking(enableAsyncCacheExceptionNoSharing: false); string result = await asyncCache.GetAsync( key: "test", singleValueInitFunc: (_) => Task.FromResult("test2"), @@ -268,7 +268,7 @@ await asyncCache.GetAsync( [Owner("jawilley")] public async Task ValidateConcurrentCreateAsyncCacheNonBlocking() { - AsyncCacheNonBlocking asyncCache = new AsyncCacheNonBlocking(); + AsyncCacheNonBlocking asyncCache = new AsyncCacheNonBlocking(enableAsyncCacheExceptionNoSharing: false); int totalLazyCalls = 0; List tasks = new List(); @@ -292,7 +292,7 @@ public async Task ValidateConcurrentCreateAsyncCacheNonBlocking() [Owner("jawilley")] public async Task ValidateConcurrentCreateWithFailureAsyncCacheNonBlocking() { - AsyncCacheNonBlocking asyncCache = new AsyncCacheNonBlocking(); + AsyncCacheNonBlocking asyncCache = new AsyncCacheNonBlocking(enableAsyncCacheExceptionNoSharing: false); int totalLazyCalls = 0; Random random = new Random(); @@ -331,7 +331,7 @@ await asyncCache.GetAsync( [Owner("jawilley")] public async Task ValidateExceptionScenariosCacheNonBlocking() { - AsyncCacheNonBlocking asyncCache = new AsyncCacheNonBlocking(); + AsyncCacheNonBlocking asyncCache = new AsyncCacheNonBlocking(enableAsyncCacheExceptionNoSharing: false); int totalLazyCalls = 0; try @@ -402,7 +402,7 @@ await asyncCache.GetAsync( public async Task Refresh_WhenRefreshRequestedForAnExistingKey_ShouldRefreshTheCache() { // Arrange. - AsyncCacheNonBlocking asyncCache = new(); + AsyncCacheNonBlocking asyncCache = new (enableAsyncCacheExceptionNoSharing: false); // Act and Assert. string result = await asyncCache.GetAsync( @@ -437,7 +437,7 @@ await Task.Delay( public async Task Refresh_WhenThrowsDocumentClientException_ShouldRemoveKeyFromTheCache() { // Arrange. - AsyncCacheNonBlocking asyncCache = new(); + AsyncCacheNonBlocking asyncCache = new (enableAsyncCacheExceptionNoSharing: false); // Act and Assert. string result = await asyncCache.GetAsync( @@ -491,7 +491,7 @@ await Task.Delay( public async Task Refresh_WhenThrowsOtherException_ShouldNotRemoveKeyFromTheCache() { // Arrange. - AsyncCacheNonBlocking asyncCache = new(); + AsyncCacheNonBlocking asyncCache = new (enableAsyncCacheExceptionNoSharing: false); // Act and Assert. string result = await asyncCache.GetAsync( @@ -531,5 +531,51 @@ public async Task Refresh_WhenThrowsOtherException_ShouldNotRemoveKeyFromTheCach Assert.AreEqual("value1", result); } + + [TestMethod] + [DataRow(true)] + [DataRow(false)] + public async Task ValidateCacheGetAsyncExceptionPostProcessing(bool enabled) + { + // Arrange + Exception testException = new TimeoutException("Simulated timeout exception"); + CancellationToken cancellationToken = CancellationToken.None; + + AsyncCacheNonBlocking asyncCache = new AsyncCacheNonBlocking(enableAsyncCacheExceptionNoSharing: enabled); + + Random random = new Random(); + List tasks = new List(); + for (int i = 0; i < 50; i++) + { + // Insert a random delay to simulate multiple request coming at different times + await Task.Delay(random.Next(0, 5)); + tasks.Add(Task.Run(async () => + { + try + { + await asyncCache.GetAsync( + key: "testKey", + singleValueInitFunc: async (_) => + { + await Task.Delay(5); + throw testException; + }, + forceRefresh: (_) => false); + Assert.Fail(); + } + catch (TimeoutException dce) + { + if (enabled) + { + Assert.IsFalse(Object.ReferenceEquals(dce, testException)); + } + else + { + Assert.IsTrue(Object.ReferenceEquals(dce, testException)); + } + } + })); + } + } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Routing/PartitionRoutingHelperTest.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Routing/PartitionRoutingHelperTest.cs index ca444d7a09..032b099a48 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Routing/PartitionRoutingHelperTest.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Routing/PartitionRoutingHelperTest.cs @@ -718,7 +718,8 @@ private static async Task PrefixPartitionKeyTestRunnerAsync( isContinuationExpected: true, allowNonValueAggregateQuery: false, hasLogicalPartitionKey: false, - allowDCount: true, + allowDCount: true, + hybridSearchSkipOrderByRewrite: false, useSystemPrefix: false, geospatialType: Cosmos.GeospatialType.Geography); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SessionRetryOptionsUnitTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SessionRetryOptionsUnitTests.cs new file mode 100644 index 0000000000..a441ec0669 --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SessionRetryOptionsUnitTests.cs @@ -0,0 +1,76 @@ +namespace Microsoft.Azure.Cosmos.Tests +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Text; + using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; + + /// + /// Tests for + /// + [TestClass] + public class SessionRetryOptionsUnitTests + { + [TestMethod] + public void SessionRetryOptionsValidValuesTest() + { + Environment.SetEnvironmentVariable(ConfigurationManager.MinInRegionRetryTimeForWritesInMs, "200"); + Environment.SetEnvironmentVariable(ConfigurationManager.MaxRetriesInLocalRegionWhenRemoteRegionPreferred, "1"); + try + { + CosmosClientOptions clientOptions = new CosmosClientOptions() + { + EnableRemoteRegionPreferredForSessionRetry = true, + }; + + Assert.IsTrue(clientOptions.SessionRetryOptions.MinInRegionRetryTime == TimeSpan.FromMilliseconds(200)); + Assert.IsTrue(clientOptions.SessionRetryOptions.MaxInRegionRetryCount == 1); + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.MinInRegionRetryTimeForWritesInMs, null); + Environment.SetEnvironmentVariable(ConfigurationManager.MaxRetriesInLocalRegionWhenRemoteRegionPreferred, null); + } + + } + + [TestMethod] + public void SessionRetryOptionsDefaultValuesTest() + { + CosmosClientOptions clientOptions = new CosmosClientOptions() + { + EnableRemoteRegionPreferredForSessionRetry = true, + }; + + Assert.IsTrue(clientOptions.SessionRetryOptions.MinInRegionRetryTime == TimeSpan.FromMilliseconds(500)); + Assert.IsTrue(clientOptions.SessionRetryOptions.MaxInRegionRetryCount == 1); + + } + + [TestMethod] + public void SessionRetryOptionsInValidValuesTest() + { + Environment.SetEnvironmentVariable(ConfigurationManager.MinInRegionRetryTimeForWritesInMs, "50"); + Environment.SetEnvironmentVariable(ConfigurationManager.MaxRetriesInLocalRegionWhenRemoteRegionPreferred, "0"); + try + { + CosmosClientOptions clientOptions = new CosmosClientOptions() + { + EnableRemoteRegionPreferredForSessionRetry = true, + }; + + Assert.IsTrue(clientOptions.SessionRetryOptions.MinInRegionRetryTime == TimeSpan.FromMilliseconds(100)); + Assert.IsTrue(clientOptions.SessionRetryOptions.MaxInRegionRetryCount == 1); + } + finally + { + Environment.SetEnvironmentVariable(ConfigurationManager.MinInRegionRetryTimeForWritesInMs, null); + Environment.SetEnvironmentVariable(ConfigurationManager.MaxRetriesInLocalRegionWhenRemoteRegionPreferred, null); + } + + } + + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SettingsContractTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SettingsContractTests.cs index 88efdcc831..4e7e4a9861 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SettingsContractTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SettingsContractTests.cs @@ -18,6 +18,7 @@ namespace Microsoft.Azure.Cosmos.Tests using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json; using Newtonsoft.Json.Linq; + using FullTextPath = Microsoft.Azure.Cosmos.FullTextPath; [TestClass] public class SettingsContractTests @@ -1136,6 +1137,58 @@ public void VectorEmbeddingPolicySerialization() Assert.IsTrue(embedding2.Equals(vectorEmbeddings.Value()[1].ToObject())); } + [TestMethod] + public void FullTextPolicySerialization() + { + ContainerProperties containerSettings = new ContainerProperties("TestContainer", "/pk"); + string serialization = JsonConvert.SerializeObject(containerSettings); + Assert.IsFalse(serialization.Contains("fullTextPolicy"), "Full Text Policy should not be included by default"); + + string defaultLanguage = "en-US", path1 = "/fts1", path2 = "/fts2", path3 = "/fts3"; + + FullTextPath fullTextPath1 = new Cosmos.FullTextPath() + { + Path = path1, + Language = "en-US", + }; + + FullTextPath fullTextPath2 = new Cosmos.FullTextPath() + { + Path = path2, + Language = "en-US", + }; + + FullTextPath fullTextPath3 = new Cosmos.FullTextPath() + { + Path = path3, + Language = "en-US", + }; + + Collection fullTextPaths = new Collection() + { + fullTextPath1, + fullTextPath2, + fullTextPath3, + }; + + containerSettings.FullTextPolicy = new Cosmos.FullTextPolicy() + { + DefaultLanguage = defaultLanguage, + FullTextPaths = fullTextPaths, + }; + + string serializationWithValues = JsonConvert.SerializeObject(containerSettings); + Assert.IsTrue(serializationWithValues.Contains("fullTextPolicy"), "Full Text Policy should be included."); + + JObject parsed = JObject.Parse(serializationWithValues); + JToken fullTextPathsDeSerialized = parsed["fullTextPolicy"]["fullTextPaths"]; + JToken fullTextLanguageDeSerialized = parsed["fullTextPolicy"]["defaultLanguage"]; + Assert.AreEqual(JTokenType.Array, fullTextPathsDeSerialized.Type, "Full Text Policy serialized paths should be an array."); + Assert.AreEqual(JTokenType.String, fullTextLanguageDeSerialized.Type, "Full Text Policy serialized language should be a string."); + Assert.IsTrue(fullTextPath1.Equals(fullTextPathsDeSerialized.Value()[0].ToObject())); + Assert.IsTrue(fullTextPath2.Equals(fullTextPathsDeSerialized.Value()[1].ToObject())); + } + private static T CosmosDeserialize(string payload) { using (MemoryStream ms = new MemoryStream()) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SqlObjects/SqlObjectVisitorBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SqlObjects/SqlObjectVisitorBaselineTests.cs index 541d6034fa..cba3cfb796 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SqlObjects/SqlObjectVisitorBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SqlObjects/SqlObjectVisitorBaselineTests.cs @@ -12,6 +12,9 @@ namespace Microsoft.Azure.Cosmos.Test.SqlObjects using System.Text.RegularExpressions; using System.Xml; using BaselineTest; + using Microsoft.Azure.Cosmos.CosmosElements; + using Microsoft.Azure.Cosmos.CosmosElements.Numbers; + using Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql; using Microsoft.Azure.Cosmos.SqlObjects; using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json; @@ -401,6 +404,14 @@ public void SqlFunctionCalls() SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.Array, SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(42)))), + new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.ArrayAvg, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.ArrayAvg, + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))))), new SqlObjectVisitorInput( SqlFunctionCallScalarExpression.Names.ArrayConcat, SqlFunctionCallScalarExpression.CreateBuiltin( @@ -628,13 +639,25 @@ public void SqlFunctionCalls() SqlFunctionCallScalarExpression.Names.DateTimeAdd, SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.DateTimeAdd, - SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("Year")), - SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2020)), - SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("YYYY")))), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("yyyy")), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("2020-08-06T20:45:22.1234567Z")))), + new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.DateTimeBin, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.DateTimeBin, + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("2020-08-06T20:45:22.1234567Z")), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("yyyy")))), + new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.DateTimeFormat, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.DateTimeFormat, + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("2020-08-06T20:45:22.1234567Z")), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("(h-hh-hhh)")))), new SqlObjectVisitorInput( SqlFunctionCallScalarExpression.Names.DateTimeDiff, SqlFunctionCallScalarExpression.CreateBuiltin( - SqlFunctionCallScalarExpression.Identifiers.DateTimeAdd, + SqlFunctionCallScalarExpression.Identifiers.DateTimeDiff, SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("Year")), SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("2020-08-06T20:45:22.1234567Z")), SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("2020-08-06T20:45:22.1234567Z")))), @@ -662,6 +685,11 @@ public void SqlFunctionCalls() SqlFunctionCallScalarExpression.Identifiers.DateTimeToTimestamp, SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("2020-08-06T20:45:22.1234567Z")))), new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.Day, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.Day, + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("2020-08-06T20:45:22.1234567Z")))), + new SqlObjectVisitorInput( SqlFunctionCallScalarExpression.Names.Degrees, SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.Degrees, @@ -700,6 +728,13 @@ public void SqlFunctionCalls() SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.GetCurrentTimestamp)), new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.Iif, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.Iif, + SqlLiteralScalarExpression.Create(SqlBooleanLiteral.Create(true)), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("YES")), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("NO")))), + new SqlObjectVisitorInput( SqlFunctionCallScalarExpression.Names.IndexOf, SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.IndexOf, @@ -716,6 +751,11 @@ public void SqlFunctionCalls() SqlFunctionCallScalarExpression.Identifiers.IsBool, SqlLiteralScalarExpression.Create(SqlBooleanLiteral.Create(true)))), new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.IsDateTime, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.IsDateTime, + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(42)))), + new SqlObjectVisitorInput( SqlFunctionCallScalarExpression.Names.IsDefined, SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.IsDefined, @@ -751,6 +791,12 @@ public void SqlFunctionCalls() SqlFunctionCallScalarExpression.Identifiers.IsString, SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("hello")))), new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.LastIndexOf, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.LastIndexOf, + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("ABCDABCDABC")), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("ABC")))), + new SqlObjectVisitorInput( SqlFunctionCallScalarExpression.Names.Left, SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.Left, @@ -799,6 +845,11 @@ public void SqlFunctionCalls() SqlFunctionCallScalarExpression.Identifiers.Min, SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(42)))), new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.Month, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.Month, + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("2020-08-06T20:45:22.1234567Z")))), + new SqlObjectVisitorInput( SqlFunctionCallScalarExpression.Names.ObjectToArray, SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.ObjectToArray, @@ -857,6 +908,54 @@ public void SqlFunctionCalls() SqlFunctionCallScalarExpression.Identifiers.Rtrim, SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(42)))), new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.SetDifference, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.SetDifference, + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))), + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))))), + new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.SetEqual, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.SetEqual, + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))), + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))))), + new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.SetIntersect, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.SetIntersect, + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))), + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))))), + new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.SetUnion, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.SetUnion, + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))), + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))))), + new SqlObjectVisitorInput( SqlFunctionCallScalarExpression.Names.Sign, SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.Sign, @@ -917,6 +1016,21 @@ public void SqlFunctionCalls() SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("hi")), SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("hello")))), new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.StringJoin, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.StringJoin, + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("a")), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("b")), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("c"))), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("hello")))), + new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.StringSplit, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.StringSplit, + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("hello")), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("e")))), + new SqlObjectVisitorInput( SqlFunctionCallScalarExpression.Names.StringToArray, SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.StringToArray, @@ -987,7 +1101,24 @@ public void SqlFunctionCalls() SqlFunctionCallScalarExpression.Names.Upper, SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.Upper, - SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(42)))) + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(42)))), + new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.VectorDistance, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.VectorDistance, + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))), + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))))), + new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.Year, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.Year, + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("2020-08-06T20:45:22.1234567Z")))), }; this.ExecuteTestSuite(inputs); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ThinClientStoreClientTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ThinClientStoreClientTests.cs new file mode 100644 index 0000000000..3fd033ab7a --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ThinClientStoreClientTests.cs @@ -0,0 +1,380 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Tests +{ + using System; + using System.Collections.ObjectModel; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Text; + using System.Threading; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos.Routing; + using Microsoft.Azure.Cosmos.Telemetry; + using Microsoft.Azure.Cosmos.Tracing; + using Microsoft.Azure.Documents; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + + [TestClass] + public class ThinClientStoreClientTests + { + private const string base64MockResponse = + "9AEAAMkAAAAIvhHfD23jSaynaR+gyTZ3AAAAAQIAByFUaHUsIDEzIEZlYiAyMDI1IDE0OjI1OjI4LjAyNCBHTVQEAAgmACIwMDAwYWQzZS0wMDAwLTAyMDAtMDAwMC02N2FlNjRjMDAwMDAiDgAIVABkb2N1bWVudFNpemU9NTEyMDA7ZG9jdW1lbnRzU2l6ZT01MjQyODgwMDtkb2N1bWVudHNDb3VudD0tMTtjb2xsZWN0aW9uU2l6ZT01MjQyODgwMDsPAAhBAGRvY3VtZW50U2l6ZT0wO2RvY3VtZW50c1NpemU9MTtkb2N1bWVudHNDb3VudD04O2NvbGxlY3Rpb25TaXplPTM7EAAHBDEuMTkTAAUKAAAAAAAAABUADgzDMAzDMBxAFwAIOgBkYnMvdGhpbi1jbGllbnQtdGVzdC1kYi9jb2xscy90aGluLWNsaWVudC10ZXN0LWNvbnRhaW5lci0xGAAIDABOSDF1QUo2QU5tMD0aAAUJAAAAAAAAAB4AAgMAAAAfAAIEAAAAIQAIAQAwJgACAQAAACkABQkAAAAAAAAAMAACAAAAADUAAgEAAAA6AAUKAAAAAAAAADsABQkAAAAAAAAAPgAIBQAtMSMxMFEADkjhehSuRxBAYwAIAQAweAAF//////////89AQAAeyJpZCI6IjNiMTFiNDM2LTViMTUtNGQwZS1iZWYwLWY1MzVmNjA0MTQxYyIsInBrIjoicGsiLCJuYW1lIjoiODM2MzI0NTA2IiwiZW1haWwiOiJhYmNAZGVmLmNvbSIsImJvZHkiOiJibGFibGEiLCJfcmlkIjoiTkgxdUFKNkFObTBKQUFBQUFBQUFBQT09IiwiX3NlbGYiOiJkYnMvTkgxdUFBPT0vY29sbHMvTkgxdUFKNkFObTA9L2RvY3MvTkgxdUFKNkFObTBKQUFBQUFBQUFBQT09LyIsIl9ldGFnIjoiXCIwMDAwYWQzZS0wMDAwLTAyMDAtMDAwMC02N2FlNjRjMDAwMDBcIiIsIl9hdHRhY2htZW50cyI6ImF0dGFjaG1lbnRzLyIsIl90cyI6MTczOTQ4MjMwNH0="; + + private readonly Uri thinClientEndpoint = new("https://thinproxy.cosmos.azure.com/"); + + [TestInitialize] + public void TestInitialize() + { + System.Diagnostics.Trace.CorrelationManager.ActivityId = Guid.NewGuid(); + } + + [TestCleanup] + public void TestCleanup() + { + System.Diagnostics.Trace.CorrelationManager.ActivityId = Guid.Empty; + } + + [TestMethod] + [DataRow(HttpStatusCode.NotFound, "{\"message\":\"Sample 404 JSON error.\"}", "application/json")] + [DataRow(HttpStatusCode.InternalServerError, "{\"message\":\"Sample 500 JSON error.\"}", "application/json")] + [DataRow(HttpStatusCode.Forbidden, "403 Forbidden.", "text/html")] + public async Task InvokeAsync_ShouldThrowDocumentClientException(HttpStatusCode statusCode, string content, string contentType) + { + // Arrange + HttpResponseMessage mockResponse = new HttpResponseMessage(statusCode) + { + Content = new StringContent(content, Encoding.UTF8, contentType) + }; + + CosmosHttpClient cosmosHttpClient = MockCosmosUtil.CreateMockCosmosHttpClientFromFunc( + _ => Task.FromResult(mockResponse)); + + ThinClientStoreClient thinClientStoreClient = new ThinClientStoreClient( + httpClient: cosmosHttpClient, + eventSource: null, + serializerSettings: null); + + DocumentServiceRequest request = DocumentServiceRequest.Create( + operationType: OperationType.Read, + resourceType: ResourceType.Document, + resourceId: "docId", + body: null, + authorizationTokenType: AuthorizationTokenType.PrimaryMasterKey); + + request.Headers[HttpConstants.HttpHeaders.PartitionKey] = "[\"myPartitionKey\"]"; + + Mock sessionContainerMock = new Mock(); + Mock storeModelMock = new Mock(); + Mock tokenProviderMock = new Mock(); + Mock retryPolicyFactoryMock = new Mock(); + TelemetryToServiceHelper telemetry = null; + + Mock clientCollectionCacheMock = new Mock( + sessionContainerMock.Object, + storeModelMock.Object, + tokenProviderMock.Object, + retryPolicyFactoryMock.Object, + telemetry, + true) + { + CallBase = true + }; + + clientCollectionCacheMock + .Setup(c => c.ResolveCollectionAsync( + It.IsAny(), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(this.GetMockContainerProperties()); + + // Act + Assert => Should throw DocumentClientException + await Assert.ThrowsExceptionAsync(async () => + await thinClientStoreClient.InvokeAsync( + request, + ResourceType.Document, + new Uri("https://mock.cosmos.com/dbs/mockdb/colls/mockcoll/docs/mockdoc"), + this.thinClientEndpoint, + "mockaccount", + clientCollectionCacheMock.Object, + default)); + } + + [TestMethod] + public async Task InvokeAsync_Rntbd200_ShouldReturnDocumentServiceResponse() + { + HttpResponseMessage successResponse = new HttpResponseMessage(HttpStatusCode.Created) + { + Content = new ByteArrayContent(Convert.FromBase64String(base64MockResponse)) + }; + + CosmosHttpClient cosmosHttpClient = MockCosmosUtil.CreateMockCosmosHttpClientFromFunc( + _ => Task.FromResult(successResponse)); + + ThinClientStoreClient thinClientStoreClient = new ThinClientStoreClient( + httpClient: cosmosHttpClient, + eventSource: null, + serializerSettings: null); + + DocumentServiceRequest request = DocumentServiceRequest.Create( + operationType: OperationType.Read, + resourceType: ResourceType.Document, + resourceId: "docId", + body: null, + authorizationTokenType: AuthorizationTokenType.PrimaryMasterKey); + + // Add partition key + request.Headers[HttpConstants.HttpHeaders.PartitionKey] = "[\"myPartitionKey\"]"; + + Mock sessionContainerMock = new Mock(); + Mock storeModelMock = new Mock(); + Mock tokenProviderMock = new Mock(); + Mock retryPolicyFactoryMock = new Mock(); + TelemetryToServiceHelper telemetry = null; + Mock clientCollectionCacheMock = new Mock( + sessionContainerMock.Object, + storeModelMock.Object, + tokenProviderMock.Object, + retryPolicyFactoryMock.Object, + telemetry, + true) + { + CallBase = true + }; + + clientCollectionCacheMock + .Setup(c => c.ResolveCollectionAsync( + It.IsAny(), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(this.GetMockContainerProperties()); + + // Act + DocumentServiceResponse dsr = await thinClientStoreClient.InvokeAsync( + request, + ResourceType.Document, + new Uri("https://mock.cosmos.com/dbs/mockdb/colls/mockcoll/docs/mockdoc"), + this.thinClientEndpoint, + "mockaccount", + clientCollectionCacheMock.Object, + default); + + // Assert + Assert.IsNotNull(dsr); + Assert.AreEqual(HttpStatusCode.Created, dsr.StatusCode); + } + + [TestMethod] + public async Task InvokeAsync_ShouldAddRequiredProxyHeaders() + { + HttpResponseMessage successResponse = new HttpResponseMessage(HttpStatusCode.Created) + { + Content = new ByteArrayContent(Convert.FromBase64String(base64MockResponse)) + }; + + HttpRequestMessage capturedRequest = null; + Mock mockCosmosHttpClient = new Mock(); + mockCosmosHttpClient.Setup(client => client.SendHttpAsync( + It.IsAny>>(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny())) + .Callback>, ResourceType, HttpTimeoutPolicy, IClientSideRequestStatistics, CancellationToken, DocumentServiceRequest>( + async (requestFactory, _, _, _, _, _) => + capturedRequest = await requestFactory()) + .ReturnsAsync(successResponse); + + ThinClientStoreClient thinClientStoreClient = new ThinClientStoreClient( + httpClient: mockCosmosHttpClient.Object, + eventSource: null, + serializerSettings: null); + + DocumentServiceRequest request = DocumentServiceRequest.Create( + operationType: OperationType.Read, + resourceType: ResourceType.Document, + resourceId: "docId", + body: null, + authorizationTokenType: AuthorizationTokenType.PrimaryMasterKey); + + // Add partition key + request.Headers[HttpConstants.HttpHeaders.PartitionKey] = "[\"myPartitionKey\"]"; + + // Set up a mock partition key range in the request context + PartitionKeyRange mockPartitionKeyRange = new PartitionKeyRange + { + MinInclusive = "00000000-0000-0000-0000-000000000000", + MaxExclusive = "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF" + }; + + // Initialize request context if needed + if (request.RequestContext == null) + { + request.RequestContext = new DocumentServiceRequestContext(); + } + + // Set the partition key range in the request context + request.RequestContext.ResolvedPartitionKeyRange = mockPartitionKeyRange; + + Mock sessionContainerMock = new Mock(); + Mock storeModelMock = new Mock(); + Mock tokenProviderMock = new Mock(); + Mock retryPolicyFactoryMock = new Mock(); + TelemetryToServiceHelper telemetry = null; + Mock clientCollectionCacheMock = new Mock( + sessionContainerMock.Object, + storeModelMock.Object, + tokenProviderMock.Object, + retryPolicyFactoryMock.Object, + telemetry, + true) + { + CallBase = true + }; + + clientCollectionCacheMock + .Setup(c => c.ResolveCollectionAsync( + It.IsAny(), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(this.GetMockContainerProperties()); + + // Act + await thinClientStoreClient.InvokeAsync( + request, + ResourceType.Document, + new Uri("https://mock.cosmos.com/dbs/mockdb/colls/mockcoll/docs/mockdoc"), + this.thinClientEndpoint, + "mockaccount", + clientCollectionCacheMock.Object, + default); + + // Assert + Assert.IsNotNull(capturedRequest, "The request was not captured"); + + // Get all request headers for verification + System.Collections.Generic.Dictionary requestHeaders = capturedRequest.Headers.ToDictionary(h => h.Key, h => h.Value.FirstOrDefault()); + + // Verify the required proxy headers + Assert.IsTrue(requestHeaders.ContainsKey(ThinClientConstants.ProxyStartEpk), "ProxyStartEpk header is missing"); + Assert.AreEqual(mockPartitionKeyRange.MinInclusive, requestHeaders[ThinClientConstants.ProxyStartEpk]); + + Assert.IsTrue(requestHeaders.ContainsKey(ThinClientConstants.ProxyEndEpk), "ProxyEndEpk header is missing"); + Assert.AreEqual(mockPartitionKeyRange.MaxExclusive, requestHeaders[ThinClientConstants.ProxyEndEpk]); + + Assert.IsTrue(requestHeaders.ContainsKey(ThinClientConstants.ProxyOperationType), "ProxyOperationType header is missing"); + Assert.AreEqual(request.OperationType.ToOperationTypeString(), requestHeaders[ThinClientConstants.ProxyOperationType]); + + Assert.IsTrue(requestHeaders.ContainsKey(ThinClientConstants.ProxyResourceType), "ProxyResourceType header is missing"); + Assert.AreEqual(request.ResourceType.ToResourceTypeString(), requestHeaders[ThinClientConstants.ProxyResourceType]); + } + + [TestMethod] + public async Task InvokeAsync_ShouldNotAddProxyEpkHeaders_WhenPartitionKeyRangeIsNull() + { + HttpResponseMessage successResponse = new HttpResponseMessage(HttpStatusCode.Created) + { + Content = new ByteArrayContent(Convert.FromBase64String(base64MockResponse)) + }; + + HttpRequestMessage capturedRequest = null; + Mock mockCosmosHttpClient = new Mock(); + mockCosmosHttpClient.Setup(client => client.SendHttpAsync( + It.IsAny>>(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny())) + .Callback>, ResourceType, HttpTimeoutPolicy, IClientSideRequestStatistics, CancellationToken, DocumentServiceRequest>( + async (requestFactory, _, _, _, _, _) => + capturedRequest = await requestFactory()) + .ReturnsAsync(successResponse); + + ThinClientStoreClient thinClientStoreClient = new ThinClientStoreClient( + httpClient: mockCosmosHttpClient.Object, + eventSource: null, + serializerSettings: null); + + DocumentServiceRequest request = DocumentServiceRequest.Create( + operationType: OperationType.Read, + resourceType: ResourceType.Document, + resourceId: "docId", + body: null, + authorizationTokenType: AuthorizationTokenType.PrimaryMasterKey); + + // Add partition key + request.Headers[HttpConstants.HttpHeaders.PartitionKey] = "[\"myPartitionKey\"]"; + + request.RequestContext.ResolvedPartitionKeyRange = null; + if (request.RequestContext == null) + { + request.RequestContext = new DocumentServiceRequestContext(); + }; + + Mock sessionContainerMock = new Mock(); + Mock storeModelMock = new Mock(); + Mock tokenProviderMock = new Mock(); + Mock retryPolicyFactoryMock = new Mock(); + TelemetryToServiceHelper telemetry = null; + Mock clientCollectionCacheMock = new Mock( + sessionContainerMock.Object, + storeModelMock.Object, + tokenProviderMock.Object, + retryPolicyFactoryMock.Object, + telemetry, + true) + { + CallBase = true + }; + + clientCollectionCacheMock + .Setup(c => c.ResolveCollectionAsync( + It.IsAny(), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(this.GetMockContainerProperties()); + + // Act + await thinClientStoreClient.InvokeAsync( + request, + ResourceType.Document, + new Uri("https://mock.cosmos.com/dbs/mockdb/colls/mockcoll/docs/mockdoc"), + this.thinClientEndpoint, + "mockaccount", + clientCollectionCacheMock.Object, + default); + + // Assert + Assert.IsNotNull(capturedRequest, "The request was not captured"); + + System.Collections.Generic.Dictionary headers = capturedRequest.Headers.ToDictionary(h => h.Key, h => h.Value.FirstOrDefault()); + + Assert.IsFalse(headers.ContainsKey(ThinClientConstants.ProxyStartEpk), "ProxyStartEpk should not be added when PKRange is null"); + Assert.IsFalse(headers.ContainsKey(ThinClientConstants.ProxyEndEpk), "ProxyEndEpk should not be added when PKRange is null"); + } + + private ContainerProperties GetMockContainerProperties() + { + ContainerProperties containerProperties = new ContainerProperties + { + PartitionKey = new PartitionKeyDefinition + { + Paths = new Collection { "/pk" } + } + }; + + typeof(ContainerProperties) + .GetProperty("ResourceId", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance) + ?.SetValue(containerProperties, "-Jlvm9pqHGk="); + + return containerProperties; + } + } +} diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ThinClientStoreModelTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ThinClientStoreModelTests.cs new file mode 100644 index 0000000000..56726374fe --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ThinClientStoreModelTests.cs @@ -0,0 +1,375 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Tests +{ + using System; + using System.IO; + using System.Net; + using System.Net.Http; + using System.Reflection; + using System.Runtime.Serialization; + using System.Threading; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos.Common; + using Microsoft.Azure.Cosmos.Routing; + using Microsoft.Azure.Documents; + using Microsoft.Azure.Documents.Collections; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + + [TestClass] + public class ThinClientStoreModelTests + { + private ThinClientStoreModel thinClientStoreModel; + private GlobalEndpointManager endpointManager; + private SessionContainer sessionContainer; + private readonly ConsistencyLevel defaultConsistencyLevel = ConsistencyLevel.Session; + + [TestInitialize] + public void TestInitialize() + { + this.sessionContainer = new SessionContainer("testhost"); + + Mock mockDocumentClient = new Mock(); + mockDocumentClient + .Setup(c => c.ServiceEndpoint) + .Returns(new Uri("https://mock.proxy.com")); + + ConnectionPolicy connectionPolicy = new ConnectionPolicy + { + UseMultipleWriteLocations = false + }; + + this.endpointManager = new GlobalEndpointManager( + owner: mockDocumentClient.Object, + connectionPolicy: connectionPolicy); + + this.thinClientStoreModel = new ThinClientStoreModel( + endpointManager: this.endpointManager, + globalPartitionEndpointManager: GlobalPartitionEndpointManagerNoOp.Instance, + sessionContainer: this.sessionContainer, + defaultConsistencyLevel: (Cosmos.ConsistencyLevel)this.defaultConsistencyLevel, + eventSource: new DocumentClientEventSource(), + serializerSettings: null, + httpClient: null); + + PartitionKeyRangeCache pkRangeCache = + (PartitionKeyRangeCache)FormatterServices.GetUninitializedObject(typeof(PartitionKeyRangeCache)); + ClientCollectionCache collCache = + (ClientCollectionCache)FormatterServices.GetUninitializedObject(typeof(ClientCollectionCache)); + this.thinClientStoreModel.SetCaches(pkRangeCache, collCache); + + System.Diagnostics.Trace.CorrelationManager.ActivityId = Guid.NewGuid(); + } + + [TestCleanup] + public void TestCleanup() + { + System.Diagnostics.Trace.CorrelationManager.ActivityId = Guid.Empty; + this.thinClientStoreModel?.Dispose(); + } + + [TestMethod] + public async Task ProcessMessageAsync_Success_ShouldReturnDocumentServiceResponse() + { + // Arrange + // A single base64-encoded RNTBD response representing an HTTP 201 (Created) + string mockBase64 = "9AEAAMkAAAAIvhHfD23jSaynaR+gyTZ3AAAAAQIAByFUaHUsIDEzIEZlYiAyMDI1IDE0OjI1OjI4LjAyNCBHTVQEAAgmACIwMDAwYWQzZS0wMDAwLTAyMDAtMDAwMC02N2FlNjRjMDAwMDAiDgAIVABkb2N1bWVudFNpemU9NTEyMDA7ZG9jdW1lbnRzU2l6ZT01MjQyODgwMDtkb2N1bWVudHNDb3VudD0tMTtjb2xsZWN0aW9uU2l6ZT01MjQyODgwMDsPAAhBAGRvY3VtZW50U2l6ZT0wO2RvY3VtZW50c1NpemU9MTtkb2N1bWVudHNDb3VudD04O2NvbGxlY3Rpb25TaXplPTM7EAAHBDEuMTkTAAUKAAAAAAAAABUADgzDMAzDMBxAFwAIOgBkYnMvdGhpbi1jbGllbnQtdGVzdC1kYi9jb2xscy90aGluLWNsaWVudC10ZXN0LWNvbnRhaW5lci0xGAAIDABOSDF1QUo2QU5tMD0aAAUJAAAAAAAAAB4AAgMAAAAfAAIEAAAAIQAIAQAwJgACAQAAACkABQkAAAAAAAAAMAACAAAAADUAAgEAAAA6AAUKAAAAAAAAADsABQkAAAAAAAAAPgAIBQAtMSMxMFEADkjhehSuRxBAYwAIAQAweAAF//////////89AQAAeyJpZCI6IjNiMTFiNDM2LTViMTUtNGQwZS1iZWYwLWY1MzVmNjA0MTQxYyIsInBrIjoicGsiLCJuYW1lIjoiODM2MzI0NTA2IiwiZW1haWwiOiJhYmNAZGVmLmNvbSIsImJvZHkiOiJibGFibGEiLCJfcmlkIjoiTkgxdUFKNkFObTBKQUFBQUFBQUFBQT09IiwiX3NlbGYiOiJkYnMvTkgxdUFBPT0vY29sbHMvTkgxdUFKNkFObTA9L2RvY3MvTkgxdUFKNkFObTBKQUFBQUFBQUFBQT09LyIsIl9ldGFnIjoiXCIwMDAwYWQzZS0wMDAwLTAyMDAtMDAwMC02N2FlNjRjMDAwMDBcIiIsIl9hdHRhY2htZW50cyI6ImF0dGFjaG1lbnRzLyIsIl90cyI6MTczOTQ4MjMwNH0="; + + HttpResponseMessage successResponse = new HttpResponseMessage(HttpStatusCode.Created) + { + Content = new ByteArrayContent(Convert.FromBase64String(mockBase64)) + }; + + MockThinClientStoreClient thinClientStoreClient = new MockThinClientStoreClient( + (request, resourceType, uri, endpoint, globalDatabaseAccountName, clientCollectionCache, cancellationToken) => + { + Stream responseBody = successResponse.Content.ReadAsStream(); + INameValueCollection headers = new StoreResponseNameValueCollection(); + return Task.FromResult(new DocumentServiceResponse(responseBody, headers, successResponse.StatusCode)); + }); + + DocumentServiceRequest request = DocumentServiceRequest.Create( + operationType: OperationType.Create, + resourceType: ResourceType.Document, + resourceId: "NH1uAJ6ANm0=", + body: null, + authorizationTokenType: AuthorizationTokenType.PrimaryMasterKey); + + Mock docClientMulti = new Mock(); + docClientMulti.Setup(c => c.ServiceEndpoint).Returns(new Uri("http://localhost")); + + AccountProperties validAccountProperties = new AccountProperties(); + + docClientMulti + .Setup(c => c.GetDatabaseAccountInternalAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(validAccountProperties); + + ConnectionPolicy policy = new ConnectionPolicy + { + UseMultipleWriteLocations = true + }; + + GlobalEndpointManager multiEndpointMgr = new GlobalEndpointManager(docClientMulti.Object, policy); + + ThinClientStoreModel storeModel = new ThinClientStoreModel( + endpointManager: multiEndpointMgr, + globalPartitionEndpointManager: GlobalPartitionEndpointManagerNoOp.Instance, + sessionContainer: this.sessionContainer, + defaultConsistencyLevel: (Cosmos.ConsistencyLevel)this.defaultConsistencyLevel, + eventSource: new DocumentClientEventSource(), + serializerSettings: null, + httpClient: null); + + ClientCollectionCache clientCollectionCache = new Mock( + this.sessionContainer, + storeModel, + null, + null, + null, + false).Object; + + PartitionKeyRangeCache partitionKeyRangeCache = new Mock( + null, + storeModel, + clientCollectionCache, + multiEndpointMgr, + false).Object; + + storeModel.SetCaches(partitionKeyRangeCache, clientCollectionCache); + + // Inject the thinclient store client that returns 201 + ReplaceThinClientStoreClientField(storeModel, thinClientStoreClient); + + // Act + DocumentServiceResponse response = await storeModel.ProcessMessageAsync(request); + + // Assert + Assert.IsNotNull(response); + Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); + } + + [TestMethod] + [Owner("dkunda")] + public async Task ProcessMessageAsync_WithUnsupportedOperations_ShouldFallbackToGatewayModeAndReturnDocumentServiceResponse() + { + // Arrange + // A single base64-encoded RNTBD response representing an HTTP 201 (Created) + HttpResponseMessage successResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent("Response") }; + HttpRequestMessage capturedRequest = null; + Mock mockCosmosHttpClient = new Mock(); + mockCosmosHttpClient.Setup(client => client.SendHttpAsync( + It.IsAny>>(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny())) + .Callback>, ResourceType, HttpTimeoutPolicy, IClientSideRequestStatistics, CancellationToken, DocumentServiceRequest>( + async (requestFactory, _, _, _, _, _) => + capturedRequest = await requestFactory()) + .ReturnsAsync(successResponse); + + DocumentServiceRequest request = DocumentServiceRequest.Create( + operationType: OperationType.QueryPlan, + resourceType: ResourceType.Document, + resourceId: "NH1uAJ6ANm0=", + body: null, + authorizationTokenType: AuthorizationTokenType.PrimaryMasterKey); + + Mock docClientMulti = new Mock(); + docClientMulti.Setup(c => c.ServiceEndpoint).Returns(new Uri("http://localhost")); + + AccountProperties validAccountProperties = new AccountProperties(); + + docClientMulti + .Setup(c => c.GetDatabaseAccountInternalAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(validAccountProperties); + + ConnectionPolicy policy = new ConnectionPolicy + { + UseMultipleWriteLocations = true + }; + + GlobalEndpointManager multiEndpointMgr = new GlobalEndpointManager(docClientMulti.Object, policy); + + ThinClientStoreModel storeModel = new ThinClientStoreModel( + endpointManager: multiEndpointMgr, + globalPartitionEndpointManager: GlobalPartitionEndpointManagerNoOp.Instance, + sessionContainer: this.sessionContainer, + defaultConsistencyLevel: (Cosmos.ConsistencyLevel)this.defaultConsistencyLevel, + eventSource: new DocumentClientEventSource(), + serializerSettings: null, + httpClient: mockCosmosHttpClient.Object); + + ClientCollectionCache clientCollectionCache = new Mock( + this.sessionContainer, + storeModel, + null, + null, + null, + false).Object; + + PartitionKeyRangeCache partitionKeyRangeCache = new Mock( + null, + storeModel, + clientCollectionCache, + multiEndpointMgr, + false).Object; + + storeModel.SetCaches(partitionKeyRangeCache, clientCollectionCache); + + // Act + DocumentServiceResponse response = await storeModel.ProcessMessageAsync(request); + + // Assert + Assert.IsNotNull(response); + Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); + } + + [TestMethod] + public void Dispose_ShouldDisposeThinClientStoreClient() + { + // Arrange + bool disposeCalled = false; + + ThinClientStoreClient thinClientStoreClient = new MockThinClientStoreClient( + (request, resourceType, uri, endpoint, globalDatabaseAccountName, clientCollectionCache, cancellationToken) => + throw new NotImplementedException(), + () => disposeCalled = true); + + ReplaceThinClientStoreClientField(this.thinClientStoreModel, thinClientStoreClient); + // Act + this.thinClientStoreModel.Dispose(); + // Assert + Assert.IsTrue(disposeCalled, "Expected Dispose to be called on ThinClientStoreClient."); + } + + [TestMethod] + public async Task ProcessMessageAsync_404_ShouldThrowDocumentClientException() + { + // Arrange + MockThinClientStoreClient thinClientStoreClient = new MockThinClientStoreClient( + (request, resourceType, uri, endpoint, globalDatabaseAccountName, clientCollectionCache, cancellationToken) => + throw new DocumentClientException( + message: "Not Found", + innerException: null, + responseHeaders: new StoreResponseNameValueCollection(), + statusCode: HttpStatusCode.NotFound, + requestUri: uri)); + + DocumentServiceRequest request = DocumentServiceRequest.Create( + operationType: OperationType.Read, + resourceType: ResourceType.Document, + resourceId: "NH1uAJ6ANm0=", + body: null, + authorizationTokenType: AuthorizationTokenType.PrimaryMasterKey); + + Mock docClientOkay = new Mock(); + docClientOkay + .Setup(c => c.ServiceEndpoint) + .Returns(new Uri("https://myCosmosAccount.documents.azure.com/")); + + AccountProperties validProperties = new AccountProperties(); + + docClientOkay + .Setup(c => c.GetDatabaseAccountInternalAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(validProperties); + + ConnectionPolicy policy = new ConnectionPolicy + { + UseMultipleWriteLocations = false + }; + + GlobalEndpointManager endpointManagerOk = new GlobalEndpointManager(docClientOkay.Object, policy); + + ThinClientStoreModel storeModel = new ThinClientStoreModel( + endpointManager: endpointManagerOk, + globalPartitionEndpointManager: GlobalPartitionEndpointManagerNoOp.Instance, + sessionContainer: this.sessionContainer, + defaultConsistencyLevel: (Cosmos.ConsistencyLevel)this.defaultConsistencyLevel, + eventSource: new DocumentClientEventSource(), + serializerSettings: null, + httpClient: null); + + ClientCollectionCache clientCollectionCache = new Mock( + this.sessionContainer, + storeModel, + null, + null, + null, + false).Object; + + PartitionKeyRangeCache partitionKeyRangeCache = new Mock( + null, + storeModel, + clientCollectionCache, + endpointManagerOk, + false).Object; + + storeModel.SetCaches(partitionKeyRangeCache, clientCollectionCache); + + ReplaceThinClientStoreClientField(storeModel, thinClientStoreClient); + + // Act & Assert + await Assert.ThrowsExceptionAsync( + async () => await storeModel.ProcessMessageAsync(request), + "Expected 404 DocumentClientException from the final thinClientStore call"); + } + + private static void ReplaceThinClientStoreClientField(ThinClientStoreModel model, ThinClientStoreClient newClient) + { + FieldInfo field = typeof(ThinClientStoreModel).GetField( + "thinClientStoreClient", + BindingFlags.NonPublic | BindingFlags.Instance) + ?? throw new InvalidOperationException("Could not find 'thinClientStoreClient' field on ThinClientStoreModel"); + + field.SetValue(model, newClient); + } + + internal class MockThinClientStoreClient : ThinClientStoreClient + { + private readonly Func> invokeAsyncFunc; + private readonly Action onDispose; + + public MockThinClientStoreClient( + Func> invokeAsyncFunc, + Action onDispose = null) + : base( + httpClient: null, + eventSource: null, + serializerSettings: null) + { + this.invokeAsyncFunc = invokeAsyncFunc; + this.onDispose = onDispose; + } + + public override async Task InvokeAsync( + DocumentServiceRequest request, + ResourceType resourceType, + Uri physicalAddress, + Uri thinClientEndpoint, + string globalDatabaseAccountName, + ClientCollectionCache clientCollectionCache, + CancellationToken cancellationToken) + { + return await this.invokeAsyncFunc( + request, + resourceType, + physicalAddress, + thinClientEndpoint, + globalDatabaseAccountName, + clientCollectionCache, + cancellationToken); + } + + public override void Dispose() + { + base.Dispose(); + this.onDispose?.Invoke(); + } + } + } +} diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ThinClientTransportSerializerTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ThinClientTransportSerializerTests.cs new file mode 100644 index 0000000000..12670038ca --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ThinClientTransportSerializerTests.cs @@ -0,0 +1,198 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Tests +{ + using System; + using System.Collections.ObjectModel; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos.Routing; + using Microsoft.Azure.Cosmos.Telemetry; + using Microsoft.Azure.Cosmos.Tracing; + using Microsoft.Azure.Documents; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + + [TestClass] + public class ThinClientTransportSerializerTests + { + // A single base64-encoded RNTBD response representing an HTTP 201 (Created) in RNTBD format. + private const string base64MockResponse = + "9AEAAMkAAAAIvhHfD23jSaynaR+gyTZ3AAAAAQIAByFUaHUsIDEzIEZlYiAyMDI1IDE0OjI1OjI4LjAyNCBHTVQEAAgmACIwMDAwYWQzZS0wMDAwLTAyMDAtMDAwMC02N2FlNjRjMDAwMDAiDgAIVABkb2N1bWVudFNpemU9NTEyMDA7ZG9jdW1lbnRzU2l6ZT01MjQyODgwMDtkb2N1bWVudHNDb3VudD0tMTtjb2xsZWN0aW9uU2l6ZT01MjQyODgwMDsPAAhBAGRvY3VtZW50U2l6ZT0wO2RvY3VtZW50c1NpemU9MTtkb2N1bWVudHNDb3VudD04O2NvbGxlY3Rpb25TaXplPTM7EAAHBDEuMTkTAAUKAAAAAAAAABUADgzDMAzDMBxAFwAIOgBkYnMvdGhpbi1jbGllbnQtdGVzdC1kYi9jb2xscy90aGluLWNsaWVudC10ZXN0LWNvbnRhaW5lci0xGAAIDABOSDF1QUo2QU5tMD0aAAUJAAAAAAAAAB4AAgMAAAAfAAIEAAAAIQAIAQAwJgACAQAAACkABQkAAAAAAAAAMAACAAAAADUAAgEAAAA6AAUKAAAAAAAAADsABQkAAAAAAAAAPgAIBQAtMSMxMFEADkjhehSuRxBAYwAIAQAweAAF//////////89AQAAeyJpZCI6IjNiMTFiNDM2LTViMTUtNGQwZS1iZWYwLWY1MzVmNjA0MTQxYyIsInBrIjoicGsiLCJuYW1lIjoiODM2MzI0NTA2IiwiZW1haWwiOiJhYmNAZGVmLmNvbSIsImJvZHkiOiJibGFibGEiLCJfcmlkIjoiTkgxdUFKNkFObTBKQUFBQUFBQUFBQT09IiwiX3NlbGYiOiJkYnMvTkgxdUFBPT0vY29sbHMvTkgxdUFKNkFObTA9L2RvY3MvTkgxdUFKNkFObTBKQUFBQUFBQUFBQT09LyIsIl9ldGFnIjoiXCIwMDAwYWQzZS0wMDAwLTAyMDAtMDAwMC02N2FlNjRjMDAwMDBcIiIsIl9hdHRhY2htZW50cyI6ImF0dGFjaG1lbnRzLyIsIl90cyI6MTczOTQ4MjMwNH0="; + + [TestMethod] + public async Task SerializeProxyRequestAsync_ShouldThrowIfNoPartitionKeyInPointOperation() + { + // Arrange + HttpRequestMessage message = new HttpRequestMessage + { + RequestUri = new Uri("https://localhost/dbs/TestDb/colls/TestColl/docs/TestDoc") + }; + message.Headers.Add(ThinClientConstants.ProxyOperationType, OperationType.Read.ToString()); + message.Headers.Add(ThinClientConstants.ProxyResourceType, ResourceType.Document.ToString()); + message.Headers.Add(HttpConstants.HttpHeaders.ActivityId, Guid.NewGuid().ToString()); + + ThinClientTransportSerializer.BufferProviderWrapper bufferProvider = new(); + + Mock sessionContainerMock = new Mock(); + Mock storeModelMock = new Mock(); + Mock tokenProviderMock = new Mock(); + Mock retryPolicyFactoryMock = new Mock(); + TelemetryToServiceHelper telemetry = null; // or mock if needed + + Mock clientCollectionCacheMock = new Mock( + sessionContainerMock.Object, + storeModelMock.Object, + tokenProviderMock.Object, + retryPolicyFactoryMock.Object, + telemetry, + true) + { + CallBase = true + }; + + clientCollectionCacheMock + .Setup(c => c.ResolveCollectionAsync( + It.IsAny(), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(this.GetMockContainerProperties()); + + // Act & Assert + await Assert.ThrowsExceptionAsync( + () => ThinClientTransportSerializer.SerializeProxyRequestAsync( + bufferProvider, + "MockAccount", + clientCollectionCacheMock.Object, + message), + "Expected an InternalServerErrorException for missing PartitionKey in point operation"); + } + + [TestMethod] + public async Task SerializeProxyRequestAsync_ShouldNotThrowIfPartitionKeyProvided() + { + // Arrange + HttpRequestMessage message = new HttpRequestMessage + { + Content = new StringContent("Test Body"), + RequestUri = new Uri("https://localhost/dbs/TestDb/colls/TestColl/docs/TestDoc") + }; + message.Headers.Add(ThinClientConstants.ProxyOperationType, OperationType.Read.ToString()); + message.Headers.Add(ThinClientConstants.ProxyResourceType, ResourceType.Document.ToString()); + message.Headers.TryAddWithoutValidation(HttpConstants.HttpHeaders.PartitionKey, "[\"SamplePk\"]"); + message.Headers.Add(HttpConstants.HttpHeaders.ActivityId, Guid.NewGuid().ToString()); + + ThinClientTransportSerializer.BufferProviderWrapper bufferProvider = new(); + + Mock sessionContainerMock = new Mock(); + Mock storeModelMock = new Mock(); + Mock tokenProviderMock = new Mock(); + Mock retryPolicyFactoryMock = new Mock(); + TelemetryToServiceHelper telemetry = null; + + Mock clientCollectionCacheMock = new Mock( + sessionContainerMock.Object, + storeModelMock.Object, + tokenProviderMock.Object, + retryPolicyFactoryMock.Object, + telemetry, + true) + { + CallBase = true + }; + + clientCollectionCacheMock + .Setup(c => c.ResolveCollectionAsync( + It.IsAny(), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(this.GetMockContainerProperties()); + + // Act + Stream resultStream = await ThinClientTransportSerializer.SerializeProxyRequestAsync( + bufferProvider, + "MockAccount", + clientCollectionCacheMock.Object, + message); + + // Assert + Assert.IsNotNull(resultStream, "Expected a valid stream result."); + Assert.IsTrue(resultStream.Length > 0, "Stream should contain RNTBD-serialized bytes."); + } + + [TestMethod] + public void GetEffectivePartitionKeyHash_ShouldReturnHash() + { + // Arrange + string pkJson = "[\"TestValue\"]"; + + // Act + string epkHash = ThinClientTransportSerializer.GetEffectivePartitionKeyHash( + pkJson, + this.GetMockContainerProperties().PartitionKey); + + // Assert + Assert.IsNotNull(epkHash, "EPK hash should not be null for a valid JSON partition key."); + Assert.IsTrue(epkHash.Length > 0, "EPK hash should have a non-empty value."); + } + + [TestMethod] + public async Task ConvertProxyResponseAsync_ShouldThrowIfStatusMismatch() + { + // Arrange + HttpResponseMessage httpResponse = new HttpResponseMessage(HttpStatusCode.OK) + { + Content = new ByteArrayContent(Convert.FromBase64String(base64MockResponse)) + }; + + // Act & Assert + await Assert.ThrowsExceptionAsync(() => + ThinClientTransportSerializer.ConvertProxyResponseAsync(httpResponse)); + } + + [TestMethod] + public async Task ConvertProxyResponseAsync_ShouldReturnHttpResponse_WhenValid() + { + // Arrange + HttpResponseMessage httpResponse = new HttpResponseMessage(HttpStatusCode.Created) + { + Content = new ByteArrayContent(Convert.FromBase64String(base64MockResponse)) + }; + + // Act + HttpResponseMessage converted = await ThinClientTransportSerializer.ConvertProxyResponseAsync(httpResponse); + + // Assert + Assert.AreEqual(HttpStatusCode.Created, converted.StatusCode, "Expected matched 201 status code."); + Assert.IsNotNull(converted.Content, "Converted response should have content."); + + Assert.IsTrue( + converted.Headers.Any(h => h.Key == ThinClientConstants.RoutedViaProxy), + "Expected 'x-ms-thinclient-route-via-proxy' header to be set in the converted response."); + } + + private ContainerProperties GetMockContainerProperties() + { + ContainerProperties containerProperties = new ContainerProperties + { + PartitionKey = new PartitionKeyDefinition + { + Paths = new Collection { "/pk" } + } + }; + + typeof(ContainerProperties) + .GetProperty("ResourceId", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance) + ?.SetValue(containerProperties, "-Jlvm9pqHGk="); + + return containerProperties; + } + + } +} diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Tracing/TraceWriterBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Tracing/TraceWriterBaselineTests.cs index ecb747b8d7..b7b165fc5b 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Tracing/TraceWriterBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Tracing/TraceWriterBaselineTests.cs @@ -780,7 +780,8 @@ private static QueryInfo GetQueryPlan(string query) isContinuationExpected: false, allowNonValueAggregateQuery: true, hasLogicalPartitionKey: false, - allowDCount: true, + allowDCount: true, + hybridSearchSkipOrderByRewrite: false, useSystemPrefix: false, geospatialType: Cosmos.GeospatialType.Geography); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Utils/MockCosmosUtil.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Utils/MockCosmosUtil.cs index 41d7dc303b..e86a19873f 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Utils/MockCosmosUtil.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Utils/MockCosmosUtil.cs @@ -92,6 +92,30 @@ public static CosmosHttpClient CreateCosmosHttpClient( receivedResponseEventArgs: null); } + public static CosmosHttpClient CreateMockCosmosHttpClientFromFunc( + Func> sendFunc) + { + return MockCosmosUtil.CreateCosmosHttpClient( + () => new HttpClient(new DelegatingHttpHandler(sendFunc))); + } + + private class DelegatingHttpHandler : HttpMessageHandler + { + private readonly Func> sendFunc; + + public DelegatingHttpHandler(Func> sendFunc) + { + this.sendFunc = sendFunc; + } + + protected override Task SendAsync( + HttpRequestMessage request, + CancellationToken cancellationToken) + { + return this.sendFunc(request); + } + } + public static Mock GetPartitionRoutingHelperMock(string partitionRangeKeyId) { Mock partitionRoutingHelperMock = new Mock(); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Utils/MockDocumentClient.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Utils/MockDocumentClient.cs index 357fe9295f..1b6f50ed06 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Utils/MockDocumentClient.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Utils/MockDocumentClient.cs @@ -156,7 +156,7 @@ internal virtual PartitionKeyRange ResolvePartitionKeyRangeById(string collectio private void Init() { - this.collectionCache = new Mock(new SessionContainer("testhost"), new ServerStoreModel(null), null, null, null); + this.collectionCache = new Mock(new SessionContainer("testhost"), new ServerStoreModel(null), null, null, null, true); const string pkPath = "/pk"; this.collectionCache.Setup (m => @@ -229,7 +229,7 @@ private void Init() using GlobalEndpointManager endpointManager = new(mockDocumentClient.Object, new ConnectionPolicy()); - this.partitionKeyRangeCache = new Mock(null, null, null, endpointManager); + this.partitionKeyRangeCache = new Mock(null, null, null, endpointManager, false); this.partitionKeyRangeCache.Setup( m => m.TryLookupAsync( It.IsAny(), @@ -260,7 +260,7 @@ private void Init() ).Returns((string collectionRid, string pkRangeId, ITrace trace, bool forceRefresh) => Task.FromResult(this.ResolvePartitionKeyRangeById(collectionRid, pkRangeId, forceRefresh))); - this.MockGlobalEndpointManager = new Mock(this, new ConnectionPolicy()); + this.MockGlobalEndpointManager = new Mock(this, new ConnectionPolicy(), false); this.MockGlobalEndpointManager.Setup(gep => gep.ResolveServiceEndpoint(It.IsAny())).Returns(new Uri("http://localhost")); this.MockGlobalEndpointManager.Setup(gep => gep.InitializeAccountPropertiesAndStartBackgroundRefresh(It.IsAny())); SessionContainer sessionContainer = new SessionContainer(this.ServiceEndpoint.Host); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Utils/QueryPartitionProviderTestInstance.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Utils/QueryPartitionProviderTestInstance.cs index 50cb919729..0677ddb978 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Utils/QueryPartitionProviderTestInstance.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Utils/QueryPartitionProviderTestInstance.cs @@ -30,7 +30,8 @@ public static class QueryPartitionProviderTestInstance {"maxSpatialQueryCells", 12}, {"spatialMaxGeometryPointCount", 256}, {"sqlDisableQueryILOptimization", false}, - {"sqlDisableFilterPlanOptimization", false} + {"sqlDisableFilterPlanOptimization", false}, + {"queryEnableFullText", true } }; internal static readonly QueryPartitionProvider Object = new QueryPartitionProvider(DefaultQueryEngineConfiguration as IDictionary); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Utils/TestUtils.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Utils/TestUtils.cs new file mode 100644 index 0000000000..ffdd8b98e7 --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Utils/TestUtils.cs @@ -0,0 +1,82 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Tests +{ + using System; + using System.Collections.ObjectModel; + using System.Reflection; + using Microsoft.Azure.Cosmos.Common; + using Microsoft.Azure.Cosmos.Routing; + using Moq; + using System.Threading.Tasks; + using System.Threading; + using Microsoft.Azure.Cosmos.Tracing; + using Microsoft.Azure.Documents; + + /// + /// Common utility class for unit tests. + /// + internal static class TestUtils + { + /// + /// This helper method uses reflection to set the private and read only fields + /// to the disered values to help the test cases mimic the expected behavior. + /// + /// An object where reflection will be applied to update the field. + /// A string containing the internal field name. + /// An integer to add or substract the desired delay in minutes. + internal static void AddMinuteToDateTimeFieldUsingReflection( + object objectName, + string fieldName, + int delayInMinutes) + { + FieldInfo fieldInfo = objectName + .GetType() + .GetField( + name: fieldName, + bindingAttr: BindingFlags.Instance | BindingFlags.NonPublic); + + DateTime? fieldValue = (DateTime?)fieldInfo + .GetValue( + obj: objectName); + + fieldInfo + .SetValue( + obj: objectName, + value: ((DateTime)fieldValue).AddMinutes(delayInMinutes)); + } + + public static void SetupCachesInGatewayStoreModel( + GatewayStoreModel storeModel, + GlobalEndpointManager endpointManager) + { + PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition() + { + Kind = PartitionKind.Hash, + Paths = new Collection() + { + "/id" + } + }; + + // Prepare mocked caches. + Mock clientCollectionCache = new Mock(new SessionContainer("testhost"), storeModel, null, null, null, false); + Mock partitionKeyRangeCache = new Mock(null, storeModel, clientCollectionCache.Object, endpointManager, false); + + ContainerProperties containerProperties = ContainerProperties.CreateWithResourceId("test"); + containerProperties.PartitionKey = partitionKeyDefinition; + clientCollectionCache.Setup + (m => + m.ResolveCollectionAsync( + It.IsAny(), + It.IsAny(), + It.IsAny() + ) + ).Returns(Task.FromResult(containerProperties)); + + storeModel.SetCaches(partitionKeyRangeCache.Object, clientCollectionCache.Object); + } + } +} \ No newline at end of file diff --git a/azure-pipelines-encryption-custom-official.yml b/azure-pipelines-encryption-custom-official.yml new file mode 100644 index 0000000000..046b83ac78 --- /dev/null +++ b/azure-pipelines-encryption-custom-official.yml @@ -0,0 +1,29 @@ +trigger: none + +pr: none + +variables: + ReleaseArguments: ' --filter "TestCategory!=Quarantine" --verbosity normal ' + VmImage: windows-latest # https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops + BuildConfiguration: Release + Packaging.EnableSBOMSigning: true + +stages: +- stage: + displayName: Encryption Custom Release Gates + jobs: + - template: templates/static-tools-encryption-custom.yml + parameters: + BuildConfiguration: '${{ variables.BuildConfiguration }}' + VmImage: '${{ variables.VmImage }}' + +- stage: + displayName: Build, Pack and Publish + jobs: + - template: templates/encryption-custom-nuget-pack.yml + parameters: + BuildConfiguration: Release + VmImage: '${{ variables.VmImage }}' + ReleasePackage: true + OutputPath: '$(Build.ArtifactStagingDirectory)/bin/AnyCPU/$(BuildConfiguration)/Microsoft.Azure.Cosmos.Encryption.Custom' + BlobVersion: $(BlobVersion) diff --git a/azure-pipelines-encryption-custom.yml b/azure-pipelines-encryption-custom.yml deleted file mode 100644 index 5075e6d46b..0000000000 --- a/azure-pipelines-encryption-custom.yml +++ /dev/null @@ -1,77 +0,0 @@ -trigger: none - -pr: none - -variables: - ReleaseArguments: ' --filter "TestCategory!=Quarantine" --verbosity normal ' - VmImage: windows-latest # https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops - BuildConfiguration: Release - Packaging.EnableSBOMSigning: true - -stages: -- stage: - displayName: Publish - jobs: - - job: - pool: - name: 'OneES' - steps: - # Add this Command to Include the .NET SDK and runtimes - - task: UseDotNet@2 - displayName: Use .NET 6.0 - inputs: - packageType: 'runtime' - version: '6.x' - - - task: UseDotNet@2 - displayName: Use .NET 8.0 - inputs: - packageType: 'sdk' - version: '8.x' - - - task: DotNetCoreCLI@2 - displayName: Build Microsoft.Azure.Cosmos.Encryption.Custom - inputs: - command: build - configuration: $(BuildConfiguration) - nugetConfigPath: NuGet.config - projects: Microsoft.Azure.Cosmos.Encryption.Custom/src/Microsoft.Azure.Cosmos.Encryption.Custom.csproj - arguments: --configuration $(BuildConfiguration) -p:Optimize=true - versioningScheme: OFF - - - task: DotNetCoreCLI@2 - displayName: 'Create Encryption.Custom SDK NuGet Package' - inputs: - command: custom - projects: 'Microsoft.Azure.Cosmos.Encryption.Custom\src\Microsoft.Azure.Cosmos.Encryption.Custom.csproj' - custom: pack - arguments: '-v detailed -c $(BuildConfiguration) --no-build --no-restore -o "$(Build.ArtifactStagingDirectory)\bin\AnyCPU\$(BuildConfiguration)\Microsoft.Azure.Cosmos.Encryption.Custom"' - - - task: DotNetCoreCLI@2 - displayName: 'Create Encryption.Custom SDK NuGet Symbols Package' - inputs: - command: custom - projects: 'Microsoft.Azure.Cosmos.Encryption.Custom\src\Microsoft.Azure.Cosmos.Encryption.Custom.csproj' - custom: pack - arguments: '-v detailed -c $(BuildConfiguration) --no-build --include-symbols /p:SymbolPackageFormat=snupkg --no-restore -o "$(Build.ArtifactStagingDirectory)\bin\AnyCPU\$(BuildConfiguration)\Microsoft.Azure.Cosmos.Encryption.Custom"' - - - task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 - inputs: - BuildDropPath: '$(Build.ArtifactStagingDirectory)/bin/AnyCPU/$(BuildConfiguration)/Microsoft.Azure.Cosmos.Encryption.Custom' - - - task: AzureFileCopy@2 - displayName: ' Copy Artifacts to Azure SDK Release blob storage' - condition: and(succeeded(),ne(variables['BlobVersion'], '')) - inputs: - SourcePath: '$(Build.ArtifactStagingDirectory)/bin/AnyCPU/$(BuildConfiguration)/Microsoft.Azure.Cosmos.Encryption.Custom' - azureSubscription: azuresdkpartnerdrops - Destination: AzureBlob - storage: azuresdkpartnerdrops - ContainerName: 'drops' - BlobPrefix: 'cosmosdb/csharp/encryption.custom/$(BlobVersion)' - - - task: PublishBuildArtifacts@1 - displayName: 'Publish Artifacts: Microsoft.Azure.Cosmos.Encryption.Custom' - inputs: - artifactName: Microsoft.Azure.Cosmos.Encryption.Custom -# diff --git a/azure-pipelines-encryption-official.yml b/azure-pipelines-encryption-official.yml new file mode 100644 index 0000000000..c5748b2ed7 --- /dev/null +++ b/azure-pipelines-encryption-official.yml @@ -0,0 +1,29 @@ +trigger: none + +pr: none + +variables: + ReleaseArguments: ' --filter "TestCategory!=Quarantine" --verbosity normal ' + VmImage: windows-latest # https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops + BuildConfiguration: Release + Packaging.EnableSBOMSigning: true + +stages: +- stage: + displayName: Encryption Release Gates + jobs: + - template: templates/static-tools-encryption.yml + parameters: + BuildConfiguration: '${{ variables.BuildConfiguration }}' + VmImage: '${{ variables.VmImage }}' + +- stage: + displayName: Build, Pack and Publish + jobs: + - template: templates/encryption-nuget-pack.yml + parameters: + BuildConfiguration: Release + VmImage: '${{ variables.VmImage }}' + ReleasePackage: true + OutputPath: '$(Build.ArtifactStagingDirectory)/bin/AnyCPU/$(BuildConfiguration)/Microsoft.Azure.Cosmos.Encryption' + BlobVersion: $(BlobVersion) diff --git a/azure-pipelines-encryption.yml b/azure-pipelines-encryption.yml deleted file mode 100644 index ae476af886..0000000000 --- a/azure-pipelines-encryption.yml +++ /dev/null @@ -1,78 +0,0 @@ -trigger: none - -pr: none - -variables: - ReleaseArguments: ' --filter "TestCategory!=Quarantine" --verbosity normal ' - VmImage: windows-latest # https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops - BuildConfiguration: Release - Packaging.EnableSBOMSigning: true - -stages: -- stage: - displayName: Publish - jobs: - - job: - pool: - name: 'OneES' - - steps: - # Add this Command to Include the .NET SDK and runtimes - - task: UseDotNet@2 - displayName: Use .NET 6.0 - inputs: - packageType: 'runtime' - version: '6.x' - - - task: UseDotNet@2 - displayName: Use .NET 8.0 - inputs: - packageType: 'sdk' - version: '8.x' - - - task: DotNetCoreCLI@2 - displayName: Build Microsoft.Azure.Cosmos.Encryption - inputs: - command: build - configuration: $(BuildConfiguration) - nugetConfigPath: NuGet.config - projects: Microsoft.Azure.Cosmos.Encryption/src/Microsoft.Azure.Cosmos.Encryption.csproj - arguments: --configuration $(BuildConfiguration) -p:Optimize=true - versioningScheme: OFF - - - task: DotNetCoreCLI@2 - displayName: 'Create Encryption SDK NuGet Package' - inputs: - command: custom - projects: 'Microsoft.Azure.Cosmos.Encryption\src\Microsoft.Azure.Cosmos.Encryption.csproj' - custom: pack - arguments: '-v detailed -c $(BuildConfiguration) --no-build --no-restore -o "$(Build.ArtifactStagingDirectory)\bin\AnyCPU\$(BuildConfiguration)\Microsoft.Azure.Cosmos.Encryption"' - - - task: DotNetCoreCLI@2 - displayName: 'Create Encryption SDK NuGet Symbols Package' - inputs: - command: custom - projects: 'Microsoft.Azure.Cosmos.Encryption\src\Microsoft.Azure.Cosmos.Encryption.csproj' - custom: pack - arguments: '-v detailed -c $(BuildConfiguration) --no-build --include-symbols /p:SymbolPackageFormat=snupkg --no-restore -o "$(Build.ArtifactStagingDirectory)\bin\AnyCPU\$(BuildConfiguration)\Microsoft.Azure.Cosmos.Encryption"' - - - task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 - inputs: - BuildDropPath: '$(Build.ArtifactStagingDirectory)/bin/AnyCPU/$(BuildConfiguration)/Microsoft.Azure.Cosmos.Encryption' - - - task: AzureFileCopy@2 - displayName: ' Copy Artifacts to Azure SDK Release blob storage' - condition: and(succeeded(),ne(variables['BlobVersion'], '')) - inputs: - SourcePath: '$(Build.ArtifactStagingDirectory)/bin/AnyCPU/$(BuildConfiguration)/Microsoft.Azure.Cosmos.Encryption' - azureSubscription: azuresdkpartnerdrops - Destination: AzureBlob - storage: azuresdkpartnerdrops - ContainerName: 'drops' - BlobPrefix: 'cosmosdb/csharp/encryption/$(BlobVersion)' - - - task: PublishBuildArtifacts@1 - displayName: 'Publish Artifacts: Microsoft.Azure.Cosmos.Encryption' - inputs: - artifactName: Microsoft.Azure.Cosmos.Encryption -# diff --git a/azure-pipelines-rolling.yml b/azure-pipelines-rolling.yml index 2f8f914b1c..7f9ed358ef 100644 --- a/azure-pipelines-rolling.yml +++ b/azure-pipelines-rolling.yml @@ -28,6 +28,18 @@ jobs: Arguments: $(ReleaseArguments) VmImage: $(VmImage) MultiRegionConnectionString: $(COSMOSDB_MULTI_REGION) + MultiRegionMultiMasterConnectionString: $(COSMOSDB_MULTIMASTER) + IncludeEncryption: true + IncludePerformance: true + IncludeCoverage: true + +- template: templates/build-test.yml + parameters: + BuildConfiguration: Release /p:IsPreview=true + Arguments: $(ReleaseArguments) + VmImage: $(VmImage) + MultiRegionConnectionString: $(COSMOSDB_MULTI_REGION) + MultiRegionMultiMasterConnectionString: $(COSMOSDB_MULTIMASTER) IncludeEncryption: true IncludePerformance: true IncludeCoverage: true diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 127335d335..c1cb0a8de1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,6 +6,7 @@ pr: include: - master - releases/* + - msdata/direct* paths: include: - '*' @@ -72,3 +73,12 @@ jobs: BuildConfiguration: Release Arguments: $(ReleaseArguments) VmImage: $(VmImage) + +- template: templates/build-thinclient.yml + parameters: + BuildConfiguration: Release + Arguments: $(ReleaseArguments) + VmImage: $(VmImage) + ThinClientConnectionString: $(COSMOSDB_THINCLIENT) + IncludePerformance: true + IncludeCoverage: true \ No newline at end of file diff --git a/changelog.md b/changelog.md index 8ede985226..ea0f6f81ba 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,6 @@ ## Recommended version -The **minimum recommended version is [3.47.0](#3.47.0)**. +The **minimum recommended version is [3.51.0](#3.51.0)**. Make sure that your applications, when using the .NET V3 SDK, are using at least the version described here to have all the critical fixes. With the release of [3.47.0](#3.47.0), it is now best practice to include a cross regional hedging availability strategy when using the Azure Cosmos DB .NET SDK. For more information about cross regional hedging, see [here](https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/docs/Cross%20Region%20Request%20Hedging.md). @@ -15,6 +15,133 @@ Preview features are treated as a separate branch and will not be included in th The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +### [3.53.0-preview.1](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.53.0-preview.1) - 2025-7-10 + +### [3.52.1](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.52.1) - 2025-7-10 + +#### Fixed +- [5257](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5257) QueryPlan: Fixes 410 Gone exception on query plan calls in Non-X64 windows platforms + +### [3.53.0-preview.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.53.0-preview.0) - 2025-6-13 + +### [3.52.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.52.0) - 2025-6-13 + +#### Added + +- [5180](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5180) Query: Adds public PopulateQueryAdvice capability +- [5215](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5215) Client Encryption: Adds support for latest Cosmos package and bumps up Encryption package for nuget release +- [5157](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5157) Query: Adds support for LINQ extension method for VectorDistance + > This also includes a Direct Package version update to `3.39.1` in PR [#5241](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5241) which includes the following: + - Rntbd Health Check Improvements Part 3: Enables Aggressive Timeout Detection By Default. + - Introduce East US 3 region in the SDK. + +#### Fixed + +- [5221](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5221) Query : Fixes Skip + Order By Bug +- [5218](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5218) Binary Encoding: Fixes DateTime Parsing Issue with Trailing Zeros in the Milli-Seconds Precision +- [5234](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5234) Client Encryption: Fixes Encryption Release Pipeline + +### [3.52.0-preview.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.52.0-preview.0) - 2025-5-16 + +### [3.51.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.51.0) - 2025-5-16 + +#### Added + +- [5182](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5182) InMemoryLeaseContainer: Adds public API to use InMemoryLeaseContainer with ChangeFeedProcessorBuilder +- [5170](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5170) PPAF: Adds Code to Fetch Enablement Flag Through Gateway Database Account Response + +#### Fixed + +- [5197](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5197) GlobalEndpointManager: Fixes Observed exception (ObjectDisposedException) + + +### [3.51.0-preview.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.51.0-preview.0) - 2025-5-9 + +### [3.50.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.50.0) - 2025-5-9 + +#### Added + +- [4993](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/4993) Query: Adds LINQ extension method for ORDER BY RANK, FullTextScore and RRF +- [5121](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5121) Query: Adds support for the optimized query plan that skips the order by rewrite +- [5190](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5190) Hedging: Adds Hedging for Write requests GA + +#### Fixed + +- [5145](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5145) Query: Fixes handling of undefined projections in hybrid search +- [5150](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5150) Query: Fixes Full Text Search APIs by marking them public +- [5162](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5162) HPK : Fixes code documentation to reference PartitionKeyPaths for HPK scenarios +- [5163](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5163) Query: Fixes function signature for RRF, OrderByRank and FullTextScore LINQ extension methods +- [5171](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5172) Query: Fixes FullText Policy API by making language optional +- [5189](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5189) Hedging: Fixes Concurrency Issue + +### [3.50.0-preview.1](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.50.0-preview.1) - 2025-5-6 + +### [3.49.1](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.49.1) - 2025-5-6 + +#### Fixed + +- [5174](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5174) Query: Fixes default for the query plan optimization for Hybrid Search to be disabled + +### [3.50.0-preview.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.50.0-preview.0) - 2025-4-17 + +#### Added +- [5136](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5136) VectorIndexing: Adds Preview APIs for VectorIndexing Policies + +### [3.49.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.49.0) - 2025-4-17 + +#### Added + +- [5077](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5077) ThroughputBucketing: Adds changes to make ThroughputBucket public for preview SDK +- [5069](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5069) AsyncCache: Adds support for stack trace optimization during exceptions for AsyncCache and AsyncCacheNonblocking +- [5120](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5106) Query: Adds an environment variable for disabling the hybrid search query plan optimization +- [5127](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5127) UnknownRntbdHeader : Adds a new SDK capability for UnknownRntbdHeaders +- [5128](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5128) Session Consistency: Adds SessionTokenMismatchRetryPolicy optimization through customer supplied region switch hints + +### Fixed + +- [5089](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5089) WebAssembly : Fixes Guard the ServicePointAccessor call in DocumentClass with IsSupported as well +- [5106](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5106) Diagnostics: Fixes bug where some overloaded substatus codes are displayed incorrectly in diagnostics. +- [5139](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5139) Query: Fixes flip of boolean switch for hybridSearchSkipOrderByRewrite + +### [3.49.0-preview.1](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.49.0-preview.1) - 2025-4-11 + +### [3.48.1](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.48.1) - 2025-4-11 + +#### Fixed + +- [5108](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5108) Metadata requests: Fixes bug where certain metadata requests are not retried with a client cold start with only query requests. + +#### Added + +- [5108](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5108) ClientRetryPolicy: Adds Cross Regional Retry on `Gone` (410) with `LeaseNotFound` (1022) sub status code. +- [5108](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5108) ClientRetryPolicy: Adds Cross Regional Retry for read requests on `InternalServerError` (500) status code. +- [5108](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5108) ClientRetryPolicy: Adds Retry on the Preferred Regions on endpoint failures. + +### [3.49.0-preview.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.49.0-preview.0) - 2025-3-21 + +### [3.48.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.48.0) - 2025-3-21 + +#### Fixed + +- [5024](http://github.com/Azure/azure-cosmos-dotnet-v3/pull/5024) Query: Fixes logic to determine whether to use distributed query by adding a check for gateway connection mode +- [5049](http://github.com/Azure/azure-cosmos-dotnet-v3/pull/5049) .NET9: Fixes WebAssembly or browser scenarios by conditionally setting the ConnectionLimit +- [4470](http://github.com/Azure/azure-cosmos-dotnet-v3/pull/4470) NonBlockingAsyncCache: Fixes lambda func capturing the outer context (memory optimization) +- [4977](http://github.com/Azure/azure-cosmos-dotnet-v3/pull/4977) Heiarchical Partition Keys: Fixes bug for ReadMany where None Partition does not return results + +#### Added + +- [5057](http://github.com/Azure/azure-cosmos-dotnet-v3/pull/5057) AvailabilityStrategy: Adds WithAvailabilityStrategy method to public GA SDK. +- [5011](http://github.com/Azure/azure-cosmos-dotnet-v3/pull/5011) Query: Adds query feature and deserialization of component weights for weighted rank fusion +- [4980](http://github.com/Azure/azure-cosmos-dotnet-v3/pull/4980) Query: Adds FullTextContains, FullTextContainsAll, FullTextContainsAny as LINQ extension method +- [4978](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/4978) Scripts: Adds Stream APIs for CRUD Operations + +### [3.48.0-preview.2](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.48.0-preview.2) - 2025-2-28 + +### [3.47.2](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.47.2) - 2025-2-28 + +#### Fixed +- [5030](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5030) Binary Encoding: Fixes Serialization Gaps on Newtonsoft Reader/Writer for Transactional Batch API. + ### [3.48.0-preview.1](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.48.0-preview.1) - 2025-2-14 ### [3.47.1](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.47.1) - 2025-2-14 diff --git a/docs/Cross Region Request Hedging.md b/docs/Cross Region Request Hedging.md index 1041a85750..17f3d31854 100644 --- a/docs/Cross Region Request Hedging.md +++ b/docs/Cross Region Request Hedging.md @@ -70,11 +70,33 @@ ItemRequestOptions requestOptions = new ItemRequestOptions() }; ``` -When enabled at the `CosmosClient` level, the availability strategy applies to all read requests unless explicitly disabled per request: ReadItem, Queries (single and cross partition), ReadMany, and ChangeFeed. It is not enabled for write requests. +When enabled at the `CosmosClient` level, the availability strategy applies to all read requests unless explicitly disabled per request: ReadItem, Queries (single and cross partition), ReadMany, and ChangeFeed. + +## Hedging for Write Requests + +Availability strategies can also be used for write requests. This feature is not enabled by default, but can be enabled by setting the `enableMultiWriteRegionHedge` parameter to `true` when creating the `CrossRegionHedgingStrategy`. This will allow the SDK to send out hedged requests for write requests as well. This feature can only be used for accounts where multi region writes are enabled. Like read requssts, the SDK will only hedge for document requests, not container, database, or other write requests. Please note that all conflict resolution must be handled by the client application. Write request hedging otherwise preforms the same as read request hedging. + +```csharp +CosmosClientOptions options = new CosmosClientOptions() +{ + AvailabilityStrategy + = AvailabilityStrategy.CrossRegionHedgingStrategy( + threshold: TimeSpan.FromSeconds(1.5), + thresholdStep: TimeSpan.FromSeconds(1), + enableMultiWriteRegionHedge: true + ), + ApplicationPreferredRegions = new List() { "East US", "West US", "Central US"}, +}; + +CosmosClient client = new CosmosClient( + accountEndpoint: "account endpoint", + authKeyOrResourceToken: "auth key or resource token", + clientOptions: options); +``` ## Diagnostics -In the diagnostics data there are two new areas of note `Response Region` and `Hedge Context` that will appear when using this feature. `Response Region` shows the region that the request is ultimately served out of. `Hedge Context` shows all the regions requests were sent to. +In the diagnostics data there are two new areas of note `Hedge Config` and `Hedge Context` that will appear when using this feature. `Hedge Config` shows what the configured availability strategy used is, along with whether hedging for write requests are enabled. `Hedge Context` shows all the regions requests were sent to. To find what region the request was sent to, look for the `StoreResponse` in the diagnostics data. A full example of a hedged request can be seen [here](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/master/Microsoft.Azure.Cosmos.Samples/Usage/Hedging/ReadRequestDiagnosticsExample.json). ```json "Summary": { @@ -105,11 +127,11 @@ In the diagnostics data there are two new areas of note `Response Region` and `H "ConsistencyConfig": "(consistency: NotSet, prgns:[Central US, North Central US], apprgn: )", "ProcessorCount": 12 }, + "Hedge Config": "t:100ms, s:50ms, w:False", "Hedge Context": [ "Central US", "North Central US" ], - "Response Region": "North Central US" } ``` diff --git a/templates/build-test.yml b/templates/build-test.yml index a7c5c93fcb..33bb4f3e0b 100644 --- a/templates/build-test.yml +++ b/templates/build-test.yml @@ -5,8 +5,8 @@ parameters: Arguments: '' VmImage: '' # https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops OS: 'Windows' - EmulatorPipeline1Arguments: ' --filter "TestCategory!=Flaky & TestCategory!=Quarantine & TestCategory!=Functional & TestCategory!=ClientTelemetryRelease & TestCategory!=LongRunning & TestCategory!=MultiRegion & TestCategory!=MultiMaster & (TestCategory=ClientTelemetryEmulator|TestCategory=Query|TestCategory=ReadFeed|TestCategory=Batch|TestCategory=ChangeFeed)" --verbosity normal ' - EmulatorPipeline2Arguments: ' --filter "TestCategory!=Flaky & TestCategory!=Quarantine & TestCategory!=Functional & TestCategory!=ClientTelemetryRelease & TestCategory!=ClientTelemetryEmulator & TestCategory!=Query & TestCategory!=ReadFeed & TestCategory!=Batch & TestCategory!=ChangeFeed & TestCategory!=LongRunning & TestCategory!=MultiRegion & TestCategory!=MultiMaster" --verbosity normal ' + EmulatorPipeline1Arguments: ' --filter "TestCategory!=Flaky & TestCategory!=Quarantine & TestCategory!=Functional & TestCategory!=ClientTelemetryRelease & TestCategory !=ThinClient & TestCategory!=LongRunning & TestCategory!=MultiRegion & TestCategory!=MultiMaster & (TestCategory=ClientTelemetryEmulator|TestCategory=Query|TestCategory=ReadFeed|TestCategory=Batch|TestCategory=ChangeFeed)" --verbosity normal ' + EmulatorPipeline2Arguments: ' --filter "TestCategory!=Flaky & TestCategory!=Quarantine & TestCategory!=Functional & TestCategory!=ClientTelemetryRelease & TestCategory !=ThinClient & TestCategory!=ClientTelemetryEmulator & TestCategory!=Query & TestCategory!=ReadFeed & TestCategory!=Batch & TestCategory!=ChangeFeed & TestCategory!=LongRunning & TestCategory!=MultiRegion & TestCategory!=MultiMaster" --verbosity normal ' EmulatorPipeline3Arguments: ' --filter "TestCategory=MultiRegion" --verbosity normal ' EmulatorPipeline4Arguments: ' --filter "TestCategory=MultiMaster" --verbosity normal ' EmulatorPipeline1CategoryListName: ' Client Telemetry, Query, ChangeFeed, ReadFeed, Batch ' # Divided in 2 categories to run them in parallel and reduce the PR feedback time @@ -111,63 +111,6 @@ jobs: packageType: 'sdk' version: '8.x' - - task: DotNetCoreCLI@2 - displayName: Microsoft.Azure.Cosmos.Tests - condition: succeeded() - retryCountOnTaskFailure: 2 - inputs: - command: test - projects: 'Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/*.csproj' - arguments: ${{ parameters.Arguments }} /p:OS=${{ parameters.OS }} - publishTestResults: true - nugetConfigPath: NuGet.config - testRunTitle: Microsoft.Azure.Cosmos.Tests - -- job: - displayName: Microsoft.Azure.Cosmos.Tests Flaky - pool: - name: 'OneES' - - steps: - - checkout: self # self represents the repo where the initial Pipelines YAML file was found - clean: true # if true, execute `execute git clean -ffdx && git reset --hard HEAD` before fetching - - # Add this Command to Include the .NET 6 SDK - - task: UseDotNet@2 - displayName: Use .NET 6.0 - inputs: - packageType: 'sdk' - version: '6.x' - - - task: DotNetCoreCLI@2 - displayName: Microsoft.Azure.Cosmos.Tests - condition: succeeded() - retryCountOnTaskFailure: 4 - inputs: - command: test - projects: 'Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/*.csproj' - arguments: --filter "TestCategory=Flaky" --verbosity normal /p:OS=${{ parameters.OS }} - publishTestResults: true - nugetConfigPath: NuGet.config - testRunTitle: Microsoft.Azure.Cosmos.Tests - - -- job: - displayName: Microsoft.Azure.Cosmos.Tests Coverage - condition: and(succeeded(), eq(${{ parameters.IncludeCoverage }}, true)) - pool: - name: 'OneES' - steps: - - checkout: self # self represents the repo where the initial Pipelines YAML file was found - clean: true # if true, execute `execute git clean -ffdx && git reset --hard HEAD` before fetching - - # Add this Command to Include the .NET 6 SDK - - task: UseDotNet@2 - displayName: Use .NET 6.0 - inputs: - packageType: 'sdk' - version: '6.x' - - task: DotNetCoreCLI@2 displayName: Microsoft.Azure.Cosmos.Tests condition: succeeded() diff --git a/templates/build-thinclient.yml b/templates/build-thinclient.yml new file mode 100644 index 0000000000..527a7a4ad9 --- /dev/null +++ b/templates/build-thinclient.yml @@ -0,0 +1,53 @@ +# File: templates/build-thinclient.yml + +parameters: + BuildConfiguration: '' + Arguments: '' + VmImage: '' # https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops + OS: 'Windows' + EmulatorPipeline5Arguments: ' --filter "TestCategory=ThinClient" --verbosity normal ' + EmulatorPipeline5CategoryListName: ' ThinClient ' + ThinClientConnectionString: '' + IncludeEncryption: true + IncludePerformance: true + IncludeCoverage: true + +jobs: +- job: + displayName: EmulatorTests ${{ parameters.BuildConfiguration }} - ${{ parameters.EmulatorPipeline5CategoryListName }} + timeoutInMinutes: 120 + condition: always() + continueOnError: true + pool: + name: 'OneES' + + steps: + - checkout: self + clean: true + + - task: UseDotNet@2 + displayName: Use .NET 6.0 + inputs: + packageType: 'runtime' + version: '6.x' + + - task: UseDotNet@2 + displayName: Use .NET 8.0 + inputs: + packageType: 'sdk' + version: '8.x' + + - task: DotNetCoreCLI@2 + displayName: Microsoft.Azure.Cosmos.EmulatorTests - ${{ parameters.EmulatorPipeline5CategoryListName }} + continueOnError: true + inputs: + command: test + projects: 'Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/*.csproj' + arguments: ${{ parameters.EmulatorPipeline5Arguments }} --configuration ${{ parameters.BuildConfiguration }} /p:OS=${{ parameters.OS }} + nugetConfigPath: NuGet.config + publishTestResults: true + testRunTitle: Microsoft.Azure.Cosmos.EmulatorTests - ${{ parameters.EmulatorPipeline5CategoryListName }} + env: + COSMOSDB_THINCLIENT: ${{ parameters.ThinClientConnectionString }} + AZURE_COSMOS_THIN_CLIENT_ENABLED: 'True' + AZURE_COSMOS_NON_STREAMING_ORDER_BY_FLAG_DISABLED: 'true' diff --git a/templates/encryption-custom-nuget-pack.yml b/templates/encryption-custom-nuget-pack.yml new file mode 100644 index 0000000000..1dcb542532 --- /dev/null +++ b/templates/encryption-custom-nuget-pack.yml @@ -0,0 +1,79 @@ +# File: templates/encryption-nuget-pack.yml + +parameters: + - name: BuildConfiguration + type: string + default: '' + - name: Arguments + type: string + default: '' + - name: VmImage + type: string + default: '' + - name: OutputPath + type: string + default: '' + - name: BlobVersion + type: string + default: '' + - name: ReleasePackage + type: boolean + default: false + - name: CleanupFolder + type: boolean + default: false + +jobs: +- job: GenerateNugetPackages + displayName: Generate Nuget packages + pool: + name: 'OneES' + + steps: + - task: DotNetCoreCLI@2 + displayName: Build Microsoft.Azure.Cosmos.Encryption.Custom + inputs: + command: build + configuration: $(BuildConfiguration) + nugetConfigPath: NuGet.config + projects: Microsoft.Azure.Cosmos.Encryption.Custom/src/Microsoft.Azure.Cosmos.Encryption.Custom.csproj + arguments: --configuration ${{ parameters.BuildConfiguration }} -p:Optimize=true ${{ parameters.Arguments }} + versioningScheme: OFF + + - task: DotNetCoreCLI@2 + displayName: 'Create Encryption Custom NuGet Package' + inputs: + command: custom + projects: 'Microsoft.Azure.Cosmos.Encryption.Custom/src/Microsoft.Azure.Cosmos.Encryption.Custom.csproj' + custom: pack + arguments: '-v detailed -c ${{ parameters.BuildConfiguration }} --no-build ${{ parameters.Arguments }} --no-restore -o "${{ parameters.OutputPath }}"' + + - ${{ if eq(parameters.ReleasePackage, true) }}: + - task: DotNetCoreCLI@2 + displayName: 'Create Encryption Custom NuGet Symbols Package' + inputs: + command: custom + projects: 'Microsoft.Azure.Cosmos.Encryption.Custom/src/Microsoft.Azure.Cosmos.Encryption.Custom.csproj' + custom: pack + arguments: '-v detailed -c ${{ parameters.BuildConfiguration }} --no-build --include-symbols /p:SymbolPackageFormat=snupkg ${{ parameters.Arguments }} --no-restore -o "${{ parameters.OutputPath }}"' + - task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 + inputs: + BuildDropPath: '$(Build.ArtifactStagingDirectory)\bin\AnyCPU\$(BuildConfiguration)\Microsoft.Azure.Cosmos.Encryption.Custom' + + - ${{ if ne(parameters.BlobVersion, '') }}: + - task: AzureFileCopy@6 + displayName: 'Copy Artifacts to Azure SDK Release blob storage' + condition: succeeded() + inputs: + SourcePath: '$(Build.ArtifactStagingDirectory)\bin\AnyCPU\$(BuildConfiguration)\Microsoft.Azure.Cosmos.Encryption.Custom/**' + azureSubscription: azuresdkpartnerdrops + Destination: AzureBlob + storage: azuresdkpartnerdrops + ContainerName: 'drops' + BlobPrefix: 'cosmosdb/csharp/encryption.custom/$(BlobVersion)' + CleanTargetBeforeCopy: ${{ parameters.CleanupFolder }} + + - task: PublishBuildArtifacts@1 + displayName: 'Publish Artifacts: Microsoft.Azure.Cosmos.Encryption.Custom' + inputs: + artifactName: Microsoft.Azure.Cosmos.Encryption.Custom diff --git a/templates/encryption-nuget-pack.yml b/templates/encryption-nuget-pack.yml new file mode 100644 index 0000000000..c7db70b4d8 --- /dev/null +++ b/templates/encryption-nuget-pack.yml @@ -0,0 +1,79 @@ +# File: templates/encryption-nuget-pack.yml + +parameters: + - name: BuildConfiguration + type: string + default: '' + - name: Arguments + type: string + default: '' + - name: VmImage + type: string + default: '' + - name: OutputPath + type: string + default: '' + - name: BlobVersion + type: string + default: '' + - name: ReleasePackage + type: boolean + default: false + - name: CleanupFolder + type: boolean + default: false + +jobs: +- job: GenerateNugetPackages + displayName: Generate Nuget packages + pool: + name: 'OneES' + + steps: + - task: DotNetCoreCLI@2 + displayName: Build Microsoft.Azure.Cosmos.Encryption + inputs: + command: build + configuration: $(BuildConfiguration) + nugetConfigPath: NuGet.config + projects: Microsoft.Azure.Cosmos.Encryption/src/Microsoft.Azure.Cosmos.Encryption.csproj + arguments: --configuration ${{ parameters.BuildConfiguration }} -p:Optimize=true ${{ parameters.Arguments }} + versioningScheme: OFF + + - task: DotNetCoreCLI@2 + displayName: 'Create Encryption NuGet Package' + inputs: + command: custom + projects: 'Microsoft.Azure.Cosmos.Encryption/src/Microsoft.Azure.Cosmos.Encryption.csproj' + custom: pack + arguments: '-v detailed -c ${{ parameters.BuildConfiguration }} --no-build ${{ parameters.Arguments }} --no-restore -o "${{ parameters.OutputPath }}"' + + - ${{ if eq(parameters.ReleasePackage, true) }}: + - task: DotNetCoreCLI@2 + displayName: 'Create Encryption NuGet Symbols Package' + inputs: + command: custom + projects: 'Microsoft.Azure.Cosmos.Encryption/src/Microsoft.Azure.Cosmos.Encryption.csproj' + custom: pack + arguments: '-v detailed -c ${{ parameters.BuildConfiguration }} --no-build --include-symbols /p:SymbolPackageFormat=snupkg ${{ parameters.Arguments }} --no-restore -o "${{ parameters.OutputPath }}"' + - task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 + inputs: + BuildDropPath: '$(Build.ArtifactStagingDirectory)/bin/AnyCPU/$(BuildConfiguration)/Microsoft.Azure.Cosmos.Encryption' + + - ${{ if ne(parameters.BlobVersion, '') }}: + - task: AzureFileCopy@6 + displayName: 'Copy Artifacts to Azure SDK Release blob storage' + condition: succeeded() + inputs: + SourcePath: '$(Build.ArtifactStagingDirectory)/bin/AnyCPU/$(BuildConfiguration)/Microsoft.Azure.Cosmos.Encryption/**' + azureSubscription: azuresdkpartnerdrops + Destination: AzureBlob + storage: azuresdkpartnerdrops + ContainerName: 'drops' + BlobPrefix: 'cosmosdb/csharp/encryption/$(BlobVersion)' + CleanTargetBeforeCopy: ${{ parameters.CleanupFolder }} + + - task: PublishBuildArtifacts@1 + displayName: 'Publish Artifacts: Microsoft.Azure.Cosmos.Encryption' + inputs: + artifactName: Microsoft.Azure.Cosmos.Encryption diff --git a/templates/static-tools-encryption-custom.yml b/templates/static-tools-encryption-custom.yml new file mode 100644 index 0000000000..1b9746c637 --- /dev/null +++ b/templates/static-tools-encryption-custom.yml @@ -0,0 +1,83 @@ +# File: templates\static-tools-encryption.yml + +parameters: + BuildConfiguration: '' + VmImage: '' + +jobs: +- job: + displayName: Static Analysis + pool: + name: 'OneES' + + steps: + - checkout: self # self represents the repo where the initial Pipelines YAML file was found + clean: true # if true, execute `execute git clean -ffdx && git reset --hard HEAD` before fetching + + - task: DotNetCoreCLI@2 + displayName: Build Microsoft.Azure.Cosmos.Encryption.Custom + inputs: + command: build + nugetConfigPath: NuGet.config + projects: Microsoft.Azure.Cosmos.Encryption.Custom/src/Microsoft.Azure.Cosmos.Encryption.Custom.csproj + arguments: '-p:Optimize=true --configuration Release' + versioningScheme: OFF + + - task: securedevelopmentteam.vss-secure-development-tools.build-task-binskim.BinSkim@4 + displayName: 'BinSkim' + condition: eq(1,2) #disablng as nuget repo failing + inputs: + AnalyzeTargetGlob: $(Build.SourcesDirectory)\Microsoft.Azure.Cosmos.Encryption.Custom\src\bin\Release\netstandard2.0\Microsoft.Azure.Cosmos.Encryption.Custom.dll + AnalyzeRecurse: true + AnalyzeVerbose: true + AnalyzeHashes: false + AnalyzeStatistics: false + AnalyzeEnvironment: false + + # Analyze source and build output text files for credentials + - task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@3 + displayName: 'CredScan' + condition: eq(1,2) #disablng as nuget repo failing + inputs: + toolMajorVersion: V2 + scanFolder: $(Build.SourcesDirectory) + suppressionsFile: CredScanSuppressions.json + debugMode: false + verboseOutput: false + + # Scan text elements including code, code comments, and content/web pages, for sensitive terms based on legal, cultural, or geopolitical reasons + - task: securedevelopmentteam.vss-secure-development-tools.build-task-policheck.PoliCheck@2 + displayName: 'PoliCheck' + condition: eq(1,2) #disablng as nuget repo failing + inputs: + targetType: F + optionsFC: 0 + + # AntiMalware scan + - task: securedevelopmentteam.vss-secure-development-tools.build-task-antimalware.AntiMalware@4 + displayName: 'AntiMalware' + continueOnError: true # signature refresh failing resulting in tasks failures + inputs: + EnableServices: true + + - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 + displayName: 'Component Governance Detection' #https://docs.opensource.microsoft.com/tools/cg.html + inputs: + alertWarningLevel: Medium + failOnAlert: true + + # Publish Analysis Results (position after all tools ran) + - task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@3 + displayName: 'Publish Security Analysis Logs' + + # The Post-Analysis build task will analyze the log files produced by the tools, and introduce a build break + - task: securedevelopmentteam.vss-secure-development-tools.build-task-postanalysis.PostAnalysis@2 + displayName: 'Post Analysis' + condition: eq(1,2) #disablng as nuget repo failing + inputs: + GdnBreakFast: true + GdnBreakAllTools: false + GdnBreakGdnToolCredScan: true + GdnBreakGdnToolBinSkim: true + GdnBreakGdnToolPoliCheck: true + GdnBreakGdnToolPoliCheckSeverity: Error diff --git a/templates/static-tools-encryption.yml b/templates/static-tools-encryption.yml new file mode 100644 index 0000000000..f553d93e3d --- /dev/null +++ b/templates/static-tools-encryption.yml @@ -0,0 +1,83 @@ +# File: templates\static-tools-encryption.yml + +parameters: + BuildConfiguration: '' + VmImage: '' + +jobs: +- job: + displayName: Static Analysis + pool: + name: 'OneES' + + steps: + - checkout: self # self represents the repo where the initial Pipelines YAML file was found + clean: true # if true, execute `execute git clean -ffdx && git reset --hard HEAD` before fetching + + - task: DotNetCoreCLI@2 + displayName: Build Microsoft.Azure.Cosmos.Encryption + inputs: + command: build + nugetConfigPath: NuGet.config + projects: Microsoft.Azure.Cosmos.Encryption/src/Microsoft.Azure.Cosmos.Encryption.csproj + arguments: '-p:Optimize=true --configuration Release' + versioningScheme: OFF + + - task: securedevelopmentteam.vss-secure-development-tools.build-task-binskim.BinSkim@4 + displayName: 'BinSkim' + condition: eq(1,2) #disablng as nuget repo failing + inputs: + AnalyzeTargetGlob: $(Build.SourcesDirectory)\Microsoft.Azure.Cosmos.Encryption\src\bin\Release\netstandard2.0\Microsoft.Azure.Cosmos.Encryption.dll + AnalyzeRecurse: true + AnalyzeVerbose: true + AnalyzeHashes: false + AnalyzeStatistics: false + AnalyzeEnvironment: false + + # Analyze source and build output text files for credentials + - task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@3 + displayName: 'CredScan' + condition: eq(1,2) #disablng as nuget repo failing + inputs: + toolMajorVersion: V2 + scanFolder: $(Build.SourcesDirectory) + suppressionsFile: CredScanSuppressions.json + debugMode: false + verboseOutput: false + + # Scan text elements including code, code comments, and content/web pages, for sensitive terms based on legal, cultural, or geopolitical reasons + - task: securedevelopmentteam.vss-secure-development-tools.build-task-policheck.PoliCheck@2 + displayName: 'PoliCheck' + condition: eq(1,2) #disablng as nuget repo failing + inputs: + targetType: F + optionsFC: 0 + + # AntiMalware scan + - task: securedevelopmentteam.vss-secure-development-tools.build-task-antimalware.AntiMalware@4 + displayName: 'AntiMalware' + continueOnError: true # signature refresh failing resulting in tasks failures + inputs: + EnableServices: true + + - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 + displayName: 'Component Governance Detection' #https://docs.opensource.microsoft.com/tools/cg.html + inputs: + alertWarningLevel: Medium + failOnAlert: true + + # Publish Analysis Results (position after all tools ran) + - task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@3 + displayName: 'Publish Security Analysis Logs' + + # The Post-Analysis build task will analyze the log files produced by the tools, and introduce a build break + - task: securedevelopmentteam.vss-secure-development-tools.build-task-postanalysis.PostAnalysis@2 + displayName: 'Post Analysis' + condition: eq(1,2) #disablng as nuget repo failing + inputs: + GdnBreakFast: true + GdnBreakAllTools: false + GdnBreakGdnToolCredScan: true + GdnBreakGdnToolBinSkim: true + GdnBreakGdnToolPoliCheck: true + GdnBreakGdnToolPoliCheckSeverity: Error