From 5775771f5d4ef4df43d32f5382158052b124bef2 Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Thu, 27 Oct 2022 22:52:12 +0800 Subject: [PATCH 01/18] implement operation id --- .../NextLinkOperationImplementation.cs | 14 +++++++++++++- src/assets/Generator.Shared/ProtocolOperation.cs | 9 +++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/assets/Generator.Shared/NextLinkOperationImplementation.cs b/src/assets/Generator.Shared/NextLinkOperationImplementation.cs index 909d5b5421d..793cd8ea317 100644 --- a/src/assets/Generator.Shared/NextLinkOperationImplementation.cs +++ b/src/assets/Generator.Shared/NextLinkOperationImplementation.cs @@ -4,6 +4,7 @@ #nullable enable using System; +using System.Collections.Generic; using System.Linq; using System.Text.Json; using System.Threading; @@ -36,10 +37,20 @@ public static IOperation Create( Uri startRequestUri, Response response, OperationFinalStateVia finalStateVia, + out string id, string? apiVersionOverride = null) { string? apiVersionStr = apiVersionOverride ?? (TryGetApiVersion(startRequestUri, out ReadOnlySpan apiVersion) ? apiVersion.ToString() : null); var headerSource = GetHeaderSource(requestMethod, startRequestUri, response, apiVersionStr, out var nextRequestUri); + var lroDetails = new Dictionary() + { + ["HeaderSource"] = HeaderSource.Location.ToString(), + ["NextRequestUri"] = nextRequestUri, + ["InitialUri"] = startRequestUri.AbsoluteUri, + ["InitialResponse"] = response.ToString() + }; + var lroData = BinaryData.FromObjectAsJson(lroDetails); + id = Convert.ToBase64String(lroData.ToArray()); if (headerSource == HeaderSource.None && IsFinalState(response, headerSource, out var failureState)) { return new CompletedOperation(failureState ?? GetOperationStateFromFinalResponse(requestMethod, response)); @@ -61,9 +72,10 @@ public static IOperation Create( Uri startRequestUri, Response response, OperationFinalStateVia finalStateVia, + out string id, string? apiVersionOverride = null) { - var operation = Create(pipeline, requestMethod, startRequestUri, response, finalStateVia, apiVersionOverride); + var operation = Create(pipeline, requestMethod, startRequestUri, response, finalStateVia, out id, apiVersionOverride); return new OperationToOperationOfT(operationSource, operation); } diff --git a/src/assets/Generator.Shared/ProtocolOperation.cs b/src/assets/Generator.Shared/ProtocolOperation.cs index ad51347ae3d..69ce042895b 100644 --- a/src/assets/Generator.Shared/ProtocolOperation.cs +++ b/src/assets/Generator.Shared/ProtocolOperation.cs @@ -19,16 +19,13 @@ internal class ProtocolOperation : Operation, IOperation where T : notn internal ProtocolOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, string scopeName, Func resultSelector) { _resultSelector = resultSelector; - _nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia); + _nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, out string id); + Id = id; _operation = new OperationInternal(clientDiagnostics, this, response, scopeName); } -#pragma warning disable CA1822 - // This scenario is currently unsupported. - // See: https://github.com/Azure/autorest.csharp/issues/2158. /// - public override string Id => throw new NotSupportedException(); -#pragma warning restore CA1822 + public override string Id { get; } /// public override T Value => _operation.Value; From 218c786c74a889a987462f48f0fd1d1596a70d4c Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Mon, 7 Nov 2022 13:30:17 +0800 Subject: [PATCH 02/18] calculate operation id --- .../NextLinkOperationImplementation.cs | 122 ++++++++++++++++-- 1 file changed, 114 insertions(+), 8 deletions(-) diff --git a/src/assets/Generator.Shared/NextLinkOperationImplementation.cs b/src/assets/Generator.Shared/NextLinkOperationImplementation.cs index 793cd8ea317..9aba630d095 100644 --- a/src/assets/Generator.Shared/NextLinkOperationImplementation.cs +++ b/src/assets/Generator.Shared/NextLinkOperationImplementation.cs @@ -5,8 +5,10 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text.Json; +using System.Text.Json.Serialization; using System.Threading; using System.Threading.Tasks; using System.Xml.Linq; @@ -42,29 +44,75 @@ public static IOperation Create( { string? apiVersionStr = apiVersionOverride ?? (TryGetApiVersion(startRequestUri, out ReadOnlySpan apiVersion) ? apiVersion.ToString() : null); var headerSource = GetHeaderSource(requestMethod, startRequestUri, response, apiVersionStr, out var nextRequestUri); - var lroDetails = new Dictionary() + var (originalResponseHasLocation, lastKnownLocation) = headerSource == HeaderSource.Location + ? (true, nextRequestUri) + : response.Headers.TryGetValue("Location", out var locationUri) + ? (true, locationUri) + : (false, null); + var serializeOptions = new JsonSerializerOptions { Converters = { new StreamConverter() } }; + var lroDetails = new Dictionary() { - ["HeaderSource"] = HeaderSource.Location.ToString(), + ["HeaderSource"] = headerSource.ToString(), ["NextRequestUri"] = nextRequestUri, ["InitialUri"] = startRequestUri.AbsoluteUri, - ["InitialResponse"] = response.ToString() + ["InitialResponse"] = BinaryData.FromObjectAsJson(response, serializeOptions).ToString(), + ["RequestMethod"] = requestMethod.ToString(), + ["OriginalResponseHasLocation"] = originalResponseHasLocation.ToString(), + ["LastKnownLocation"] = lastKnownLocation, + ["FinalStateVia"] = finalStateVia.ToString() }; var lroData = BinaryData.FromObjectAsJson(lroDetails); id = Convert.ToBase64String(lroData.ToArray()); + if (headerSource == HeaderSource.None && IsFinalState(response, headerSource, out var failureState)) { return new CompletedOperation(failureState ?? GetOperationStateFromFinalResponse(requestMethod, response)); } - var (originalResponseHasLocation, lastKnownLocation) = headerSource == HeaderSource.Location - ? (true, nextRequestUri) - : response.Headers.TryGetValue("Location", out var locationUri) - ? (true, locationUri) - : (false, null); + return new NextLinkOperationImplementation(pipeline, requestMethod, startRequestUri, nextRequestUri, headerSource, originalResponseHasLocation, lastKnownLocation, finalStateVia, apiVersionStr); + } + + public static IOperation Create( + HttpPipeline pipeline, + RequestMethod requestMethod, + Uri startRequestUri, + Response response, + OperationFinalStateVia finalStateVia, + string nextRequestUri, + string headerSourceStr, + bool originalResponseHasLocation, + string lastKnownLocation, + string? apiVersionOverride = null) + { + string? apiVersionStr = apiVersionOverride ?? (TryGetApiVersion(startRequestUri, out ReadOnlySpan apiVersion) ? apiVersion.ToString() : null); + if (!Enum.TryParse(headerSourceStr, out HeaderSource headerSource)) + headerSource = HeaderSource.None; + + if (headerSource == HeaderSource.None && IsFinalState(response, headerSource, out var failureState)) + { + return new CompletedOperation(failureState ?? GetOperationStateFromFinalResponse(requestMethod, response)); + } return new NextLinkOperationImplementation(pipeline, requestMethod, startRequestUri, nextRequestUri, headerSource, originalResponseHasLocation, lastKnownLocation, finalStateVia, apiVersionStr); } + public static IOperation Create( + IOperationSource operationSource, + HttpPipeline pipeline, + RequestMethod requestMethod, + Uri startRequestUri, + Response response, + OperationFinalStateVia finalStateVia, + string nextRequestUri, + string headerSourceStr, + bool originalResponseHasLocation, + string lastKnownLocation, + string? apiVersionOverride = null) + { + var operation = Create(pipeline, requestMethod, startRequestUri, response, finalStateVia, nextRequestUri, headerSourceStr, originalResponseHasLocation, lastKnownLocation, apiVersionOverride); + return new OperationToOperationOfT(operationSource, operation); + } + public static IOperation Create( IOperationSource operationSource, HttpPipeline pipeline, @@ -436,5 +484,63 @@ public async ValueTask> UpdateStateAsync(bool async, Cancellat return OperationState.Pending(state.RawResponse); } } + + private class StreamConverter : JsonConverter + { + /// Serialize stream to BinaryData string. + /// The writer. + /// The Stream model. + /// The options for JsonSerializer. + public override void Write(Utf8JsonWriter writer, Stream model, JsonSerializerOptions options) + { + if (model.Length == 0) + { + //JsonSerializer.Serialize(writer, JsonDocument.Parse("{}").RootElement); + writer.WriteNullValue(); + return; + } + MemoryStream? memoryContent = model as MemoryStream; + + if (memoryContent == null) + { + throw new InvalidOperationException($"The response is not fully buffered."); + } + + if (memoryContent.TryGetBuffer(out ArraySegment segment)) + { + var data = new BinaryData(segment.AsMemory()); +#if NET6_0_OR_GREATER + writer.WriteRawValue(data); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(data.ToString()).RootElement); +#endif + } + else + { + var data = new BinaryData(memoryContent.ToArray()); +#if NET6_0_OR_GREATER + writer.WriteRawValue(data); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(data.ToString()).RootElement); +#endif + } + } + + /// Deserialize Stream from BinaryData string. + /// The reader. + /// The type to convert + /// The options for JsonSerializer. + public override Stream Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + using var document = JsonDocument.ParseValue(ref reader); + foreach (var property in document.RootElement.EnumerateObject()) + { + // todo: add null check + var value = property.Value.GetString(); + return BinaryData.FromString(value!).ToStream(); + } + return new BinaryData(Array.Empty()).ToStream(); + } + } } } From a1ef6ceecebdf45b3d09b96b56d0ed1292814d4b Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Mon, 14 Nov 2022 10:44:09 +0800 Subject: [PATCH 03/18] add GetOperationId method --- .../Azure.Core.Shared/OperationInternal.cs | 15 ++ .../Azure.Core.Shared/OperationInternalOfT.cs | 89 ++++++++++ .../NextLinkOperationImplementation.cs | 159 ++++++------------ 3 files changed, 155 insertions(+), 108 deletions(-) diff --git a/src/assets/Azure.Core.Shared/OperationInternal.cs b/src/assets/Azure.Core.Shared/OperationInternal.cs index 245ef6c2fde..f1b6f269216 100644 --- a/src/assets/Azure.Core.Shared/OperationInternal.cs +++ b/src/assets/Azure.Core.Shared/OperationInternal.cs @@ -110,6 +110,11 @@ private OperationInternal(OperationState finalState) protected override async ValueTask UpdateStatusAsync(bool async, CancellationToken cancellationToken) => async ? await _internalOperation.UpdateStatusAsync(cancellationToken).ConfigureAwait(false) : _internalOperation.UpdateStatus(cancellationToken); + public string GetOperationId() + { + return _internalOperation.GetOperationId(); + } + // Wrapper type that converts OperationState to OperationState and can be passed to `OperationInternal` constructor. private class OperationToOperationOfTProxy : IOperation { @@ -135,6 +140,11 @@ public async ValueTask> UpdateStateAsync(bool async, C return OperationState.Failure(state.RawResponse, state.OperationFailedException); } + + public string GetOperationId() + { + return _operation.GetOperationId(); + } } } @@ -173,6 +183,11 @@ internal interface IOperation /// /// ValueTask UpdateStateAsync(bool async, CancellationToken cancellationToken); + + /// + /// To get the Id of the operation for rehydration purpose. + /// + string GetOperationId(); } /// diff --git a/src/assets/Azure.Core.Shared/OperationInternalOfT.cs b/src/assets/Azure.Core.Shared/OperationInternalOfT.cs index 3319a8d8c38..6dd5ee7f39a 100644 --- a/src/assets/Azure.Core.Shared/OperationInternalOfT.cs +++ b/src/assets/Azure.Core.Shared/OperationInternalOfT.cs @@ -5,6 +5,9 @@ using System; using System.Collections.Generic; +using System.IO; +using System.Text.Json; +using System.Text.Json.Serialization; using System.Threading; using System.Threading.Tasks; using Azure.Core.Pipeline; @@ -279,6 +282,24 @@ protected override async ValueTask UpdateStatusAsync(bool async, Cance } } + public string GetOperationId() + { + try + { + return _operation.GetOperationId(); + } + catch (NotImplementedException) + { + var serializeOptions = new JsonSerializerOptions { Converters = { new StreamConverter() } }; + var lroDetails = new Dictionary() + { + ["InitialResponse"] = BinaryData.FromObjectAsJson(_rawResponse).ToString() + }; + var lroData = BinaryData.FromObjectAsJson(lroDetails); + return Convert.ToBase64String(lroData.ToArray()); + } + } + private static Response GetResponseFromState(OperationState state) { if (state.HasSucceeded) @@ -289,10 +310,73 @@ private static Response GetResponseFromState(OperationState state) throw state.OperationFailedException!; } + private class StreamConverter : JsonConverter + { + /// Serialize stream to BinaryData string. + /// The writer. + /// The Stream model. + /// The options for JsonSerializer. + public override void Write(Utf8JsonWriter writer, Stream model, JsonSerializerOptions options) + { + if (model.Length == 0) + { + //JsonSerializer.Serialize(writer, JsonDocument.Parse("{}").RootElement); + writer.WriteNullValue(); + return; + } + MemoryStream? memoryContent = model as MemoryStream; + + if (memoryContent == null) + { + throw new InvalidOperationException($"The response is not fully buffered."); + } + + if (memoryContent.TryGetBuffer(out ArraySegment segment)) + { + var data = new BinaryData(segment.AsMemory()); +#if NET6_0_OR_GREATER + writer.WriteRawValue(data); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(data.ToString()).RootElement); +#endif + } + else + { + var data = new BinaryData(memoryContent.ToArray()); +#if NET6_0_OR_GREATER + writer.WriteRawValue(data); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(data.ToString()).RootElement); +#endif + } + } + + /// Deserialize Stream from BinaryData string. + /// The reader. + /// The type to convert + /// The options for JsonSerializer. + public override Stream Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + using var document = JsonDocument.ParseValue(ref reader); + foreach (var property in document.RootElement.EnumerateObject()) + { + // todo: add null check + var value = property.Value.GetString(); + return BinaryData.FromString(value!).ToStream(); + } + return new BinaryData(Array.Empty()).ToStream(); + } + } + private class FinalOperation : IOperation { public ValueTask> UpdateStateAsync(bool async, CancellationToken cancellationToken) => throw new NotSupportedException("The operation has already completed"); + + public string GetOperationId() + { + throw new NotImplementedException(); + } } } @@ -333,6 +417,11 @@ internal interface IOperation /// /// ValueTask> UpdateStateAsync(bool async, CancellationToken cancellationToken); + + /// + /// To get the Id of the operation for rehydration purpose. + /// + string GetOperationId(); } /// diff --git a/src/assets/Generator.Shared/NextLinkOperationImplementation.cs b/src/assets/Generator.Shared/NextLinkOperationImplementation.cs index 9aba630d095..fce936e889a 100644 --- a/src/assets/Generator.Shared/NextLinkOperationImplementation.cs +++ b/src/assets/Generator.Shared/NextLinkOperationImplementation.cs @@ -39,91 +39,66 @@ public static IOperation Create( Uri startRequestUri, Response response, OperationFinalStateVia finalStateVia, - out string id, string? apiVersionOverride = null) { string? apiVersionStr = apiVersionOverride ?? (TryGetApiVersion(startRequestUri, out ReadOnlySpan apiVersion) ? apiVersion.ToString() : null); var headerSource = GetHeaderSource(requestMethod, startRequestUri, response, apiVersionStr, out var nextRequestUri); + if (headerSource == HeaderSource.None && IsFinalState(response, headerSource, out var failureState)) + { + return new CompletedOperation(failureState ?? GetOperationStateFromFinalResponse(requestMethod, response)); + } + var (originalResponseHasLocation, lastKnownLocation) = headerSource == HeaderSource.Location ? (true, nextRequestUri) : response.Headers.TryGetValue("Location", out var locationUri) ? (true, locationUri) : (false, null); - var serializeOptions = new JsonSerializerOptions { Converters = { new StreamConverter() } }; - var lroDetails = new Dictionary() - { - ["HeaderSource"] = headerSource.ToString(), - ["NextRequestUri"] = nextRequestUri, - ["InitialUri"] = startRequestUri.AbsoluteUri, - ["InitialResponse"] = BinaryData.FromObjectAsJson(response, serializeOptions).ToString(), - ["RequestMethod"] = requestMethod.ToString(), - ["OriginalResponseHasLocation"] = originalResponseHasLocation.ToString(), - ["LastKnownLocation"] = lastKnownLocation, - ["FinalStateVia"] = finalStateVia.ToString() - }; - var lroData = BinaryData.FromObjectAsJson(lroDetails); - id = Convert.ToBase64String(lroData.ToArray()); - - if (headerSource == HeaderSource.None && IsFinalState(response, headerSource, out var failureState)) - { - return new CompletedOperation(failureState ?? GetOperationStateFromFinalResponse(requestMethod, response)); - } return new NextLinkOperationImplementation(pipeline, requestMethod, startRequestUri, nextRequestUri, headerSource, originalResponseHasLocation, lastKnownLocation, finalStateVia, apiVersionStr); } - public static IOperation Create( + public static IOperation Create( + IOperationSource operationSource, HttpPipeline pipeline, RequestMethod requestMethod, Uri startRequestUri, Response response, OperationFinalStateVia finalStateVia, - string nextRequestUri, - string headerSourceStr, - bool originalResponseHasLocation, - string lastKnownLocation, string? apiVersionOverride = null) { - string? apiVersionStr = apiVersionOverride ?? (TryGetApiVersion(startRequestUri, out ReadOnlySpan apiVersion) ? apiVersion.ToString() : null); - if (!Enum.TryParse(headerSourceStr, out HeaderSource headerSource)) - headerSource = HeaderSource.None; - - if (headerSource == HeaderSource.None && IsFinalState(response, headerSource, out var failureState)) - { - return new CompletedOperation(failureState ?? GetOperationStateFromFinalResponse(requestMethod, response)); - } - - return new NextLinkOperationImplementation(pipeline, requestMethod, startRequestUri, nextRequestUri, headerSource, originalResponseHasLocation, lastKnownLocation, finalStateVia, apiVersionStr); + var operation = Create(pipeline, requestMethod, startRequestUri, response, finalStateVia, apiVersionOverride); + return new OperationToOperationOfT(operationSource, operation); } - public static IOperation Create( - IOperationSource operationSource, + public static IOperation Create( HttpPipeline pipeline, - RequestMethod requestMethod, - Uri startRequestUri, - Response response, - OperationFinalStateVia finalStateVia, - string nextRequestUri, - string headerSourceStr, - bool originalResponseHasLocation, - string lastKnownLocation, + string id, string? apiVersionOverride = null) { - var operation = Create(pipeline, requestMethod, startRequestUri, response, finalStateVia, nextRequestUri, headerSourceStr, originalResponseHasLocation, lastKnownLocation, apiVersionOverride); - return new OperationToOperationOfT(operationSource, operation); + var lroDetails = BinaryData.FromBytes(Convert.FromBase64String(id)).ToObjectFromJson>(); + if (!Uri.TryCreate(lroDetails["InitialUri"], UriKind.Absolute, out var startRequestUri)) + throw new InvalidOperationException("Invalid initial URI"); + if (!lroDetails.TryGetValue("NextRequestUri", out var nextRequestUri)) + throw new InvalidOperationException("Invalid next request URI"); + RequestMethod requestMethod = new RequestMethod(lroDetails["RequestMethod"]); + bool originalResponseHasLocation = bool.Parse(lroDetails["OriginalResponseHasLocation"]); + string lastKnownLocation = lroDetails["LastKnownLocation"]; + if (!Enum.TryParse(lroDetails["FinalStateVia"], out OperationFinalStateVia finalStateVia)) + finalStateVia = OperationFinalStateVia.Location; + string? apiVersionStr = apiVersionOverride ?? (TryGetApiVersion(startRequestUri, out ReadOnlySpan apiVersion) ? apiVersion.ToString() : null); + if (!Enum.TryParse(lroDetails["HeaderSource"], out HeaderSource headerSource)) + headerSource = HeaderSource.None; + + return new NextLinkOperationImplementation(pipeline, requestMethod, startRequestUri, nextRequestUri, headerSource, originalResponseHasLocation, lastKnownLocation, finalStateVia, apiVersionStr); } public static IOperation Create( IOperationSource operationSource, HttpPipeline pipeline, - RequestMethod requestMethod, - Uri startRequestUri, - Response response, - OperationFinalStateVia finalStateVia, - out string id, + string id, string? apiVersionOverride = null) { - var operation = Create(pipeline, requestMethod, startRequestUri, response, finalStateVia, out id, apiVersionOverride); + var operation = Create(pipeline, id, apiVersionOverride); return new OperationToOperationOfT(operationSource, operation); } @@ -149,6 +124,22 @@ private NextLinkOperationImplementation( _apiVersion = apiVersion; } + public string GetOperationId() + { + var lroDetails = new Dictionary() + { + ["HeaderSource"] = _headerSource.ToString(), + ["NextRequestUri"] = _nextRequestUri, + ["InitialUri"] = _startRequestUri.AbsoluteUri, + ["RequestMethod"] = _requestMethod.ToString(), + ["OriginalResponseHasLocation"] = _originalResponseHasLocation.ToString(), + ["LastKnownLocation"] = _lastKnownLocation, + ["FinalStateVia"] = _finalStateVia.ToString() + }; + var lroData = BinaryData.FromObjectAsJson(lroDetails); + return Convert.ToBase64String(lroData.ToArray()); + } + public async ValueTask UpdateStateAsync(bool async, CancellationToken cancellationToken) { Response response = await GetResponseAsync(async, _nextRequestUri, cancellationToken).ConfigureAwait(false); @@ -451,6 +442,11 @@ public CompletedOperation(OperationState operationState) } public ValueTask UpdateStateAsync(bool async, CancellationToken cancellationToken) => new(_operationState); + + public string GetOperationId() + { + throw new NotImplementedException(); + } } private sealed class OperationToOperationOfT : IOperation @@ -483,63 +479,10 @@ public async ValueTask> UpdateStateAsync(bool async, Cancellat return OperationState.Pending(state.RawResponse); } - } - private class StreamConverter : JsonConverter - { - /// Serialize stream to BinaryData string. - /// The writer. - /// The Stream model. - /// The options for JsonSerializer. - public override void Write(Utf8JsonWriter writer, Stream model, JsonSerializerOptions options) + public string GetOperationId() { - if (model.Length == 0) - { - //JsonSerializer.Serialize(writer, JsonDocument.Parse("{}").RootElement); - writer.WriteNullValue(); - return; - } - MemoryStream? memoryContent = model as MemoryStream; - - if (memoryContent == null) - { - throw new InvalidOperationException($"The response is not fully buffered."); - } - - if (memoryContent.TryGetBuffer(out ArraySegment segment)) - { - var data = new BinaryData(segment.AsMemory()); -#if NET6_0_OR_GREATER - writer.WriteRawValue(data); -#else - JsonSerializer.Serialize(writer, JsonDocument.Parse(data.ToString()).RootElement); -#endif - } - else - { - var data = new BinaryData(memoryContent.ToArray()); -#if NET6_0_OR_GREATER - writer.WriteRawValue(data); -#else - JsonSerializer.Serialize(writer, JsonDocument.Parse(data.ToString()).RootElement); -#endif - } - } - - /// Deserialize Stream from BinaryData string. - /// The reader. - /// The type to convert - /// The options for JsonSerializer. - public override Stream Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - using var document = JsonDocument.ParseValue(ref reader); - foreach (var property in document.RootElement.EnumerateObject()) - { - // todo: add null check - var value = property.Value.GetString(); - return BinaryData.FromString(value!).ToStream(); - } - return new BinaryData(Array.Empty()).ToStream(); + return _operation.GetOperationId(); } } } From 2c74c2134622480a357f933cf013e1e98900acf9 Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Wed, 16 Nov 2022 13:53:24 +0800 Subject: [PATCH 04/18] update shared source --- .../Azure.Core.Shared/OperationInternal.cs | 225 +++++++++++++++++- .../Azure.Core.Shared/OperationInternalOfT.cs | 39 ++- .../Generator.Shared/ProtocolOperation.cs | 10 +- 3 files changed, 262 insertions(+), 12 deletions(-) diff --git a/src/assets/Azure.Core.Shared/OperationInternal.cs b/src/assets/Azure.Core.Shared/OperationInternal.cs index f1b6f269216..dd0587309f5 100644 --- a/src/assets/Azure.Core.Shared/OperationInternal.cs +++ b/src/assets/Azure.Core.Shared/OperationInternal.cs @@ -3,6 +3,11 @@ using System; using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; using System.Threading; using System.Threading.Tasks; using Azure.Core.Pipeline; @@ -86,7 +91,7 @@ internal class OperationInternal : OperationInternalBase public OperationInternal( ClientDiagnostics clientDiagnostics, IOperation operation, - Response rawResponse, + Response? rawResponse, string? operationTypeName = null, IEnumerable>? scopeAttributes = null, DelayStrategy? fallbackStrategy = null) @@ -103,6 +108,26 @@ private OperationInternal(OperationState finalState) : OperationInternal.Failed(finalState.RawResponse, finalState.OperationFailedException!); } + public static OperationInternal Create( + string id, + ClientDiagnostics clientDiagnostics, + HttpPipeline pipeline, + string? operationTypeName = null, + IEnumerable>? scopeAttributes = null, + DelayStrategy? fallbackStrategy = null, + string? interimApiVersion = null) + { + var lroDetails = BinaryData.FromBytes(Convert.FromBase64String(id)).ToObjectFromJson>(); + + if (lroDetails.TryGetValue("FinalResponse", out string? finalResponse)) + { + Response response = JsonSerializer.Deserialize(finalResponse)!; + return OperationInternal.Succeeded(response); + } + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, interimApiVersion); + return new OperationInternal(clientDiagnostics, nextLinkOperation, null, operationTypeName, scopeAttributes, fallbackStrategy); + } + public override Response RawResponse => _internalOperation.RawResponse; public override bool HasCompleted => _internalOperation.HasCompleted; @@ -146,6 +171,204 @@ public string GetOperationId() return _operation.GetOperationId(); } } + + [JsonConverter(typeof(DecodedResponseConverter))] + internal class DecodedResponse : Response + { + #nullable disable + private readonly Dictionary> _headers = new Dictionary>(StringComparer.OrdinalIgnoreCase); + + public DecodedResponse() + { + } + + internal DecodedResponse(int status, string reasonPhrase, Stream contentStream, string clientRequestId, bool isError, Dictionary> headers) + { + Status = status; + ReasonPhrase = reasonPhrase; + ContentStream = contentStream; + ClientRequestId = clientRequestId; + _isError = isError; + _headers = headers; + } + + internal static DecodedResponse DeserializeDecodedResponse(JsonElement element) + { + int status = default; + Optional reasonPhrase = default; + Optional contentStream = default; + Optional clientRequestId = default; + Optional isError = default; + Dictionary> headers = new Dictionary>(StringComparer.OrdinalIgnoreCase); + + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("Status")) + { + status = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("ReasonPhrase")) + { + reasonPhrase = property.Value.GetString(); + continue; + } + if (property.NameEquals("ContentStream")) + { + var content = property.Value.GetString(); + contentStream = new MemoryStream(Encoding.UTF8.GetBytes(content ?? "")); + continue; + } + if (property.NameEquals("ClientRequestId")) + { + clientRequestId = property.Value.GetString(); + continue; + } + if (property.NameEquals("IsError")) + { + isError = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("Headers")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + string name = default; + string value = default; + foreach (var property0 in item.EnumerateObject()) + { + if (property0.NameEquals("Name")) + { + name = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("Value")) + { + value = property0.Value.GetString(); + continue; + } + } + array.Add(new HttpHeader(name, value)); + } + foreach (var item in array) + { + if (!headers.TryGetValue(item.Name, out List values)) + { + headers[item.Name] = values = new List(); + } + values.Add(item.Value); + } + continue; + } + } + return new DecodedResponse(status, reasonPhrase, contentStream, clientRequestId, isError, headers); + } + + internal partial class DecodedResponseConverter : JsonConverter + { + public override void Write(Utf8JsonWriter writer, DecodedResponse model, JsonSerializerOptions options) + { + writer.WriteObjectValue(model); + } + public override DecodedResponse Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + using var document = JsonDocument.ParseValue(ref reader); + return DeserializeDecodedResponse(document.RootElement); + } + } + + public override int Status { get; } + + public override string ReasonPhrase { get; } + + public override Stream ContentStream { get; set; } + + public override string ClientRequestId { get; set; } + + private bool? _isError; + public override bool IsError { get => _isError ?? base.IsError; } + public void SetIsError(bool value) => _isError = value; + + public bool IsDisposed { get; private set; } + + public void SetContent(byte[] content) + { + ContentStream = new MemoryStream(content, 0, content.Length, false, true); + } + + public DecodedResponse SetContent(string content) + { + SetContent(Encoding.UTF8.GetBytes(content)); + return this; + } + + public DecodedResponse AddHeader(string name, string value) + { + return AddHeader(new HttpHeader(name, value)); + } + + public DecodedResponse AddHeader(HttpHeader header) + { + if (!_headers.TryGetValue(header.Name, out List values)) + { + _headers[header.Name] = values = new List(); + } + + values.Add(header.Value); + return this; + } + + #if HAS_INTERNALS_VISIBLE_CORE + internal + #endif + protected override bool TryGetHeader(string name, out string value) + { + if (_headers.TryGetValue(name, out List values)) + { + value = JoinHeaderValue(values); + return true; + } + + value = null; + return false; + } + + #if HAS_INTERNALS_VISIBLE_CORE + internal + #endif + protected override bool TryGetHeaderValues(string name, out IEnumerable values) + { + var result = _headers.TryGetValue(name, out List valuesList); + values = valuesList; + return result; + } + + #if HAS_INTERNALS_VISIBLE_CORE + internal + #endif + protected override bool ContainsHeader(string name) + { + return TryGetHeaderValues(name, out _); + } + + #if HAS_INTERNALS_VISIBLE_CORE + internal + #endif + protected override IEnumerable EnumerateHeaders() => _headers.Select(h => new HttpHeader(h.Key, JoinHeaderValue(h.Value))); + + private static string JoinHeaderValue(IEnumerable values) + { + return string.Join(",", values); + } + + public override void Dispose() + { + IsDisposed = true; + GC.SuppressFinalize(this); + } + #nullable enable + } } /// diff --git a/src/assets/Azure.Core.Shared/OperationInternalOfT.cs b/src/assets/Azure.Core.Shared/OperationInternalOfT.cs index 6dd5ee7f39a..740d592a6d0 100644 --- a/src/assets/Azure.Core.Shared/OperationInternalOfT.cs +++ b/src/assets/Azure.Core.Shared/OperationInternalOfT.cs @@ -56,7 +56,7 @@ internal class OperationInternal : OperationInternalBase { private readonly IOperation _operation; private readonly AsyncLockWithValue> _stateLock; - private Response _rawResponse; + private Response? _rawResponse; /// /// Initializes a new instance of the class in a final successful state. @@ -98,7 +98,7 @@ internal class OperationInternal : OperationInternalBase public OperationInternal( ClientDiagnostics clientDiagnostics, IOperation operation, - Response rawResponse, + Response? rawResponse, string? operationTypeName = null, IEnumerable>? scopeAttributes = null, DelayStrategy? fallbackStrategy = null) @@ -119,7 +119,28 @@ private OperationInternal(OperationState finalState) _stateLock = new AsyncLockWithValue>(finalState); } - public override Response RawResponse => _stateLock.TryGetValue(out var state) ? state.RawResponse : _rawResponse; + public static OperationInternal Create( + string id, + IOperationSource source, + ClientDiagnostics clientDiagnostics, + HttpPipeline pipeline, + string? operationTypeName = null, + IEnumerable>? scopeAttributes = null, + DelayStrategy? fallbackStrategy = null, + string? interimApiVersion = null) + { + var lroDetails = BinaryData.FromBytes(Convert.FromBase64String(id)).ToObjectFromJson>(); + + if (lroDetails.TryGetValue("FinalResponse", out string? finalResponse)) + { + Response response = JsonSerializer.Deserialize(finalResponse)!; + return OperationInternal.Succeeded(response, source.CreateResult(response, CancellationToken.None)); + } + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, interimApiVersion); + return new OperationInternal(clientDiagnostics, nextLinkOperation, null, operationTypeName, scopeAttributes, fallbackStrategy); + } + + public override Response RawResponse => (_stateLock.TryGetValue(out var state) ? state.RawResponse : _rawResponse) ?? throw new InvalidOperationException("The operation does not have a response yet. Please call UpdateStatus or WaitForCompletion first."); public override bool HasCompleted => _stateLock.HasValue; @@ -293,7 +314,7 @@ public string GetOperationId() var serializeOptions = new JsonSerializerOptions { Converters = { new StreamConverter() } }; var lroDetails = new Dictionary() { - ["InitialResponse"] = BinaryData.FromObjectAsJson(_rawResponse).ToString() + ["FinalResponse"] = BinaryData.FromObjectAsJson(_rawResponse!, serializeOptions).ToString() }; var lroData = BinaryData.FromObjectAsJson(lroDetails); return Convert.ToBase64String(lroData.ToArray()); @@ -310,7 +331,7 @@ private static Response GetResponseFromState(OperationState state) throw state.OperationFailedException!; } - private class StreamConverter : JsonConverter + internal class StreamConverter : JsonConverter { /// Serialize stream to BinaryData string. /// The writer. @@ -320,7 +341,6 @@ public override void Write(Utf8JsonWriter writer, Stream model, JsonSerializerOp { if (model.Length == 0) { - //JsonSerializer.Serialize(writer, JsonDocument.Parse("{}").RootElement); writer.WriteNullValue(); return; } @@ -360,11 +380,14 @@ public override Stream Read(ref Utf8JsonReader reader, Type typeToConvert, JsonS using var document = JsonDocument.ParseValue(ref reader); foreach (var property in document.RootElement.EnumerateObject()) { - // todo: add null check + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } var value = property.Value.GetString(); return BinaryData.FromString(value!).ToStream(); } - return new BinaryData(Array.Empty()).ToStream(); + return new MemoryStream(); } } diff --git a/src/assets/Generator.Shared/ProtocolOperation.cs b/src/assets/Generator.Shared/ProtocolOperation.cs index 69ce042895b..eca20aee99c 100644 --- a/src/assets/Generator.Shared/ProtocolOperation.cs +++ b/src/assets/Generator.Shared/ProtocolOperation.cs @@ -19,13 +19,12 @@ internal class ProtocolOperation : Operation, IOperation where T : notn internal ProtocolOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, string scopeName, Func resultSelector) { _resultSelector = resultSelector; - _nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, out string id); - Id = id; + _nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia); _operation = new OperationInternal(clientDiagnostics, this, response, scopeName); } /// - public override string Id { get; } + public override string Id => _nextLinkOperation.GetOperationId(); /// public override T Value => _operation.Value; @@ -66,5 +65,10 @@ async ValueTask> IOperation.UpdateStateAsync(bool async, Ca return OperationState.Pending(state.RawResponse); } + + public string GetOperationId() + { + return _nextLinkOperation.GetOperationId(); + } } } From 86043602e998456419b90b031f7316aee9c3fb8b Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Wed, 16 Nov 2022 15:47:10 +0800 Subject: [PATCH 05/18] implement LRO id --- .../LongRunningOperation/StorageArmOperation.cs | 10 ++++++---- .../LongRunningOperation/StorageArmOperationOfT.cs | 10 ++++++---- .../LongRunningOperation/SampleArmOperation.cs | 10 ++++++---- .../LongRunningOperation/SampleArmOperationOfT.cs | 10 ++++++---- .../Mgmt/Generation/MgmtLongRunningOperationWriter.cs | 11 +++++++---- .../ExactMatchFlattenInheritanceArmOperationOfT.cs | 10 ++++++---- .../ExactMatchInheritanceArmOperationOfT.cs | 10 ++++++---- .../MgmtDiscriminatorArmOperation.cs | 10 ++++++---- .../MgmtDiscriminatorArmOperationOfT.cs | 10 ++++++---- .../MgmtExpandResourceTypesArmOperation.cs | 10 ++++++---- .../MgmtExpandResourceTypesArmOperationOfT.cs | 10 ++++++---- ...MgmtExtensionCommonRestOperationArmOperationOfT.cs | 10 ++++++---- .../MgmtExtensionResourceArmOperation.cs | 10 ++++++---- .../MgmtExtensionResourceArmOperationOfT.cs | 10 ++++++---- .../LongRunningOperation/MgmtLROArmOperation.cs | 10 ++++++---- .../LongRunningOperation/MgmtLROArmOperationOfT.cs | 10 ++++++---- .../MgmtListMethodsArmOperationOfT.cs | 10 ++++++---- .../MgmtMockAndSampleArmOperation.cs | 10 ++++++---- .../MgmtMockAndSampleArmOperationOfT.cs | 10 ++++++---- .../MgmtMultipleParentResourceArmOperation.cs | 10 ++++++---- .../MgmtMultipleParentResourceArmOperationOfT.cs | 10 ++++++---- .../MgmtNonStringPathVariableArmOperation.cs | 10 ++++++---- .../MgmtNonStringPathVariableArmOperationOfT.cs | 10 ++++++---- .../MgmtOperationsArmOperation.cs | 10 ++++++---- .../MgmtOperationsArmOperationOfT.cs | 10 ++++++---- .../MgmtOptionalConstantArmOperation.cs | 10 ++++++---- .../MgmtOptionalConstantArmOperationOfT.cs | 10 ++++++---- .../MgmtParamOrderingArmOperation.cs | 10 ++++++---- .../MgmtParamOrderingArmOperationOfT.cs | 10 ++++++---- .../LongRunningOperation/MgmtParentArmOperation.cs | 10 ++++++---- .../LongRunningOperation/MgmtParentArmOperationOfT.cs | 10 ++++++---- .../MgmtPropertyChooserArmOperation.cs | 10 ++++++---- .../MgmtPropertyChooserArmOperationOfT.cs | 10 ++++++---- .../MgmtRenameRulesArmOperation.cs | 10 ++++++---- .../MgmtRenameRulesArmOperationOfT.cs | 10 ++++++---- .../MgmtResourceNameArmOperationOfT.cs | 10 ++++++---- .../MgmtSafeFlattenArmOperationOfT.cs | 10 ++++++---- .../MgmtScopeResourceArmOperation.cs | 10 ++++++---- .../MgmtScopeResourceArmOperationOfT.cs | 10 ++++++---- .../MgmtSubscriptionNameParameterArmOperation.cs | 10 ++++++---- .../MgmtSubscriptionNameParameterArmOperationOfT.cs | 10 ++++++---- .../NoTypeReplacementArmOperationOfT.cs | 10 ++++++---- .../OmitOperationGroupsArmOperationOfT.cs | 10 ++++++---- .../LongRunningOperation/PaginationArmOperationOfT.cs | 10 ++++++---- .../ResourceRenameArmOperation.cs | 10 ++++++---- .../ResourceRenameArmOperationOfT.cs | 10 ++++++---- .../SingletonResourceArmOperationOfT.cs | 10 ++++++---- .../SubscriptionExtensionsArmOperationOfT.cs | 10 ++++++---- .../SupersetFlattenInheritanceArmOperationOfT.cs | 10 ++++++---- .../SupersetInheritanceArmOperationOfT.cs | 10 ++++++---- .../LongRunningOperation/TenantOnlyArmOperationOfT.cs | 10 ++++++---- .../XmlDeserializationArmOperation.cs | 10 ++++++---- .../XmlDeserializationArmOperationOfT.cs | 10 ++++++---- 53 files changed, 319 insertions(+), 212 deletions(-) diff --git a/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperation.cs b/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperation.cs index e2b4f1a30a3..83e0abff88e 100644 --- a/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperation.cs +++ b/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperation.cs @@ -37,11 +37,13 @@ internal StorageArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline p _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "StorageArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal StorageArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "StorageArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperationOfT.cs b/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperationOfT.cs index dcd9c80072f..560181a4c8e 100644 --- a/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperationOfT.cs +++ b/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperationOfT.cs @@ -37,11 +37,13 @@ internal StorageArmOperation(IOperationSource source, ClientDiagnostics clien _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "StorageArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal StorageArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "StorageArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperation.cs b/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperation.cs index 04d330f21b7..8bfd2cb3c56 100644 --- a/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperation.cs +++ b/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperation.cs @@ -37,11 +37,13 @@ internal SampleArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pi _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "SampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal SampleArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "SampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperationOfT.cs b/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperationOfT.cs index 8b3fba044b6..b3c443aee41 100644 --- a/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperationOfT.cs +++ b/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperationOfT.cs @@ -37,11 +37,13 @@ internal SampleArmOperation(IOperationSource source, ClientDiagnostics client _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "SampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal SampleArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "SampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/src/AutoRest.CSharp/Mgmt/Generation/MgmtLongRunningOperationWriter.cs b/src/AutoRest.CSharp/Mgmt/Generation/MgmtLongRunningOperationWriter.cs index f14c9ac13af..2961347649c 100644 --- a/src/AutoRest.CSharp/Mgmt/Generation/MgmtLongRunningOperationWriter.cs +++ b/src/AutoRest.CSharp/Mgmt/Generation/MgmtLongRunningOperationWriter.cs @@ -81,12 +81,15 @@ public void Write() } _writer.Line(); + using (_writer.Scope($"internal {_name}({_operationSourceString}{typeof(ClientDiagnostics)} clientDiagnostics, {typeof(HttpPipeline)} pipeline, {typeof(string)} id)")) + { + _writer.Line($"_operation = {_operationInternalType}.Create(id, {_sourceString}clientDiagnostics, pipeline, {_name:L}, fallbackStrategy: new {typeof(ExponentialDelayStrategy)}());"); + } + _writer.Line(); + _writer.WriteXmlDocumentationInheritDoc(); _writer - .LineRaw("#pragma warning disable CA1822") - .LineRaw($"[{typeof(EditorBrowsableAttribute)}({typeof(EditorBrowsableState)}.{nameof(EditorBrowsableState.Never)})]") - .LineRaw("public override string Id => throw new NotImplementedException();") - .LineRaw("#pragma warning restore CA1822") + .LineRaw("public override string Id => _operation.GetOperationId();") .Line(); if (_isGeneric) diff --git a/test/TestProjects/ExactMatchFlattenInheritance/Generated/LongRunningOperation/ExactMatchFlattenInheritanceArmOperationOfT.cs b/test/TestProjects/ExactMatchFlattenInheritance/Generated/LongRunningOperation/ExactMatchFlattenInheritanceArmOperationOfT.cs index be75afb72e6..ecaa5ae54fc 100644 --- a/test/TestProjects/ExactMatchFlattenInheritance/Generated/LongRunningOperation/ExactMatchFlattenInheritanceArmOperationOfT.cs +++ b/test/TestProjects/ExactMatchFlattenInheritance/Generated/LongRunningOperation/ExactMatchFlattenInheritanceArmOperationOfT.cs @@ -37,11 +37,13 @@ internal ExactMatchFlattenInheritanceArmOperation(IOperationSource source, Cl _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "ExactMatchFlattenInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal ExactMatchFlattenInheritanceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "ExactMatchFlattenInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/ExactMatchInheritance/Generated/LongRunningOperation/ExactMatchInheritanceArmOperationOfT.cs b/test/TestProjects/ExactMatchInheritance/Generated/LongRunningOperation/ExactMatchInheritanceArmOperationOfT.cs index 38d3f39e5e9..d19c270cd8b 100644 --- a/test/TestProjects/ExactMatchInheritance/Generated/LongRunningOperation/ExactMatchInheritanceArmOperationOfT.cs +++ b/test/TestProjects/ExactMatchInheritance/Generated/LongRunningOperation/ExactMatchInheritanceArmOperationOfT.cs @@ -37,11 +37,13 @@ internal ExactMatchInheritanceArmOperation(IOperationSource source, ClientDia _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "ExactMatchInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal ExactMatchInheritanceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "ExactMatchInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperation.cs b/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperation.cs index f769d9165fc..332475f2499 100644 --- a/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperation.cs +++ b/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperation.cs @@ -37,11 +37,13 @@ internal MgmtDiscriminatorArmOperation(ClientDiagnostics clientDiagnostics, Http _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtDiscriminatorArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtDiscriminatorArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtDiscriminatorArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperationOfT.cs b/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperationOfT.cs index 3335536e16d..3ce5d0fc0d4 100644 --- a/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperationOfT.cs +++ b/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperationOfT.cs @@ -37,11 +37,13 @@ internal MgmtDiscriminatorArmOperation(IOperationSource source, ClientDiagnos _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtDiscriminatorArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtDiscriminatorArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtDiscriminatorArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperation.cs b/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperation.cs index df5981e5473..93f159c6663 100644 --- a/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperation.cs +++ b/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperation.cs @@ -37,11 +37,13 @@ internal MgmtExpandResourceTypesArmOperation(ClientDiagnostics clientDiagnostics _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtExpandResourceTypesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtExpandResourceTypesArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtExpandResourceTypesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperationOfT.cs b/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperationOfT.cs index a3bea825e19..2930033a06e 100644 --- a/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperationOfT.cs +++ b/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperationOfT.cs @@ -37,11 +37,13 @@ internal MgmtExpandResourceTypesArmOperation(IOperationSource source, ClientD _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtExpandResourceTypesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtExpandResourceTypesArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtExpandResourceTypesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtExtensionCommonRestOperation/Generated/LongRunningOperation/MgmtExtensionCommonRestOperationArmOperationOfT.cs b/test/TestProjects/MgmtExtensionCommonRestOperation/Generated/LongRunningOperation/MgmtExtensionCommonRestOperationArmOperationOfT.cs index 6d966806c9f..23fdcdd911b 100644 --- a/test/TestProjects/MgmtExtensionCommonRestOperation/Generated/LongRunningOperation/MgmtExtensionCommonRestOperationArmOperationOfT.cs +++ b/test/TestProjects/MgmtExtensionCommonRestOperation/Generated/LongRunningOperation/MgmtExtensionCommonRestOperationArmOperationOfT.cs @@ -37,11 +37,13 @@ internal MgmtExtensionCommonRestOperationArmOperation(IOperationSource source _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtExtensionCommonRestOperationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtExtensionCommonRestOperationArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtExtensionCommonRestOperationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperation.cs b/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperation.cs index e65590055ca..007d75854c6 100644 --- a/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperation.cs +++ b/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperation.cs @@ -37,11 +37,13 @@ internal MgmtExtensionResourceArmOperation(ClientDiagnostics clientDiagnostics, _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtExtensionResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtExtensionResourceArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtExtensionResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperationOfT.cs b/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperationOfT.cs index 49a33ebcd12..ceaab95af8a 100644 --- a/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperationOfT.cs +++ b/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperationOfT.cs @@ -37,11 +37,13 @@ internal MgmtExtensionResourceArmOperation(IOperationSource source, ClientDia _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtExtensionResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtExtensionResourceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtExtensionResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperation.cs b/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperation.cs index 02dadf4bb3b..b1f8598a179 100644 --- a/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperation.cs +++ b/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperation.cs @@ -37,11 +37,13 @@ internal MgmtLROArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline p _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtLROArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtLROArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtLROArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperationOfT.cs b/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperationOfT.cs index 7d7c6266e86..bc4997380e4 100644 --- a/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperationOfT.cs +++ b/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperationOfT.cs @@ -37,11 +37,13 @@ internal MgmtLROArmOperation(IOperationSource source, ClientDiagnostics clien _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtLROArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtLROArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtLROArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtListMethods/Generated/LongRunningOperation/MgmtListMethodsArmOperationOfT.cs b/test/TestProjects/MgmtListMethods/Generated/LongRunningOperation/MgmtListMethodsArmOperationOfT.cs index 29c26274492..4f655818a50 100644 --- a/test/TestProjects/MgmtListMethods/Generated/LongRunningOperation/MgmtListMethodsArmOperationOfT.cs +++ b/test/TestProjects/MgmtListMethods/Generated/LongRunningOperation/MgmtListMethodsArmOperationOfT.cs @@ -37,11 +37,13 @@ internal MgmtListMethodsArmOperation(IOperationSource source, ClientDiagnosti _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtListMethodsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtListMethodsArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtListMethodsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperation.cs b/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperation.cs index 68d02b5ee5a..55744a18a82 100644 --- a/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperation.cs +++ b/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperation.cs @@ -37,11 +37,13 @@ internal MgmtMockAndSampleArmOperation(ClientDiagnostics clientDiagnostics, Http _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtMockAndSampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtMockAndSampleArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtMockAndSampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperationOfT.cs b/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperationOfT.cs index e79a0952e30..e2a8828db90 100644 --- a/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperationOfT.cs +++ b/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperationOfT.cs @@ -37,11 +37,13 @@ internal MgmtMockAndSampleArmOperation(IOperationSource source, ClientDiagnos _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtMockAndSampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtMockAndSampleArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtMockAndSampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperation.cs b/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperation.cs index bac8cf0a0f1..0467f1422b6 100644 --- a/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperation.cs +++ b/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperation.cs @@ -37,11 +37,13 @@ internal MgmtMultipleParentResourceArmOperation(ClientDiagnostics clientDiagnost _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtMultipleParentResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtMultipleParentResourceArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtMultipleParentResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperationOfT.cs b/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperationOfT.cs index 62936d9ac9e..7e141b43f31 100644 --- a/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperationOfT.cs +++ b/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperationOfT.cs @@ -37,11 +37,13 @@ internal MgmtMultipleParentResourceArmOperation(IOperationSource source, Clie _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtMultipleParentResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtMultipleParentResourceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtMultipleParentResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperation.cs b/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperation.cs index 016945a2e72..11d7fd82be3 100644 --- a/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperation.cs +++ b/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperation.cs @@ -37,11 +37,13 @@ internal MgmtNonStringPathVariableArmOperation(ClientDiagnostics clientDiagnosti _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtNonStringPathVariableArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtNonStringPathVariableArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtNonStringPathVariableArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperationOfT.cs b/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperationOfT.cs index b81e4ba27fc..fc7879c84ad 100644 --- a/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperationOfT.cs +++ b/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperationOfT.cs @@ -37,11 +37,13 @@ internal MgmtNonStringPathVariableArmOperation(IOperationSource source, Clien _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtNonStringPathVariableArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtNonStringPathVariableArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtNonStringPathVariableArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperation.cs b/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperation.cs index 6466f70b161..49ab64524b2 100644 --- a/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperation.cs +++ b/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperation.cs @@ -37,11 +37,13 @@ internal MgmtOperationsArmOperation(ClientDiagnostics clientDiagnostics, HttpPip _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtOperationsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtOperationsArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtOperationsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperationOfT.cs b/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperationOfT.cs index c25f09b1bb3..245090456c1 100644 --- a/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperationOfT.cs +++ b/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperationOfT.cs @@ -37,11 +37,13 @@ internal MgmtOperationsArmOperation(IOperationSource source, ClientDiagnostic _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtOperationsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtOperationsArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtOperationsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperation.cs b/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperation.cs index 8dcb1032b75..001f9cb0247 100644 --- a/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperation.cs +++ b/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperation.cs @@ -37,11 +37,13 @@ internal MgmtOptionalConstantArmOperation(ClientDiagnostics clientDiagnostics, H _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtOptionalConstantArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtOptionalConstantArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtOptionalConstantArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperationOfT.cs b/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperationOfT.cs index f8d22135a2c..6f5e814a7bf 100644 --- a/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperationOfT.cs +++ b/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperationOfT.cs @@ -37,11 +37,13 @@ internal MgmtOptionalConstantArmOperation(IOperationSource source, ClientDiag _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtOptionalConstantArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtOptionalConstantArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtOptionalConstantArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperation.cs b/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperation.cs index 7ad4756b482..a9eb6cfdd13 100644 --- a/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperation.cs +++ b/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperation.cs @@ -37,11 +37,13 @@ internal MgmtParamOrderingArmOperation(ClientDiagnostics clientDiagnostics, Http _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtParamOrderingArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtParamOrderingArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtParamOrderingArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperationOfT.cs b/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperationOfT.cs index 89adcc4e01e..968a07145f3 100644 --- a/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperationOfT.cs +++ b/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperationOfT.cs @@ -37,11 +37,13 @@ internal MgmtParamOrderingArmOperation(IOperationSource source, ClientDiagnos _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtParamOrderingArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtParamOrderingArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtParamOrderingArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperation.cs b/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperation.cs index 814748eb951..8cf6e898c30 100644 --- a/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperation.cs +++ b/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperation.cs @@ -37,11 +37,13 @@ internal MgmtParentArmOperation(ClientDiagnostics clientDiagnostics, HttpPipelin _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtParentArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtParentArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtParentArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperationOfT.cs b/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperationOfT.cs index aea2556cbf7..b7983a0c52d 100644 --- a/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperationOfT.cs +++ b/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperationOfT.cs @@ -37,11 +37,13 @@ internal MgmtParentArmOperation(IOperationSource source, ClientDiagnostics cl _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtParentArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtParentArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtParentArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperation.cs b/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperation.cs index 0bb9c2f436e..2c29489c62f 100644 --- a/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperation.cs +++ b/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperation.cs @@ -37,11 +37,13 @@ internal MgmtPropertyChooserArmOperation(ClientDiagnostics clientDiagnostics, Ht _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtPropertyChooserArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtPropertyChooserArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtPropertyChooserArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperationOfT.cs b/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperationOfT.cs index 325d5ed7b0f..94c42aaa0c6 100644 --- a/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperationOfT.cs +++ b/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperationOfT.cs @@ -37,11 +37,13 @@ internal MgmtPropertyChooserArmOperation(IOperationSource source, ClientDiagn _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtPropertyChooserArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtPropertyChooserArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtPropertyChooserArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperation.cs b/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperation.cs index c0a2538ffb4..611bed742ac 100644 --- a/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperation.cs +++ b/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperation.cs @@ -37,11 +37,13 @@ internal MgmtRenameRulesArmOperation(ClientDiagnostics clientDiagnostics, HttpPi _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtRenameRulesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtRenameRulesArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtRenameRulesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperationOfT.cs b/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperationOfT.cs index 7fdac588046..7493a69060d 100644 --- a/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperationOfT.cs +++ b/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperationOfT.cs @@ -37,11 +37,13 @@ internal MgmtRenameRulesArmOperation(IOperationSource source, ClientDiagnosti _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtRenameRulesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtRenameRulesArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtRenameRulesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtResourceName/Generated/LongRunningOperation/MgmtResourceNameArmOperationOfT.cs b/test/TestProjects/MgmtResourceName/Generated/LongRunningOperation/MgmtResourceNameArmOperationOfT.cs index 7904125fd93..15acdbd4550 100644 --- a/test/TestProjects/MgmtResourceName/Generated/LongRunningOperation/MgmtResourceNameArmOperationOfT.cs +++ b/test/TestProjects/MgmtResourceName/Generated/LongRunningOperation/MgmtResourceNameArmOperationOfT.cs @@ -37,11 +37,13 @@ internal MgmtResourceNameArmOperation(IOperationSource source, ClientDiagnost _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtResourceNameArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtResourceNameArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtResourceNameArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtSafeFlatten/Generated/LongRunningOperation/MgmtSafeFlattenArmOperationOfT.cs b/test/TestProjects/MgmtSafeFlatten/Generated/LongRunningOperation/MgmtSafeFlattenArmOperationOfT.cs index 7ed4e6a0375..407fb4773ac 100644 --- a/test/TestProjects/MgmtSafeFlatten/Generated/LongRunningOperation/MgmtSafeFlattenArmOperationOfT.cs +++ b/test/TestProjects/MgmtSafeFlatten/Generated/LongRunningOperation/MgmtSafeFlattenArmOperationOfT.cs @@ -37,11 +37,13 @@ internal MgmtSafeFlattenArmOperation(IOperationSource source, ClientDiagnosti _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtSafeFlattenArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtSafeFlattenArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtSafeFlattenArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperation.cs b/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperation.cs index 5fabafcf46f..7e5f4723c49 100644 --- a/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperation.cs +++ b/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperation.cs @@ -37,11 +37,13 @@ internal MgmtScopeResourceArmOperation(ClientDiagnostics clientDiagnostics, Http _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtScopeResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtScopeResourceArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtScopeResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperationOfT.cs b/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperationOfT.cs index fac81e69034..76a000f101f 100644 --- a/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperationOfT.cs +++ b/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperationOfT.cs @@ -37,11 +37,13 @@ internal MgmtScopeResourceArmOperation(IOperationSource source, ClientDiagnos _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtScopeResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtScopeResourceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtScopeResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperation.cs b/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperation.cs index 3a70b3b4f2c..1b9155de524 100644 --- a/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperation.cs +++ b/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperation.cs @@ -37,11 +37,13 @@ internal MgmtSubscriptionNameParameterArmOperation(ClientDiagnostics clientDiagn _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtSubscriptionNameParameterArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtSubscriptionNameParameterArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtSubscriptionNameParameterArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperationOfT.cs b/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperationOfT.cs index d9ad8a104ba..0af24fde6e2 100644 --- a/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperationOfT.cs +++ b/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperationOfT.cs @@ -37,11 +37,13 @@ internal MgmtSubscriptionNameParameterArmOperation(IOperationSource source, C _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtSubscriptionNameParameterArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal MgmtSubscriptionNameParameterArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtSubscriptionNameParameterArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/NoTypeReplacement/Generated/LongRunningOperation/NoTypeReplacementArmOperationOfT.cs b/test/TestProjects/NoTypeReplacement/Generated/LongRunningOperation/NoTypeReplacementArmOperationOfT.cs index 57ab3dee5f7..edbfc105c7d 100644 --- a/test/TestProjects/NoTypeReplacement/Generated/LongRunningOperation/NoTypeReplacementArmOperationOfT.cs +++ b/test/TestProjects/NoTypeReplacement/Generated/LongRunningOperation/NoTypeReplacementArmOperationOfT.cs @@ -37,11 +37,13 @@ internal NoTypeReplacementArmOperation(IOperationSource source, ClientDiagnos _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "NoTypeReplacementArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal NoTypeReplacementArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "NoTypeReplacementArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/OmitOperationGroups/Generated/LongRunningOperation/OmitOperationGroupsArmOperationOfT.cs b/test/TestProjects/OmitOperationGroups/Generated/LongRunningOperation/OmitOperationGroupsArmOperationOfT.cs index 60839cd324e..8149f0f98e8 100644 --- a/test/TestProjects/OmitOperationGroups/Generated/LongRunningOperation/OmitOperationGroupsArmOperationOfT.cs +++ b/test/TestProjects/OmitOperationGroups/Generated/LongRunningOperation/OmitOperationGroupsArmOperationOfT.cs @@ -37,11 +37,13 @@ internal OmitOperationGroupsArmOperation(IOperationSource source, ClientDiagn _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "OmitOperationGroupsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal OmitOperationGroupsArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "OmitOperationGroupsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/Pagination/Generated/LongRunningOperation/PaginationArmOperationOfT.cs b/test/TestProjects/Pagination/Generated/LongRunningOperation/PaginationArmOperationOfT.cs index 12a175800f6..cfffac6cd97 100644 --- a/test/TestProjects/Pagination/Generated/LongRunningOperation/PaginationArmOperationOfT.cs +++ b/test/TestProjects/Pagination/Generated/LongRunningOperation/PaginationArmOperationOfT.cs @@ -37,11 +37,13 @@ internal PaginationArmOperation(IOperationSource source, ClientDiagnostics cl _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "PaginationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal PaginationArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "PaginationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperation.cs b/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperation.cs index 7efc02cf178..66d38f8597d 100644 --- a/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperation.cs +++ b/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperation.cs @@ -37,11 +37,13 @@ internal ResourceRenameArmOperation(ClientDiagnostics clientDiagnostics, HttpPip _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "ResourceRenameArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal ResourceRenameArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "ResourceRenameArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperationOfT.cs b/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperationOfT.cs index c6c51dbc56e..0e16eb34e51 100644 --- a/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperationOfT.cs +++ b/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperationOfT.cs @@ -37,11 +37,13 @@ internal ResourceRenameArmOperation(IOperationSource source, ClientDiagnostic _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "ResourceRenameArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal ResourceRenameArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "ResourceRenameArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/SingletonResource/Generated/LongRunningOperation/SingletonResourceArmOperationOfT.cs b/test/TestProjects/SingletonResource/Generated/LongRunningOperation/SingletonResourceArmOperationOfT.cs index 816330581dc..08bb5d4fedc 100644 --- a/test/TestProjects/SingletonResource/Generated/LongRunningOperation/SingletonResourceArmOperationOfT.cs +++ b/test/TestProjects/SingletonResource/Generated/LongRunningOperation/SingletonResourceArmOperationOfT.cs @@ -37,11 +37,13 @@ internal SingletonResourceArmOperation(IOperationSource source, ClientDiagnos _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "SingletonResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal SingletonResourceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "SingletonResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/SubscriptionExtensions/Generated/LongRunningOperation/SubscriptionExtensionsArmOperationOfT.cs b/test/TestProjects/SubscriptionExtensions/Generated/LongRunningOperation/SubscriptionExtensionsArmOperationOfT.cs index 7c650d7ddd5..30d8ee9ea67 100644 --- a/test/TestProjects/SubscriptionExtensions/Generated/LongRunningOperation/SubscriptionExtensionsArmOperationOfT.cs +++ b/test/TestProjects/SubscriptionExtensions/Generated/LongRunningOperation/SubscriptionExtensionsArmOperationOfT.cs @@ -37,11 +37,13 @@ internal SubscriptionExtensionsArmOperation(IOperationSource source, ClientDi _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "SubscriptionExtensionsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal SubscriptionExtensionsArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "SubscriptionExtensionsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/SupersetFlattenInheritance/Generated/LongRunningOperation/SupersetFlattenInheritanceArmOperationOfT.cs b/test/TestProjects/SupersetFlattenInheritance/Generated/LongRunningOperation/SupersetFlattenInheritanceArmOperationOfT.cs index 19472d94e42..2ed7fa9aa94 100644 --- a/test/TestProjects/SupersetFlattenInheritance/Generated/LongRunningOperation/SupersetFlattenInheritanceArmOperationOfT.cs +++ b/test/TestProjects/SupersetFlattenInheritance/Generated/LongRunningOperation/SupersetFlattenInheritanceArmOperationOfT.cs @@ -37,11 +37,13 @@ internal SupersetFlattenInheritanceArmOperation(IOperationSource source, Clie _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "SupersetFlattenInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal SupersetFlattenInheritanceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "SupersetFlattenInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/SupersetInheritance/Generated/LongRunningOperation/SupersetInheritanceArmOperationOfT.cs b/test/TestProjects/SupersetInheritance/Generated/LongRunningOperation/SupersetInheritanceArmOperationOfT.cs index 2a90488b555..3d430e60526 100644 --- a/test/TestProjects/SupersetInheritance/Generated/LongRunningOperation/SupersetInheritanceArmOperationOfT.cs +++ b/test/TestProjects/SupersetInheritance/Generated/LongRunningOperation/SupersetInheritanceArmOperationOfT.cs @@ -37,11 +37,13 @@ internal SupersetInheritanceArmOperation(IOperationSource source, ClientDiagn _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "SupersetInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal SupersetInheritanceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "SupersetInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/TenantOnly/Generated/LongRunningOperation/TenantOnlyArmOperationOfT.cs b/test/TestProjects/TenantOnly/Generated/LongRunningOperation/TenantOnlyArmOperationOfT.cs index fe75c409450..7b1ed48c5f9 100644 --- a/test/TestProjects/TenantOnly/Generated/LongRunningOperation/TenantOnlyArmOperationOfT.cs +++ b/test/TestProjects/TenantOnly/Generated/LongRunningOperation/TenantOnlyArmOperationOfT.cs @@ -37,11 +37,13 @@ internal TenantOnlyArmOperation(IOperationSource source, ClientDiagnostics cl _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "TenantOnlyArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal TenantOnlyArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "TenantOnlyArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; diff --git a/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperation.cs b/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperation.cs index f780eb122cc..87495b9b52e 100644 --- a/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperation.cs +++ b/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperation.cs @@ -37,11 +37,13 @@ internal XmlDeserializationArmOperation(ClientDiagnostics clientDiagnostics, Htt _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "XmlDeserializationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal XmlDeserializationArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "XmlDeserializationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperationOfT.cs b/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperationOfT.cs index a6ae496bd35..1926dc81fe7 100644 --- a/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperationOfT.cs +++ b/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperationOfT.cs @@ -37,11 +37,13 @@ internal XmlDeserializationArmOperation(IOperationSource source, ClientDiagno _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "XmlDeserializationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } + internal XmlDeserializationArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) + { + _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "XmlDeserializationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + } + /// -#pragma warning disable CA1822 - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string Id => throw new NotImplementedException(); -#pragma warning restore CA1822 + public override string Id => _operation.GetOperationId(); /// public override T Value => _operation.Value; From 7b5219586e31cc29791e3cbf5bd7e788558a4245 Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Wed, 16 Nov 2022 15:54:13 +0800 Subject: [PATCH 06/18] temporary update on DownloadSharedSource.ps1 --- eng/DownloadSharedSource.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/DownloadSharedSource.ps1 b/eng/DownloadSharedSource.ps1 index 36e93e4eb23..3ff9d1daf21 100644 --- a/eng/DownloadSharedSource.ps1 +++ b/eng/DownloadSharedSource.ps1 @@ -19,7 +19,8 @@ $files = @('AsyncLockWithValue.cs', 'ClientDiagnostics.cs', 'DiagnosticScope.cs' 'Multipart/MultipartContent.cs', 'AzureKeyCredentialPolicy.cs', 'AppContextSwitchHelper.cs', 'ConstantDelayStrategy.cs', 'DelayStrategy.cs', 'ExponentialDelayStrategy.cs', 'OperationPoller.cs', 'RetryAfterDelayStrategy.cs', 'ForwardsClientCallsAttribute.cs', 'AsyncLockWithValue.cs', 'VoidValue.cs') -$baseUrl = 'https://raw.githubusercontent.com/Azure/azure-sdk-for-net/main/sdk/core/Azure.Core/src/Shared/' +// TODO: temporary change to target at support_lro_rehydration branch +$baseUrl = 'https://raw.githubusercontent.com/Azure/azure-sdk-for-net/support_lro_rehydration/sdk/core/Azure.Core/src/Shared/' DownloadAll $files $baseUrl $downloadPath #Download management Shared From fc1f157af2f4a2c392f5d6b49db88833745697d9 Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Wed, 16 Nov 2022 16:03:34 +0800 Subject: [PATCH 07/18] fix comment in ps --- eng/DownloadSharedSource.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/DownloadSharedSource.ps1 b/eng/DownloadSharedSource.ps1 index 3ff9d1daf21..769c9538b59 100644 --- a/eng/DownloadSharedSource.ps1 +++ b/eng/DownloadSharedSource.ps1 @@ -19,7 +19,7 @@ $files = @('AsyncLockWithValue.cs', 'ClientDiagnostics.cs', 'DiagnosticScope.cs' 'Multipart/MultipartContent.cs', 'AzureKeyCredentialPolicy.cs', 'AppContextSwitchHelper.cs', 'ConstantDelayStrategy.cs', 'DelayStrategy.cs', 'ExponentialDelayStrategy.cs', 'OperationPoller.cs', 'RetryAfterDelayStrategy.cs', 'ForwardsClientCallsAttribute.cs', 'AsyncLockWithValue.cs', 'VoidValue.cs') -// TODO: temporary change to target at support_lro_rehydration branch +# TODO: temporary change to target at support_lro_rehydration branch $baseUrl = 'https://raw.githubusercontent.com/Azure/azure-sdk-for-net/support_lro_rehydration/sdk/core/Azure.Core/src/Shared/' DownloadAll $files $baseUrl $downloadPath From d67dc9239c6d8325e513b1224886c99a501ea529 Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Fri, 18 Nov 2022 11:51:38 +0800 Subject: [PATCH 08/18] update shared files --- src/assets/Azure.Core.Shared/OperationInternal.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/assets/Azure.Core.Shared/OperationInternal.cs b/src/assets/Azure.Core.Shared/OperationInternal.cs index dd0587309f5..89b07e844fe 100644 --- a/src/assets/Azure.Core.Shared/OperationInternal.cs +++ b/src/assets/Azure.Core.Shared/OperationInternal.cs @@ -196,7 +196,7 @@ internal static DecodedResponse DeserializeDecodedResponse(JsonElement element) { int status = default; Optional reasonPhrase = default; - Optional contentStream = default; + Stream contentStream = new MemoryStream(); Optional clientRequestId = default; Optional isError = default; Dictionary> headers = new Dictionary>(StringComparer.OrdinalIgnoreCase); @@ -215,8 +215,12 @@ internal static DecodedResponse DeserializeDecodedResponse(JsonElement element) } if (property.NameEquals("ContentStream")) { - var content = property.Value.GetString(); - contentStream = new MemoryStream(Encoding.UTF8.GetBytes(content ?? "")); + var content = BinaryData.FromObjectAsJson(property.Value); + if (content != null) + { + content.ToStream().CopyTo(contentStream); + contentStream.Position = 0; + } continue; } if (property.NameEquals("ClientRequestId")) From a80f359c5176def9dc0ed04cf17b56165e942f13 Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Fri, 18 Nov 2022 15:54:48 +0800 Subject: [PATCH 09/18] update LRO creation --- eng/DownloadSharedSource.ps1 | 2 +- .../StorageArmOperation.cs | 3 +- .../StorageArmOperationOfT.cs | 3 +- .../SampleArmOperation.cs | 3 +- .../SampleArmOperationOfT.cs | 3 +- .../MgmtLongRunningOperationWriter.cs | 4 +- .../IOperationSource.cs | 0 .../Azure.Core.Shared/OperationInternal.cs | 84 +++++++++++++++---- .../Azure.Core.Shared/OperationInternalOfT.cs | 78 ++--------------- .../NextLinkOperationImplementation.cs | 26 ++++-- ...tMatchFlattenInheritanceArmOperationOfT.cs | 3 +- .../ExactMatchInheritanceArmOperationOfT.cs | 3 +- .../MgmtDiscriminatorArmOperation.cs | 3 +- .../MgmtDiscriminatorArmOperationOfT.cs | 3 +- .../MgmtExpandResourceTypesArmOperation.cs | 3 +- .../MgmtExpandResourceTypesArmOperationOfT.cs | 3 +- ...nsionCommonRestOperationArmOperationOfT.cs | 3 +- .../MgmtExtensionResourceArmOperation.cs | 3 +- .../MgmtExtensionResourceArmOperationOfT.cs | 3 +- .../MgmtLROArmOperation.cs | 3 +- .../MgmtLROArmOperationOfT.cs | 3 +- .../MgmtListMethodsArmOperationOfT.cs | 3 +- .../MgmtMockAndSampleArmOperation.cs | 3 +- .../MgmtMockAndSampleArmOperationOfT.cs | 3 +- .../MgmtMultipleParentResourceArmOperation.cs | 3 +- ...mtMultipleParentResourceArmOperationOfT.cs | 3 +- .../MgmtNonStringPathVariableArmOperation.cs | 3 +- ...gmtNonStringPathVariableArmOperationOfT.cs | 3 +- .../MgmtOperationsArmOperation.cs | 3 +- .../MgmtOperationsArmOperationOfT.cs | 3 +- .../MgmtOptionalConstantArmOperation.cs | 3 +- .../MgmtOptionalConstantArmOperationOfT.cs | 3 +- .../MgmtParamOrderingArmOperation.cs | 3 +- .../MgmtParamOrderingArmOperationOfT.cs | 3 +- .../MgmtParentArmOperation.cs | 3 +- .../MgmtParentArmOperationOfT.cs | 3 +- .../MgmtPropertyChooserArmOperation.cs | 3 +- .../MgmtPropertyChooserArmOperationOfT.cs | 3 +- .../MgmtRenameRulesArmOperation.cs | 3 +- .../MgmtRenameRulesArmOperationOfT.cs | 3 +- .../MgmtResourceNameArmOperationOfT.cs | 3 +- .../MgmtSafeFlattenArmOperationOfT.cs | 3 +- .../MgmtScopeResourceArmOperation.cs | 3 +- .../MgmtScopeResourceArmOperationOfT.cs | 3 +- ...mtSubscriptionNameParameterArmOperation.cs | 3 +- ...ubscriptionNameParameterArmOperationOfT.cs | 3 +- .../NoTypeReplacementArmOperationOfT.cs | 3 +- .../OmitOperationGroupsArmOperationOfT.cs | 3 +- .../PaginationArmOperationOfT.cs | 3 +- .../ResourceRenameArmOperation.cs | 3 +- .../ResourceRenameArmOperationOfT.cs | 3 +- .../SingletonResourceArmOperationOfT.cs | 3 +- .../SubscriptionExtensionsArmOperationOfT.cs | 3 +- ...persetFlattenInheritanceArmOperationOfT.cs | 3 +- .../SupersetInheritanceArmOperationOfT.cs | 3 +- .../TenantOnlyArmOperationOfT.cs | 3 +- .../XmlDeserializationArmOperation.cs | 3 +- .../XmlDeserializationArmOperationOfT.cs | 3 +- 58 files changed, 206 insertions(+), 144 deletions(-) rename src/assets/{Generator.Shared => Azure.Core.Shared}/IOperationSource.cs (100%) diff --git a/eng/DownloadSharedSource.ps1 b/eng/DownloadSharedSource.ps1 index 769c9538b59..bd0e19621ae 100644 --- a/eng/DownloadSharedSource.ps1 +++ b/eng/DownloadSharedSource.ps1 @@ -18,7 +18,7 @@ $files = @('AsyncLockWithValue.cs', 'ClientDiagnostics.cs', 'DiagnosticScope.cs' 'OperationInternalBase.cs', 'OperationInternal.cs', 'VoidValue.cs', 'OperationInternalOfT.cs', 'TaskExtensions.cs', 'Argument.cs', 'Multipart/MultipartFormDataContent.cs', 'Multipart/MultipartContent.cs', 'AzureKeyCredentialPolicy.cs', 'AppContextSwitchHelper.cs', 'ConstantDelayStrategy.cs', 'DelayStrategy.cs', 'ExponentialDelayStrategy.cs', 'OperationPoller.cs', 'RetryAfterDelayStrategy.cs', - 'ForwardsClientCallsAttribute.cs', 'AsyncLockWithValue.cs', 'VoidValue.cs') + 'ForwardsClientCallsAttribute.cs', 'AsyncLockWithValue.cs', 'VoidValue.cs', 'IOperationSource.cs') # TODO: temporary change to target at support_lro_rehydration branch $baseUrl = 'https://raw.githubusercontent.com/Azure/azure-sdk-for-net/support_lro_rehydration/sdk/core/Azure.Core/src/Shared/' DownloadAll $files $baseUrl $downloadPath diff --git a/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperation.cs b/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperation.cs index 83e0abff88e..75677b804ca 100644 --- a/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperation.cs +++ b/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperation.cs @@ -39,7 +39,8 @@ internal StorageArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline p internal StorageArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "StorageArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "StorageArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperationOfT.cs b/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperationOfT.cs index 560181a4c8e..6a993b3ae5d 100644 --- a/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperationOfT.cs +++ b/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperationOfT.cs @@ -39,7 +39,8 @@ internal StorageArmOperation(IOperationSource source, ClientDiagnostics clien internal StorageArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "StorageArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "StorageArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperation.cs b/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperation.cs index 8bfd2cb3c56..0ae811d6cde 100644 --- a/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperation.cs +++ b/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperation.cs @@ -39,7 +39,8 @@ internal SampleArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pi internal SampleArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "SampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "SampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperationOfT.cs b/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperationOfT.cs index b3c443aee41..8a245a0c2b4 100644 --- a/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperationOfT.cs +++ b/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperationOfT.cs @@ -39,7 +39,8 @@ internal SampleArmOperation(IOperationSource source, ClientDiagnostics client internal SampleArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "SampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "SampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/src/AutoRest.CSharp/Mgmt/Generation/MgmtLongRunningOperationWriter.cs b/src/AutoRest.CSharp/Mgmt/Generation/MgmtLongRunningOperationWriter.cs index 2961347649c..b4573bfe5be 100644 --- a/src/AutoRest.CSharp/Mgmt/Generation/MgmtLongRunningOperationWriter.cs +++ b/src/AutoRest.CSharp/Mgmt/Generation/MgmtLongRunningOperationWriter.cs @@ -83,7 +83,9 @@ public void Write() using (_writer.Scope($"internal {_name}({_operationSourceString}{typeof(ClientDiagnostics)} clientDiagnostics, {typeof(HttpPipeline)} pipeline, {typeof(string)} id)")) { - _writer.Line($"_operation = {_operationInternalType}.Create(id, {_sourceString}clientDiagnostics, pipeline, {_name:L}, fallbackStrategy: new {typeof(ExponentialDelayStrategy)}());"); + var nextLinkOperation = new CodeWriterDeclaration("nextLinkOperation"); + _writer.Line($"var {nextLinkOperation:D} = {typeof(NextLinkOperationImplementation)}.{nameof(NextLinkOperationImplementation.Create)}({_sourceString}pipeline, id, out {typeof(string)} finalResponse);"); + _writer.Line($"_operation = {_operationInternalType}.Create({_sourceString}clientDiagnostics, {nextLinkOperation}, finalResponse, {_name:L}, fallbackStrategy: new {typeof(ExponentialDelayStrategy)}());"); } _writer.Line(); diff --git a/src/assets/Generator.Shared/IOperationSource.cs b/src/assets/Azure.Core.Shared/IOperationSource.cs similarity index 100% rename from src/assets/Generator.Shared/IOperationSource.cs rename to src/assets/Azure.Core.Shared/IOperationSource.cs diff --git a/src/assets/Azure.Core.Shared/OperationInternal.cs b/src/assets/Azure.Core.Shared/OperationInternal.cs index 89b07e844fe..28950505328 100644 --- a/src/assets/Azure.Core.Shared/OperationInternal.cs +++ b/src/assets/Azure.Core.Shared/OperationInternal.cs @@ -109,23 +109,19 @@ private OperationInternal(OperationState finalState) } public static OperationInternal Create( - string id, ClientDiagnostics clientDiagnostics, - HttpPipeline pipeline, + IOperation? operation, + string? finalResponse, string? operationTypeName = null, IEnumerable>? scopeAttributes = null, - DelayStrategy? fallbackStrategy = null, - string? interimApiVersion = null) + DelayStrategy? fallbackStrategy = null) { - var lroDetails = BinaryData.FromBytes(Convert.FromBase64String(id)).ToObjectFromJson>(); - - if (lroDetails.TryGetValue("FinalResponse", out string? finalResponse)) + if (finalResponse != null) { Response response = JsonSerializer.Deserialize(finalResponse)!; return OperationInternal.Succeeded(response); } - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, interimApiVersion); - return new OperationInternal(clientDiagnostics, nextLinkOperation, null, operationTypeName, scopeAttributes, fallbackStrategy); + return new OperationInternal(clientDiagnostics, operation!, null, operationTypeName, scopeAttributes, fallbackStrategy); } public override Response RawResponse => _internalOperation.RawResponse; @@ -135,7 +131,7 @@ public static OperationInternal Create( protected override async ValueTask UpdateStatusAsync(bool async, CancellationToken cancellationToken) => async ? await _internalOperation.UpdateStatusAsync(cancellationToken).ConfigureAwait(false) : _internalOperation.UpdateStatus(cancellationToken); - public string GetOperationId() + public virtual string GetOperationId() { return _internalOperation.GetOperationId(); } @@ -172,6 +168,66 @@ public string GetOperationId() } } + internal class StreamConverter : JsonConverter + { + /// Serialize stream to BinaryData string. + /// The writer. + /// The Stream model. + /// The options for JsonSerializer. + public override void Write(Utf8JsonWriter writer, Stream model, JsonSerializerOptions options) + { + if (model.Length == 0) + { + writer.WriteNullValue(); + return; + } + MemoryStream? memoryContent = model as MemoryStream; + + if (memoryContent == null) + { + throw new InvalidOperationException($"The response is not fully buffered."); + } + + if (memoryContent.TryGetBuffer(out ArraySegment segment)) + { + var data = new BinaryData(segment.AsMemory()); +#if NET6_0_OR_GREATER + writer.WriteRawValue(data); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(data.ToString()).RootElement); +#endif + } + else + { + var data = new BinaryData(memoryContent.ToArray()); +#if NET6_0_OR_GREATER + writer.WriteRawValue(data); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(data.ToString()).RootElement); +#endif + } + } + + /// Deserialize Stream from BinaryData string. + /// The reader. + /// The type to convert + /// The options for JsonSerializer. + public override Stream Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + using var document = JsonDocument.ParseValue(ref reader); + foreach (var property in document.RootElement.EnumerateObject()) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var value = property.Value.GetString(); + return BinaryData.FromString(value!).ToStream(); + } + return new MemoryStream(); + } + } + [JsonConverter(typeof(DecodedResponseConverter))] internal class DecodedResponse : Response { @@ -195,10 +251,10 @@ internal DecodedResponse(int status, string reasonPhrase, Stream contentStream, internal static DecodedResponse DeserializeDecodedResponse(JsonElement element) { int status = default; - Optional reasonPhrase = default; + string reasonPhrase = default; Stream contentStream = new MemoryStream(); - Optional clientRequestId = default; - Optional isError = default; + string clientRequestId = default; + bool isError = default; Dictionary> headers = new Dictionary>(StringComparer.OrdinalIgnoreCase); foreach (var property in element.EnumerateObject()) @@ -273,7 +329,7 @@ internal partial class DecodedResponseConverter : JsonConverter { public override void Write(Utf8JsonWriter writer, DecodedResponse model, JsonSerializerOptions options) { - writer.WriteObjectValue(model); + throw new NotImplementedException("This converter should only be used for deserialization."); } public override DecodedResponse Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { diff --git a/src/assets/Azure.Core.Shared/OperationInternalOfT.cs b/src/assets/Azure.Core.Shared/OperationInternalOfT.cs index 740d592a6d0..a633d98f03a 100644 --- a/src/assets/Azure.Core.Shared/OperationInternalOfT.cs +++ b/src/assets/Azure.Core.Shared/OperationInternalOfT.cs @@ -120,24 +120,20 @@ private OperationInternal(OperationState finalState) } public static OperationInternal Create( - string id, IOperationSource source, ClientDiagnostics clientDiagnostics, - HttpPipeline pipeline, + IOperation? operation, + string? finalResponse, string? operationTypeName = null, IEnumerable>? scopeAttributes = null, - DelayStrategy? fallbackStrategy = null, - string? interimApiVersion = null) + DelayStrategy? fallbackStrategy = null) { - var lroDetails = BinaryData.FromBytes(Convert.FromBase64String(id)).ToObjectFromJson>(); - - if (lroDetails.TryGetValue("FinalResponse", out string? finalResponse)) + if (finalResponse != null) { Response response = JsonSerializer.Deserialize(finalResponse)!; return OperationInternal.Succeeded(response, source.CreateResult(response, CancellationToken.None)); } - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, interimApiVersion); - return new OperationInternal(clientDiagnostics, nextLinkOperation, null, operationTypeName, scopeAttributes, fallbackStrategy); + return new OperationInternal(clientDiagnostics, operation!, null, operationTypeName, scopeAttributes, fallbackStrategy); } public override Response RawResponse => (_stateLock.TryGetValue(out var state) ? state.RawResponse : _rawResponse) ?? throw new InvalidOperationException("The operation does not have a response yet. Please call UpdateStatus or WaitForCompletion first."); @@ -303,7 +299,7 @@ protected override async ValueTask UpdateStatusAsync(bool async, Cance } } - public string GetOperationId() + public virtual string GetOperationId() { try { @@ -311,7 +307,7 @@ public string GetOperationId() } catch (NotImplementedException) { - var serializeOptions = new JsonSerializerOptions { Converters = { new StreamConverter() } }; + var serializeOptions = new JsonSerializerOptions { Converters = { new OperationInternal.StreamConverter() } }; var lroDetails = new Dictionary() { ["FinalResponse"] = BinaryData.FromObjectAsJson(_rawResponse!, serializeOptions).ToString() @@ -331,66 +327,6 @@ private static Response GetResponseFromState(OperationState state) throw state.OperationFailedException!; } - internal class StreamConverter : JsonConverter - { - /// Serialize stream to BinaryData string. - /// The writer. - /// The Stream model. - /// The options for JsonSerializer. - public override void Write(Utf8JsonWriter writer, Stream model, JsonSerializerOptions options) - { - if (model.Length == 0) - { - writer.WriteNullValue(); - return; - } - MemoryStream? memoryContent = model as MemoryStream; - - if (memoryContent == null) - { - throw new InvalidOperationException($"The response is not fully buffered."); - } - - if (memoryContent.TryGetBuffer(out ArraySegment segment)) - { - var data = new BinaryData(segment.AsMemory()); -#if NET6_0_OR_GREATER - writer.WriteRawValue(data); -#else - JsonSerializer.Serialize(writer, JsonDocument.Parse(data.ToString()).RootElement); -#endif - } - else - { - var data = new BinaryData(memoryContent.ToArray()); -#if NET6_0_OR_GREATER - writer.WriteRawValue(data); -#else - JsonSerializer.Serialize(writer, JsonDocument.Parse(data.ToString()).RootElement); -#endif - } - } - - /// Deserialize Stream from BinaryData string. - /// The reader. - /// The type to convert - /// The options for JsonSerializer. - public override Stream Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - using var document = JsonDocument.ParseValue(ref reader); - foreach (var property in document.RootElement.EnumerateObject()) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - var value = property.Value.GetString(); - return BinaryData.FromString(value!).ToStream(); - } - return new MemoryStream(); - } - } - private class FinalOperation : IOperation { public ValueTask> UpdateStateAsync(bool async, CancellationToken cancellationToken) diff --git a/src/assets/Generator.Shared/NextLinkOperationImplementation.cs b/src/assets/Generator.Shared/NextLinkOperationImplementation.cs index fce936e889a..b1eec63b7e8 100644 --- a/src/assets/Generator.Shared/NextLinkOperationImplementation.cs +++ b/src/assets/Generator.Shared/NextLinkOperationImplementation.cs @@ -70,12 +70,17 @@ public static IOperation Create( return new OperationToOperationOfT(operationSource, operation); } - public static IOperation Create( + public static IOperation? Create( HttpPipeline pipeline, string id, + out string? finalResponse, string? apiVersionOverride = null) { var lroDetails = BinaryData.FromBytes(Convert.FromBase64String(id)).ToObjectFromJson>(); + if (lroDetails.TryGetValue("FinalResponse", out finalResponse)) + { + return null; + } if (!Uri.TryCreate(lroDetails["InitialUri"], UriKind.Absolute, out var startRequestUri)) throw new InvalidOperationException("Invalid initial URI"); if (!lroDetails.TryGetValue("NextRequestUri", out var nextRequestUri)) @@ -92,14 +97,19 @@ public static IOperation Create( return new NextLinkOperationImplementation(pipeline, requestMethod, startRequestUri, nextRequestUri, headerSource, originalResponseHasLocation, lastKnownLocation, finalStateVia, apiVersionStr); } - public static IOperation Create( + public static IOperation? Create( IOperationSource operationSource, HttpPipeline pipeline, string id, + out string? finalResponse, string? apiVersionOverride = null) { - var operation = Create(pipeline, id, apiVersionOverride); - return new OperationToOperationOfT(operationSource, operation); + var operation = Create(pipeline, id, out finalResponse, apiVersionOverride); + if (finalResponse != null) + { + return null; + } + return new OperationToOperationOfT(operationSource, operation!); } private NextLinkOperationImplementation( @@ -445,7 +455,13 @@ public CompletedOperation(OperationState operationState) public string GetOperationId() { - throw new NotImplementedException(); + var serializeOptions = new JsonSerializerOptions { Converters = { new OperationInternal.StreamConverter() } }; + var lroDetails = new Dictionary() + { + ["FinalResponse"] = BinaryData.FromObjectAsJson(_operationState.RawResponse, serializeOptions).ToString() + }; + var lroData = BinaryData.FromObjectAsJson(lroDetails); + return Convert.ToBase64String(lroData.ToArray()); } } diff --git a/test/TestProjects/ExactMatchFlattenInheritance/Generated/LongRunningOperation/ExactMatchFlattenInheritanceArmOperationOfT.cs b/test/TestProjects/ExactMatchFlattenInheritance/Generated/LongRunningOperation/ExactMatchFlattenInheritanceArmOperationOfT.cs index ecaa5ae54fc..243c2121bae 100644 --- a/test/TestProjects/ExactMatchFlattenInheritance/Generated/LongRunningOperation/ExactMatchFlattenInheritanceArmOperationOfT.cs +++ b/test/TestProjects/ExactMatchFlattenInheritance/Generated/LongRunningOperation/ExactMatchFlattenInheritanceArmOperationOfT.cs @@ -39,7 +39,8 @@ internal ExactMatchFlattenInheritanceArmOperation(IOperationSource source, Cl internal ExactMatchFlattenInheritanceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "ExactMatchFlattenInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "ExactMatchFlattenInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/ExactMatchInheritance/Generated/LongRunningOperation/ExactMatchInheritanceArmOperationOfT.cs b/test/TestProjects/ExactMatchInheritance/Generated/LongRunningOperation/ExactMatchInheritanceArmOperationOfT.cs index d19c270cd8b..373c6617538 100644 --- a/test/TestProjects/ExactMatchInheritance/Generated/LongRunningOperation/ExactMatchInheritanceArmOperationOfT.cs +++ b/test/TestProjects/ExactMatchInheritance/Generated/LongRunningOperation/ExactMatchInheritanceArmOperationOfT.cs @@ -39,7 +39,8 @@ internal ExactMatchInheritanceArmOperation(IOperationSource source, ClientDia internal ExactMatchInheritanceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "ExactMatchInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "ExactMatchInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperation.cs b/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperation.cs index 332475f2499..022effecaa9 100644 --- a/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperation.cs +++ b/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperation.cs @@ -39,7 +39,8 @@ internal MgmtDiscriminatorArmOperation(ClientDiagnostics clientDiagnostics, Http internal MgmtDiscriminatorArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtDiscriminatorArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtDiscriminatorArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperationOfT.cs b/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperationOfT.cs index 3ce5d0fc0d4..25d12a3a82a 100644 --- a/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperationOfT.cs +++ b/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperationOfT.cs @@ -39,7 +39,8 @@ internal MgmtDiscriminatorArmOperation(IOperationSource source, ClientDiagnos internal MgmtDiscriminatorArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtDiscriminatorArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtDiscriminatorArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperation.cs b/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperation.cs index 93f159c6663..66fd7a442a1 100644 --- a/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperation.cs +++ b/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperation.cs @@ -39,7 +39,8 @@ internal MgmtExpandResourceTypesArmOperation(ClientDiagnostics clientDiagnostics internal MgmtExpandResourceTypesArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtExpandResourceTypesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtExpandResourceTypesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperationOfT.cs b/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperationOfT.cs index 2930033a06e..d0fb6e666a2 100644 --- a/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperationOfT.cs +++ b/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperationOfT.cs @@ -39,7 +39,8 @@ internal MgmtExpandResourceTypesArmOperation(IOperationSource source, ClientD internal MgmtExpandResourceTypesArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtExpandResourceTypesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtExpandResourceTypesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtExtensionCommonRestOperation/Generated/LongRunningOperation/MgmtExtensionCommonRestOperationArmOperationOfT.cs b/test/TestProjects/MgmtExtensionCommonRestOperation/Generated/LongRunningOperation/MgmtExtensionCommonRestOperationArmOperationOfT.cs index 23fdcdd911b..a6fd4b58d3a 100644 --- a/test/TestProjects/MgmtExtensionCommonRestOperation/Generated/LongRunningOperation/MgmtExtensionCommonRestOperationArmOperationOfT.cs +++ b/test/TestProjects/MgmtExtensionCommonRestOperation/Generated/LongRunningOperation/MgmtExtensionCommonRestOperationArmOperationOfT.cs @@ -39,7 +39,8 @@ internal MgmtExtensionCommonRestOperationArmOperation(IOperationSource source internal MgmtExtensionCommonRestOperationArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtExtensionCommonRestOperationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtExtensionCommonRestOperationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperation.cs b/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperation.cs index 007d75854c6..657e8e948fb 100644 --- a/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperation.cs +++ b/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperation.cs @@ -39,7 +39,8 @@ internal MgmtExtensionResourceArmOperation(ClientDiagnostics clientDiagnostics, internal MgmtExtensionResourceArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtExtensionResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtExtensionResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperationOfT.cs b/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperationOfT.cs index ceaab95af8a..41f9670721f 100644 --- a/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperationOfT.cs +++ b/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperationOfT.cs @@ -39,7 +39,8 @@ internal MgmtExtensionResourceArmOperation(IOperationSource source, ClientDia internal MgmtExtensionResourceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtExtensionResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtExtensionResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperation.cs b/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperation.cs index b1f8598a179..cde70cba6b3 100644 --- a/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperation.cs +++ b/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperation.cs @@ -39,7 +39,8 @@ internal MgmtLROArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline p internal MgmtLROArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtLROArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtLROArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperationOfT.cs b/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperationOfT.cs index bc4997380e4..1fb18f375ed 100644 --- a/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperationOfT.cs +++ b/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperationOfT.cs @@ -39,7 +39,8 @@ internal MgmtLROArmOperation(IOperationSource source, ClientDiagnostics clien internal MgmtLROArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtLROArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtLROArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtListMethods/Generated/LongRunningOperation/MgmtListMethodsArmOperationOfT.cs b/test/TestProjects/MgmtListMethods/Generated/LongRunningOperation/MgmtListMethodsArmOperationOfT.cs index 4f655818a50..b8c1d415c68 100644 --- a/test/TestProjects/MgmtListMethods/Generated/LongRunningOperation/MgmtListMethodsArmOperationOfT.cs +++ b/test/TestProjects/MgmtListMethods/Generated/LongRunningOperation/MgmtListMethodsArmOperationOfT.cs @@ -39,7 +39,8 @@ internal MgmtListMethodsArmOperation(IOperationSource source, ClientDiagnosti internal MgmtListMethodsArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtListMethodsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtListMethodsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperation.cs b/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperation.cs index 55744a18a82..0a8e6462e5f 100644 --- a/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperation.cs +++ b/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperation.cs @@ -39,7 +39,8 @@ internal MgmtMockAndSampleArmOperation(ClientDiagnostics clientDiagnostics, Http internal MgmtMockAndSampleArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtMockAndSampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtMockAndSampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperationOfT.cs b/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperationOfT.cs index e2a8828db90..bc1b5d9c8bb 100644 --- a/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperationOfT.cs +++ b/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperationOfT.cs @@ -39,7 +39,8 @@ internal MgmtMockAndSampleArmOperation(IOperationSource source, ClientDiagnos internal MgmtMockAndSampleArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtMockAndSampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtMockAndSampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperation.cs b/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperation.cs index 0467f1422b6..06a664f8111 100644 --- a/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperation.cs +++ b/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperation.cs @@ -39,7 +39,8 @@ internal MgmtMultipleParentResourceArmOperation(ClientDiagnostics clientDiagnost internal MgmtMultipleParentResourceArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtMultipleParentResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtMultipleParentResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperationOfT.cs b/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperationOfT.cs index 7e141b43f31..9deb6da6eda 100644 --- a/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperationOfT.cs +++ b/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperationOfT.cs @@ -39,7 +39,8 @@ internal MgmtMultipleParentResourceArmOperation(IOperationSource source, Clie internal MgmtMultipleParentResourceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtMultipleParentResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtMultipleParentResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperation.cs b/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperation.cs index 11d7fd82be3..1382c0ba2ca 100644 --- a/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperation.cs +++ b/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperation.cs @@ -39,7 +39,8 @@ internal MgmtNonStringPathVariableArmOperation(ClientDiagnostics clientDiagnosti internal MgmtNonStringPathVariableArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtNonStringPathVariableArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtNonStringPathVariableArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperationOfT.cs b/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperationOfT.cs index fc7879c84ad..697a15e843f 100644 --- a/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperationOfT.cs +++ b/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperationOfT.cs @@ -39,7 +39,8 @@ internal MgmtNonStringPathVariableArmOperation(IOperationSource source, Clien internal MgmtNonStringPathVariableArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtNonStringPathVariableArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtNonStringPathVariableArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperation.cs b/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperation.cs index 49ab64524b2..114e1cb576d 100644 --- a/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperation.cs +++ b/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperation.cs @@ -39,7 +39,8 @@ internal MgmtOperationsArmOperation(ClientDiagnostics clientDiagnostics, HttpPip internal MgmtOperationsArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtOperationsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtOperationsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperationOfT.cs b/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperationOfT.cs index 245090456c1..00362e5f8a6 100644 --- a/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperationOfT.cs +++ b/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperationOfT.cs @@ -39,7 +39,8 @@ internal MgmtOperationsArmOperation(IOperationSource source, ClientDiagnostic internal MgmtOperationsArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtOperationsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtOperationsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperation.cs b/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperation.cs index 001f9cb0247..d2d40ccf34f 100644 --- a/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperation.cs +++ b/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperation.cs @@ -39,7 +39,8 @@ internal MgmtOptionalConstantArmOperation(ClientDiagnostics clientDiagnostics, H internal MgmtOptionalConstantArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtOptionalConstantArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtOptionalConstantArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperationOfT.cs b/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperationOfT.cs index 6f5e814a7bf..8be502ff907 100644 --- a/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperationOfT.cs +++ b/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperationOfT.cs @@ -39,7 +39,8 @@ internal MgmtOptionalConstantArmOperation(IOperationSource source, ClientDiag internal MgmtOptionalConstantArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtOptionalConstantArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtOptionalConstantArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperation.cs b/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperation.cs index a9eb6cfdd13..0931acb3d19 100644 --- a/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperation.cs +++ b/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperation.cs @@ -39,7 +39,8 @@ internal MgmtParamOrderingArmOperation(ClientDiagnostics clientDiagnostics, Http internal MgmtParamOrderingArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtParamOrderingArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtParamOrderingArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperationOfT.cs b/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperationOfT.cs index 968a07145f3..58b322d3bb8 100644 --- a/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperationOfT.cs +++ b/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperationOfT.cs @@ -39,7 +39,8 @@ internal MgmtParamOrderingArmOperation(IOperationSource source, ClientDiagnos internal MgmtParamOrderingArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtParamOrderingArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtParamOrderingArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperation.cs b/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperation.cs index 8cf6e898c30..ffa190fedef 100644 --- a/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperation.cs +++ b/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperation.cs @@ -39,7 +39,8 @@ internal MgmtParentArmOperation(ClientDiagnostics clientDiagnostics, HttpPipelin internal MgmtParentArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtParentArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtParentArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperationOfT.cs b/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperationOfT.cs index b7983a0c52d..6635328741c 100644 --- a/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperationOfT.cs +++ b/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperationOfT.cs @@ -39,7 +39,8 @@ internal MgmtParentArmOperation(IOperationSource source, ClientDiagnostics cl internal MgmtParentArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtParentArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtParentArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperation.cs b/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperation.cs index 2c29489c62f..e3e29119010 100644 --- a/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperation.cs +++ b/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperation.cs @@ -39,7 +39,8 @@ internal MgmtPropertyChooserArmOperation(ClientDiagnostics clientDiagnostics, Ht internal MgmtPropertyChooserArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtPropertyChooserArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtPropertyChooserArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperationOfT.cs b/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperationOfT.cs index 94c42aaa0c6..33c329757b3 100644 --- a/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperationOfT.cs +++ b/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperationOfT.cs @@ -39,7 +39,8 @@ internal MgmtPropertyChooserArmOperation(IOperationSource source, ClientDiagn internal MgmtPropertyChooserArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtPropertyChooserArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtPropertyChooserArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperation.cs b/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperation.cs index 611bed742ac..8e24bf849cb 100644 --- a/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperation.cs +++ b/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperation.cs @@ -39,7 +39,8 @@ internal MgmtRenameRulesArmOperation(ClientDiagnostics clientDiagnostics, HttpPi internal MgmtRenameRulesArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtRenameRulesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtRenameRulesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperationOfT.cs b/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperationOfT.cs index 7493a69060d..4c99a035add 100644 --- a/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperationOfT.cs +++ b/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperationOfT.cs @@ -39,7 +39,8 @@ internal MgmtRenameRulesArmOperation(IOperationSource source, ClientDiagnosti internal MgmtRenameRulesArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtRenameRulesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtRenameRulesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtResourceName/Generated/LongRunningOperation/MgmtResourceNameArmOperationOfT.cs b/test/TestProjects/MgmtResourceName/Generated/LongRunningOperation/MgmtResourceNameArmOperationOfT.cs index 15acdbd4550..2857f09b96b 100644 --- a/test/TestProjects/MgmtResourceName/Generated/LongRunningOperation/MgmtResourceNameArmOperationOfT.cs +++ b/test/TestProjects/MgmtResourceName/Generated/LongRunningOperation/MgmtResourceNameArmOperationOfT.cs @@ -39,7 +39,8 @@ internal MgmtResourceNameArmOperation(IOperationSource source, ClientDiagnost internal MgmtResourceNameArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtResourceNameArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtResourceNameArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtSafeFlatten/Generated/LongRunningOperation/MgmtSafeFlattenArmOperationOfT.cs b/test/TestProjects/MgmtSafeFlatten/Generated/LongRunningOperation/MgmtSafeFlattenArmOperationOfT.cs index 407fb4773ac..54cfa890602 100644 --- a/test/TestProjects/MgmtSafeFlatten/Generated/LongRunningOperation/MgmtSafeFlattenArmOperationOfT.cs +++ b/test/TestProjects/MgmtSafeFlatten/Generated/LongRunningOperation/MgmtSafeFlattenArmOperationOfT.cs @@ -39,7 +39,8 @@ internal MgmtSafeFlattenArmOperation(IOperationSource source, ClientDiagnosti internal MgmtSafeFlattenArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtSafeFlattenArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtSafeFlattenArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperation.cs b/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperation.cs index 7e5f4723c49..e065bdc0e78 100644 --- a/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperation.cs +++ b/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperation.cs @@ -39,7 +39,8 @@ internal MgmtScopeResourceArmOperation(ClientDiagnostics clientDiagnostics, Http internal MgmtScopeResourceArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtScopeResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtScopeResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperationOfT.cs b/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperationOfT.cs index 76a000f101f..f89f5cd61f8 100644 --- a/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperationOfT.cs +++ b/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperationOfT.cs @@ -39,7 +39,8 @@ internal MgmtScopeResourceArmOperation(IOperationSource source, ClientDiagnos internal MgmtScopeResourceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtScopeResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtScopeResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperation.cs b/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperation.cs index 1b9155de524..0b06b560ee6 100644 --- a/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperation.cs +++ b/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperation.cs @@ -39,7 +39,8 @@ internal MgmtSubscriptionNameParameterArmOperation(ClientDiagnostics clientDiagn internal MgmtSubscriptionNameParameterArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "MgmtSubscriptionNameParameterArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtSubscriptionNameParameterArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperationOfT.cs b/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperationOfT.cs index 0af24fde6e2..9de18f178a6 100644 --- a/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperationOfT.cs +++ b/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperationOfT.cs @@ -39,7 +39,8 @@ internal MgmtSubscriptionNameParameterArmOperation(IOperationSource source, C internal MgmtSubscriptionNameParameterArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "MgmtSubscriptionNameParameterArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtSubscriptionNameParameterArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/NoTypeReplacement/Generated/LongRunningOperation/NoTypeReplacementArmOperationOfT.cs b/test/TestProjects/NoTypeReplacement/Generated/LongRunningOperation/NoTypeReplacementArmOperationOfT.cs index edbfc105c7d..bb4845ede39 100644 --- a/test/TestProjects/NoTypeReplacement/Generated/LongRunningOperation/NoTypeReplacementArmOperationOfT.cs +++ b/test/TestProjects/NoTypeReplacement/Generated/LongRunningOperation/NoTypeReplacementArmOperationOfT.cs @@ -39,7 +39,8 @@ internal NoTypeReplacementArmOperation(IOperationSource source, ClientDiagnos internal NoTypeReplacementArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "NoTypeReplacementArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "NoTypeReplacementArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/OmitOperationGroups/Generated/LongRunningOperation/OmitOperationGroupsArmOperationOfT.cs b/test/TestProjects/OmitOperationGroups/Generated/LongRunningOperation/OmitOperationGroupsArmOperationOfT.cs index 8149f0f98e8..51a52d3e016 100644 --- a/test/TestProjects/OmitOperationGroups/Generated/LongRunningOperation/OmitOperationGroupsArmOperationOfT.cs +++ b/test/TestProjects/OmitOperationGroups/Generated/LongRunningOperation/OmitOperationGroupsArmOperationOfT.cs @@ -39,7 +39,8 @@ internal OmitOperationGroupsArmOperation(IOperationSource source, ClientDiagn internal OmitOperationGroupsArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "OmitOperationGroupsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "OmitOperationGroupsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/Pagination/Generated/LongRunningOperation/PaginationArmOperationOfT.cs b/test/TestProjects/Pagination/Generated/LongRunningOperation/PaginationArmOperationOfT.cs index cfffac6cd97..4c02e19d9e7 100644 --- a/test/TestProjects/Pagination/Generated/LongRunningOperation/PaginationArmOperationOfT.cs +++ b/test/TestProjects/Pagination/Generated/LongRunningOperation/PaginationArmOperationOfT.cs @@ -39,7 +39,8 @@ internal PaginationArmOperation(IOperationSource source, ClientDiagnostics cl internal PaginationArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "PaginationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "PaginationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperation.cs b/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperation.cs index 66d38f8597d..3a47b8ba892 100644 --- a/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperation.cs +++ b/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperation.cs @@ -39,7 +39,8 @@ internal ResourceRenameArmOperation(ClientDiagnostics clientDiagnostics, HttpPip internal ResourceRenameArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "ResourceRenameArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "ResourceRenameArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperationOfT.cs b/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperationOfT.cs index 0e16eb34e51..439c9f16860 100644 --- a/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperationOfT.cs +++ b/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperationOfT.cs @@ -39,7 +39,8 @@ internal ResourceRenameArmOperation(IOperationSource source, ClientDiagnostic internal ResourceRenameArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "ResourceRenameArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "ResourceRenameArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/SingletonResource/Generated/LongRunningOperation/SingletonResourceArmOperationOfT.cs b/test/TestProjects/SingletonResource/Generated/LongRunningOperation/SingletonResourceArmOperationOfT.cs index 08bb5d4fedc..ae3fc051a94 100644 --- a/test/TestProjects/SingletonResource/Generated/LongRunningOperation/SingletonResourceArmOperationOfT.cs +++ b/test/TestProjects/SingletonResource/Generated/LongRunningOperation/SingletonResourceArmOperationOfT.cs @@ -39,7 +39,8 @@ internal SingletonResourceArmOperation(IOperationSource source, ClientDiagnos internal SingletonResourceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "SingletonResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "SingletonResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/SubscriptionExtensions/Generated/LongRunningOperation/SubscriptionExtensionsArmOperationOfT.cs b/test/TestProjects/SubscriptionExtensions/Generated/LongRunningOperation/SubscriptionExtensionsArmOperationOfT.cs index 30d8ee9ea67..62c1dc7cc7f 100644 --- a/test/TestProjects/SubscriptionExtensions/Generated/LongRunningOperation/SubscriptionExtensionsArmOperationOfT.cs +++ b/test/TestProjects/SubscriptionExtensions/Generated/LongRunningOperation/SubscriptionExtensionsArmOperationOfT.cs @@ -39,7 +39,8 @@ internal SubscriptionExtensionsArmOperation(IOperationSource source, ClientDi internal SubscriptionExtensionsArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "SubscriptionExtensionsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "SubscriptionExtensionsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/SupersetFlattenInheritance/Generated/LongRunningOperation/SupersetFlattenInheritanceArmOperationOfT.cs b/test/TestProjects/SupersetFlattenInheritance/Generated/LongRunningOperation/SupersetFlattenInheritanceArmOperationOfT.cs index 2ed7fa9aa94..9228b98b4be 100644 --- a/test/TestProjects/SupersetFlattenInheritance/Generated/LongRunningOperation/SupersetFlattenInheritanceArmOperationOfT.cs +++ b/test/TestProjects/SupersetFlattenInheritance/Generated/LongRunningOperation/SupersetFlattenInheritanceArmOperationOfT.cs @@ -39,7 +39,8 @@ internal SupersetFlattenInheritanceArmOperation(IOperationSource source, Clie internal SupersetFlattenInheritanceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "SupersetFlattenInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "SupersetFlattenInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/SupersetInheritance/Generated/LongRunningOperation/SupersetInheritanceArmOperationOfT.cs b/test/TestProjects/SupersetInheritance/Generated/LongRunningOperation/SupersetInheritanceArmOperationOfT.cs index 3d430e60526..c6ab1480ecb 100644 --- a/test/TestProjects/SupersetInheritance/Generated/LongRunningOperation/SupersetInheritanceArmOperationOfT.cs +++ b/test/TestProjects/SupersetInheritance/Generated/LongRunningOperation/SupersetInheritanceArmOperationOfT.cs @@ -39,7 +39,8 @@ internal SupersetInheritanceArmOperation(IOperationSource source, ClientDiagn internal SupersetInheritanceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "SupersetInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "SupersetInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/TenantOnly/Generated/LongRunningOperation/TenantOnlyArmOperationOfT.cs b/test/TestProjects/TenantOnly/Generated/LongRunningOperation/TenantOnlyArmOperationOfT.cs index 7b1ed48c5f9..a24d4ad5870 100644 --- a/test/TestProjects/TenantOnly/Generated/LongRunningOperation/TenantOnlyArmOperationOfT.cs +++ b/test/TestProjects/TenantOnly/Generated/LongRunningOperation/TenantOnlyArmOperationOfT.cs @@ -39,7 +39,8 @@ internal TenantOnlyArmOperation(IOperationSource source, ClientDiagnostics cl internal TenantOnlyArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "TenantOnlyArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "TenantOnlyArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperation.cs b/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperation.cs index 87495b9b52e..2aad4b5720d 100644 --- a/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperation.cs +++ b/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperation.cs @@ -39,7 +39,8 @@ internal XmlDeserializationArmOperation(ClientDiagnostics clientDiagnostics, Htt internal XmlDeserializationArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, clientDiagnostics, pipeline, "XmlDeserializationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "XmlDeserializationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// diff --git a/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperationOfT.cs b/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperationOfT.cs index 1926dc81fe7..b7879425542 100644 --- a/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperationOfT.cs +++ b/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperationOfT.cs @@ -39,7 +39,8 @@ internal XmlDeserializationArmOperation(IOperationSource source, ClientDiagno internal XmlDeserializationArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) { - _operation = OperationInternal.Create(id, source, clientDiagnostics, pipeline, "XmlDeserializationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); + _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "XmlDeserializationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } /// From 5881c40518fe10738e3cbe2756bb35690f632bcc Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Fri, 18 Nov 2022 22:43:17 +0800 Subject: [PATCH 10/18] update shared files --- eng/DownloadSharedSource.ps1 | 2 +- src/assets/Azure.Core.Shared/IOperationSource.cs | 14 -------------- .../Azure.Core.Shared/OperationInternalOfT.cs | 6 ++++++ 3 files changed, 7 insertions(+), 15 deletions(-) delete mode 100644 src/assets/Azure.Core.Shared/IOperationSource.cs diff --git a/eng/DownloadSharedSource.ps1 b/eng/DownloadSharedSource.ps1 index bd0e19621ae..769c9538b59 100644 --- a/eng/DownloadSharedSource.ps1 +++ b/eng/DownloadSharedSource.ps1 @@ -18,7 +18,7 @@ $files = @('AsyncLockWithValue.cs', 'ClientDiagnostics.cs', 'DiagnosticScope.cs' 'OperationInternalBase.cs', 'OperationInternal.cs', 'VoidValue.cs', 'OperationInternalOfT.cs', 'TaskExtensions.cs', 'Argument.cs', 'Multipart/MultipartFormDataContent.cs', 'Multipart/MultipartContent.cs', 'AzureKeyCredentialPolicy.cs', 'AppContextSwitchHelper.cs', 'ConstantDelayStrategy.cs', 'DelayStrategy.cs', 'ExponentialDelayStrategy.cs', 'OperationPoller.cs', 'RetryAfterDelayStrategy.cs', - 'ForwardsClientCallsAttribute.cs', 'AsyncLockWithValue.cs', 'VoidValue.cs', 'IOperationSource.cs') + 'ForwardsClientCallsAttribute.cs', 'AsyncLockWithValue.cs', 'VoidValue.cs') # TODO: temporary change to target at support_lro_rehydration branch $baseUrl = 'https://raw.githubusercontent.com/Azure/azure-sdk-for-net/support_lro_rehydration/sdk/core/Azure.Core/src/Shared/' DownloadAll $files $baseUrl $downloadPath diff --git a/src/assets/Azure.Core.Shared/IOperationSource.cs b/src/assets/Azure.Core.Shared/IOperationSource.cs deleted file mode 100644 index 1be2f9b733d..00000000000 --- a/src/assets/Azure.Core.Shared/IOperationSource.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Threading; -using System.Threading.Tasks; - -namespace Azure.Core -{ - internal interface IOperationSource - { - T CreateResult(Response response, CancellationToken cancellationToken); - ValueTask CreateResultAsync(Response response, CancellationToken cancellationToken); - } -} diff --git a/src/assets/Azure.Core.Shared/OperationInternalOfT.cs b/src/assets/Azure.Core.Shared/OperationInternalOfT.cs index a633d98f03a..2d72074d7cf 100644 --- a/src/assets/Azure.Core.Shared/OperationInternalOfT.cs +++ b/src/assets/Azure.Core.Shared/OperationInternalOfT.cs @@ -383,6 +383,12 @@ internal interface IOperation string GetOperationId(); } + internal interface IOperationSource + { + T CreateResult(Response response, CancellationToken cancellationToken); + ValueTask CreateResultAsync(Response response, CancellationToken cancellationToken); + } + /// /// A helper structure passed to to indicate the current operation state. This structure must be /// instantiated by one of its static methods, depending on the operation state: From cd9e92860fdf471518e2e621ad66fb426e718476 Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Wed, 14 Dec 2022 15:46:21 +0800 Subject: [PATCH 11/18] changes for .NET 7 --- src/assets/Generator.Shared/FormUrlEncodedContent.cs | 2 ++ src/assets/Generator.Shared/NextLinkOperationImplementation.cs | 1 - src/assets/Generator.Shared/StringRequestContent.cs | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/assets/Generator.Shared/FormUrlEncodedContent.cs b/src/assets/Generator.Shared/FormUrlEncodedContent.cs index a8b8cbfc4ad..3a3ea7bcb0f 100644 --- a/src/assets/Generator.Shared/FormUrlEncodedContent.cs +++ b/src/assets/Generator.Shared/FormUrlEncodedContent.cs @@ -34,7 +34,9 @@ private void BuildIfNeeded () public override async Task WriteToAsync(Stream stream, CancellationToken cancellation) { BuildIfNeeded (); +#pragma warning disable CA1835 await stream.WriteAsync(_bytes, 0, _bytes.Length, cancellation).ConfigureAwait(false); +#pragma warning restore CA1835 } public override void WriteTo(Stream stream, CancellationToken cancellation) diff --git a/src/assets/Generator.Shared/NextLinkOperationImplementation.cs b/src/assets/Generator.Shared/NextLinkOperationImplementation.cs index 725caf4b1ad..c8f50381534 100644 --- a/src/assets/Generator.Shared/NextLinkOperationImplementation.cs +++ b/src/assets/Generator.Shared/NextLinkOperationImplementation.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.IO; using System.Text.Json; using System.Text.Json.Serialization; using System.Threading; diff --git a/src/assets/Generator.Shared/StringRequestContent.cs b/src/assets/Generator.Shared/StringRequestContent.cs index 1ba2bb2682c..29198ea5251 100644 --- a/src/assets/Generator.Shared/StringRequestContent.cs +++ b/src/assets/Generator.Shared/StringRequestContent.cs @@ -19,7 +19,9 @@ public StringRequestContent(string value) public override async Task WriteToAsync(Stream stream, CancellationToken cancellation) { +#pragma warning disable CA1835 await stream.WriteAsync(_bytes, 0, _bytes.Length, cancellation).ConfigureAwait(false); +#pragma warning restore CA1835 } public override void WriteTo(Stream stream, CancellationToken cancellation) From 5ac5c30b6aa614167c5a5cf8e39452ecb1da53ee Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Thu, 15 Dec 2022 19:56:36 +0800 Subject: [PATCH 12/18] update shared code --- eng/DownloadSharedSource.ps1 | 7 +- .../MgmtLongRunningOperationWriter.cs | 13 +- .../Azure.Core.Shared/ClientDiagnostics.cs | 2 + .../Azure.Core.Shared/DecodedResponse.cs | 218 +++++++++++++++ .../Azure.Core.Shared/IOperationSourceOfT.cs | 18 ++ .../Azure.Core.Shared/OperationInternal.cs | 262 ------------------ .../Azure.Core.Shared/OperationInternalOfT.cs | 25 +- .../Azure.Core.Shared/StreamConverter.cs | 78 ++++++ .../NextLinkOperationImplementation.cs | 2 +- .../IOperationSourceProviderOfT.cs | 20 ++ 10 files changed, 352 insertions(+), 293 deletions(-) create mode 100644 src/assets/Azure.Core.Shared/DecodedResponse.cs create mode 100644 src/assets/Azure.Core.Shared/IOperationSourceOfT.cs create mode 100644 src/assets/Azure.Core.Shared/StreamConverter.cs create mode 100644 src/assets/Management.Shared/IOperationSourceProviderOfT.cs diff --git a/eng/DownloadSharedSource.ps1 b/eng/DownloadSharedSource.ps1 index 769c9538b59..fd858fb292a 100644 --- a/eng/DownloadSharedSource.ps1 +++ b/eng/DownloadSharedSource.ps1 @@ -18,14 +18,15 @@ $files = @('AsyncLockWithValue.cs', 'ClientDiagnostics.cs', 'DiagnosticScope.cs' 'OperationInternalBase.cs', 'OperationInternal.cs', 'VoidValue.cs', 'OperationInternalOfT.cs', 'TaskExtensions.cs', 'Argument.cs', 'Multipart/MultipartFormDataContent.cs', 'Multipart/MultipartContent.cs', 'AzureKeyCredentialPolicy.cs', 'AppContextSwitchHelper.cs', 'ConstantDelayStrategy.cs', 'DelayStrategy.cs', 'ExponentialDelayStrategy.cs', 'OperationPoller.cs', 'RetryAfterDelayStrategy.cs', - 'ForwardsClientCallsAttribute.cs', 'AsyncLockWithValue.cs', 'VoidValue.cs') + 'ForwardsClientCallsAttribute.cs', 'AsyncLockWithValue.cs', 'VoidValue.cs', 'IOperationSourceOfT.cs', 'DecodedResponse.cs', 'StreamConverter.cs') # TODO: temporary change to target at support_lro_rehydration branch $baseUrl = 'https://raw.githubusercontent.com/Azure/azure-sdk-for-net/support_lro_rehydration/sdk/core/Azure.Core/src/Shared/' DownloadAll $files $baseUrl $downloadPath #Download management Shared -$files = 'SharedExtensions.cs', 'ManagedServiceIdentityTypeV3Converter.cs' +$files = 'SharedExtensions.cs', 'ManagedServiceIdentityTypeV3Converter.cs', 'IOperationSourceProviderOfT.cs' $downloadPath = Resolve-Path (Join-Path $PSScriptRoot '..' 'src' 'assets' 'Management.Shared') Get-ChildItem $downloadPath -Filter *.cs | Remove-Item; -$baseUrl = 'https://raw.githubusercontent.com/Azure/azure-sdk-for-net/main/sdk/resourcemanager/Azure.ResourceManager/src/Shared/' +# TODO: temporary change to target at support_lro_rehydration branch +$baseUrl = 'https://raw.githubusercontent.com/Azure/azure-sdk-for-net/support_lro_rehydration/sdk/resourcemanager/Azure.ResourceManager/src/Shared/' DownloadAll $files $baseUrl $downloadPath diff --git a/src/AutoRest.CSharp/Mgmt/Generation/MgmtLongRunningOperationWriter.cs b/src/AutoRest.CSharp/Mgmt/Generation/MgmtLongRunningOperationWriter.cs index b4573bfe5be..f14c9ac13af 100644 --- a/src/AutoRest.CSharp/Mgmt/Generation/MgmtLongRunningOperationWriter.cs +++ b/src/AutoRest.CSharp/Mgmt/Generation/MgmtLongRunningOperationWriter.cs @@ -81,17 +81,12 @@ public void Write() } _writer.Line(); - using (_writer.Scope($"internal {_name}({_operationSourceString}{typeof(ClientDiagnostics)} clientDiagnostics, {typeof(HttpPipeline)} pipeline, {typeof(string)} id)")) - { - var nextLinkOperation = new CodeWriterDeclaration("nextLinkOperation"); - _writer.Line($"var {nextLinkOperation:D} = {typeof(NextLinkOperationImplementation)}.{nameof(NextLinkOperationImplementation.Create)}({_sourceString}pipeline, id, out {typeof(string)} finalResponse);"); - _writer.Line($"_operation = {_operationInternalType}.Create({_sourceString}clientDiagnostics, {nextLinkOperation}, finalResponse, {_name:L}, fallbackStrategy: new {typeof(ExponentialDelayStrategy)}());"); - } - _writer.Line(); - _writer.WriteXmlDocumentationInheritDoc(); _writer - .LineRaw("public override string Id => _operation.GetOperationId();") + .LineRaw("#pragma warning disable CA1822") + .LineRaw($"[{typeof(EditorBrowsableAttribute)}({typeof(EditorBrowsableState)}.{nameof(EditorBrowsableState.Never)})]") + .LineRaw("public override string Id => throw new NotImplementedException();") + .LineRaw("#pragma warning restore CA1822") .Line(); if (_isGeneric) diff --git a/src/assets/Azure.Core.Shared/ClientDiagnostics.cs b/src/assets/Azure.Core.Shared/ClientDiagnostics.cs index 775df5327ef..679d2730a63 100644 --- a/src/assets/Azure.Core.Shared/ClientDiagnostics.cs +++ b/src/assets/Azure.Core.Shared/ClientDiagnostics.cs @@ -190,7 +190,9 @@ internal static string CreateRequestFailedMessageWithContent(Response response, foreach (HttpHeader responseHeader in response.Headers) { string headerValue = sanitizer.SanitizeHeader(responseHeader.Name, responseHeader.Value); +#pragma warning disable CA1305 messageBuilder.AppendLine($"{responseHeader.Name}: {headerValue}"); +#pragma warning restore CA1305 } return messageBuilder.ToString(); diff --git a/src/assets/Azure.Core.Shared/DecodedResponse.cs b/src/assets/Azure.Core.Shared/DecodedResponse.cs new file mode 100644 index 00000000000..19e277eb1f9 --- /dev/null +++ b/src/assets/Azure.Core.Shared/DecodedResponse.cs @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core.Pipeline; + +#nullable disable + +namespace Azure.Core +{ + [JsonConverter(typeof(DecodedResponseConverter))] + internal class DecodedResponse : Response + { + private readonly Dictionary> _headers = new Dictionary>(StringComparer.OrdinalIgnoreCase); + + public DecodedResponse() + { + } + + internal DecodedResponse(int status, string reasonPhrase, Stream contentStream, string clientRequestId, bool isError, Dictionary> headers) + { + Status = status; + ReasonPhrase = reasonPhrase; + ContentStream = contentStream; + ClientRequestId = clientRequestId; + _isError = isError; + _headers = headers; + } + + internal static DecodedResponse DeserializeDecodedResponse(JsonElement element) + { + int status = default; + string reasonPhrase = default; + Stream contentStream = new MemoryStream(); + string clientRequestId = default; + bool isError = default; + Dictionary> headers = new Dictionary>(StringComparer.OrdinalIgnoreCase); + + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("Status")) + { + status = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("ReasonPhrase")) + { + reasonPhrase = property.Value.GetString(); + continue; + } + if (property.NameEquals("ContentStream")) + { + var content = BinaryData.FromObjectAsJson(property.Value); + if (content != null) + { + content.ToStream().CopyTo(contentStream); + contentStream.Position = 0; + } + continue; + } + if (property.NameEquals("ClientRequestId")) + { + clientRequestId = property.Value.GetString(); + continue; + } + if (property.NameEquals("IsError")) + { + isError = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("Headers")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + string name = default; + string value = default; + foreach (var property0 in item.EnumerateObject()) + { + if (property0.NameEquals("Name")) + { + name = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("Value")) + { + value = property0.Value.GetString(); + continue; + } + } + array.Add(new HttpHeader(name, value)); + } + foreach (var item in array) + { + if (!headers.TryGetValue(item.Name, out List values)) + { + headers[item.Name] = values = new List(); + } + values.Add(item.Value); + } + continue; + } + } + return new DecodedResponse(status, reasonPhrase, contentStream, clientRequestId, isError, headers); + } + + internal partial class DecodedResponseConverter : JsonConverter + { + public override void Write(Utf8JsonWriter writer, DecodedResponse model, JsonSerializerOptions options) + { + throw new NotImplementedException("This converter should only be used for deserialization."); + } + public override DecodedResponse Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + using var document = JsonDocument.ParseValue(ref reader); + return DeserializeDecodedResponse(document.RootElement); + } + } + + public override int Status { get; } + + public override string ReasonPhrase { get; } + + public override Stream ContentStream { get; set; } + + public override string ClientRequestId { get; set; } + + private bool? _isError; + public override bool IsError { get => _isError ?? base.IsError; } + public void SetIsError(bool value) => _isError = value; + + public bool IsDisposed { get; private set; } + + public void SetContent(byte[] content) + { + ContentStream = new MemoryStream(content, 0, content.Length, false, true); + } + + public DecodedResponse SetContent(string content) + { + SetContent(Encoding.UTF8.GetBytes(content)); + return this; + } + + public DecodedResponse AddHeader(string name, string value) + { + return AddHeader(new HttpHeader(name, value)); + } + + public DecodedResponse AddHeader(HttpHeader header) + { + if (!_headers.TryGetValue(header.Name, out List values)) + { + _headers[header.Name] = values = new List(); + } + + values.Add(header.Value); + return this; + } + +#if HAS_INTERNALS_VISIBLE_CORE + internal +#endif + protected override bool TryGetHeader(string name, out string value) + { + if (_headers.TryGetValue(name, out List values)) + { + value = JoinHeaderValue(values); + return true; + } + + value = null; + return false; + } + +#if HAS_INTERNALS_VISIBLE_CORE + internal +#endif + protected override bool TryGetHeaderValues(string name, out IEnumerable values) + { + var result = _headers.TryGetValue(name, out List valuesList); + values = valuesList; + return result; + } + +#if HAS_INTERNALS_VISIBLE_CORE + internal +#endif + protected override bool ContainsHeader(string name) + { + return TryGetHeaderValues(name, out _); + } + +#if HAS_INTERNALS_VISIBLE_CORE + internal +#endif + protected override IEnumerable EnumerateHeaders() => _headers.Select(h => new HttpHeader(h.Key, JoinHeaderValue(h.Value))); + + private static string JoinHeaderValue(IEnumerable values) + { + return string.Join(",", values); + } + + public override void Dispose() + { + IsDisposed = true; + GC.SuppressFinalize(this); + } + } +} diff --git a/src/assets/Azure.Core.Shared/IOperationSourceOfT.cs b/src/assets/Azure.Core.Shared/IOperationSourceOfT.cs new file mode 100644 index 00000000000..43bd96e3c27 --- /dev/null +++ b/src/assets/Azure.Core.Shared/IOperationSourceOfT.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable enable + +using System.Threading; +using System.Threading.Tasks; + +namespace Azure.Core +{ +#pragma warning disable SA1649 // File name should match first type name + internal interface IOperationSource +#pragma warning restore SA1649 + { + T CreateResult(Response response, CancellationToken cancellationToken); + ValueTask CreateResultAsync(Response response, CancellationToken cancellationToken); + } +} diff --git a/src/assets/Azure.Core.Shared/OperationInternal.cs b/src/assets/Azure.Core.Shared/OperationInternal.cs index 28950505328..4593b278c0c 100644 --- a/src/assets/Azure.Core.Shared/OperationInternal.cs +++ b/src/assets/Azure.Core.Shared/OperationInternal.cs @@ -167,268 +167,6 @@ public string GetOperationId() return _operation.GetOperationId(); } } - - internal class StreamConverter : JsonConverter - { - /// Serialize stream to BinaryData string. - /// The writer. - /// The Stream model. - /// The options for JsonSerializer. - public override void Write(Utf8JsonWriter writer, Stream model, JsonSerializerOptions options) - { - if (model.Length == 0) - { - writer.WriteNullValue(); - return; - } - MemoryStream? memoryContent = model as MemoryStream; - - if (memoryContent == null) - { - throw new InvalidOperationException($"The response is not fully buffered."); - } - - if (memoryContent.TryGetBuffer(out ArraySegment segment)) - { - var data = new BinaryData(segment.AsMemory()); -#if NET6_0_OR_GREATER - writer.WriteRawValue(data); -#else - JsonSerializer.Serialize(writer, JsonDocument.Parse(data.ToString()).RootElement); -#endif - } - else - { - var data = new BinaryData(memoryContent.ToArray()); -#if NET6_0_OR_GREATER - writer.WriteRawValue(data); -#else - JsonSerializer.Serialize(writer, JsonDocument.Parse(data.ToString()).RootElement); -#endif - } - } - - /// Deserialize Stream from BinaryData string. - /// The reader. - /// The type to convert - /// The options for JsonSerializer. - public override Stream Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - using var document = JsonDocument.ParseValue(ref reader); - foreach (var property in document.RootElement.EnumerateObject()) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - var value = property.Value.GetString(); - return BinaryData.FromString(value!).ToStream(); - } - return new MemoryStream(); - } - } - - [JsonConverter(typeof(DecodedResponseConverter))] - internal class DecodedResponse : Response - { - #nullable disable - private readonly Dictionary> _headers = new Dictionary>(StringComparer.OrdinalIgnoreCase); - - public DecodedResponse() - { - } - - internal DecodedResponse(int status, string reasonPhrase, Stream contentStream, string clientRequestId, bool isError, Dictionary> headers) - { - Status = status; - ReasonPhrase = reasonPhrase; - ContentStream = contentStream; - ClientRequestId = clientRequestId; - _isError = isError; - _headers = headers; - } - - internal static DecodedResponse DeserializeDecodedResponse(JsonElement element) - { - int status = default; - string reasonPhrase = default; - Stream contentStream = new MemoryStream(); - string clientRequestId = default; - bool isError = default; - Dictionary> headers = new Dictionary>(StringComparer.OrdinalIgnoreCase); - - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("Status")) - { - status = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("ReasonPhrase")) - { - reasonPhrase = property.Value.GetString(); - continue; - } - if (property.NameEquals("ContentStream")) - { - var content = BinaryData.FromObjectAsJson(property.Value); - if (content != null) - { - content.ToStream().CopyTo(contentStream); - contentStream.Position = 0; - } - continue; - } - if (property.NameEquals("ClientRequestId")) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("IsError")) - { - isError = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("Headers")) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - string name = default; - string value = default; - foreach (var property0 in item.EnumerateObject()) - { - if (property0.NameEquals("Name")) - { - name = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("Value")) - { - value = property0.Value.GetString(); - continue; - } - } - array.Add(new HttpHeader(name, value)); - } - foreach (var item in array) - { - if (!headers.TryGetValue(item.Name, out List values)) - { - headers[item.Name] = values = new List(); - } - values.Add(item.Value); - } - continue; - } - } - return new DecodedResponse(status, reasonPhrase, contentStream, clientRequestId, isError, headers); - } - - internal partial class DecodedResponseConverter : JsonConverter - { - public override void Write(Utf8JsonWriter writer, DecodedResponse model, JsonSerializerOptions options) - { - throw new NotImplementedException("This converter should only be used for deserialization."); - } - public override DecodedResponse Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - using var document = JsonDocument.ParseValue(ref reader); - return DeserializeDecodedResponse(document.RootElement); - } - } - - public override int Status { get; } - - public override string ReasonPhrase { get; } - - public override Stream ContentStream { get; set; } - - public override string ClientRequestId { get; set; } - - private bool? _isError; - public override bool IsError { get => _isError ?? base.IsError; } - public void SetIsError(bool value) => _isError = value; - - public bool IsDisposed { get; private set; } - - public void SetContent(byte[] content) - { - ContentStream = new MemoryStream(content, 0, content.Length, false, true); - } - - public DecodedResponse SetContent(string content) - { - SetContent(Encoding.UTF8.GetBytes(content)); - return this; - } - - public DecodedResponse AddHeader(string name, string value) - { - return AddHeader(new HttpHeader(name, value)); - } - - public DecodedResponse AddHeader(HttpHeader header) - { - if (!_headers.TryGetValue(header.Name, out List values)) - { - _headers[header.Name] = values = new List(); - } - - values.Add(header.Value); - return this; - } - - #if HAS_INTERNALS_VISIBLE_CORE - internal - #endif - protected override bool TryGetHeader(string name, out string value) - { - if (_headers.TryGetValue(name, out List values)) - { - value = JoinHeaderValue(values); - return true; - } - - value = null; - return false; - } - - #if HAS_INTERNALS_VISIBLE_CORE - internal - #endif - protected override bool TryGetHeaderValues(string name, out IEnumerable values) - { - var result = _headers.TryGetValue(name, out List valuesList); - values = valuesList; - return result; - } - - #if HAS_INTERNALS_VISIBLE_CORE - internal - #endif - protected override bool ContainsHeader(string name) - { - return TryGetHeaderValues(name, out _); - } - - #if HAS_INTERNALS_VISIBLE_CORE - internal - #endif - protected override IEnumerable EnumerateHeaders() => _headers.Select(h => new HttpHeader(h.Key, JoinHeaderValue(h.Value))); - - private static string JoinHeaderValue(IEnumerable values) - { - return string.Join(",", values); - } - - public override void Dispose() - { - IsDisposed = true; - GC.SuppressFinalize(this); - } - #nullable enable - } } /// diff --git a/src/assets/Azure.Core.Shared/OperationInternalOfT.cs b/src/assets/Azure.Core.Shared/OperationInternalOfT.cs index 2d72074d7cf..1d2fc0abbfc 100644 --- a/src/assets/Azure.Core.Shared/OperationInternalOfT.cs +++ b/src/assets/Azure.Core.Shared/OperationInternalOfT.cs @@ -130,7 +130,7 @@ public static OperationInternal Create( { if (finalResponse != null) { - Response response = JsonSerializer.Deserialize(finalResponse)!; + Response response = JsonSerializer.Deserialize(finalResponse)!; return OperationInternal.Succeeded(response, source.CreateResult(response, CancellationToken.None)); } return new OperationInternal(clientDiagnostics, operation!, null, operationTypeName, scopeAttributes, fallbackStrategy); @@ -301,20 +301,18 @@ protected override async ValueTask UpdateStatusAsync(bool async, Cance public virtual string GetOperationId() { - try - { - return _operation.GetOperationId(); - } - catch (NotImplementedException) + var id = _operation.GetOperationId(); + if (string.IsNullOrEmpty(id)) { - var serializeOptions = new JsonSerializerOptions { Converters = { new OperationInternal.StreamConverter() } }; + var serializeOptions = new JsonSerializerOptions { Converters = { new StreamConverter() } }; var lroDetails = new Dictionary() { ["FinalResponse"] = BinaryData.FromObjectAsJson(_rawResponse!, serializeOptions).ToString() }; var lroData = BinaryData.FromObjectAsJson(lroDetails); - return Convert.ToBase64String(lroData.ToArray()); + id = Convert.ToBase64String(lroData.ToArray()); } + return id; } private static Response GetResponseFromState(OperationState state) @@ -332,10 +330,7 @@ private class FinalOperation : IOperation public ValueTask> UpdateStateAsync(bool async, CancellationToken cancellationToken) => throw new NotSupportedException("The operation has already completed"); - public string GetOperationId() - { - throw new NotImplementedException(); - } + public string GetOperationId() => string.Empty; } } @@ -383,12 +378,6 @@ internal interface IOperation string GetOperationId(); } - internal interface IOperationSource - { - T CreateResult(Response response, CancellationToken cancellationToken); - ValueTask CreateResultAsync(Response response, CancellationToken cancellationToken); - } - /// /// A helper structure passed to to indicate the current operation state. This structure must be /// instantiated by one of its static methods, depending on the operation state: diff --git a/src/assets/Azure.Core.Shared/StreamConverter.cs b/src/assets/Azure.Core.Shared/StreamConverter.cs new file mode 100644 index 00000000000..28c39017ff0 --- /dev/null +++ b/src/assets/Azure.Core.Shared/StreamConverter.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core.Pipeline; + +#nullable enable + +namespace Azure.Core +{ + internal class StreamConverter : JsonConverter + { + /// Serialize stream to BinaryData string. + /// The writer. + /// The Stream model. + /// The options for JsonSerializer. + public override void Write(Utf8JsonWriter writer, Stream model, JsonSerializerOptions options) + { + if (model.Length == 0) + { + writer.WriteNullValue(); + return; + } + MemoryStream? memoryContent = model as MemoryStream; + + if (memoryContent == null) + { + throw new InvalidOperationException($"The response is not fully buffered."); + } + + if (memoryContent.TryGetBuffer(out ArraySegment segment)) + { + var data = new BinaryData(segment.AsMemory()); +#if NET6_0_OR_GREATER + writer.WriteRawValue(data); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(data.ToString()).RootElement); +#endif + } + else + { + var data = new BinaryData(memoryContent.ToArray()); +#if NET6_0_OR_GREATER + writer.WriteRawValue(data); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(data.ToString()).RootElement); +#endif + } + } + + /// Deserialize Stream from BinaryData string. + /// The reader. + /// The type to convert + /// The options for JsonSerializer. + public override Stream Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + using var document = JsonDocument.ParseValue(ref reader); + foreach (var property in document.RootElement.EnumerateObject()) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var value = property.Value.GetString(); + return BinaryData.FromString(value!).ToStream(); + } + return new MemoryStream(); + } + } +} diff --git a/src/assets/Generator.Shared/NextLinkOperationImplementation.cs b/src/assets/Generator.Shared/NextLinkOperationImplementation.cs index c8f50381534..06fa6e6bff1 100644 --- a/src/assets/Generator.Shared/NextLinkOperationImplementation.cs +++ b/src/assets/Generator.Shared/NextLinkOperationImplementation.cs @@ -465,7 +465,7 @@ public CompletedOperation(OperationState operationState) public string GetOperationId() { - var serializeOptions = new JsonSerializerOptions { Converters = { new OperationInternal.StreamConverter() } }; + var serializeOptions = new JsonSerializerOptions { Converters = { new StreamConverter() } }; var lroDetails = new Dictionary() { ["FinalResponse"] = BinaryData.FromObjectAsJson(_operationState.RawResponse, serializeOptions).ToString() diff --git a/src/assets/Management.Shared/IOperationSourceProviderOfT.cs b/src/assets/Management.Shared/IOperationSourceProviderOfT.cs new file mode 100644 index 00000000000..f247edf68fa --- /dev/null +++ b/src/assets/Management.Shared/IOperationSourceProviderOfT.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable enable + +using Azure.ResourceManager; + +namespace Azure.Core +{ +#if NET7_0_OR_GREATER +#pragma warning disable SA1649 // File name should match first type name + internal interface IOperationSourceProvider +#pragma warning restore SA1649 + { + /// Get the IOperationSource of type T. + /// The ArmClient to use. + static abstract IOperationSource GetOperationSource(ArmClient armClient); + } +#endif +} From 56d04605bd820219c750055a2b9519696fe92493 Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Thu, 15 Dec 2022 20:20:29 +0800 Subject: [PATCH 13/18] revert IOperationSource change --- eng/DownloadSharedSource.ps1 | 6 +++--- .../Azure.Core.Shared/OperationInternal.cs | 21 ------------------- .../Azure.Core.Shared/OperationInternalOfT.cs | 19 ----------------- .../IOperationSource.cs} | 4 ---- .../IOperationSourceProviderOfT.cs | 20 ------------------ 5 files changed, 3 insertions(+), 67 deletions(-) rename src/assets/{Azure.Core.Shared/IOperationSourceOfT.cs => Generator.Shared/IOperationSource.cs} (76%) delete mode 100644 src/assets/Management.Shared/IOperationSourceProviderOfT.cs diff --git a/eng/DownloadSharedSource.ps1 b/eng/DownloadSharedSource.ps1 index fd858fb292a..a78724f6038 100644 --- a/eng/DownloadSharedSource.ps1 +++ b/eng/DownloadSharedSource.ps1 @@ -18,15 +18,15 @@ $files = @('AsyncLockWithValue.cs', 'ClientDiagnostics.cs', 'DiagnosticScope.cs' 'OperationInternalBase.cs', 'OperationInternal.cs', 'VoidValue.cs', 'OperationInternalOfT.cs', 'TaskExtensions.cs', 'Argument.cs', 'Multipart/MultipartFormDataContent.cs', 'Multipart/MultipartContent.cs', 'AzureKeyCredentialPolicy.cs', 'AppContextSwitchHelper.cs', 'ConstantDelayStrategy.cs', 'DelayStrategy.cs', 'ExponentialDelayStrategy.cs', 'OperationPoller.cs', 'RetryAfterDelayStrategy.cs', - 'ForwardsClientCallsAttribute.cs', 'AsyncLockWithValue.cs', 'VoidValue.cs', 'IOperationSourceOfT.cs', 'DecodedResponse.cs', 'StreamConverter.cs') + 'ForwardsClientCallsAttribute.cs', 'AsyncLockWithValue.cs', 'VoidValue.cs', 'DecodedResponse.cs', 'StreamConverter.cs') # TODO: temporary change to target at support_lro_rehydration branch $baseUrl = 'https://raw.githubusercontent.com/Azure/azure-sdk-for-net/support_lro_rehydration/sdk/core/Azure.Core/src/Shared/' DownloadAll $files $baseUrl $downloadPath #Download management Shared -$files = 'SharedExtensions.cs', 'ManagedServiceIdentityTypeV3Converter.cs', 'IOperationSourceProviderOfT.cs' +$files = 'SharedExtensions.cs', 'ManagedServiceIdentityTypeV3Converter.cs' $downloadPath = Resolve-Path (Join-Path $PSScriptRoot '..' 'src' 'assets' 'Management.Shared') Get-ChildItem $downloadPath -Filter *.cs | Remove-Item; # TODO: temporary change to target at support_lro_rehydration branch -$baseUrl = 'https://raw.githubusercontent.com/Azure/azure-sdk-for-net/support_lro_rehydration/sdk/resourcemanager/Azure.ResourceManager/src/Shared/' +$baseUrl = 'https://raw.githubusercontent.com/Azure/azure-sdk-for-net/main/sdk/resourcemanager/Azure.ResourceManager/src/Shared/' DownloadAll $files $baseUrl $downloadPath diff --git a/src/assets/Azure.Core.Shared/OperationInternal.cs b/src/assets/Azure.Core.Shared/OperationInternal.cs index 4593b278c0c..93943740ff7 100644 --- a/src/assets/Azure.Core.Shared/OperationInternal.cs +++ b/src/assets/Azure.Core.Shared/OperationInternal.cs @@ -3,11 +3,6 @@ using System; using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; using System.Threading; using System.Threading.Tasks; using Azure.Core.Pipeline; @@ -108,22 +103,6 @@ private OperationInternal(OperationState finalState) : OperationInternal.Failed(finalState.RawResponse, finalState.OperationFailedException!); } - public static OperationInternal Create( - ClientDiagnostics clientDiagnostics, - IOperation? operation, - string? finalResponse, - string? operationTypeName = null, - IEnumerable>? scopeAttributes = null, - DelayStrategy? fallbackStrategy = null) - { - if (finalResponse != null) - { - Response response = JsonSerializer.Deserialize(finalResponse)!; - return OperationInternal.Succeeded(response); - } - return new OperationInternal(clientDiagnostics, operation!, null, operationTypeName, scopeAttributes, fallbackStrategy); - } - public override Response RawResponse => _internalOperation.RawResponse; public override bool HasCompleted => _internalOperation.HasCompleted; diff --git a/src/assets/Azure.Core.Shared/OperationInternalOfT.cs b/src/assets/Azure.Core.Shared/OperationInternalOfT.cs index 1d2fc0abbfc..0515aaa740e 100644 --- a/src/assets/Azure.Core.Shared/OperationInternalOfT.cs +++ b/src/assets/Azure.Core.Shared/OperationInternalOfT.cs @@ -5,9 +5,7 @@ using System; using System.Collections.Generic; -using System.IO; using System.Text.Json; -using System.Text.Json.Serialization; using System.Threading; using System.Threading.Tasks; using Azure.Core.Pipeline; @@ -119,23 +117,6 @@ private OperationInternal(OperationState finalState) _stateLock = new AsyncLockWithValue>(finalState); } - public static OperationInternal Create( - IOperationSource source, - ClientDiagnostics clientDiagnostics, - IOperation? operation, - string? finalResponse, - string? operationTypeName = null, - IEnumerable>? scopeAttributes = null, - DelayStrategy? fallbackStrategy = null) - { - if (finalResponse != null) - { - Response response = JsonSerializer.Deserialize(finalResponse)!; - return OperationInternal.Succeeded(response, source.CreateResult(response, CancellationToken.None)); - } - return new OperationInternal(clientDiagnostics, operation!, null, operationTypeName, scopeAttributes, fallbackStrategy); - } - public override Response RawResponse => (_stateLock.TryGetValue(out var state) ? state.RawResponse : _rawResponse) ?? throw new InvalidOperationException("The operation does not have a response yet. Please call UpdateStatus or WaitForCompletion first."); public override bool HasCompleted => _stateLock.HasValue; diff --git a/src/assets/Azure.Core.Shared/IOperationSourceOfT.cs b/src/assets/Generator.Shared/IOperationSource.cs similarity index 76% rename from src/assets/Azure.Core.Shared/IOperationSourceOfT.cs rename to src/assets/Generator.Shared/IOperationSource.cs index 43bd96e3c27..1be2f9b733d 100644 --- a/src/assets/Azure.Core.Shared/IOperationSourceOfT.cs +++ b/src/assets/Generator.Shared/IOperationSource.cs @@ -1,16 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -#nullable enable - using System.Threading; using System.Threading.Tasks; namespace Azure.Core { -#pragma warning disable SA1649 // File name should match first type name internal interface IOperationSource -#pragma warning restore SA1649 { T CreateResult(Response response, CancellationToken cancellationToken); ValueTask CreateResultAsync(Response response, CancellationToken cancellationToken); diff --git a/src/assets/Management.Shared/IOperationSourceProviderOfT.cs b/src/assets/Management.Shared/IOperationSourceProviderOfT.cs deleted file mode 100644 index f247edf68fa..00000000000 --- a/src/assets/Management.Shared/IOperationSourceProviderOfT.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable enable - -using Azure.ResourceManager; - -namespace Azure.Core -{ -#if NET7_0_OR_GREATER -#pragma warning disable SA1649 // File name should match first type name - internal interface IOperationSourceProvider -#pragma warning restore SA1649 - { - /// Get the IOperationSource of type T. - /// The ArmClient to use. - static abstract IOperationSource GetOperationSource(ArmClient armClient); - } -#endif -} From 176a1f3607b7c5b64e2b95f98983f3ca8a8a3c96 Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Mon, 9 Jan 2023 18:35:37 +0800 Subject: [PATCH 14/18] revert samples and tests --- eng/DownloadSharedSource.ps1 | 1 - .../LongRunningOperation/StorageArmOperation.cs | 11 ++++------- .../LongRunningOperation/StorageArmOperationOfT.cs | 11 ++++------- .../LongRunningOperation/SampleArmOperation.cs | 11 ++++------- .../LongRunningOperation/SampleArmOperationOfT.cs | 11 ++++------- .../ExactMatchFlattenInheritanceArmOperationOfT.cs | 11 ++++------- .../ExactMatchInheritanceArmOperationOfT.cs | 11 ++++------- .../MgmtDiscriminatorArmOperation.cs | 11 ++++------- .../MgmtDiscriminatorArmOperationOfT.cs | 11 ++++------- .../MgmtExpandResourceTypesArmOperation.cs | 11 ++++------- .../MgmtExpandResourceTypesArmOperationOfT.cs | 11 ++++------- ...MgmtExtensionCommonRestOperationArmOperationOfT.cs | 11 ++++------- .../MgmtExtensionResourceArmOperation.cs | 11 ++++------- .../MgmtExtensionResourceArmOperationOfT.cs | 11 ++++------- .../LongRunningOperation/MgmtLROArmOperation.cs | 11 ++++------- .../LongRunningOperation/MgmtLROArmOperationOfT.cs | 11 ++++------- .../MgmtListMethodsArmOperationOfT.cs | 11 ++++------- .../MgmtMockAndSampleArmOperation.cs | 11 ++++------- .../MgmtMockAndSampleArmOperationOfT.cs | 11 ++++------- .../MgmtMultipleParentResourceArmOperation.cs | 11 ++++------- .../MgmtMultipleParentResourceArmOperationOfT.cs | 11 ++++------- .../MgmtNonStringPathVariableArmOperation.cs | 11 ++++------- .../MgmtNonStringPathVariableArmOperationOfT.cs | 11 ++++------- .../MgmtOperationsArmOperation.cs | 11 ++++------- .../MgmtOperationsArmOperationOfT.cs | 11 ++++------- .../MgmtOptionalConstantArmOperation.cs | 11 ++++------- .../MgmtOptionalConstantArmOperationOfT.cs | 11 ++++------- .../MgmtParamOrderingArmOperation.cs | 11 ++++------- .../MgmtParamOrderingArmOperationOfT.cs | 11 ++++------- .../LongRunningOperation/MgmtParentArmOperation.cs | 11 ++++------- .../LongRunningOperation/MgmtParentArmOperationOfT.cs | 11 ++++------- .../MgmtPropertyChooserArmOperation.cs | 11 ++++------- .../MgmtPropertyChooserArmOperationOfT.cs | 11 ++++------- .../MgmtRenameRulesArmOperation.cs | 11 ++++------- .../MgmtRenameRulesArmOperationOfT.cs | 11 ++++------- .../MgmtResourceNameArmOperationOfT.cs | 11 ++++------- .../MgmtSafeFlattenArmOperationOfT.cs | 11 ++++------- .../MgmtScopeResourceArmOperation.cs | 11 ++++------- .../MgmtScopeResourceArmOperationOfT.cs | 11 ++++------- .../MgmtSubscriptionNameParameterArmOperation.cs | 11 ++++------- .../MgmtSubscriptionNameParameterArmOperationOfT.cs | 11 ++++------- .../NoTypeReplacementArmOperationOfT.cs | 11 ++++------- .../OmitOperationGroupsArmOperationOfT.cs | 11 ++++------- .../LongRunningOperation/PaginationArmOperationOfT.cs | 11 ++++------- .../ResourceRenameArmOperation.cs | 11 ++++------- .../ResourceRenameArmOperationOfT.cs | 11 ++++------- .../SingletonResourceArmOperationOfT.cs | 11 ++++------- .../SubscriptionExtensionsArmOperationOfT.cs | 11 ++++------- .../SupersetFlattenInheritanceArmOperationOfT.cs | 11 ++++------- .../SupersetInheritanceArmOperationOfT.cs | 11 ++++------- .../LongRunningOperation/TenantOnlyArmOperationOfT.cs | 11 ++++------- .../XmlDeserializationArmOperation.cs | 11 ++++------- .../XmlDeserializationArmOperationOfT.cs | 11 ++++------- 53 files changed, 208 insertions(+), 365 deletions(-) diff --git a/eng/DownloadSharedSource.ps1 b/eng/DownloadSharedSource.ps1 index a78724f6038..43bfd17600b 100644 --- a/eng/DownloadSharedSource.ps1 +++ b/eng/DownloadSharedSource.ps1 @@ -27,6 +27,5 @@ DownloadAll $files $baseUrl $downloadPath $files = 'SharedExtensions.cs', 'ManagedServiceIdentityTypeV3Converter.cs' $downloadPath = Resolve-Path (Join-Path $PSScriptRoot '..' 'src' 'assets' 'Management.Shared') Get-ChildItem $downloadPath -Filter *.cs | Remove-Item; -# TODO: temporary change to target at support_lro_rehydration branch $baseUrl = 'https://raw.githubusercontent.com/Azure/azure-sdk-for-net/main/sdk/resourcemanager/Azure.ResourceManager/src/Shared/' DownloadAll $files $baseUrl $downloadPath diff --git a/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperation.cs b/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperation.cs index 75677b804ca..e2b4f1a30a3 100644 --- a/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperation.cs +++ b/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperation.cs @@ -37,14 +37,11 @@ internal StorageArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline p _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "StorageArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal StorageArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "StorageArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperationOfT.cs b/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperationOfT.cs index 6a993b3ae5d..dcd9c80072f 100644 --- a/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperationOfT.cs +++ b/samples/Azure.Management.Storage/Generated/LongRunningOperation/StorageArmOperationOfT.cs @@ -37,14 +37,11 @@ internal StorageArmOperation(IOperationSource source, ClientDiagnostics clien _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "StorageArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal StorageArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "StorageArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperation.cs b/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperation.cs index 0ae811d6cde..04d330f21b7 100644 --- a/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperation.cs +++ b/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperation.cs @@ -37,14 +37,11 @@ internal SampleArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pi _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "SampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal SampleArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "SampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperationOfT.cs b/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperationOfT.cs index 8a245a0c2b4..8b3fba044b6 100644 --- a/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperationOfT.cs +++ b/samples/Azure.ResourceManager.Sample/Generated/LongRunningOperation/SampleArmOperationOfT.cs @@ -37,14 +37,11 @@ internal SampleArmOperation(IOperationSource source, ClientDiagnostics client _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "SampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal SampleArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "SampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/ExactMatchFlattenInheritance/Generated/LongRunningOperation/ExactMatchFlattenInheritanceArmOperationOfT.cs b/test/TestProjects/ExactMatchFlattenInheritance/Generated/LongRunningOperation/ExactMatchFlattenInheritanceArmOperationOfT.cs index 243c2121bae..be75afb72e6 100644 --- a/test/TestProjects/ExactMatchFlattenInheritance/Generated/LongRunningOperation/ExactMatchFlattenInheritanceArmOperationOfT.cs +++ b/test/TestProjects/ExactMatchFlattenInheritance/Generated/LongRunningOperation/ExactMatchFlattenInheritanceArmOperationOfT.cs @@ -37,14 +37,11 @@ internal ExactMatchFlattenInheritanceArmOperation(IOperationSource source, Cl _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "ExactMatchFlattenInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal ExactMatchFlattenInheritanceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "ExactMatchFlattenInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/ExactMatchInheritance/Generated/LongRunningOperation/ExactMatchInheritanceArmOperationOfT.cs b/test/TestProjects/ExactMatchInheritance/Generated/LongRunningOperation/ExactMatchInheritanceArmOperationOfT.cs index 373c6617538..38d3f39e5e9 100644 --- a/test/TestProjects/ExactMatchInheritance/Generated/LongRunningOperation/ExactMatchInheritanceArmOperationOfT.cs +++ b/test/TestProjects/ExactMatchInheritance/Generated/LongRunningOperation/ExactMatchInheritanceArmOperationOfT.cs @@ -37,14 +37,11 @@ internal ExactMatchInheritanceArmOperation(IOperationSource source, ClientDia _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "ExactMatchInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal ExactMatchInheritanceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "ExactMatchInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperation.cs b/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperation.cs index 022effecaa9..f769d9165fc 100644 --- a/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperation.cs +++ b/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperation.cs @@ -37,14 +37,11 @@ internal MgmtDiscriminatorArmOperation(ClientDiagnostics clientDiagnostics, Http _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtDiscriminatorArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtDiscriminatorArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtDiscriminatorArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperationOfT.cs b/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperationOfT.cs index 25d12a3a82a..3335536e16d 100644 --- a/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperationOfT.cs +++ b/test/TestProjects/MgmtDiscriminator/Generated/LongRunningOperation/MgmtDiscriminatorArmOperationOfT.cs @@ -37,14 +37,11 @@ internal MgmtDiscriminatorArmOperation(IOperationSource source, ClientDiagnos _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtDiscriminatorArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtDiscriminatorArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtDiscriminatorArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperation.cs b/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperation.cs index 66fd7a442a1..df5981e5473 100644 --- a/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperation.cs +++ b/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperation.cs @@ -37,14 +37,11 @@ internal MgmtExpandResourceTypesArmOperation(ClientDiagnostics clientDiagnostics _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtExpandResourceTypesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtExpandResourceTypesArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtExpandResourceTypesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperationOfT.cs b/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperationOfT.cs index d0fb6e666a2..a3bea825e19 100644 --- a/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperationOfT.cs +++ b/test/TestProjects/MgmtExpandResourceTypes/Generated/LongRunningOperation/MgmtExpandResourceTypesArmOperationOfT.cs @@ -37,14 +37,11 @@ internal MgmtExpandResourceTypesArmOperation(IOperationSource source, ClientD _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtExpandResourceTypesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtExpandResourceTypesArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtExpandResourceTypesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtExtensionCommonRestOperation/Generated/LongRunningOperation/MgmtExtensionCommonRestOperationArmOperationOfT.cs b/test/TestProjects/MgmtExtensionCommonRestOperation/Generated/LongRunningOperation/MgmtExtensionCommonRestOperationArmOperationOfT.cs index a6fd4b58d3a..6d966806c9f 100644 --- a/test/TestProjects/MgmtExtensionCommonRestOperation/Generated/LongRunningOperation/MgmtExtensionCommonRestOperationArmOperationOfT.cs +++ b/test/TestProjects/MgmtExtensionCommonRestOperation/Generated/LongRunningOperation/MgmtExtensionCommonRestOperationArmOperationOfT.cs @@ -37,14 +37,11 @@ internal MgmtExtensionCommonRestOperationArmOperation(IOperationSource source _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtExtensionCommonRestOperationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtExtensionCommonRestOperationArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtExtensionCommonRestOperationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperation.cs b/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperation.cs index 657e8e948fb..e65590055ca 100644 --- a/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperation.cs +++ b/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperation.cs @@ -37,14 +37,11 @@ internal MgmtExtensionResourceArmOperation(ClientDiagnostics clientDiagnostics, _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtExtensionResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtExtensionResourceArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtExtensionResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperationOfT.cs b/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperationOfT.cs index 41f9670721f..49a33ebcd12 100644 --- a/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperationOfT.cs +++ b/test/TestProjects/MgmtExtensionResource/Generated/LongRunningOperation/MgmtExtensionResourceArmOperationOfT.cs @@ -37,14 +37,11 @@ internal MgmtExtensionResourceArmOperation(IOperationSource source, ClientDia _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtExtensionResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtExtensionResourceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtExtensionResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperation.cs b/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperation.cs index cde70cba6b3..02dadf4bb3b 100644 --- a/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperation.cs +++ b/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperation.cs @@ -37,14 +37,11 @@ internal MgmtLROArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline p _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtLROArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtLROArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtLROArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperationOfT.cs b/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperationOfT.cs index 1fb18f375ed..7d7c6266e86 100644 --- a/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperationOfT.cs +++ b/test/TestProjects/MgmtLRO/Generated/LongRunningOperation/MgmtLROArmOperationOfT.cs @@ -37,14 +37,11 @@ internal MgmtLROArmOperation(IOperationSource source, ClientDiagnostics clien _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtLROArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtLROArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtLROArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtListMethods/Generated/LongRunningOperation/MgmtListMethodsArmOperationOfT.cs b/test/TestProjects/MgmtListMethods/Generated/LongRunningOperation/MgmtListMethodsArmOperationOfT.cs index b8c1d415c68..29c26274492 100644 --- a/test/TestProjects/MgmtListMethods/Generated/LongRunningOperation/MgmtListMethodsArmOperationOfT.cs +++ b/test/TestProjects/MgmtListMethods/Generated/LongRunningOperation/MgmtListMethodsArmOperationOfT.cs @@ -37,14 +37,11 @@ internal MgmtListMethodsArmOperation(IOperationSource source, ClientDiagnosti _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtListMethodsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtListMethodsArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtListMethodsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperation.cs b/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperation.cs index 0a8e6462e5f..68d02b5ee5a 100644 --- a/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperation.cs +++ b/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperation.cs @@ -37,14 +37,11 @@ internal MgmtMockAndSampleArmOperation(ClientDiagnostics clientDiagnostics, Http _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtMockAndSampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtMockAndSampleArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtMockAndSampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperationOfT.cs b/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperationOfT.cs index bc1b5d9c8bb..e79a0952e30 100644 --- a/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperationOfT.cs +++ b/test/TestProjects/MgmtMockAndSample/src/Generated/LongRunningOperation/MgmtMockAndSampleArmOperationOfT.cs @@ -37,14 +37,11 @@ internal MgmtMockAndSampleArmOperation(IOperationSource source, ClientDiagnos _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtMockAndSampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtMockAndSampleArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtMockAndSampleArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperation.cs b/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperation.cs index 06a664f8111..bac8cf0a0f1 100644 --- a/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperation.cs +++ b/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperation.cs @@ -37,14 +37,11 @@ internal MgmtMultipleParentResourceArmOperation(ClientDiagnostics clientDiagnost _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtMultipleParentResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtMultipleParentResourceArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtMultipleParentResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperationOfT.cs b/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperationOfT.cs index 9deb6da6eda..62936d9ac9e 100644 --- a/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperationOfT.cs +++ b/test/TestProjects/MgmtMultipleParentResource/Generated/LongRunningOperation/MgmtMultipleParentResourceArmOperationOfT.cs @@ -37,14 +37,11 @@ internal MgmtMultipleParentResourceArmOperation(IOperationSource source, Clie _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtMultipleParentResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtMultipleParentResourceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtMultipleParentResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperation.cs b/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperation.cs index 1382c0ba2ca..016945a2e72 100644 --- a/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperation.cs +++ b/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperation.cs @@ -37,14 +37,11 @@ internal MgmtNonStringPathVariableArmOperation(ClientDiagnostics clientDiagnosti _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtNonStringPathVariableArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtNonStringPathVariableArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtNonStringPathVariableArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperationOfT.cs b/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperationOfT.cs index 697a15e843f..b81e4ba27fc 100644 --- a/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperationOfT.cs +++ b/test/TestProjects/MgmtNonStringPathVariable/Generated/LongRunningOperation/MgmtNonStringPathVariableArmOperationOfT.cs @@ -37,14 +37,11 @@ internal MgmtNonStringPathVariableArmOperation(IOperationSource source, Clien _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtNonStringPathVariableArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtNonStringPathVariableArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtNonStringPathVariableArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperation.cs b/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperation.cs index 114e1cb576d..6466f70b161 100644 --- a/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperation.cs +++ b/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperation.cs @@ -37,14 +37,11 @@ internal MgmtOperationsArmOperation(ClientDiagnostics clientDiagnostics, HttpPip _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtOperationsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtOperationsArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtOperationsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperationOfT.cs b/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperationOfT.cs index 00362e5f8a6..c25f09b1bb3 100644 --- a/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperationOfT.cs +++ b/test/TestProjects/MgmtOperations/Generated/LongRunningOperation/MgmtOperationsArmOperationOfT.cs @@ -37,14 +37,11 @@ internal MgmtOperationsArmOperation(IOperationSource source, ClientDiagnostic _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtOperationsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtOperationsArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtOperationsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperation.cs b/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperation.cs index d2d40ccf34f..8dcb1032b75 100644 --- a/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperation.cs +++ b/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperation.cs @@ -37,14 +37,11 @@ internal MgmtOptionalConstantArmOperation(ClientDiagnostics clientDiagnostics, H _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtOptionalConstantArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtOptionalConstantArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtOptionalConstantArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperationOfT.cs b/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperationOfT.cs index 8be502ff907..f8d22135a2c 100644 --- a/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperationOfT.cs +++ b/test/TestProjects/MgmtOptionalConstant/Generated/LongRunningOperation/MgmtOptionalConstantArmOperationOfT.cs @@ -37,14 +37,11 @@ internal MgmtOptionalConstantArmOperation(IOperationSource source, ClientDiag _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtOptionalConstantArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtOptionalConstantArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtOptionalConstantArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperation.cs b/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperation.cs index 0931acb3d19..7ad4756b482 100644 --- a/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperation.cs +++ b/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperation.cs @@ -37,14 +37,11 @@ internal MgmtParamOrderingArmOperation(ClientDiagnostics clientDiagnostics, Http _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtParamOrderingArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtParamOrderingArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtParamOrderingArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperationOfT.cs b/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperationOfT.cs index 58b322d3bb8..89adcc4e01e 100644 --- a/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperationOfT.cs +++ b/test/TestProjects/MgmtParamOrdering/Generated/LongRunningOperation/MgmtParamOrderingArmOperationOfT.cs @@ -37,14 +37,11 @@ internal MgmtParamOrderingArmOperation(IOperationSource source, ClientDiagnos _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtParamOrderingArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtParamOrderingArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtParamOrderingArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperation.cs b/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperation.cs index ffa190fedef..814748eb951 100644 --- a/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperation.cs +++ b/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperation.cs @@ -37,14 +37,11 @@ internal MgmtParentArmOperation(ClientDiagnostics clientDiagnostics, HttpPipelin _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtParentArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtParentArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtParentArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperationOfT.cs b/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperationOfT.cs index 6635328741c..aea2556cbf7 100644 --- a/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperationOfT.cs +++ b/test/TestProjects/MgmtParent/Generated/LongRunningOperation/MgmtParentArmOperationOfT.cs @@ -37,14 +37,11 @@ internal MgmtParentArmOperation(IOperationSource source, ClientDiagnostics cl _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtParentArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtParentArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtParentArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperation.cs b/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperation.cs index e3e29119010..0bb9c2f436e 100644 --- a/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperation.cs +++ b/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperation.cs @@ -37,14 +37,11 @@ internal MgmtPropertyChooserArmOperation(ClientDiagnostics clientDiagnostics, Ht _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtPropertyChooserArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtPropertyChooserArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtPropertyChooserArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperationOfT.cs b/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperationOfT.cs index 33c329757b3..325d5ed7b0f 100644 --- a/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperationOfT.cs +++ b/test/TestProjects/MgmtPropertyChooser/Generated/LongRunningOperation/MgmtPropertyChooserArmOperationOfT.cs @@ -37,14 +37,11 @@ internal MgmtPropertyChooserArmOperation(IOperationSource source, ClientDiagn _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtPropertyChooserArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtPropertyChooserArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtPropertyChooserArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperation.cs b/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperation.cs index 8e24bf849cb..c0a2538ffb4 100644 --- a/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperation.cs +++ b/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperation.cs @@ -37,14 +37,11 @@ internal MgmtRenameRulesArmOperation(ClientDiagnostics clientDiagnostics, HttpPi _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtRenameRulesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtRenameRulesArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtRenameRulesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperationOfT.cs b/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperationOfT.cs index 4c99a035add..7fdac588046 100644 --- a/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperationOfT.cs +++ b/test/TestProjects/MgmtRenameRules/Generated/LongRunningOperation/MgmtRenameRulesArmOperationOfT.cs @@ -37,14 +37,11 @@ internal MgmtRenameRulesArmOperation(IOperationSource source, ClientDiagnosti _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtRenameRulesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtRenameRulesArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtRenameRulesArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtResourceName/Generated/LongRunningOperation/MgmtResourceNameArmOperationOfT.cs b/test/TestProjects/MgmtResourceName/Generated/LongRunningOperation/MgmtResourceNameArmOperationOfT.cs index 2857f09b96b..7904125fd93 100644 --- a/test/TestProjects/MgmtResourceName/Generated/LongRunningOperation/MgmtResourceNameArmOperationOfT.cs +++ b/test/TestProjects/MgmtResourceName/Generated/LongRunningOperation/MgmtResourceNameArmOperationOfT.cs @@ -37,14 +37,11 @@ internal MgmtResourceNameArmOperation(IOperationSource source, ClientDiagnost _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtResourceNameArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtResourceNameArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtResourceNameArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtSafeFlatten/Generated/LongRunningOperation/MgmtSafeFlattenArmOperationOfT.cs b/test/TestProjects/MgmtSafeFlatten/Generated/LongRunningOperation/MgmtSafeFlattenArmOperationOfT.cs index 54cfa890602..7ed4e6a0375 100644 --- a/test/TestProjects/MgmtSafeFlatten/Generated/LongRunningOperation/MgmtSafeFlattenArmOperationOfT.cs +++ b/test/TestProjects/MgmtSafeFlatten/Generated/LongRunningOperation/MgmtSafeFlattenArmOperationOfT.cs @@ -37,14 +37,11 @@ internal MgmtSafeFlattenArmOperation(IOperationSource source, ClientDiagnosti _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtSafeFlattenArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtSafeFlattenArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtSafeFlattenArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperation.cs b/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperation.cs index e065bdc0e78..5fabafcf46f 100644 --- a/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperation.cs +++ b/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperation.cs @@ -37,14 +37,11 @@ internal MgmtScopeResourceArmOperation(ClientDiagnostics clientDiagnostics, Http _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtScopeResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtScopeResourceArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtScopeResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperationOfT.cs b/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperationOfT.cs index f89f5cd61f8..fac81e69034 100644 --- a/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperationOfT.cs +++ b/test/TestProjects/MgmtScopeResource/Generated/LongRunningOperation/MgmtScopeResourceArmOperationOfT.cs @@ -37,14 +37,11 @@ internal MgmtScopeResourceArmOperation(IOperationSource source, ClientDiagnos _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtScopeResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtScopeResourceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtScopeResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperation.cs b/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperation.cs index 0b06b560ee6..3a70b3b4f2c 100644 --- a/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperation.cs +++ b/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperation.cs @@ -37,14 +37,11 @@ internal MgmtSubscriptionNameParameterArmOperation(ClientDiagnostics clientDiagn _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtSubscriptionNameParameterArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtSubscriptionNameParameterArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "MgmtSubscriptionNameParameterArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperationOfT.cs b/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperationOfT.cs index 9de18f178a6..d9ad8a104ba 100644 --- a/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperationOfT.cs +++ b/test/TestProjects/MgmtSubscriptionNameParameter/Generated/LongRunningOperation/MgmtSubscriptionNameParameterArmOperationOfT.cs @@ -37,14 +37,11 @@ internal MgmtSubscriptionNameParameterArmOperation(IOperationSource source, C _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "MgmtSubscriptionNameParameterArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal MgmtSubscriptionNameParameterArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "MgmtSubscriptionNameParameterArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/NoTypeReplacement/Generated/LongRunningOperation/NoTypeReplacementArmOperationOfT.cs b/test/TestProjects/NoTypeReplacement/Generated/LongRunningOperation/NoTypeReplacementArmOperationOfT.cs index bb4845ede39..57ab3dee5f7 100644 --- a/test/TestProjects/NoTypeReplacement/Generated/LongRunningOperation/NoTypeReplacementArmOperationOfT.cs +++ b/test/TestProjects/NoTypeReplacement/Generated/LongRunningOperation/NoTypeReplacementArmOperationOfT.cs @@ -37,14 +37,11 @@ internal NoTypeReplacementArmOperation(IOperationSource source, ClientDiagnos _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "NoTypeReplacementArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal NoTypeReplacementArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "NoTypeReplacementArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/OmitOperationGroups/Generated/LongRunningOperation/OmitOperationGroupsArmOperationOfT.cs b/test/TestProjects/OmitOperationGroups/Generated/LongRunningOperation/OmitOperationGroupsArmOperationOfT.cs index 51a52d3e016..60839cd324e 100644 --- a/test/TestProjects/OmitOperationGroups/Generated/LongRunningOperation/OmitOperationGroupsArmOperationOfT.cs +++ b/test/TestProjects/OmitOperationGroups/Generated/LongRunningOperation/OmitOperationGroupsArmOperationOfT.cs @@ -37,14 +37,11 @@ internal OmitOperationGroupsArmOperation(IOperationSource source, ClientDiagn _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "OmitOperationGroupsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal OmitOperationGroupsArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "OmitOperationGroupsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/Pagination/Generated/LongRunningOperation/PaginationArmOperationOfT.cs b/test/TestProjects/Pagination/Generated/LongRunningOperation/PaginationArmOperationOfT.cs index 4c02e19d9e7..12a175800f6 100644 --- a/test/TestProjects/Pagination/Generated/LongRunningOperation/PaginationArmOperationOfT.cs +++ b/test/TestProjects/Pagination/Generated/LongRunningOperation/PaginationArmOperationOfT.cs @@ -37,14 +37,11 @@ internal PaginationArmOperation(IOperationSource source, ClientDiagnostics cl _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "PaginationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal PaginationArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "PaginationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperation.cs b/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperation.cs index 3a47b8ba892..7efc02cf178 100644 --- a/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperation.cs +++ b/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperation.cs @@ -37,14 +37,11 @@ internal ResourceRenameArmOperation(ClientDiagnostics clientDiagnostics, HttpPip _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "ResourceRenameArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal ResourceRenameArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "ResourceRenameArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperationOfT.cs b/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperationOfT.cs index 439c9f16860..c6c51dbc56e 100644 --- a/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperationOfT.cs +++ b/test/TestProjects/ResourceRename/Generated/LongRunningOperation/ResourceRenameArmOperationOfT.cs @@ -37,14 +37,11 @@ internal ResourceRenameArmOperation(IOperationSource source, ClientDiagnostic _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "ResourceRenameArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal ResourceRenameArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "ResourceRenameArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/SingletonResource/Generated/LongRunningOperation/SingletonResourceArmOperationOfT.cs b/test/TestProjects/SingletonResource/Generated/LongRunningOperation/SingletonResourceArmOperationOfT.cs index ae3fc051a94..816330581dc 100644 --- a/test/TestProjects/SingletonResource/Generated/LongRunningOperation/SingletonResourceArmOperationOfT.cs +++ b/test/TestProjects/SingletonResource/Generated/LongRunningOperation/SingletonResourceArmOperationOfT.cs @@ -37,14 +37,11 @@ internal SingletonResourceArmOperation(IOperationSource source, ClientDiagnos _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "SingletonResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal SingletonResourceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "SingletonResourceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/SubscriptionExtensions/Generated/LongRunningOperation/SubscriptionExtensionsArmOperationOfT.cs b/test/TestProjects/SubscriptionExtensions/Generated/LongRunningOperation/SubscriptionExtensionsArmOperationOfT.cs index 62c1dc7cc7f..7c650d7ddd5 100644 --- a/test/TestProjects/SubscriptionExtensions/Generated/LongRunningOperation/SubscriptionExtensionsArmOperationOfT.cs +++ b/test/TestProjects/SubscriptionExtensions/Generated/LongRunningOperation/SubscriptionExtensionsArmOperationOfT.cs @@ -37,14 +37,11 @@ internal SubscriptionExtensionsArmOperation(IOperationSource source, ClientDi _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "SubscriptionExtensionsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal SubscriptionExtensionsArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "SubscriptionExtensionsArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/SupersetFlattenInheritance/Generated/LongRunningOperation/SupersetFlattenInheritanceArmOperationOfT.cs b/test/TestProjects/SupersetFlattenInheritance/Generated/LongRunningOperation/SupersetFlattenInheritanceArmOperationOfT.cs index 9228b98b4be..19472d94e42 100644 --- a/test/TestProjects/SupersetFlattenInheritance/Generated/LongRunningOperation/SupersetFlattenInheritanceArmOperationOfT.cs +++ b/test/TestProjects/SupersetFlattenInheritance/Generated/LongRunningOperation/SupersetFlattenInheritanceArmOperationOfT.cs @@ -37,14 +37,11 @@ internal SupersetFlattenInheritanceArmOperation(IOperationSource source, Clie _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "SupersetFlattenInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal SupersetFlattenInheritanceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "SupersetFlattenInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/SupersetInheritance/Generated/LongRunningOperation/SupersetInheritanceArmOperationOfT.cs b/test/TestProjects/SupersetInheritance/Generated/LongRunningOperation/SupersetInheritanceArmOperationOfT.cs index c6ab1480ecb..2a90488b555 100644 --- a/test/TestProjects/SupersetInheritance/Generated/LongRunningOperation/SupersetInheritanceArmOperationOfT.cs +++ b/test/TestProjects/SupersetInheritance/Generated/LongRunningOperation/SupersetInheritanceArmOperationOfT.cs @@ -37,14 +37,11 @@ internal SupersetInheritanceArmOperation(IOperationSource source, ClientDiagn _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "SupersetInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal SupersetInheritanceArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "SupersetInheritanceArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/TenantOnly/Generated/LongRunningOperation/TenantOnlyArmOperationOfT.cs b/test/TestProjects/TenantOnly/Generated/LongRunningOperation/TenantOnlyArmOperationOfT.cs index a24d4ad5870..fe75c409450 100644 --- a/test/TestProjects/TenantOnly/Generated/LongRunningOperation/TenantOnlyArmOperationOfT.cs +++ b/test/TestProjects/TenantOnly/Generated/LongRunningOperation/TenantOnlyArmOperationOfT.cs @@ -37,14 +37,11 @@ internal TenantOnlyArmOperation(IOperationSource source, ClientDiagnostics cl _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "TenantOnlyArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal TenantOnlyArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "TenantOnlyArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; diff --git a/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperation.cs b/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperation.cs index 2aad4b5720d..f780eb122cc 100644 --- a/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperation.cs +++ b/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperation.cs @@ -37,14 +37,11 @@ internal XmlDeserializationArmOperation(ClientDiagnostics clientDiagnostics, Htt _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "XmlDeserializationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal XmlDeserializationArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(clientDiagnostics, nextLinkOperation, finalResponse, "XmlDeserializationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override bool HasCompleted => _operation.HasCompleted; diff --git a/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperationOfT.cs b/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperationOfT.cs index b7879425542..a6ae496bd35 100644 --- a/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperationOfT.cs +++ b/test/TestProjects/XmlDeserialization/Generated/LongRunningOperation/XmlDeserializationArmOperationOfT.cs @@ -37,14 +37,11 @@ internal XmlDeserializationArmOperation(IOperationSource source, ClientDiagno _operation = new OperationInternal(clientDiagnostics, nextLinkOperation, response, "XmlDeserializationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); } - internal XmlDeserializationArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string id) - { - var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, id, out string finalResponse); - _operation = OperationInternal.Create(source, clientDiagnostics, nextLinkOperation, finalResponse, "XmlDeserializationArmOperation", fallbackStrategy: new ExponentialDelayStrategy()); - } - /// - public override string Id => _operation.GetOperationId(); +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 /// public override T Value => _operation.Value; From 92d5e2069f4e6918774faf1c96683326a5e31410 Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Thu, 12 Jan 2023 22:19:52 +0800 Subject: [PATCH 15/18] update shared code --- src/assets/Azure.Core.Shared/DecodedResponse.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/Azure.Core.Shared/DecodedResponse.cs b/src/assets/Azure.Core.Shared/DecodedResponse.cs index 19e277eb1f9..a5dd32459b0 100644 --- a/src/assets/Azure.Core.Shared/DecodedResponse.cs +++ b/src/assets/Azure.Core.Shared/DecodedResponse.cs @@ -116,7 +116,7 @@ internal partial class DecodedResponseConverter : JsonConverter { public override void Write(Utf8JsonWriter writer, DecodedResponse model, JsonSerializerOptions options) { - throw new NotImplementedException("This converter should only be used for deserialization."); + throw new InvalidOperationException("This converter should only be used for deserialization."); } public override DecodedResponse Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { From b30f757d92027b899c764c5ac87969a920a8c608 Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Fri, 10 Feb 2023 09:27:57 +0800 Subject: [PATCH 16/18] remove FinalResponse from id --- .../NextLinkOperationImplementation.cs | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/assets/Generator.Shared/NextLinkOperationImplementation.cs b/src/assets/Generator.Shared/NextLinkOperationImplementation.cs index 06fa6e6bff1..507ca7fbb74 100644 --- a/src/assets/Generator.Shared/NextLinkOperationImplementation.cs +++ b/src/assets/Generator.Shared/NextLinkOperationImplementation.cs @@ -67,14 +67,9 @@ public static IOperation Create( public static IOperation? Create( HttpPipeline pipeline, string id, - out string? finalResponse, string? apiVersionOverride = null) { var lroDetails = BinaryData.FromBytes(Convert.FromBase64String(id)).ToObjectFromJson>(); - if (lroDetails.TryGetValue("FinalResponse", out finalResponse)) - { - return null; - } if (!Uri.TryCreate(lroDetails["InitialUri"], UriKind.Absolute, out var startRequestUri)) throw new InvalidOperationException("Invalid initial URI"); if (!lroDetails.TryGetValue("NextRequestUri", out var nextRequestUri)) @@ -95,14 +90,9 @@ public static IOperation Create( IOperationSource operationSource, HttpPipeline pipeline, string id, - out string? finalResponse, string? apiVersionOverride = null) { - var operation = Create(pipeline, id, out finalResponse, apiVersionOverride); - if (finalResponse != null) - { - return null; - } + var operation = Create(pipeline, id, apiVersionOverride); return new OperationToOperationOfT(operationSource, operation!); } @@ -465,13 +455,7 @@ public CompletedOperation(OperationState operationState) public string GetOperationId() { - var serializeOptions = new JsonSerializerOptions { Converters = { new StreamConverter() } }; - var lroDetails = new Dictionary() - { - ["FinalResponse"] = BinaryData.FromObjectAsJson(_operationState.RawResponse, serializeOptions).ToString() - }; - var lroData = BinaryData.FromObjectAsJson(lroDetails); - return Convert.ToBase64String(lroData.ToArray()); + return string.Empty; } } From ed449de35308c1cf698441a048317a70c135e8b5 Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Wed, 1 Mar 2023 14:53:04 +0800 Subject: [PATCH 17/18] update DownloadSharedSource --- eng/DownloadSharedSource.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/DownloadSharedSource.ps1 b/eng/DownloadSharedSource.ps1 index 43bfd17600b..769c9538b59 100644 --- a/eng/DownloadSharedSource.ps1 +++ b/eng/DownloadSharedSource.ps1 @@ -18,7 +18,7 @@ $files = @('AsyncLockWithValue.cs', 'ClientDiagnostics.cs', 'DiagnosticScope.cs' 'OperationInternalBase.cs', 'OperationInternal.cs', 'VoidValue.cs', 'OperationInternalOfT.cs', 'TaskExtensions.cs', 'Argument.cs', 'Multipart/MultipartFormDataContent.cs', 'Multipart/MultipartContent.cs', 'AzureKeyCredentialPolicy.cs', 'AppContextSwitchHelper.cs', 'ConstantDelayStrategy.cs', 'DelayStrategy.cs', 'ExponentialDelayStrategy.cs', 'OperationPoller.cs', 'RetryAfterDelayStrategy.cs', - 'ForwardsClientCallsAttribute.cs', 'AsyncLockWithValue.cs', 'VoidValue.cs', 'DecodedResponse.cs', 'StreamConverter.cs') + 'ForwardsClientCallsAttribute.cs', 'AsyncLockWithValue.cs', 'VoidValue.cs') # TODO: temporary change to target at support_lro_rehydration branch $baseUrl = 'https://raw.githubusercontent.com/Azure/azure-sdk-for-net/support_lro_rehydration/sdk/core/Azure.Core/src/Shared/' DownloadAll $files $baseUrl $downloadPath From 325718ac3808b41759f838c9d8b587b2dcfadcad Mon Sep 17 00:00:00 2001 From: Feng Zhou Date: Wed, 1 Mar 2023 14:56:10 +0800 Subject: [PATCH 18/18] update shared source --- .../Azure.Core.Shared/DecodedResponse.cs | 218 ------------------ .../Azure.Core.Shared/OperationInternalOfT.cs | 13 +- .../Azure.Core.Shared/StreamConverter.cs | 78 ------- 3 files changed, 1 insertion(+), 308 deletions(-) delete mode 100644 src/assets/Azure.Core.Shared/DecodedResponse.cs delete mode 100644 src/assets/Azure.Core.Shared/StreamConverter.cs diff --git a/src/assets/Azure.Core.Shared/DecodedResponse.cs b/src/assets/Azure.Core.Shared/DecodedResponse.cs deleted file mode 100644 index a5dd32459b0..00000000000 --- a/src/assets/Azure.Core.Shared/DecodedResponse.cs +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core.Pipeline; - -#nullable disable - -namespace Azure.Core -{ - [JsonConverter(typeof(DecodedResponseConverter))] - internal class DecodedResponse : Response - { - private readonly Dictionary> _headers = new Dictionary>(StringComparer.OrdinalIgnoreCase); - - public DecodedResponse() - { - } - - internal DecodedResponse(int status, string reasonPhrase, Stream contentStream, string clientRequestId, bool isError, Dictionary> headers) - { - Status = status; - ReasonPhrase = reasonPhrase; - ContentStream = contentStream; - ClientRequestId = clientRequestId; - _isError = isError; - _headers = headers; - } - - internal static DecodedResponse DeserializeDecodedResponse(JsonElement element) - { - int status = default; - string reasonPhrase = default; - Stream contentStream = new MemoryStream(); - string clientRequestId = default; - bool isError = default; - Dictionary> headers = new Dictionary>(StringComparer.OrdinalIgnoreCase); - - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("Status")) - { - status = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("ReasonPhrase")) - { - reasonPhrase = property.Value.GetString(); - continue; - } - if (property.NameEquals("ContentStream")) - { - var content = BinaryData.FromObjectAsJson(property.Value); - if (content != null) - { - content.ToStream().CopyTo(contentStream); - contentStream.Position = 0; - } - continue; - } - if (property.NameEquals("ClientRequestId")) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("IsError")) - { - isError = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("Headers")) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - string name = default; - string value = default; - foreach (var property0 in item.EnumerateObject()) - { - if (property0.NameEquals("Name")) - { - name = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("Value")) - { - value = property0.Value.GetString(); - continue; - } - } - array.Add(new HttpHeader(name, value)); - } - foreach (var item in array) - { - if (!headers.TryGetValue(item.Name, out List values)) - { - headers[item.Name] = values = new List(); - } - values.Add(item.Value); - } - continue; - } - } - return new DecodedResponse(status, reasonPhrase, contentStream, clientRequestId, isError, headers); - } - - internal partial class DecodedResponseConverter : JsonConverter - { - public override void Write(Utf8JsonWriter writer, DecodedResponse model, JsonSerializerOptions options) - { - throw new InvalidOperationException("This converter should only be used for deserialization."); - } - public override DecodedResponse Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - using var document = JsonDocument.ParseValue(ref reader); - return DeserializeDecodedResponse(document.RootElement); - } - } - - public override int Status { get; } - - public override string ReasonPhrase { get; } - - public override Stream ContentStream { get; set; } - - public override string ClientRequestId { get; set; } - - private bool? _isError; - public override bool IsError { get => _isError ?? base.IsError; } - public void SetIsError(bool value) => _isError = value; - - public bool IsDisposed { get; private set; } - - public void SetContent(byte[] content) - { - ContentStream = new MemoryStream(content, 0, content.Length, false, true); - } - - public DecodedResponse SetContent(string content) - { - SetContent(Encoding.UTF8.GetBytes(content)); - return this; - } - - public DecodedResponse AddHeader(string name, string value) - { - return AddHeader(new HttpHeader(name, value)); - } - - public DecodedResponse AddHeader(HttpHeader header) - { - if (!_headers.TryGetValue(header.Name, out List values)) - { - _headers[header.Name] = values = new List(); - } - - values.Add(header.Value); - return this; - } - -#if HAS_INTERNALS_VISIBLE_CORE - internal -#endif - protected override bool TryGetHeader(string name, out string value) - { - if (_headers.TryGetValue(name, out List values)) - { - value = JoinHeaderValue(values); - return true; - } - - value = null; - return false; - } - -#if HAS_INTERNALS_VISIBLE_CORE - internal -#endif - protected override bool TryGetHeaderValues(string name, out IEnumerable values) - { - var result = _headers.TryGetValue(name, out List valuesList); - values = valuesList; - return result; - } - -#if HAS_INTERNALS_VISIBLE_CORE - internal -#endif - protected override bool ContainsHeader(string name) - { - return TryGetHeaderValues(name, out _); - } - -#if HAS_INTERNALS_VISIBLE_CORE - internal -#endif - protected override IEnumerable EnumerateHeaders() => _headers.Select(h => new HttpHeader(h.Key, JoinHeaderValue(h.Value))); - - private static string JoinHeaderValue(IEnumerable values) - { - return string.Join(",", values); - } - - public override void Dispose() - { - IsDisposed = true; - GC.SuppressFinalize(this); - } - } -} diff --git a/src/assets/Azure.Core.Shared/OperationInternalOfT.cs b/src/assets/Azure.Core.Shared/OperationInternalOfT.cs index 0515aaa740e..2438f21d507 100644 --- a/src/assets/Azure.Core.Shared/OperationInternalOfT.cs +++ b/src/assets/Azure.Core.Shared/OperationInternalOfT.cs @@ -282,18 +282,7 @@ protected override async ValueTask UpdateStatusAsync(bool async, Cance public virtual string GetOperationId() { - var id = _operation.GetOperationId(); - if (string.IsNullOrEmpty(id)) - { - var serializeOptions = new JsonSerializerOptions { Converters = { new StreamConverter() } }; - var lroDetails = new Dictionary() - { - ["FinalResponse"] = BinaryData.FromObjectAsJson(_rawResponse!, serializeOptions).ToString() - }; - var lroData = BinaryData.FromObjectAsJson(lroDetails); - id = Convert.ToBase64String(lroData.ToArray()); - } - return id; + return _operation.GetOperationId(); } private static Response GetResponseFromState(OperationState state) diff --git a/src/assets/Azure.Core.Shared/StreamConverter.cs b/src/assets/Azure.Core.Shared/StreamConverter.cs deleted file mode 100644 index 28c39017ff0..00000000000 --- a/src/assets/Azure.Core.Shared/StreamConverter.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core.Pipeline; - -#nullable enable - -namespace Azure.Core -{ - internal class StreamConverter : JsonConverter - { - /// Serialize stream to BinaryData string. - /// The writer. - /// The Stream model. - /// The options for JsonSerializer. - public override void Write(Utf8JsonWriter writer, Stream model, JsonSerializerOptions options) - { - if (model.Length == 0) - { - writer.WriteNullValue(); - return; - } - MemoryStream? memoryContent = model as MemoryStream; - - if (memoryContent == null) - { - throw new InvalidOperationException($"The response is not fully buffered."); - } - - if (memoryContent.TryGetBuffer(out ArraySegment segment)) - { - var data = new BinaryData(segment.AsMemory()); -#if NET6_0_OR_GREATER - writer.WriteRawValue(data); -#else - JsonSerializer.Serialize(writer, JsonDocument.Parse(data.ToString()).RootElement); -#endif - } - else - { - var data = new BinaryData(memoryContent.ToArray()); -#if NET6_0_OR_GREATER - writer.WriteRawValue(data); -#else - JsonSerializer.Serialize(writer, JsonDocument.Parse(data.ToString()).RootElement); -#endif - } - } - - /// Deserialize Stream from BinaryData string. - /// The reader. - /// The type to convert - /// The options for JsonSerializer. - public override Stream Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - using var document = JsonDocument.ParseValue(ref reader); - foreach (var property in document.RootElement.EnumerateObject()) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - var value = property.Value.GetString(); - return BinaryData.FromString(value!).ToStream(); - } - return new MemoryStream(); - } - } -}