Skip to content

Commit

Permalink
Reshuffle shared source files (Azure#38509)
Browse files Browse the repository at this point in the history
* Move GZipUtf8JsonRequestContent to Monitor

* Move GuidUtilities to ServiceBus

* Make GeoRedundantFallbackPolicy internal

* move ErrorResponse<T> into HttpPipelineExtensions

* Move NoValueResponse<T> to Tables
  • Loading branch information
annelo-msft authored and yaotongms committed Oct 12, 2023
1 parent 44b83e0 commit af83deb
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 36 deletions.
1 change: 0 additions & 1 deletion eng/Directory.Build.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@
<Compile Include="$(AzureCoreSharedSources)ClientDiagnostics.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)DiagnosticScope.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)DiagnosticScopeFactory.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)ErrorResponse.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)FixedDelayWithNoJitterStrategy.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)FormUrlEncodedContent.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)HttpMessageSanitizer.cs" LinkBase="Shared/Core" />
Expand Down
1 change: 0 additions & 1 deletion sdk/core/Azure.Core/src/Azure.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
<Compile Include="Shared\CancellationHelper.cs" />
<Compile Include="Shared\OperationPoller.cs" />
<Compile Include="Shared\TypeReferenceTypeAttribute.cs" />
<Compile Include="Shared\GeoRedundantFallbackPolicy.cs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
using System;
using System.Diagnostics;
using System.Threading;
using Azure.Core.Pipeline;

#nullable enable

namespace Azure.Core.Shared
namespace Azure.Core.Pipeline
{
/// <summary>
/// Internal policy that can be used to support georedundant fallbacks for Azure services. The policy maintains the current healthy host
Expand Down Expand Up @@ -172,4 +171,4 @@ public void ResetPrimaryIfNeeded()
}
}
}
}
}
23 changes: 0 additions & 23 deletions sdk/core/Azure.Core/src/Shared/ErrorResponse.cs

This file was deleted.

16 changes: 16 additions & 0 deletions sdk/core/Azure.Core/src/Shared/HttpPipelineExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,21 @@ private static (CancellationToken CancellationToken, ErrorOptions ErrorOptions)

return (requestContext.CancellationToken, requestContext.ErrorOptions);
}

internal class ErrorResponse<T> : Response<T>
{
private readonly Response _response;
private readonly RequestFailedException _exception;

public ErrorResponse(Response response, RequestFailedException exception)
{
_response = response;
_exception = exception;
}

public override T Value { get => throw _exception; }

public override Response GetRawResponse() => _response;
}
}
}
4 changes: 0 additions & 4 deletions sdk/core/Azure.Core/tests/Azure.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,8 @@
<Compile Include="..\src\Shared\ChangeTrackingDictionary.cs" LinkBase="Shared" />
<Compile Include="..\src\Shared\ChangeTrackingList.cs" LinkBase="Shared" />
<Compile Include="..\src\Shared\ConnectionString.cs" LinkBase="Shared" />
<Compile Include="..\src\Shared\ErrorResponse.cs" LinkBase="Shared" />
<Compile Include="..\src\Shared\FormUrlEncodedContent.cs" LinkBase="Shared" />
<Compile Include="..\src\Shared\ForwardsClientCallsAttribute.cs" LinkBase="Shared" />
<Compile Include="..\src\Shared\GuidUtilities.cs" LinkBase="Shared" />
<Compile Include="..\src\Shared\GZipUtf8JsonRequestContent.cs" LinkBase="Shared" />
<Compile Include="..\src\Shared\HttpPipelineExtensions.cs" LinkBase="Shared" />
<Compile Include="..\src\Shared\IUtf8JsonSerializable.cs" LinkBase="Shared" />
<Compile Include="..\src\Shared\IOperationSource.cs" LinkBase="Shared" />
Expand All @@ -48,7 +45,6 @@
<Compile Include="..\src\Shared\LightweightPkcs8Decoder.cs" LinkBase="Shared" />
<Compile Include="..\src\Shared\NextLinkOperationImplementation.cs" LinkBase="Shared" />
<Compile Include="..\src\Shared\NoBodyResponseOfT.cs" LinkBase="Shared" />
<Compile Include="..\src\Shared\NoValueResponseOfT.cs" LinkBase="Shared" />
<Compile Include="..\src\Shared\OperationFinalStateVia.cs" LinkBase="Shared" />
<Compile Include="..\src\Shared\Optional.cs" LinkBase="Shared" />
<Compile Include="..\src\Shared\Page.cs" LinkBase="Shared" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<Compile Include="$(AzureCoreSharedSources)ArrayBufferWriter.cs" LinkBase="Shared" />
<Compile Include="$(AzureCoreSharedSources)AzureResourceProviderNamespaceAttribute.cs" LinkBase="Shared" />
<Compile Include="$(AzureCoreSharedSources)AzureKeyCredentialPolicy.cs" LinkBase="Shared" />
<Compile Include="$(AzureCoreSharedSources)GZipUtf8JsonRequestContent.cs" LinkBase="Shared" />
<Compile Include="$(AzureCoreSharedSources)SyncAsyncEventHandlerExtensions.cs" LinkBase="Shared" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
<Compile Include="$(AzureCoreSharedSources)ValueStopwatch.cs" LinkBase="SharedSource\Azure.Core" />
<Compile Include="$(AzureCoreSharedSources)PageResponseEnumerator.cs" LinkBase="SharedSource\Azure.Core" />
<Compile Include="$(AzureCoreSharedSources)AzureResourceProviderNamespaceAttribute.cs" LinkBase="SharedSource\Azure.Core" />
<Compile Include="$(AzureCoreSharedSources)GuidUtilities.cs" LinkBase="SharedSource\Azure.Core" />
<Compile Include="$(AzureCoreSharedSources)MessagingClientDiagnostics.cs" LinkBase="SharedSource\Azure.Core" />
<Compile Include="$(AzureCoreSharedSources)MessagingDiagnosticOperation.cs" LinkBase="SharedSource\Azure.Core" />
<Compile Include="$(AzureCoreAmqpSharedSources)AmqpAnnotatedMessageConverter.cs" LinkBase="SharedSource\Azure.Core.Amqp" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Azure.Core.Shared;
using NUnit.Framework;

namespace Azure.Core.Tests;
namespace Azure.Messaging.ServiceBus.Tests;

public class GuidUtilitiesTests
{
Expand Down
1 change: 0 additions & 1 deletion sdk/tables/Azure.Data.Tables/src/Azure.Data.Tables.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
</ItemGroup>

<ItemGroup>
<Compile Include="$(AzureCoreSharedSources)NoValueResponseOfT.cs" LinkBase="Shared" />
<Compile Include="$(AzureCoreSharedSources)ForwardsClientCallsAttribute.cs" LinkBase="Shared" />
</ItemGroup>
<ItemGroup>
Expand Down

0 comments on commit af83deb

Please sign in to comment.