diff --git a/samples/Azure.AI.FormRecognizer/Azure.AI.FormRecognizer/Generated/ServiceAnalyzeLayoutAsyncHeaders.cs b/samples/Azure.AI.FormRecognizer/Azure.AI.FormRecognizer/Generated/ServiceAnalyzeLayoutAsyncHeaders.cs new file mode 100644 index 00000000000..8c3c43471ac --- /dev/null +++ b/samples/Azure.AI.FormRecognizer/Azure.AI.FormRecognizer/Generated/ServiceAnalyzeLayoutAsyncHeaders.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace Azure.AI.FormRecognizer +{ + internal class ServiceAnalyzeLayoutAsyncHeaders + { + private readonly Response _response; + public ServiceAnalyzeLayoutAsyncHeaders(Response response) + { + _response = response; + } + public string OperationLocation => _response.Headers.TryGetValue("Operation-Location", out string value) ? value : null; + } +} diff --git a/samples/Azure.AI.FormRecognizer/Azure.AI.FormRecognizer/Generated/ServiceAnalyzeReceiptAsyncHeaders.cs b/samples/Azure.AI.FormRecognizer/Azure.AI.FormRecognizer/Generated/ServiceAnalyzeReceiptAsyncHeaders.cs new file mode 100644 index 00000000000..a4c2b80fb63 --- /dev/null +++ b/samples/Azure.AI.FormRecognizer/Azure.AI.FormRecognizer/Generated/ServiceAnalyzeReceiptAsyncHeaders.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace Azure.AI.FormRecognizer +{ + internal class ServiceAnalyzeReceiptAsyncHeaders + { + private readonly Response _response; + public ServiceAnalyzeReceiptAsyncHeaders(Response response) + { + _response = response; + } + public string OperationLocation => _response.Headers.TryGetValue("Operation-Location", out string value) ? value : null; + } +} diff --git a/samples/Azure.AI.FormRecognizer/Azure.AI.FormRecognizer/Generated/ServiceAnalyzeWithCustomModelHeaders.cs b/samples/Azure.AI.FormRecognizer/Azure.AI.FormRecognizer/Generated/ServiceAnalyzeWithCustomModelHeaders.cs new file mode 100644 index 00000000000..4535dc70062 --- /dev/null +++ b/samples/Azure.AI.FormRecognizer/Azure.AI.FormRecognizer/Generated/ServiceAnalyzeWithCustomModelHeaders.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace Azure.AI.FormRecognizer +{ + internal class ServiceAnalyzeWithCustomModelHeaders + { + private readonly Response _response; + public ServiceAnalyzeWithCustomModelHeaders(Response response) + { + _response = response; + } + public string OperationLocation => _response.Headers.TryGetValue("Operation-Location", out string value) ? value : null; + } +} diff --git a/samples/Azure.AI.FormRecognizer/Azure.AI.FormRecognizer/Generated/ServiceCopyCustomModelHeaders.cs b/samples/Azure.AI.FormRecognizer/Azure.AI.FormRecognizer/Generated/ServiceCopyCustomModelHeaders.cs new file mode 100644 index 00000000000..954faa762e0 --- /dev/null +++ b/samples/Azure.AI.FormRecognizer/Azure.AI.FormRecognizer/Generated/ServiceCopyCustomModelHeaders.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace Azure.AI.FormRecognizer +{ + internal class ServiceCopyCustomModelHeaders + { + private readonly Response _response; + public ServiceCopyCustomModelHeaders(Response response) + { + _response = response; + } + public string OperationLocation => _response.Headers.TryGetValue("Operation-Location", out string value) ? value : null; + } +} diff --git a/samples/Azure.AI.FormRecognizer/Azure.AI.FormRecognizer/Generated/ServiceRestClient.cs b/samples/Azure.AI.FormRecognizer/Azure.AI.FormRecognizer/Generated/ServiceRestClient.cs index 3f7018e1f58..7867d9cefb0 100644 --- a/samples/Azure.AI.FormRecognizer/Azure.AI.FormRecognizer/Generated/ServiceRestClient.cs +++ b/samples/Azure.AI.FormRecognizer/Azure.AI.FormRecognizer/Generated/ServiceRestClient.cs @@ -250,7 +250,7 @@ internal HttpMessage CreateAnalyzeWithCustomModelRequest(Guid modelId, ContentTy /// .json, .pdf, .jpg, .png or .tiff type file stream. /// Include text lines and element references in the result. /// The cancellation token to use. - public async Task AnalyzeWithCustomModelAsync(Guid modelId, ContentType contentType, Stream fileStream, bool? includeTextDetails = null, CancellationToken cancellationToken = default) + public async Task> AnalyzeWithCustomModelAsync(Guid modelId, ContentType contentType, Stream fileStream, bool? includeTextDetails = null, CancellationToken cancellationToken = default) { if (fileStream == null) { @@ -259,10 +259,11 @@ public async Task AnalyzeWithCustomModelAsync(Guid modelId, ContentTyp using var message = CreateAnalyzeWithCustomModelRequest(modelId, contentType, fileStream, includeTextDetails); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new ServiceAnalyzeWithCustomModelHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -274,7 +275,7 @@ public async Task AnalyzeWithCustomModelAsync(Guid modelId, ContentTyp /// .json, .pdf, .jpg, .png or .tiff type file stream. /// Include text lines and element references in the result. /// The cancellation token to use. - public Response AnalyzeWithCustomModel(Guid modelId, ContentType contentType, Stream fileStream, bool? includeTextDetails = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders AnalyzeWithCustomModel(Guid modelId, ContentType contentType, Stream fileStream, bool? includeTextDetails = null, CancellationToken cancellationToken = default) { if (fileStream == null) { @@ -283,10 +284,11 @@ public Response AnalyzeWithCustomModel(Guid modelId, ContentType contentType, St using var message = CreateAnalyzeWithCustomModelRequest(modelId, contentType, fileStream, includeTextDetails); _pipeline.Send(message, cancellationToken); + var headers = new ServiceAnalyzeWithCustomModelHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -323,14 +325,15 @@ internal HttpMessage CreateAnalyzeWithCustomModelRequest(Guid modelId, bool? inc /// Include text lines and element references in the result. /// .json, .pdf, .jpg, .png or .tiff type file stream. /// The cancellation token to use. - public async Task AnalyzeWithCustomModelAsync(Guid modelId, bool? includeTextDetails = null, SourcePath fileStream = null, CancellationToken cancellationToken = default) + public async Task> AnalyzeWithCustomModelAsync(Guid modelId, bool? includeTextDetails = null, SourcePath fileStream = null, CancellationToken cancellationToken = default) { using var message = CreateAnalyzeWithCustomModelRequest(modelId, includeTextDetails, fileStream); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new ServiceAnalyzeWithCustomModelHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -341,14 +344,15 @@ public async Task AnalyzeWithCustomModelAsync(Guid modelId, bool? incl /// Include text lines and element references in the result. /// .json, .pdf, .jpg, .png or .tiff type file stream. /// The cancellation token to use. - public Response AnalyzeWithCustomModel(Guid modelId, bool? includeTextDetails = null, SourcePath fileStream = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders AnalyzeWithCustomModel(Guid modelId, bool? includeTextDetails = null, SourcePath fileStream = null, CancellationToken cancellationToken = default) { using var message = CreateAnalyzeWithCustomModelRequest(modelId, includeTextDetails, fileStream); _pipeline.Send(message, cancellationToken); + var headers = new ServiceAnalyzeWithCustomModelHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -451,7 +455,7 @@ internal HttpMessage CreateCopyCustomModelRequest(Guid modelId, CopyRequest copy /// Model identifier. /// Copy request parameters. /// The cancellation token to use. - public async Task CopyCustomModelAsync(Guid modelId, CopyRequest copyRequest, CancellationToken cancellationToken = default) + public async Task> CopyCustomModelAsync(Guid modelId, CopyRequest copyRequest, CancellationToken cancellationToken = default) { if (copyRequest == null) { @@ -460,10 +464,11 @@ public async Task CopyCustomModelAsync(Guid modelId, CopyRequest copyR using var message = CreateCopyCustomModelRequest(modelId, copyRequest); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new ServiceCopyCustomModelHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -473,7 +478,7 @@ public async Task CopyCustomModelAsync(Guid modelId, CopyRequest copyR /// Model identifier. /// Copy request parameters. /// The cancellation token to use. - public Response CopyCustomModel(Guid modelId, CopyRequest copyRequest, CancellationToken cancellationToken = default) + public ResponseWithHeaders CopyCustomModel(Guid modelId, CopyRequest copyRequest, CancellationToken cancellationToken = default) { if (copyRequest == null) { @@ -482,10 +487,11 @@ public Response CopyCustomModel(Guid modelId, CopyRequest copyRequest, Cancellat using var message = CreateCopyCustomModelRequest(modelId, copyRequest); _pipeline.Send(message, cancellationToken); + var headers = new ServiceCopyCustomModelHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -658,7 +664,7 @@ internal HttpMessage CreateAnalyzeReceiptAsyncRequest(ContentType contentType, S /// .json, .pdf, .jpg, .png or .tiff type file stream. /// Include text lines and element references in the result. /// The cancellation token to use. - public async Task AnalyzeReceiptAsyncAsync(ContentType contentType, Stream fileStream, bool? includeTextDetails = null, CancellationToken cancellationToken = default) + public async Task> AnalyzeReceiptAsyncAsync(ContentType contentType, Stream fileStream, bool? includeTextDetails = null, CancellationToken cancellationToken = default) { if (fileStream == null) { @@ -667,10 +673,11 @@ public async Task AnalyzeReceiptAsyncAsync(ContentType contentType, St using var message = CreateAnalyzeReceiptAsyncRequest(contentType, fileStream, includeTextDetails); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new ServiceAnalyzeReceiptAsyncHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -681,7 +688,7 @@ public async Task AnalyzeReceiptAsyncAsync(ContentType contentType, St /// .json, .pdf, .jpg, .png or .tiff type file stream. /// Include text lines and element references in the result. /// The cancellation token to use. - public Response AnalyzeReceiptAsync(ContentType contentType, Stream fileStream, bool? includeTextDetails = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders AnalyzeReceiptAsync(ContentType contentType, Stream fileStream, bool? includeTextDetails = null, CancellationToken cancellationToken = default) { if (fileStream == null) { @@ -690,10 +697,11 @@ public Response AnalyzeReceiptAsync(ContentType contentType, Stream fileStream, using var message = CreateAnalyzeReceiptAsyncRequest(contentType, fileStream, includeTextDetails); _pipeline.Send(message, cancellationToken); + var headers = new ServiceAnalyzeReceiptAsyncHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -727,14 +735,15 @@ internal HttpMessage CreateAnalyzeReceiptAsyncRequest(bool? includeTextDetails, /// Include text lines and element references in the result. /// .json, .pdf, .jpg, .png or .tiff type file stream. /// The cancellation token to use. - public async Task AnalyzeReceiptAsyncAsync(bool? includeTextDetails = null, SourcePath fileStream = null, CancellationToken cancellationToken = default) + public async Task> AnalyzeReceiptAsyncAsync(bool? includeTextDetails = null, SourcePath fileStream = null, CancellationToken cancellationToken = default) { using var message = CreateAnalyzeReceiptAsyncRequest(includeTextDetails, fileStream); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new ServiceAnalyzeReceiptAsyncHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -744,14 +753,15 @@ public async Task AnalyzeReceiptAsyncAsync(bool? includeTextDetails = /// Include text lines and element references in the result. /// .json, .pdf, .jpg, .png or .tiff type file stream. /// The cancellation token to use. - public Response AnalyzeReceiptAsync(bool? includeTextDetails = null, SourcePath fileStream = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders AnalyzeReceiptAsync(bool? includeTextDetails = null, SourcePath fileStream = null, CancellationToken cancellationToken = default) { using var message = CreateAnalyzeReceiptAsyncRequest(includeTextDetails, fileStream); _pipeline.Send(message, cancellationToken); + var headers = new ServiceAnalyzeReceiptAsyncHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -846,7 +856,7 @@ internal HttpMessage CreateAnalyzeLayoutAsyncRequest(ContentType contentType, St /// Upload file type. /// .json, .pdf, .jpg, .png or .tiff type file stream. /// The cancellation token to use. - public async Task AnalyzeLayoutAsyncAsync(ContentType contentType, Stream fileStream, CancellationToken cancellationToken = default) + public async Task> AnalyzeLayoutAsyncAsync(ContentType contentType, Stream fileStream, CancellationToken cancellationToken = default) { if (fileStream == null) { @@ -855,10 +865,11 @@ public async Task AnalyzeLayoutAsyncAsync(ContentType contentType, Str using var message = CreateAnalyzeLayoutAsyncRequest(contentType, fileStream); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new ServiceAnalyzeLayoutAsyncHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -868,7 +879,7 @@ public async Task AnalyzeLayoutAsyncAsync(ContentType contentType, Str /// Upload file type. /// .json, .pdf, .jpg, .png or .tiff type file stream. /// The cancellation token to use. - public Response AnalyzeLayoutAsync(ContentType contentType, Stream fileStream, CancellationToken cancellationToken = default) + public ResponseWithHeaders AnalyzeLayoutAsync(ContentType contentType, Stream fileStream, CancellationToken cancellationToken = default) { if (fileStream == null) { @@ -877,10 +888,11 @@ public Response AnalyzeLayoutAsync(ContentType contentType, Stream fileStream, C using var message = CreateAnalyzeLayoutAsyncRequest(contentType, fileStream); _pipeline.Send(message, cancellationToken); + var headers = new ServiceAnalyzeLayoutAsyncHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -909,14 +921,15 @@ internal HttpMessage CreateAnalyzeLayoutAsyncRequest(SourcePath fileStream) /// Extract text and layout information from a given document. The input document must be of one of the supported content types - 'application/pdf', 'image/jpeg', 'image/png' or 'image/tiff'. Alternatively, use 'application/json' type to specify the location (Uri or local path) of the document to be analyzed. /// .json, .pdf, .jpg, .png or .tiff type file stream. /// The cancellation token to use. - public async Task AnalyzeLayoutAsyncAsync(SourcePath fileStream = null, CancellationToken cancellationToken = default) + public async Task> AnalyzeLayoutAsyncAsync(SourcePath fileStream = null, CancellationToken cancellationToken = default) { using var message = CreateAnalyzeLayoutAsyncRequest(fileStream); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new ServiceAnalyzeLayoutAsyncHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -925,14 +938,15 @@ public async Task AnalyzeLayoutAsyncAsync(SourcePath fileStream = null /// Extract text and layout information from a given document. The input document must be of one of the supported content types - 'application/pdf', 'image/jpeg', 'image/png' or 'image/tiff'. Alternatively, use 'application/json' type to specify the location (Uri or local path) of the document to be analyzed. /// .json, .pdf, .jpg, .png or .tiff type file stream. /// The cancellation token to use. - public Response AnalyzeLayoutAsync(SourcePath fileStream = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders AnalyzeLayoutAsync(SourcePath fileStream = null, CancellationToken cancellationToken = default) { using var message = CreateAnalyzeLayoutAsyncRequest(fileStream); _pipeline.Send(message, cancellationToken); + var headers = new ServiceAnalyzeLayoutAsyncHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } diff --git a/src/AutoRest.CSharp.V3/Output/Models/Responses/ResponseHeaderGroupType.cs b/src/AutoRest.CSharp.V3/Output/Models/Responses/ResponseHeaderGroupType.cs index 8d61136cb42..fc69e922c64 100644 --- a/src/AutoRest.CSharp.V3/Output/Models/Responses/ResponseHeaderGroupType.cs +++ b/src/AutoRest.CSharp.V3/Output/Models/Responses/ResponseHeaderGroupType.cs @@ -48,7 +48,7 @@ ResponseHeader CreateResponseHeader(HttpResponseHeader header) => .Select(h => h.First()) .ToArray(); - if (!httpResponseHeaders.Any() || operation.IsLongRunning) + if (!httpResponseHeaders.Any()) { return null; } diff --git a/src/AutoRest.CSharp.V3/Output/Models/RestClient.cs b/src/AutoRest.CSharp.V3/Output/Models/RestClient.cs index 9d9c2433b4c..0e0b0ca3c46 100644 --- a/src/AutoRest.CSharp.V3/Output/Models/RestClient.cs +++ b/src/AutoRest.CSharp.V3/Output/Models/RestClient.cs @@ -294,12 +294,6 @@ private RestClientMethod BuildMethod(Operation operation, HttpRequest httpReques List clientResponse = new List(); - if (operation.IsLongRunning) - { - // Ignore response body and headers for LROs as the ArmOperationHelpers figures out them dynamically - responseHeaderModel = null; - } - foreach (var response in operation.Responses) { clientResponse.Add(new Response( diff --git a/test/TestServerProjects/lro/Generated/LRORetrysDelete202Retry200Headers.cs b/test/TestServerProjects/lro/Generated/LRORetrysDelete202Retry200Headers.cs new file mode 100644 index 00000000000..b0e764f6457 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LRORetrysDelete202Retry200Headers.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LRORetrysDelete202Retry200Headers + { + private readonly Response _response; + public LRORetrysDelete202Retry200Headers(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LRORetrysDeleteAsyncRelativeRetrySucceededHeaders.cs b/test/TestServerProjects/lro/Generated/LRORetrysDeleteAsyncRelativeRetrySucceededHeaders.cs new file mode 100644 index 00000000000..5ab4e60eda1 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LRORetrysDeleteAsyncRelativeRetrySucceededHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LRORetrysDeleteAsyncRelativeRetrySucceededHeaders + { + private readonly Response _response; + public LRORetrysDeleteAsyncRelativeRetrySucceededHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LRORetrysDeleteProvisioning202Accepted200SucceededHeaders.cs b/test/TestServerProjects/lro/Generated/LRORetrysDeleteProvisioning202Accepted200SucceededHeaders.cs new file mode 100644 index 00000000000..d46bc7bf131 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LRORetrysDeleteProvisioning202Accepted200SucceededHeaders.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LRORetrysDeleteProvisioning202Accepted200SucceededHeaders + { + private readonly Response _response; + public LRORetrysDeleteProvisioning202Accepted200SucceededHeaders(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LRORetrysPost202Retry200Headers.cs b/test/TestServerProjects/lro/Generated/LRORetrysPost202Retry200Headers.cs new file mode 100644 index 00000000000..b2744ddc8d6 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LRORetrysPost202Retry200Headers.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LRORetrysPost202Retry200Headers + { + private readonly Response _response; + public LRORetrysPost202Retry200Headers(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LRORetrysPostAsyncRelativeRetrySucceededHeaders.cs b/test/TestServerProjects/lro/Generated/LRORetrysPostAsyncRelativeRetrySucceededHeaders.cs new file mode 100644 index 00000000000..b20922dafac --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LRORetrysPostAsyncRelativeRetrySucceededHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LRORetrysPostAsyncRelativeRetrySucceededHeaders + { + private readonly Response _response; + public LRORetrysPostAsyncRelativeRetrySucceededHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LRORetrysPutAsyncRelativeRetrySucceededHeaders.cs b/test/TestServerProjects/lro/Generated/LRORetrysPutAsyncRelativeRetrySucceededHeaders.cs new file mode 100644 index 00000000000..43dc278e430 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LRORetrysPutAsyncRelativeRetrySucceededHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LRORetrysPutAsyncRelativeRetrySucceededHeaders + { + private readonly Response _response; + public LRORetrysPutAsyncRelativeRetrySucceededHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LRORetrysRestClient.cs b/test/TestServerProjects/lro/Generated/LRORetrysRestClient.cs index 2b9678a1b08..46c080f32d8 100644 --- a/test/TestServerProjects/lro/Generated/LRORetrysRestClient.cs +++ b/test/TestServerProjects/lro/Generated/LRORetrysRestClient.cs @@ -109,14 +109,15 @@ internal HttpMessage CreatePutAsyncRelativeRetrySucceededRequest(Product product /// Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public async Task PutAsyncRelativeRetrySucceededAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PutAsyncRelativeRetrySucceededAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncRelativeRetrySucceededRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LRORetrysPutAsyncRelativeRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -125,14 +126,15 @@ public async Task PutAsyncRelativeRetrySucceededAsync(Product product /// Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public Response PutAsyncRelativeRetrySucceeded(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PutAsyncRelativeRetrySucceeded(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncRelativeRetrySucceededRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LRORetrysPutAsyncRelativeRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -152,15 +154,16 @@ internal HttpMessage CreateDeleteProvisioning202Accepted200SucceededRequest() /// Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. /// The cancellation token to use. - public async Task DeleteProvisioning202Accepted200SucceededAsync(CancellationToken cancellationToken = default) + public async Task> DeleteProvisioning202Accepted200SucceededAsync(CancellationToken cancellationToken = default) { using var message = CreateDeleteProvisioning202Accepted200SucceededRequest(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LRORetrysDeleteProvisioning202Accepted200SucceededHeaders(message.Response); switch (message.Response.Status) { case 200: case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -168,15 +171,16 @@ public async Task DeleteProvisioning202Accepted200SucceededAsync(Cance /// Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. /// The cancellation token to use. - public Response DeleteProvisioning202Accepted200Succeeded(CancellationToken cancellationToken = default) + public ResponseWithHeaders DeleteProvisioning202Accepted200Succeeded(CancellationToken cancellationToken = default) { using var message = CreateDeleteProvisioning202Accepted200SucceededRequest(); _pipeline.Send(message, cancellationToken); + var headers = new LRORetrysDeleteProvisioning202Accepted200SucceededHeaders(message.Response); switch (message.Response.Status) { case 200: case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -196,14 +200,15 @@ internal HttpMessage CreateDelete202Retry200Request() /// Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. /// The cancellation token to use. - public async Task Delete202Retry200Async(CancellationToken cancellationToken = default) + public async Task> Delete202Retry200Async(CancellationToken cancellationToken = default) { using var message = CreateDelete202Retry200Request(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LRORetrysDelete202Retry200Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -211,14 +216,15 @@ public async Task Delete202Retry200Async(CancellationToken cancellatio /// Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. /// The cancellation token to use. - public Response Delete202Retry200(CancellationToken cancellationToken = default) + public ResponseWithHeaders Delete202Retry200(CancellationToken cancellationToken = default) { using var message = CreateDelete202Retry200Request(); _pipeline.Send(message, cancellationToken); + var headers = new LRORetrysDelete202Retry200Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -238,14 +244,15 @@ internal HttpMessage CreateDeleteAsyncRelativeRetrySucceededRequest() /// Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// The cancellation token to use. - public async Task DeleteAsyncRelativeRetrySucceededAsync(CancellationToken cancellationToken = default) + public async Task> DeleteAsyncRelativeRetrySucceededAsync(CancellationToken cancellationToken = default) { using var message = CreateDeleteAsyncRelativeRetrySucceededRequest(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LRORetrysDeleteAsyncRelativeRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -253,14 +260,15 @@ public async Task DeleteAsyncRelativeRetrySucceededAsync(CancellationT /// Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// The cancellation token to use. - public Response DeleteAsyncRelativeRetrySucceeded(CancellationToken cancellationToken = default) + public ResponseWithHeaders DeleteAsyncRelativeRetrySucceeded(CancellationToken cancellationToken = default) { using var message = CreateDeleteAsyncRelativeRetrySucceededRequest(); _pipeline.Send(message, cancellationToken); + var headers = new LRORetrysDeleteAsyncRelativeRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -288,14 +296,15 @@ internal HttpMessage CreatePost202Retry200Request(Product product) /// Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. /// Product to put. /// The cancellation token to use. - public async Task Post202Retry200Async(Product product = null, CancellationToken cancellationToken = default) + public async Task> Post202Retry200Async(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePost202Retry200Request(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LRORetrysPost202Retry200Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -304,14 +313,15 @@ public async Task Post202Retry200Async(Product product = null, Cancell /// Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. /// Product to put. /// The cancellation token to use. - public Response Post202Retry200(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders Post202Retry200(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePost202Retry200Request(product); _pipeline.Send(message, cancellationToken); + var headers = new LRORetrysPost202Retry200Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -339,14 +349,15 @@ internal HttpMessage CreatePostAsyncRelativeRetrySucceededRequest(Product produc /// Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public async Task PostAsyncRelativeRetrySucceededAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PostAsyncRelativeRetrySucceededAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostAsyncRelativeRetrySucceededRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LRORetrysPostAsyncRelativeRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -355,14 +366,15 @@ public async Task PostAsyncRelativeRetrySucceededAsync(Product product /// Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public Response PostAsyncRelativeRetrySucceeded(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PostAsyncRelativeRetrySucceeded(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostAsyncRelativeRetrySucceededRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LRORetrysPostAsyncRelativeRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } diff --git a/test/TestServerProjects/lro/Generated/LROsCustomHeaderPost202Retry200Headers.cs b/test/TestServerProjects/lro/Generated/LROsCustomHeaderPost202Retry200Headers.cs new file mode 100644 index 00000000000..28845305f98 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsCustomHeaderPost202Retry200Headers.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsCustomHeaderPost202Retry200Headers + { + private readonly Response _response; + public LROsCustomHeaderPost202Retry200Headers(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsCustomHeaderPostAsyncRetrySucceededHeaders.cs b/test/TestServerProjects/lro/Generated/LROsCustomHeaderPostAsyncRetrySucceededHeaders.cs new file mode 100644 index 00000000000..53df01f403c --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsCustomHeaderPostAsyncRetrySucceededHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsCustomHeaderPostAsyncRetrySucceededHeaders + { + private readonly Response _response; + public LROsCustomHeaderPostAsyncRetrySucceededHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsCustomHeaderPutAsyncRetrySucceededHeaders.cs b/test/TestServerProjects/lro/Generated/LROsCustomHeaderPutAsyncRetrySucceededHeaders.cs new file mode 100644 index 00000000000..8399df7fc33 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsCustomHeaderPutAsyncRetrySucceededHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsCustomHeaderPutAsyncRetrySucceededHeaders + { + private readonly Response _response; + public LROsCustomHeaderPutAsyncRetrySucceededHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsCustomHeaderRestClient.cs b/test/TestServerProjects/lro/Generated/LROsCustomHeaderRestClient.cs index 47046106f9a..53cd2aeb5d1 100644 --- a/test/TestServerProjects/lro/Generated/LROsCustomHeaderRestClient.cs +++ b/test/TestServerProjects/lro/Generated/LROsCustomHeaderRestClient.cs @@ -56,14 +56,15 @@ internal HttpMessage CreatePutAsyncRetrySucceededRequest(Product product) /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public async Task PutAsyncRetrySucceededAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PutAsyncRetrySucceededAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncRetrySucceededRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsCustomHeaderPutAsyncRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -72,14 +73,15 @@ public async Task PutAsyncRetrySucceededAsync(Product product = null, /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public Response PutAsyncRetrySucceeded(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PutAsyncRetrySucceeded(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncRetrySucceededRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LROsCustomHeaderPutAsyncRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -160,14 +162,15 @@ internal HttpMessage CreatePost202Retry200Request(Product product) /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. /// Product to put. /// The cancellation token to use. - public async Task Post202Retry200Async(Product product = null, CancellationToken cancellationToken = default) + public async Task> Post202Retry200Async(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePost202Retry200Request(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsCustomHeaderPost202Retry200Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -176,14 +179,15 @@ public async Task Post202Retry200Async(Product product = null, Cancell /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. /// Product to put. /// The cancellation token to use. - public Response Post202Retry200(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders Post202Retry200(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePost202Retry200Request(product); _pipeline.Send(message, cancellationToken); + var headers = new LROsCustomHeaderPost202Retry200Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -211,14 +215,15 @@ internal HttpMessage CreatePostAsyncRetrySucceededRequest(Product product) /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public async Task PostAsyncRetrySucceededAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PostAsyncRetrySucceededAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostAsyncRetrySucceededRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsCustomHeaderPostAsyncRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -227,14 +232,15 @@ public async Task PostAsyncRetrySucceededAsync(Product product = null, /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public Response PostAsyncRetrySucceeded(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PostAsyncRetrySucceeded(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostAsyncRetrySucceededRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LROsCustomHeaderPostAsyncRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } diff --git a/test/TestServerProjects/lro/Generated/LROsDelete202NoRetry204Headers.cs b/test/TestServerProjects/lro/Generated/LROsDelete202NoRetry204Headers.cs new file mode 100644 index 00000000000..63bcf463f52 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsDelete202NoRetry204Headers.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsDelete202NoRetry204Headers + { + private readonly Response _response; + public LROsDelete202NoRetry204Headers(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsDelete202Retry200Headers.cs b/test/TestServerProjects/lro/Generated/LROsDelete202Retry200Headers.cs new file mode 100644 index 00000000000..965792b728a --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsDelete202Retry200Headers.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsDelete202Retry200Headers + { + private readonly Response _response; + public LROsDelete202Retry200Headers(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsDeleteAsyncNoHeaderInRetryHeaders.cs b/test/TestServerProjects/lro/Generated/LROsDeleteAsyncNoHeaderInRetryHeaders.cs new file mode 100644 index 00000000000..bb8a8f9755b --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsDeleteAsyncNoHeaderInRetryHeaders.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsDeleteAsyncNoHeaderInRetryHeaders + { + private readonly Response _response; + public LROsDeleteAsyncNoHeaderInRetryHeaders(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsDeleteAsyncNoRetrySucceededHeaders.cs b/test/TestServerProjects/lro/Generated/LROsDeleteAsyncNoRetrySucceededHeaders.cs new file mode 100644 index 00000000000..bbef71ce88a --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsDeleteAsyncNoRetrySucceededHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsDeleteAsyncNoRetrySucceededHeaders + { + private readonly Response _response; + public LROsDeleteAsyncNoRetrySucceededHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsDeleteAsyncRetryFailedHeaders.cs b/test/TestServerProjects/lro/Generated/LROsDeleteAsyncRetryFailedHeaders.cs new file mode 100644 index 00000000000..4c039d04270 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsDeleteAsyncRetryFailedHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsDeleteAsyncRetryFailedHeaders + { + private readonly Response _response; + public LROsDeleteAsyncRetryFailedHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsDeleteAsyncRetrySucceededHeaders.cs b/test/TestServerProjects/lro/Generated/LROsDeleteAsyncRetrySucceededHeaders.cs new file mode 100644 index 00000000000..c2dd3836f9e --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsDeleteAsyncRetrySucceededHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsDeleteAsyncRetrySucceededHeaders + { + private readonly Response _response; + public LROsDeleteAsyncRetrySucceededHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsDeleteAsyncRetrycanceledHeaders.cs b/test/TestServerProjects/lro/Generated/LROsDeleteAsyncRetrycanceledHeaders.cs new file mode 100644 index 00000000000..0f6f9f10453 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsDeleteAsyncRetrycanceledHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsDeleteAsyncRetrycanceledHeaders + { + private readonly Response _response; + public LROsDeleteAsyncRetrycanceledHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsDeleteNoHeaderInRetryHeaders.cs b/test/TestServerProjects/lro/Generated/LROsDeleteNoHeaderInRetryHeaders.cs new file mode 100644 index 00000000000..f84ec2c00d7 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsDeleteNoHeaderInRetryHeaders.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsDeleteNoHeaderInRetryHeaders + { + private readonly Response _response; + public LROsDeleteNoHeaderInRetryHeaders(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsDeleteProvisioning202Accepted200SucceededHeaders.cs b/test/TestServerProjects/lro/Generated/LROsDeleteProvisioning202Accepted200SucceededHeaders.cs new file mode 100644 index 00000000000..84f184729fd --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsDeleteProvisioning202Accepted200SucceededHeaders.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsDeleteProvisioning202Accepted200SucceededHeaders + { + private readonly Response _response; + public LROsDeleteProvisioning202Accepted200SucceededHeaders(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsDeleteProvisioning202DeletingFailed200Headers.cs b/test/TestServerProjects/lro/Generated/LROsDeleteProvisioning202DeletingFailed200Headers.cs new file mode 100644 index 00000000000..8a67823ddb8 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsDeleteProvisioning202DeletingFailed200Headers.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsDeleteProvisioning202DeletingFailed200Headers + { + private readonly Response _response; + public LROsDeleteProvisioning202DeletingFailed200Headers(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsDeleteProvisioning202Deletingcanceled200Headers.cs b/test/TestServerProjects/lro/Generated/LROsDeleteProvisioning202Deletingcanceled200Headers.cs new file mode 100644 index 00000000000..9ea1ef90052 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsDeleteProvisioning202Deletingcanceled200Headers.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsDeleteProvisioning202Deletingcanceled200Headers + { + private readonly Response _response; + public LROsDeleteProvisioning202Deletingcanceled200Headers(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsPost202ListHeaders.cs b/test/TestServerProjects/lro/Generated/LROsPost202ListHeaders.cs new file mode 100644 index 00000000000..90edf636cef --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsPost202ListHeaders.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsPost202ListHeaders + { + private readonly Response _response; + public LROsPost202ListHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsPost202NoRetry204Headers.cs b/test/TestServerProjects/lro/Generated/LROsPost202NoRetry204Headers.cs new file mode 100644 index 00000000000..d125dcaea75 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsPost202NoRetry204Headers.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsPost202NoRetry204Headers + { + private readonly Response _response; + public LROsPost202NoRetry204Headers(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsPost202Retry200Headers.cs b/test/TestServerProjects/lro/Generated/LROsPost202Retry200Headers.cs new file mode 100644 index 00000000000..3ded0d2654a --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsPost202Retry200Headers.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsPost202Retry200Headers + { + private readonly Response _response; + public LROsPost202Retry200Headers(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsPostAsyncNoRetrySucceededHeaders.cs b/test/TestServerProjects/lro/Generated/LROsPostAsyncNoRetrySucceededHeaders.cs new file mode 100644 index 00000000000..00c3c091908 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsPostAsyncNoRetrySucceededHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsPostAsyncNoRetrySucceededHeaders + { + private readonly Response _response; + public LROsPostAsyncNoRetrySucceededHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsPostAsyncRetryFailedHeaders.cs b/test/TestServerProjects/lro/Generated/LROsPostAsyncRetryFailedHeaders.cs new file mode 100644 index 00000000000..ac3861e2192 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsPostAsyncRetryFailedHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsPostAsyncRetryFailedHeaders + { + private readonly Response _response; + public LROsPostAsyncRetryFailedHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsPostAsyncRetrySucceededHeaders.cs b/test/TestServerProjects/lro/Generated/LROsPostAsyncRetrySucceededHeaders.cs new file mode 100644 index 00000000000..602b670b622 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsPostAsyncRetrySucceededHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsPostAsyncRetrySucceededHeaders + { + private readonly Response _response; + public LROsPostAsyncRetrySucceededHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsPostAsyncRetrycanceledHeaders.cs b/test/TestServerProjects/lro/Generated/LROsPostAsyncRetrycanceledHeaders.cs new file mode 100644 index 00000000000..7f8767a33ab --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsPostAsyncRetrycanceledHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsPostAsyncRetrycanceledHeaders + { + private readonly Response _response; + public LROsPostAsyncRetrycanceledHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsPutAsyncNoHeaderInRetryHeaders.cs b/test/TestServerProjects/lro/Generated/LROsPutAsyncNoHeaderInRetryHeaders.cs new file mode 100644 index 00000000000..2589af16912 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsPutAsyncNoHeaderInRetryHeaders.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsPutAsyncNoHeaderInRetryHeaders + { + private readonly Response _response; + public LROsPutAsyncNoHeaderInRetryHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsPutAsyncNoRetrySucceededHeaders.cs b/test/TestServerProjects/lro/Generated/LROsPutAsyncNoRetrySucceededHeaders.cs new file mode 100644 index 00000000000..9cc73fa32c9 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsPutAsyncNoRetrySucceededHeaders.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsPutAsyncNoRetrySucceededHeaders + { + private readonly Response _response; + public LROsPutAsyncNoRetrySucceededHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsPutAsyncNoRetrycanceledHeaders.cs b/test/TestServerProjects/lro/Generated/LROsPutAsyncNoRetrycanceledHeaders.cs new file mode 100644 index 00000000000..688205445e0 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsPutAsyncNoRetrycanceledHeaders.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsPutAsyncNoRetrycanceledHeaders + { + private readonly Response _response; + public LROsPutAsyncNoRetrycanceledHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsPutAsyncRetryFailedHeaders.cs b/test/TestServerProjects/lro/Generated/LROsPutAsyncRetryFailedHeaders.cs new file mode 100644 index 00000000000..8d7fc6bb47d --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsPutAsyncRetryFailedHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsPutAsyncRetryFailedHeaders + { + private readonly Response _response; + public LROsPutAsyncRetryFailedHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsPutAsyncRetrySucceededHeaders.cs b/test/TestServerProjects/lro/Generated/LROsPutAsyncRetrySucceededHeaders.cs new file mode 100644 index 00000000000..6ee7db4517e --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsPutAsyncRetrySucceededHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsPutAsyncRetrySucceededHeaders + { + private readonly Response _response; + public LROsPutAsyncRetrySucceededHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsPutNoHeaderInRetryHeaders.cs b/test/TestServerProjects/lro/Generated/LROsPutNoHeaderInRetryHeaders.cs new file mode 100644 index 00000000000..b600996ae2b --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LROsPutNoHeaderInRetryHeaders.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LROsPutNoHeaderInRetryHeaders + { + private readonly Response _response; + public LROsPutNoHeaderInRetryHeaders(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("location", out string value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LROsRestClient.cs b/test/TestServerProjects/lro/Generated/LROsRestClient.cs index e77910f1563..b903fa54b39 100644 --- a/test/TestServerProjects/lro/Generated/LROsRestClient.cs +++ b/test/TestServerProjects/lro/Generated/LROsRestClient.cs @@ -152,15 +152,16 @@ internal HttpMessage CreatePost202ListRequest() /// Long running put request, service returns a 202 with empty body to first request, returns a 200 with body [{ 'id': '100', 'name': 'foo' }]. /// The cancellation token to use. - public async Task Post202ListAsync(CancellationToken cancellationToken = default) + public async Task> Post202ListAsync(CancellationToken cancellationToken = default) { using var message = CreatePost202ListRequest(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsPost202ListHeaders(message.Response); switch (message.Response.Status) { case 200: case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -168,15 +169,16 @@ public async Task Post202ListAsync(CancellationToken cancellationToken /// Long running put request, service returns a 202 with empty body to first request, returns a 200 with body [{ 'id': '100', 'name': 'foo' }]. /// The cancellation token to use. - public Response Post202List(CancellationToken cancellationToken = default) + public ResponseWithHeaders Post202List(CancellationToken cancellationToken = default) { using var message = CreatePost202ListRequest(); _pipeline.Send(message, cancellationToken); + var headers = new LROsPost202ListHeaders(message.Response); switch (message.Response.Status) { case 200: case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -514,14 +516,15 @@ internal HttpMessage CreatePutNoHeaderInRetryRequest(Product product) /// Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. /// Product to put. /// The cancellation token to use. - public async Task PutNoHeaderInRetryAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PutNoHeaderInRetryAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutNoHeaderInRetryRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsPutNoHeaderInRetryHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -530,14 +533,15 @@ public async Task PutNoHeaderInRetryAsync(Product product = null, Canc /// Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. /// Product to put. /// The cancellation token to use. - public Response PutNoHeaderInRetry(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PutNoHeaderInRetry(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutNoHeaderInRetryRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LROsPutNoHeaderInRetryHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -565,14 +569,15 @@ internal HttpMessage CreatePutAsyncRetrySucceededRequest(Product product) /// Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public async Task PutAsyncRetrySucceededAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PutAsyncRetrySucceededAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncRetrySucceededRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsPutAsyncRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -581,14 +586,15 @@ public async Task PutAsyncRetrySucceededAsync(Product product = null, /// Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public Response PutAsyncRetrySucceeded(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PutAsyncRetrySucceeded(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncRetrySucceededRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LROsPutAsyncRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -616,14 +622,15 @@ internal HttpMessage CreatePutAsyncNoRetrySucceededRequest(Product product) /// Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public async Task PutAsyncNoRetrySucceededAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PutAsyncNoRetrySucceededAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncNoRetrySucceededRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsPutAsyncNoRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -632,14 +639,15 @@ public async Task PutAsyncNoRetrySucceededAsync(Product product = null /// Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public Response PutAsyncNoRetrySucceeded(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PutAsyncNoRetrySucceeded(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncNoRetrySucceededRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LROsPutAsyncNoRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -667,14 +675,15 @@ internal HttpMessage CreatePutAsyncRetryFailedRequest(Product product) /// Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public async Task PutAsyncRetryFailedAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PutAsyncRetryFailedAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncRetryFailedRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsPutAsyncRetryFailedHeaders(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -683,14 +692,15 @@ public async Task PutAsyncRetryFailedAsync(Product product = null, Can /// Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public Response PutAsyncRetryFailed(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PutAsyncRetryFailed(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncRetryFailedRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LROsPutAsyncRetryFailedHeaders(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -718,14 +728,15 @@ internal HttpMessage CreatePutAsyncNoRetrycanceledRequest(Product product) /// Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public async Task PutAsyncNoRetrycanceledAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PutAsyncNoRetrycanceledAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncNoRetrycanceledRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsPutAsyncNoRetrycanceledHeaders(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -734,14 +745,15 @@ public async Task PutAsyncNoRetrycanceledAsync(Product product = null, /// Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public Response PutAsyncNoRetrycanceled(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PutAsyncNoRetrycanceled(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncNoRetrycanceledRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LROsPutAsyncNoRetrycanceledHeaders(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -769,14 +781,15 @@ internal HttpMessage CreatePutAsyncNoHeaderInRetryRequest(Product product) /// Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header. /// Product to put. /// The cancellation token to use. - public async Task PutAsyncNoHeaderInRetryAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PutAsyncNoHeaderInRetryAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncNoHeaderInRetryRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsPutAsyncNoHeaderInRetryHeaders(message.Response); switch (message.Response.Status) { case 201: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -785,14 +798,15 @@ public async Task PutAsyncNoHeaderInRetryAsync(Product product = null, /// Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header. /// Product to put. /// The cancellation token to use. - public Response PutAsyncNoHeaderInRetry(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PutAsyncNoHeaderInRetry(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncNoHeaderInRetryRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LROsPutAsyncNoHeaderInRetryHeaders(message.Response); switch (message.Response.Status) { case 201: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1016,15 +1030,16 @@ internal HttpMessage CreateDeleteProvisioning202Accepted200SucceededRequest() /// Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. /// The cancellation token to use. - public async Task DeleteProvisioning202Accepted200SucceededAsync(CancellationToken cancellationToken = default) + public async Task> DeleteProvisioning202Accepted200SucceededAsync(CancellationToken cancellationToken = default) { using var message = CreateDeleteProvisioning202Accepted200SucceededRequest(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsDeleteProvisioning202Accepted200SucceededHeaders(message.Response); switch (message.Response.Status) { case 200: case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1032,15 +1047,16 @@ public async Task DeleteProvisioning202Accepted200SucceededAsync(Cance /// Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. /// The cancellation token to use. - public Response DeleteProvisioning202Accepted200Succeeded(CancellationToken cancellationToken = default) + public ResponseWithHeaders DeleteProvisioning202Accepted200Succeeded(CancellationToken cancellationToken = default) { using var message = CreateDeleteProvisioning202Accepted200SucceededRequest(); _pipeline.Send(message, cancellationToken); + var headers = new LROsDeleteProvisioning202Accepted200SucceededHeaders(message.Response); switch (message.Response.Status) { case 200: case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1060,15 +1076,16 @@ internal HttpMessage CreateDeleteProvisioning202DeletingFailed200Request() /// Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. /// The cancellation token to use. - public async Task DeleteProvisioning202DeletingFailed200Async(CancellationToken cancellationToken = default) + public async Task> DeleteProvisioning202DeletingFailed200Async(CancellationToken cancellationToken = default) { using var message = CreateDeleteProvisioning202DeletingFailed200Request(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsDeleteProvisioning202DeletingFailed200Headers(message.Response); switch (message.Response.Status) { case 200: case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1076,15 +1093,16 @@ public async Task DeleteProvisioning202DeletingFailed200Async(Cancella /// Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. /// The cancellation token to use. - public Response DeleteProvisioning202DeletingFailed200(CancellationToken cancellationToken = default) + public ResponseWithHeaders DeleteProvisioning202DeletingFailed200(CancellationToken cancellationToken = default) { using var message = CreateDeleteProvisioning202DeletingFailed200Request(); _pipeline.Send(message, cancellationToken); + var headers = new LROsDeleteProvisioning202DeletingFailed200Headers(message.Response); switch (message.Response.Status) { case 200: case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1104,15 +1122,16 @@ internal HttpMessage CreateDeleteProvisioning202Deletingcanceled200Request() /// Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. /// The cancellation token to use. - public async Task DeleteProvisioning202Deletingcanceled200Async(CancellationToken cancellationToken = default) + public async Task> DeleteProvisioning202Deletingcanceled200Async(CancellationToken cancellationToken = default) { using var message = CreateDeleteProvisioning202Deletingcanceled200Request(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsDeleteProvisioning202Deletingcanceled200Headers(message.Response); switch (message.Response.Status) { case 200: case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1120,15 +1139,16 @@ public async Task DeleteProvisioning202Deletingcanceled200Async(Cancel /// Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. /// The cancellation token to use. - public Response DeleteProvisioning202Deletingcanceled200(CancellationToken cancellationToken = default) + public ResponseWithHeaders DeleteProvisioning202Deletingcanceled200(CancellationToken cancellationToken = default) { using var message = CreateDeleteProvisioning202Deletingcanceled200Request(); _pipeline.Send(message, cancellationToken); + var headers = new LROsDeleteProvisioning202Deletingcanceled200Headers(message.Response); switch (message.Response.Status) { case 200: case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1190,15 +1210,16 @@ internal HttpMessage CreateDelete202Retry200Request() /// Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. /// The cancellation token to use. - public async Task Delete202Retry200Async(CancellationToken cancellationToken = default) + public async Task> Delete202Retry200Async(CancellationToken cancellationToken = default) { using var message = CreateDelete202Retry200Request(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsDelete202Retry200Headers(message.Response); switch (message.Response.Status) { case 200: case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1206,15 +1227,16 @@ public async Task Delete202Retry200Async(CancellationToken cancellatio /// Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. /// The cancellation token to use. - public Response Delete202Retry200(CancellationToken cancellationToken = default) + public ResponseWithHeaders Delete202Retry200(CancellationToken cancellationToken = default) { using var message = CreateDelete202Retry200Request(); _pipeline.Send(message, cancellationToken); + var headers = new LROsDelete202Retry200Headers(message.Response); switch (message.Response.Status) { case 200: case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1234,15 +1256,16 @@ internal HttpMessage CreateDelete202NoRetry204Request() /// Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. /// The cancellation token to use. - public async Task Delete202NoRetry204Async(CancellationToken cancellationToken = default) + public async Task> Delete202NoRetry204Async(CancellationToken cancellationToken = default) { using var message = CreateDelete202NoRetry204Request(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsDelete202NoRetry204Headers(message.Response); switch (message.Response.Status) { case 200: case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1250,15 +1273,16 @@ public async Task Delete202NoRetry204Async(CancellationToken cancellat /// Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. /// The cancellation token to use. - public Response Delete202NoRetry204(CancellationToken cancellationToken = default) + public ResponseWithHeaders Delete202NoRetry204(CancellationToken cancellationToken = default) { using var message = CreateDelete202NoRetry204Request(); _pipeline.Send(message, cancellationToken); + var headers = new LROsDelete202NoRetry204Headers(message.Response); switch (message.Response.Status) { case 200: case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1278,15 +1302,16 @@ internal HttpMessage CreateDeleteNoHeaderInRetryRequest() /// Long running delete request, service returns a location header in the initial request. Subsequent calls to operation status do not contain location header. /// The cancellation token to use. - public async Task DeleteNoHeaderInRetryAsync(CancellationToken cancellationToken = default) + public async Task> DeleteNoHeaderInRetryAsync(CancellationToken cancellationToken = default) { using var message = CreateDeleteNoHeaderInRetryRequest(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsDeleteNoHeaderInRetryHeaders(message.Response); switch (message.Response.Status) { case 202: case 204: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1294,15 +1319,16 @@ public async Task DeleteNoHeaderInRetryAsync(CancellationToken cancell /// Long running delete request, service returns a location header in the initial request. Subsequent calls to operation status do not contain location header. /// The cancellation token to use. - public Response DeleteNoHeaderInRetry(CancellationToken cancellationToken = default) + public ResponseWithHeaders DeleteNoHeaderInRetry(CancellationToken cancellationToken = default) { using var message = CreateDeleteNoHeaderInRetryRequest(); _pipeline.Send(message, cancellationToken); + var headers = new LROsDeleteNoHeaderInRetryHeaders(message.Response); switch (message.Response.Status) { case 202: case 204: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1322,15 +1348,16 @@ internal HttpMessage CreateDeleteAsyncNoHeaderInRetryRequest() /// Long running delete request, service returns an Azure-AsyncOperation header in the initial request. Subsequent calls to operation status do not contain Azure-AsyncOperation header. /// The cancellation token to use. - public async Task DeleteAsyncNoHeaderInRetryAsync(CancellationToken cancellationToken = default) + public async Task> DeleteAsyncNoHeaderInRetryAsync(CancellationToken cancellationToken = default) { using var message = CreateDeleteAsyncNoHeaderInRetryRequest(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsDeleteAsyncNoHeaderInRetryHeaders(message.Response); switch (message.Response.Status) { case 202: case 204: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1338,15 +1365,16 @@ public async Task DeleteAsyncNoHeaderInRetryAsync(CancellationToken ca /// Long running delete request, service returns an Azure-AsyncOperation header in the initial request. Subsequent calls to operation status do not contain Azure-AsyncOperation header. /// The cancellation token to use. - public Response DeleteAsyncNoHeaderInRetry(CancellationToken cancellationToken = default) + public ResponseWithHeaders DeleteAsyncNoHeaderInRetry(CancellationToken cancellationToken = default) { using var message = CreateDeleteAsyncNoHeaderInRetryRequest(); _pipeline.Send(message, cancellationToken); + var headers = new LROsDeleteAsyncNoHeaderInRetryHeaders(message.Response); switch (message.Response.Status) { case 202: case 204: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1366,14 +1394,15 @@ internal HttpMessage CreateDeleteAsyncRetrySucceededRequest() /// Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// The cancellation token to use. - public async Task DeleteAsyncRetrySucceededAsync(CancellationToken cancellationToken = default) + public async Task> DeleteAsyncRetrySucceededAsync(CancellationToken cancellationToken = default) { using var message = CreateDeleteAsyncRetrySucceededRequest(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsDeleteAsyncRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1381,14 +1410,15 @@ public async Task DeleteAsyncRetrySucceededAsync(CancellationToken can /// Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// The cancellation token to use. - public Response DeleteAsyncRetrySucceeded(CancellationToken cancellationToken = default) + public ResponseWithHeaders DeleteAsyncRetrySucceeded(CancellationToken cancellationToken = default) { using var message = CreateDeleteAsyncRetrySucceededRequest(); _pipeline.Send(message, cancellationToken); + var headers = new LROsDeleteAsyncRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1408,14 +1438,15 @@ internal HttpMessage CreateDeleteAsyncNoRetrySucceededRequest() /// Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// The cancellation token to use. - public async Task DeleteAsyncNoRetrySucceededAsync(CancellationToken cancellationToken = default) + public async Task> DeleteAsyncNoRetrySucceededAsync(CancellationToken cancellationToken = default) { using var message = CreateDeleteAsyncNoRetrySucceededRequest(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsDeleteAsyncNoRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1423,14 +1454,15 @@ public async Task DeleteAsyncNoRetrySucceededAsync(CancellationToken c /// Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// The cancellation token to use. - public Response DeleteAsyncNoRetrySucceeded(CancellationToken cancellationToken = default) + public ResponseWithHeaders DeleteAsyncNoRetrySucceeded(CancellationToken cancellationToken = default) { using var message = CreateDeleteAsyncNoRetrySucceededRequest(); _pipeline.Send(message, cancellationToken); + var headers = new LROsDeleteAsyncNoRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1450,14 +1482,15 @@ internal HttpMessage CreateDeleteAsyncRetryFailedRequest() /// Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// The cancellation token to use. - public async Task DeleteAsyncRetryFailedAsync(CancellationToken cancellationToken = default) + public async Task> DeleteAsyncRetryFailedAsync(CancellationToken cancellationToken = default) { using var message = CreateDeleteAsyncRetryFailedRequest(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsDeleteAsyncRetryFailedHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1465,14 +1498,15 @@ public async Task DeleteAsyncRetryFailedAsync(CancellationToken cancel /// Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// The cancellation token to use. - public Response DeleteAsyncRetryFailed(CancellationToken cancellationToken = default) + public ResponseWithHeaders DeleteAsyncRetryFailed(CancellationToken cancellationToken = default) { using var message = CreateDeleteAsyncRetryFailedRequest(); _pipeline.Send(message, cancellationToken); + var headers = new LROsDeleteAsyncRetryFailedHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1492,14 +1526,15 @@ internal HttpMessage CreateDeleteAsyncRetrycanceledRequest() /// Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// The cancellation token to use. - public async Task DeleteAsyncRetrycanceledAsync(CancellationToken cancellationToken = default) + public async Task> DeleteAsyncRetrycanceledAsync(CancellationToken cancellationToken = default) { using var message = CreateDeleteAsyncRetrycanceledRequest(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsDeleteAsyncRetrycanceledHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1507,14 +1542,15 @@ public async Task DeleteAsyncRetrycanceledAsync(CancellationToken canc /// Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// The cancellation token to use. - public Response DeleteAsyncRetrycanceled(CancellationToken cancellationToken = default) + public ResponseWithHeaders DeleteAsyncRetrycanceled(CancellationToken cancellationToken = default) { using var message = CreateDeleteAsyncRetrycanceledRequest(); _pipeline.Send(message, cancellationToken); + var headers = new LROsDeleteAsyncRetrycanceledHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1586,14 +1622,15 @@ internal HttpMessage CreatePost202Retry200Request(Product product) /// Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. /// Product to put. /// The cancellation token to use. - public async Task Post202Retry200Async(Product product = null, CancellationToken cancellationToken = default) + public async Task> Post202Retry200Async(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePost202Retry200Request(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsPost202Retry200Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1602,14 +1639,15 @@ public async Task Post202Retry200Async(Product product = null, Cancell /// Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. /// Product to put. /// The cancellation token to use. - public Response Post202Retry200(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders Post202Retry200(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePost202Retry200Request(product); _pipeline.Send(message, cancellationToken); + var headers = new LROsPost202Retry200Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1637,14 +1675,15 @@ internal HttpMessage CreatePost202NoRetry204Request(Product product) /// Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. /// Product to put. /// The cancellation token to use. - public async Task Post202NoRetry204Async(Product product = null, CancellationToken cancellationToken = default) + public async Task> Post202NoRetry204Async(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePost202NoRetry204Request(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsPost202NoRetry204Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1653,14 +1692,15 @@ public async Task Post202NoRetry204Async(Product product = null, Cance /// Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. /// Product to put. /// The cancellation token to use. - public Response Post202NoRetry204(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders Post202NoRetry204(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePost202NoRetry204Request(product); _pipeline.Send(message, cancellationToken); + var headers = new LROsPost202NoRetry204Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1814,15 +1854,16 @@ internal HttpMessage CreatePostAsyncRetrySucceededRequest(Product product) /// Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public async Task PostAsyncRetrySucceededAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PostAsyncRetrySucceededAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostAsyncRetrySucceededRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsPostAsyncRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 200: case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1831,15 +1872,16 @@ public async Task PostAsyncRetrySucceededAsync(Product product = null, /// Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public Response PostAsyncRetrySucceeded(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PostAsyncRetrySucceeded(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostAsyncRetrySucceededRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LROsPostAsyncRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 200: case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1867,15 +1909,16 @@ internal HttpMessage CreatePostAsyncNoRetrySucceededRequest(Product product) /// Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public async Task PostAsyncNoRetrySucceededAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PostAsyncNoRetrySucceededAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostAsyncNoRetrySucceededRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsPostAsyncNoRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 200: case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1884,15 +1927,16 @@ public async Task PostAsyncNoRetrySucceededAsync(Product product = nul /// Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public Response PostAsyncNoRetrySucceeded(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PostAsyncNoRetrySucceeded(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostAsyncNoRetrySucceededRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LROsPostAsyncNoRetrySucceededHeaders(message.Response); switch (message.Response.Status) { case 200: case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1920,14 +1964,15 @@ internal HttpMessage CreatePostAsyncRetryFailedRequest(Product product) /// Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public async Task PostAsyncRetryFailedAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PostAsyncRetryFailedAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostAsyncRetryFailedRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsPostAsyncRetryFailedHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1936,14 +1981,15 @@ public async Task PostAsyncRetryFailedAsync(Product product = null, Ca /// Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public Response PostAsyncRetryFailed(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PostAsyncRetryFailed(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostAsyncRetryFailedRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LROsPostAsyncRetryFailedHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1971,14 +2017,15 @@ internal HttpMessage CreatePostAsyncRetrycanceledRequest(Product product) /// Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public async Task PostAsyncRetrycanceledAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PostAsyncRetrycanceledAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostAsyncRetrycanceledRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LROsPostAsyncRetrycanceledHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1987,14 +2034,15 @@ public async Task PostAsyncRetrycanceledAsync(Product product = null, /// Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public Response PostAsyncRetrycanceled(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PostAsyncRetrycanceled(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostAsyncRetrycanceledRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LROsPostAsyncRetrycanceledHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } diff --git a/test/TestServerProjects/lro/Generated/LrosaDsDelete202NonRetry400Headers.cs b/test/TestServerProjects/lro/Generated/LrosaDsDelete202NonRetry400Headers.cs new file mode 100644 index 00000000000..ee4b18d97a3 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LrosaDsDelete202NonRetry400Headers.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LrosaDsDelete202NonRetry400Headers + { + private readonly Response _response; + public LrosaDsDelete202NonRetry400Headers(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LrosaDsDelete202RetryInvalidHeaderHeaders.cs b/test/TestServerProjects/lro/Generated/LrosaDsDelete202RetryInvalidHeaderHeaders.cs new file mode 100644 index 00000000000..0036d6cab6a --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LrosaDsDelete202RetryInvalidHeaderHeaders.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LrosaDsDelete202RetryInvalidHeaderHeaders + { + private readonly Response _response; + public LrosaDsDelete202RetryInvalidHeaderHeaders(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LrosaDsDeleteAsyncRelativeRetry400Headers.cs b/test/TestServerProjects/lro/Generated/LrosaDsDeleteAsyncRelativeRetry400Headers.cs new file mode 100644 index 00000000000..b80fda16caa --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LrosaDsDeleteAsyncRelativeRetry400Headers.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LrosaDsDeleteAsyncRelativeRetry400Headers + { + private readonly Response _response; + public LrosaDsDeleteAsyncRelativeRetry400Headers(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LrosaDsDeleteAsyncRelativeRetryInvalidHeaderHeaders.cs b/test/TestServerProjects/lro/Generated/LrosaDsDeleteAsyncRelativeRetryInvalidHeaderHeaders.cs new file mode 100644 index 00000000000..e9335bea09b --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LrosaDsDeleteAsyncRelativeRetryInvalidHeaderHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LrosaDsDeleteAsyncRelativeRetryInvalidHeaderHeaders + { + private readonly Response _response; + public LrosaDsDeleteAsyncRelativeRetryInvalidHeaderHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LrosaDsDeleteAsyncRelativeRetryInvalidJsonPollingHeaders.cs b/test/TestServerProjects/lro/Generated/LrosaDsDeleteAsyncRelativeRetryInvalidJsonPollingHeaders.cs new file mode 100644 index 00000000000..df580e1de78 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LrosaDsDeleteAsyncRelativeRetryInvalidJsonPollingHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LrosaDsDeleteAsyncRelativeRetryInvalidJsonPollingHeaders + { + private readonly Response _response; + public LrosaDsDeleteAsyncRelativeRetryInvalidJsonPollingHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LrosaDsDeleteAsyncRelativeRetryNoStatusHeaders.cs b/test/TestServerProjects/lro/Generated/LrosaDsDeleteAsyncRelativeRetryNoStatusHeaders.cs new file mode 100644 index 00000000000..8753c8a6dd7 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LrosaDsDeleteAsyncRelativeRetryNoStatusHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LrosaDsDeleteAsyncRelativeRetryNoStatusHeaders + { + private readonly Response _response; + public LrosaDsDeleteAsyncRelativeRetryNoStatusHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LrosaDsDeleteNonRetry400Headers.cs b/test/TestServerProjects/lro/Generated/LrosaDsDeleteNonRetry400Headers.cs new file mode 100644 index 00000000000..1c17f8e7b15 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LrosaDsDeleteNonRetry400Headers.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LrosaDsDeleteNonRetry400Headers + { + private readonly Response _response; + public LrosaDsDeleteNonRetry400Headers(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LrosaDsPost202NoLocationHeaders.cs b/test/TestServerProjects/lro/Generated/LrosaDsPost202NoLocationHeaders.cs new file mode 100644 index 00000000000..3347b2694ac --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LrosaDsPost202NoLocationHeaders.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LrosaDsPost202NoLocationHeaders + { + private readonly Response _response; + public LrosaDsPost202NoLocationHeaders(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LrosaDsPost202NonRetry400Headers.cs b/test/TestServerProjects/lro/Generated/LrosaDsPost202NonRetry400Headers.cs new file mode 100644 index 00000000000..dff3d672bcd --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LrosaDsPost202NonRetry400Headers.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LrosaDsPost202NonRetry400Headers + { + private readonly Response _response; + public LrosaDsPost202NonRetry400Headers(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LrosaDsPost202RetryInvalidHeaderHeaders.cs b/test/TestServerProjects/lro/Generated/LrosaDsPost202RetryInvalidHeaderHeaders.cs new file mode 100644 index 00000000000..a19d23598dd --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LrosaDsPost202RetryInvalidHeaderHeaders.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LrosaDsPost202RetryInvalidHeaderHeaders + { + private readonly Response _response; + public LrosaDsPost202RetryInvalidHeaderHeaders(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LrosaDsPostAsyncRelativeRetry400Headers.cs b/test/TestServerProjects/lro/Generated/LrosaDsPostAsyncRelativeRetry400Headers.cs new file mode 100644 index 00000000000..ed8b26e9ee8 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LrosaDsPostAsyncRelativeRetry400Headers.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LrosaDsPostAsyncRelativeRetry400Headers + { + private readonly Response _response; + public LrosaDsPostAsyncRelativeRetry400Headers(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LrosaDsPostAsyncRelativeRetryInvalidHeaderHeaders.cs b/test/TestServerProjects/lro/Generated/LrosaDsPostAsyncRelativeRetryInvalidHeaderHeaders.cs new file mode 100644 index 00000000000..cb844a1698d --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LrosaDsPostAsyncRelativeRetryInvalidHeaderHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LrosaDsPostAsyncRelativeRetryInvalidHeaderHeaders + { + private readonly Response _response; + public LrosaDsPostAsyncRelativeRetryInvalidHeaderHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LrosaDsPostAsyncRelativeRetryInvalidJsonPollingHeaders.cs b/test/TestServerProjects/lro/Generated/LrosaDsPostAsyncRelativeRetryInvalidJsonPollingHeaders.cs new file mode 100644 index 00000000000..09ff8057c86 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LrosaDsPostAsyncRelativeRetryInvalidJsonPollingHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LrosaDsPostAsyncRelativeRetryInvalidJsonPollingHeaders + { + private readonly Response _response; + public LrosaDsPostAsyncRelativeRetryInvalidJsonPollingHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LrosaDsPostAsyncRelativeRetryNoPayloadHeaders.cs b/test/TestServerProjects/lro/Generated/LrosaDsPostAsyncRelativeRetryNoPayloadHeaders.cs new file mode 100644 index 00000000000..bd1de7e70fa --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LrosaDsPostAsyncRelativeRetryNoPayloadHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LrosaDsPostAsyncRelativeRetryNoPayloadHeaders + { + private readonly Response _response; + public LrosaDsPostAsyncRelativeRetryNoPayloadHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LrosaDsPostNonRetry400Headers.cs b/test/TestServerProjects/lro/Generated/LrosaDsPostNonRetry400Headers.cs new file mode 100644 index 00000000000..d473c01a71a --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LrosaDsPostNonRetry400Headers.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LrosaDsPostNonRetry400Headers + { + private readonly Response _response; + public LrosaDsPostNonRetry400Headers(Response response) + { + _response = response; + } + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LrosaDsPutAsyncRelativeRetry400Headers.cs b/test/TestServerProjects/lro/Generated/LrosaDsPutAsyncRelativeRetry400Headers.cs new file mode 100644 index 00000000000..8dc93270897 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LrosaDsPutAsyncRelativeRetry400Headers.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LrosaDsPutAsyncRelativeRetry400Headers + { + private readonly Response _response; + public LrosaDsPutAsyncRelativeRetry400Headers(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LrosaDsPutAsyncRelativeRetryInvalidHeaderHeaders.cs b/test/TestServerProjects/lro/Generated/LrosaDsPutAsyncRelativeRetryInvalidHeaderHeaders.cs new file mode 100644 index 00000000000..695382d9a0b --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LrosaDsPutAsyncRelativeRetryInvalidHeaderHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LrosaDsPutAsyncRelativeRetryInvalidHeaderHeaders + { + private readonly Response _response; + public LrosaDsPutAsyncRelativeRetryInvalidHeaderHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LrosaDsPutAsyncRelativeRetryInvalidJsonPollingHeaders.cs b/test/TestServerProjects/lro/Generated/LrosaDsPutAsyncRelativeRetryInvalidJsonPollingHeaders.cs new file mode 100644 index 00000000000..3d0b3799e20 --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LrosaDsPutAsyncRelativeRetryInvalidJsonPollingHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LrosaDsPutAsyncRelativeRetryInvalidJsonPollingHeaders + { + private readonly Response _response; + public LrosaDsPutAsyncRelativeRetryInvalidJsonPollingHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LrosaDsPutAsyncRelativeRetryNoStatusHeaders.cs b/test/TestServerProjects/lro/Generated/LrosaDsPutAsyncRelativeRetryNoStatusHeaders.cs new file mode 100644 index 00000000000..7ee988e107a --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LrosaDsPutAsyncRelativeRetryNoStatusHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LrosaDsPutAsyncRelativeRetryNoStatusHeaders + { + private readonly Response _response; + public LrosaDsPutAsyncRelativeRetryNoStatusHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LrosaDsPutAsyncRelativeRetryNoStatusPayloadHeaders.cs b/test/TestServerProjects/lro/Generated/LrosaDsPutAsyncRelativeRetryNoStatusPayloadHeaders.cs new file mode 100644 index 00000000000..2f1d78bc33b --- /dev/null +++ b/test/TestServerProjects/lro/Generated/LrosaDsPutAsyncRelativeRetryNoStatusPayloadHeaders.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace lro +{ + internal class LrosaDsPutAsyncRelativeRetryNoStatusPayloadHeaders + { + private readonly Response _response; + public LrosaDsPutAsyncRelativeRetryNoStatusPayloadHeaders(Response response) + { + _response = response; + } + public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; + public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; + public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; + } +} diff --git a/test/TestServerProjects/lro/Generated/LrosaDsRestClient.cs b/test/TestServerProjects/lro/Generated/LrosaDsRestClient.cs index 99ee43cf8c0..202f9ad0e03 100644 --- a/test/TestServerProjects/lro/Generated/LrosaDsRestClient.cs +++ b/test/TestServerProjects/lro/Generated/LrosaDsRestClient.cs @@ -215,14 +215,15 @@ internal HttpMessage CreatePutAsyncRelativeRetry400Request(Product product) /// Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public async Task PutAsyncRelativeRetry400Async(Product product = null, CancellationToken cancellationToken = default) + public async Task> PutAsyncRelativeRetry400Async(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncRelativeRetry400Request(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LrosaDsPutAsyncRelativeRetry400Headers(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -231,14 +232,15 @@ public async Task PutAsyncRelativeRetry400Async(Product product = null /// Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public Response PutAsyncRelativeRetry400(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PutAsyncRelativeRetry400(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncRelativeRetry400Request(product); _pipeline.Send(message, cancellationToken); + var headers = new LrosaDsPutAsyncRelativeRetry400Headers(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -258,14 +260,15 @@ internal HttpMessage CreateDeleteNonRetry400Request() /// Long running delete request, service returns a 400 with an error body. /// The cancellation token to use. - public async Task DeleteNonRetry400Async(CancellationToken cancellationToken = default) + public async Task> DeleteNonRetry400Async(CancellationToken cancellationToken = default) { using var message = CreateDeleteNonRetry400Request(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LrosaDsDeleteNonRetry400Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -273,14 +276,15 @@ public async Task DeleteNonRetry400Async(CancellationToken cancellatio /// Long running delete request, service returns a 400 with an error body. /// The cancellation token to use. - public Response DeleteNonRetry400(CancellationToken cancellationToken = default) + public ResponseWithHeaders DeleteNonRetry400(CancellationToken cancellationToken = default) { using var message = CreateDeleteNonRetry400Request(); _pipeline.Send(message, cancellationToken); + var headers = new LrosaDsDeleteNonRetry400Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -300,14 +304,15 @@ internal HttpMessage CreateDelete202NonRetry400Request() /// Long running delete request, service returns a 202 with a location header. /// The cancellation token to use. - public async Task Delete202NonRetry400Async(CancellationToken cancellationToken = default) + public async Task> Delete202NonRetry400Async(CancellationToken cancellationToken = default) { using var message = CreateDelete202NonRetry400Request(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LrosaDsDelete202NonRetry400Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -315,14 +320,15 @@ public async Task Delete202NonRetry400Async(CancellationToken cancella /// Long running delete request, service returns a 202 with a location header. /// The cancellation token to use. - public Response Delete202NonRetry400(CancellationToken cancellationToken = default) + public ResponseWithHeaders Delete202NonRetry400(CancellationToken cancellationToken = default) { using var message = CreateDelete202NonRetry400Request(); _pipeline.Send(message, cancellationToken); + var headers = new LrosaDsDelete202NonRetry400Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -342,14 +348,15 @@ internal HttpMessage CreateDeleteAsyncRelativeRetry400Request() /// Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// The cancellation token to use. - public async Task DeleteAsyncRelativeRetry400Async(CancellationToken cancellationToken = default) + public async Task> DeleteAsyncRelativeRetry400Async(CancellationToken cancellationToken = default) { using var message = CreateDeleteAsyncRelativeRetry400Request(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LrosaDsDeleteAsyncRelativeRetry400Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -357,14 +364,15 @@ public async Task DeleteAsyncRelativeRetry400Async(CancellationToken c /// Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// The cancellation token to use. - public Response DeleteAsyncRelativeRetry400(CancellationToken cancellationToken = default) + public ResponseWithHeaders DeleteAsyncRelativeRetry400(CancellationToken cancellationToken = default) { using var message = CreateDeleteAsyncRelativeRetry400Request(); _pipeline.Send(message, cancellationToken); + var headers = new LrosaDsDeleteAsyncRelativeRetry400Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -392,14 +400,15 @@ internal HttpMessage CreatePostNonRetry400Request(Product product) /// Long running post request, service returns a 400 with no error body. /// Product to put. /// The cancellation token to use. - public async Task PostNonRetry400Async(Product product = null, CancellationToken cancellationToken = default) + public async Task> PostNonRetry400Async(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostNonRetry400Request(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LrosaDsPostNonRetry400Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -408,14 +417,15 @@ public async Task PostNonRetry400Async(Product product = null, Cancell /// Long running post request, service returns a 400 with no error body. /// Product to put. /// The cancellation token to use. - public Response PostNonRetry400(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PostNonRetry400(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostNonRetry400Request(product); _pipeline.Send(message, cancellationToken); + var headers = new LrosaDsPostNonRetry400Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -443,14 +453,15 @@ internal HttpMessage CreatePost202NonRetry400Request(Product product) /// Long running post request, service returns a 202 with a location header. /// Product to put. /// The cancellation token to use. - public async Task Post202NonRetry400Async(Product product = null, CancellationToken cancellationToken = default) + public async Task> Post202NonRetry400Async(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePost202NonRetry400Request(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LrosaDsPost202NonRetry400Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -459,14 +470,15 @@ public async Task Post202NonRetry400Async(Product product = null, Canc /// Long running post request, service returns a 202 with a location header. /// Product to put. /// The cancellation token to use. - public Response Post202NonRetry400(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders Post202NonRetry400(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePost202NonRetry400Request(product); _pipeline.Send(message, cancellationToken); + var headers = new LrosaDsPost202NonRetry400Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -494,14 +506,15 @@ internal HttpMessage CreatePostAsyncRelativeRetry400Request(Product product) /// Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public async Task PostAsyncRelativeRetry400Async(Product product = null, CancellationToken cancellationToken = default) + public async Task> PostAsyncRelativeRetry400Async(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostAsyncRelativeRetry400Request(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LrosaDsPostAsyncRelativeRetry400Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -510,14 +523,15 @@ public async Task PostAsyncRelativeRetry400Async(Product product = nul /// Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public Response PostAsyncRelativeRetry400(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PostAsyncRelativeRetry400(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostAsyncRelativeRetry400Request(product); _pipeline.Send(message, cancellationToken); + var headers = new LrosaDsPostAsyncRelativeRetry400Headers(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -598,14 +612,15 @@ internal HttpMessage CreatePutAsyncRelativeRetryNoStatusRequest(Product product) /// Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public async Task PutAsyncRelativeRetryNoStatusAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PutAsyncRelativeRetryNoStatusAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncRelativeRetryNoStatusRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LrosaDsPutAsyncRelativeRetryNoStatusHeaders(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -614,14 +629,15 @@ public async Task PutAsyncRelativeRetryNoStatusAsync(Product product = /// Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public Response PutAsyncRelativeRetryNoStatus(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PutAsyncRelativeRetryNoStatus(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncRelativeRetryNoStatusRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LrosaDsPutAsyncRelativeRetryNoStatusHeaders(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -649,14 +665,15 @@ internal HttpMessage CreatePutAsyncRelativeRetryNoStatusPayloadRequest(Product p /// Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public async Task PutAsyncRelativeRetryNoStatusPayloadAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PutAsyncRelativeRetryNoStatusPayloadAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncRelativeRetryNoStatusPayloadRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LrosaDsPutAsyncRelativeRetryNoStatusPayloadHeaders(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -665,14 +682,15 @@ public async Task PutAsyncRelativeRetryNoStatusPayloadAsync(Product pr /// Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public Response PutAsyncRelativeRetryNoStatusPayload(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PutAsyncRelativeRetryNoStatusPayload(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncRelativeRetryNoStatusPayloadRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LrosaDsPutAsyncRelativeRetryNoStatusPayloadHeaders(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -734,14 +752,15 @@ internal HttpMessage CreateDeleteAsyncRelativeRetryNoStatusRequest() /// Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// The cancellation token to use. - public async Task DeleteAsyncRelativeRetryNoStatusAsync(CancellationToken cancellationToken = default) + public async Task> DeleteAsyncRelativeRetryNoStatusAsync(CancellationToken cancellationToken = default) { using var message = CreateDeleteAsyncRelativeRetryNoStatusRequest(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LrosaDsDeleteAsyncRelativeRetryNoStatusHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -749,14 +768,15 @@ public async Task DeleteAsyncRelativeRetryNoStatusAsync(CancellationTo /// Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// The cancellation token to use. - public Response DeleteAsyncRelativeRetryNoStatus(CancellationToken cancellationToken = default) + public ResponseWithHeaders DeleteAsyncRelativeRetryNoStatus(CancellationToken cancellationToken = default) { using var message = CreateDeleteAsyncRelativeRetryNoStatusRequest(); _pipeline.Send(message, cancellationToken); + var headers = new LrosaDsDeleteAsyncRelativeRetryNoStatusHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -784,14 +804,15 @@ internal HttpMessage CreatePost202NoLocationRequest(Product product) /// Long running post request, service returns a 202 to the initial request, without a location header. /// Product to put. /// The cancellation token to use. - public async Task Post202NoLocationAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> Post202NoLocationAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePost202NoLocationRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LrosaDsPost202NoLocationHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -800,14 +821,15 @@ public async Task Post202NoLocationAsync(Product product = null, Cance /// Long running post request, service returns a 202 to the initial request, without a location header. /// Product to put. /// The cancellation token to use. - public Response Post202NoLocation(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders Post202NoLocation(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePost202NoLocationRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LrosaDsPost202NoLocationHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -835,14 +857,15 @@ internal HttpMessage CreatePostAsyncRelativeRetryNoPayloadRequest(Product produc /// Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public async Task PostAsyncRelativeRetryNoPayloadAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PostAsyncRelativeRetryNoPayloadAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostAsyncRelativeRetryNoPayloadRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LrosaDsPostAsyncRelativeRetryNoPayloadHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -851,14 +874,15 @@ public async Task PostAsyncRelativeRetryNoPayloadAsync(Product product /// Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public Response PostAsyncRelativeRetryNoPayload(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PostAsyncRelativeRetryNoPayload(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostAsyncRelativeRetryNoPayloadRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LrosaDsPostAsyncRelativeRetryNoPayloadHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -939,14 +963,15 @@ internal HttpMessage CreatePutAsyncRelativeRetryInvalidHeaderRequest(Product pro /// Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. /// Product to put. /// The cancellation token to use. - public async Task PutAsyncRelativeRetryInvalidHeaderAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PutAsyncRelativeRetryInvalidHeaderAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncRelativeRetryInvalidHeaderRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LrosaDsPutAsyncRelativeRetryInvalidHeaderHeaders(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -955,14 +980,15 @@ public async Task PutAsyncRelativeRetryInvalidHeaderAsync(Product prod /// Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. /// Product to put. /// The cancellation token to use. - public Response PutAsyncRelativeRetryInvalidHeader(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PutAsyncRelativeRetryInvalidHeader(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncRelativeRetryInvalidHeaderRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LrosaDsPutAsyncRelativeRetryInvalidHeaderHeaders(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -990,14 +1016,15 @@ internal HttpMessage CreatePutAsyncRelativeRetryInvalidJsonPollingRequest(Produc /// Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public async Task PutAsyncRelativeRetryInvalidJsonPollingAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PutAsyncRelativeRetryInvalidJsonPollingAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncRelativeRetryInvalidJsonPollingRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LrosaDsPutAsyncRelativeRetryInvalidJsonPollingHeaders(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1006,14 +1033,15 @@ public async Task PutAsyncRelativeRetryInvalidJsonPollingAsync(Product /// Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public Response PutAsyncRelativeRetryInvalidJsonPolling(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PutAsyncRelativeRetryInvalidJsonPolling(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePutAsyncRelativeRetryInvalidJsonPollingRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LrosaDsPutAsyncRelativeRetryInvalidJsonPollingHeaders(message.Response); switch (message.Response.Status) { case 200: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1033,14 +1061,15 @@ internal HttpMessage CreateDelete202RetryInvalidHeaderRequest() /// Long running delete request, service returns a 202 to the initial request receing a reponse with an invalid 'Location' and 'Retry-After' headers. /// The cancellation token to use. - public async Task Delete202RetryInvalidHeaderAsync(CancellationToken cancellationToken = default) + public async Task> Delete202RetryInvalidHeaderAsync(CancellationToken cancellationToken = default) { using var message = CreateDelete202RetryInvalidHeaderRequest(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LrosaDsDelete202RetryInvalidHeaderHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1048,14 +1077,15 @@ public async Task Delete202RetryInvalidHeaderAsync(CancellationToken c /// Long running delete request, service returns a 202 to the initial request receing a reponse with an invalid 'Location' and 'Retry-After' headers. /// The cancellation token to use. - public Response Delete202RetryInvalidHeader(CancellationToken cancellationToken = default) + public ResponseWithHeaders Delete202RetryInvalidHeader(CancellationToken cancellationToken = default) { using var message = CreateDelete202RetryInvalidHeaderRequest(); _pipeline.Send(message, cancellationToken); + var headers = new LrosaDsDelete202RetryInvalidHeaderHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1075,14 +1105,15 @@ internal HttpMessage CreateDeleteAsyncRelativeRetryInvalidHeaderRequest() /// Long running delete request, service returns a 202 to the initial request. The endpoint indicated in the Azure-AsyncOperation header is invalid. /// The cancellation token to use. - public async Task DeleteAsyncRelativeRetryInvalidHeaderAsync(CancellationToken cancellationToken = default) + public async Task> DeleteAsyncRelativeRetryInvalidHeaderAsync(CancellationToken cancellationToken = default) { using var message = CreateDeleteAsyncRelativeRetryInvalidHeaderRequest(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LrosaDsDeleteAsyncRelativeRetryInvalidHeaderHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1090,14 +1121,15 @@ public async Task DeleteAsyncRelativeRetryInvalidHeaderAsync(Cancellat /// Long running delete request, service returns a 202 to the initial request. The endpoint indicated in the Azure-AsyncOperation header is invalid. /// The cancellation token to use. - public Response DeleteAsyncRelativeRetryInvalidHeader(CancellationToken cancellationToken = default) + public ResponseWithHeaders DeleteAsyncRelativeRetryInvalidHeader(CancellationToken cancellationToken = default) { using var message = CreateDeleteAsyncRelativeRetryInvalidHeaderRequest(); _pipeline.Send(message, cancellationToken); + var headers = new LrosaDsDeleteAsyncRelativeRetryInvalidHeaderHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1117,14 +1149,15 @@ internal HttpMessage CreateDeleteAsyncRelativeRetryInvalidJsonPollingRequest() /// Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// The cancellation token to use. - public async Task DeleteAsyncRelativeRetryInvalidJsonPollingAsync(CancellationToken cancellationToken = default) + public async Task> DeleteAsyncRelativeRetryInvalidJsonPollingAsync(CancellationToken cancellationToken = default) { using var message = CreateDeleteAsyncRelativeRetryInvalidJsonPollingRequest(); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LrosaDsDeleteAsyncRelativeRetryInvalidJsonPollingHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1132,14 +1165,15 @@ public async Task DeleteAsyncRelativeRetryInvalidJsonPollingAsync(Canc /// Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// The cancellation token to use. - public Response DeleteAsyncRelativeRetryInvalidJsonPolling(CancellationToken cancellationToken = default) + public ResponseWithHeaders DeleteAsyncRelativeRetryInvalidJsonPolling(CancellationToken cancellationToken = default) { using var message = CreateDeleteAsyncRelativeRetryInvalidJsonPollingRequest(); _pipeline.Send(message, cancellationToken); + var headers = new LrosaDsDeleteAsyncRelativeRetryInvalidJsonPollingHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1167,14 +1201,15 @@ internal HttpMessage CreatePost202RetryInvalidHeaderRequest(Product product) /// Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. /// Product to put. /// The cancellation token to use. - public async Task Post202RetryInvalidHeaderAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> Post202RetryInvalidHeaderAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePost202RetryInvalidHeaderRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LrosaDsPost202RetryInvalidHeaderHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1183,14 +1218,15 @@ public async Task Post202RetryInvalidHeaderAsync(Product product = nul /// Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. /// Product to put. /// The cancellation token to use. - public Response Post202RetryInvalidHeader(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders Post202RetryInvalidHeader(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePost202RetryInvalidHeaderRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LrosaDsPost202RetryInvalidHeaderHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1218,14 +1254,15 @@ internal HttpMessage CreatePostAsyncRelativeRetryInvalidHeaderRequest(Product pr /// Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. /// Product to put. /// The cancellation token to use. - public async Task PostAsyncRelativeRetryInvalidHeaderAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PostAsyncRelativeRetryInvalidHeaderAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostAsyncRelativeRetryInvalidHeaderRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LrosaDsPostAsyncRelativeRetryInvalidHeaderHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1234,14 +1271,15 @@ public async Task PostAsyncRelativeRetryInvalidHeaderAsync(Product pro /// Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. /// Product to put. /// The cancellation token to use. - public Response PostAsyncRelativeRetryInvalidHeader(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PostAsyncRelativeRetryInvalidHeader(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostAsyncRelativeRetryInvalidHeaderRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LrosaDsPostAsyncRelativeRetryInvalidHeaderHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1269,14 +1307,15 @@ internal HttpMessage CreatePostAsyncRelativeRetryInvalidJsonPollingRequest(Produ /// Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public async Task PostAsyncRelativeRetryInvalidJsonPollingAsync(Product product = null, CancellationToken cancellationToken = default) + public async Task> PostAsyncRelativeRetryInvalidJsonPollingAsync(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostAsyncRelativeRetryInvalidJsonPollingRequest(product); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new LrosaDsPostAsyncRelativeRetryInvalidJsonPollingHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1285,14 +1324,15 @@ public async Task PostAsyncRelativeRetryInvalidJsonPollingAsync(Produc /// Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. /// Product to put. /// The cancellation token to use. - public Response PostAsyncRelativeRetryInvalidJsonPolling(Product product = null, CancellationToken cancellationToken = default) + public ResponseWithHeaders PostAsyncRelativeRetryInvalidJsonPolling(Product product = null, CancellationToken cancellationToken = default) { using var message = CreatePostAsyncRelativeRetryInvalidJsonPollingRequest(product); _pipeline.Send(message, cancellationToken); + var headers = new LrosaDsPostAsyncRelativeRetryInvalidJsonPollingHeaders(message.Response); switch (message.Response.Status) { case 202: - return message.Response; + return ResponseWithHeaders.FromValue(headers, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); }