This commit is contained in:
Michael Yanni 2020-05-01 15:56:12 -07:00
Родитель e693ecda7c
Коммит e2874797e4
11 изменённых файлов: 2163 добавлений и 2161 удалений

Просмотреть файл

@ -188,7 +188,17 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<CopyOperationResult>> GetCustomModelCopyResultAsync(Guid modelId, Guid resultId, CancellationToken cancellationToken = default)
{
return await RestClient.GetCustomModelCopyResultAsync(modelId, resultId, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetCustomModelCopyResult");
scope.Start();
try
{
return await RestClient.GetCustomModelCopyResultAsync(modelId, resultId, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Obtain current status and the result of a custom model copy operation. </summary>
@ -197,21 +207,51 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<CopyOperationResult> GetCustomModelCopyResult(Guid modelId, Guid resultId, CancellationToken cancellationToken = default)
{
return RestClient.GetCustomModelCopyResult(modelId, resultId, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetCustomModelCopyResult");
scope.Start();
try
{
return RestClient.GetCustomModelCopyResult(modelId, resultId, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Generate authorization to copy a model into the target Form Recognizer resource. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<CopyAuthorizationResult>> GenerateModelCopyAuthorizationAsync(CancellationToken cancellationToken = default)
{
return await RestClient.GenerateModelCopyAuthorizationAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GenerateModelCopyAuthorization");
scope.Start();
try
{
return await RestClient.GenerateModelCopyAuthorizationAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Generate authorization to copy a model into the target Form Recognizer resource. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<CopyAuthorizationResult> GenerateModelCopyAuthorization(CancellationToken cancellationToken = default)
{
return RestClient.GenerateModelCopyAuthorization(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GenerateModelCopyAuthorization");
scope.Start();
try
{
return RestClient.GenerateModelCopyAuthorization(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Track the progress and obtain the result of the analyze receipt operation. </summary>
@ -521,7 +561,7 @@ namespace Azure.AI.FormRecognizer
throw new ArgumentNullException(nameof(createOriginalHttpMessage));
}
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Post, "ServiceClient.CopyCustomModel", OperationFinalStateVia.Location, createOriginalHttpMessage);
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Post, "ServiceClient.StartCopyCustomModel", OperationFinalStateVia.Location, createOriginalHttpMessage);
}
/// <summary> Copy custom model stored in this resource (the source) to user specified target Form Recognizer resource. </summary>
@ -535,8 +575,18 @@ namespace Azure.AI.FormRecognizer
throw new ArgumentNullException(nameof(copyRequest));
}
var originalResponse = await RestClient.CopyCustomModelAsync(modelId, copyRequest, cancellationToken).ConfigureAwait(false);
return CreateCopyCustomModel(originalResponse, () => RestClient.CreateCopyCustomModelRequest(modelId, copyRequest));
using var scope = _clientDiagnostics.CreateScope("ServiceClient.StartCopyCustomModel");
scope.Start();
try
{
var originalResponse = await RestClient.CopyCustomModelAsync(modelId, copyRequest, cancellationToken).ConfigureAwait(false);
return CreateCopyCustomModel(originalResponse, () => RestClient.CreateCopyCustomModelRequest(modelId, copyRequest));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Copy custom model stored in this resource (the source) to user specified target Form Recognizer resource. </summary>
@ -550,8 +600,18 @@ namespace Azure.AI.FormRecognizer
throw new ArgumentNullException(nameof(copyRequest));
}
var originalResponse = RestClient.CopyCustomModel(modelId, copyRequest, cancellationToken);
return CreateCopyCustomModel(originalResponse, () => RestClient.CreateCopyCustomModelRequest(modelId, copyRequest));
using var scope = _clientDiagnostics.CreateScope("ServiceClient.StartCopyCustomModel");
scope.Start();
try
{
var originalResponse = RestClient.CopyCustomModel(modelId, copyRequest, cancellationToken);
return CreateCopyCustomModel(originalResponse, () => RestClient.CreateCopyCustomModelRequest(modelId, copyRequest));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Extract field text and semantic values from a given receipt document. The input document must be of one of the supported content types - &apos;application/pdf&apos;, &apos;image/jpeg&apos;, &apos;image/png&apos; or &apos;image/tiff&apos;. Alternatively, use &apos;application/json&apos; type to specify the location (Uri or local path) of the document to be analyzed. </summary>

Просмотреть файл

@ -454,24 +454,14 @@ namespace Azure.AI.FormRecognizer
throw new ArgumentNullException(nameof(copyRequest));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.CopyCustomModel");
scope.Start();
try
using var message = CreateCopyCustomModelRequest(modelId, copyRequest);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCopyCustomModelRequest(modelId, copyRequest);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 202:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 202:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -486,24 +476,14 @@ namespace Azure.AI.FormRecognizer
throw new ArgumentNullException(nameof(copyRequest));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.CopyCustomModel");
scope.Start();
try
using var message = CreateCopyCustomModelRequest(modelId, copyRequest);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCopyCustomModelRequest(modelId, copyRequest);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 202:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 202:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -529,36 +509,26 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response<CopyOperationResult>> GetCustomModelCopyResultAsync(Guid modelId, Guid resultId, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetCustomModelCopyResult");
scope.Start();
try
using var message = CreateGetCustomModelCopyResultRequest(modelId, resultId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetCustomModelCopyResultRequest(modelId, resultId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
CopyOperationResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
CopyOperationResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = CopyOperationResult.DeserializeCopyOperationResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
value = null;
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
else
{
value = CopyOperationResult.DeserializeCopyOperationResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -568,36 +538,26 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response<CopyOperationResult> GetCustomModelCopyResult(Guid modelId, Guid resultId, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetCustomModelCopyResult");
scope.Start();
try
using var message = CreateGetCustomModelCopyResultRequest(modelId, resultId);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetCustomModelCopyResultRequest(modelId, resultId);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
CopyOperationResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
CopyOperationResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = CopyOperationResult.DeserializeCopyOperationResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
value = null;
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
else
{
value = CopyOperationResult.DeserializeCopyOperationResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -618,37 +578,27 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<ResponseWithHeaders<CopyAuthorizationResult, ServiceGenerateModelCopyAuthorizationHeaders>> GenerateModelCopyAuthorizationAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GenerateModelCopyAuthorization");
scope.Start();
try
using var message = CreateGenerateModelCopyAuthorizationRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new ServiceGenerateModelCopyAuthorizationHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateGenerateModelCopyAuthorizationRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new ServiceGenerateModelCopyAuthorizationHeaders(message.Response);
switch (message.Response.Status)
{
case 201:
case 201:
{
CopyAuthorizationResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
CopyAuthorizationResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = CopyAuthorizationResult.DeserializeCopyAuthorizationResult(document.RootElement);
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
value = null;
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
else
{
value = CopyAuthorizationResult.DeserializeCopyAuthorizationResult(document.RootElement);
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -656,37 +606,27 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public ResponseWithHeaders<CopyAuthorizationResult, ServiceGenerateModelCopyAuthorizationHeaders> GenerateModelCopyAuthorization(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GenerateModelCopyAuthorization");
scope.Start();
try
using var message = CreateGenerateModelCopyAuthorizationRequest();
_pipeline.Send(message, cancellationToken);
var headers = new ServiceGenerateModelCopyAuthorizationHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateGenerateModelCopyAuthorizationRequest();
_pipeline.Send(message, cancellationToken);
var headers = new ServiceGenerateModelCopyAuthorizationHeaders(message.Response);
switch (message.Response.Status)
{
case 201:
case 201:
{
CopyAuthorizationResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
CopyAuthorizationResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = CopyAuthorizationResult.DeserializeCopyAuthorizationResult(document.RootElement);
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
value = null;
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
else
{
value = CopyAuthorizationResult.DeserializeCopyAuthorizationResult(document.RootElement);
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}

Просмотреть файл

@ -47,7 +47,7 @@ namespace Azure.Management.Storage
scope.Start();
try
{
return await RestClient.CreateAsync(resourceGroupName, accountName, shareName, metadata, shareQuota, cancellationToken).ConfigureAwait(false);
return await RestClient.CreateAsync(resourceGroupName, accountName, shareName, fileShare, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
@ -68,7 +68,7 @@ namespace Azure.Management.Storage
scope.Start();
try
{
return RestClient.Create(resourceGroupName, accountName, shareName, metadata, shareQuota, cancellationToken);
return RestClient.Create(resourceGroupName, accountName, shareName, fileShare, cancellationToken);
}
catch (Exception e)
{
@ -89,7 +89,7 @@ namespace Azure.Management.Storage
scope.Start();
try
{
return await RestClient.UpdateAsync(resourceGroupName, accountName, shareName, metadata, shareQuota, cancellationToken).ConfigureAwait(false);
return await RestClient.UpdateAsync(resourceGroupName, accountName, shareName, fileShare, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
@ -110,7 +110,7 @@ namespace Azure.Management.Storage
scope.Start();
try
{
return RestClient.Update(resourceGroupName, accountName, shareName, metadata, shareQuota, cancellationToken);
return RestClient.Update(resourceGroupName, accountName, shareName, fileShare, cancellationToken);
}
catch (Exception e)
{
@ -208,7 +208,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> RestoreAsync(string resourceGroupName, string accountName, string shareName, string deletedShareName, string deletedShareVersion, CancellationToken cancellationToken = default)
{
return await RestClient.RestoreAsync(resourceGroupName, accountName, shareName, deletedShareName, deletedShareVersion, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.Restore");
scope.Start();
try
{
return await RestClient.RestoreAsync(resourceGroupName, accountName, shareName, deletedShareName, deletedShareVersion, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Restore a file share within a valid retention days if share soft delete is enabled. </summary>
@ -220,7 +230,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response Restore(string resourceGroupName, string accountName, string shareName, string deletedShareName, string deletedShareVersion, CancellationToken cancellationToken = default)
{
return RestClient.Restore(resourceGroupName, accountName, shareName, deletedShareName, deletedShareVersion, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.Restore");
scope.Start();
try
{
return RestClient.Restore(resourceGroupName, accountName, shareName, deletedShareName, deletedShareVersion, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Lists all shares. </summary>

Просмотреть файл

@ -204,7 +204,7 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(fileShare));
}
using var message = CreateCreateRequest(resourceGroupName, accountName, shareName, metadata, shareQuota);
using var message = CreateCreateRequest(resourceGroupName, accountName, shareName, fileShare);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
@ -253,7 +253,7 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(fileShare));
}
using var message = CreateCreateRequest(resourceGroupName, accountName, shareName, metadata, shareQuota);
using var message = CreateCreateRequest(resourceGroupName, accountName, shareName, fileShare);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
@ -326,7 +326,7 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(fileShare));
}
using var message = CreateUpdateRequest(resourceGroupName, accountName, shareName, metadata, shareQuota);
using var message = CreateUpdateRequest(resourceGroupName, accountName, shareName, fileShare);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
@ -374,7 +374,7 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(fileShare));
}
using var message = CreateUpdateRequest(resourceGroupName, accountName, shareName, metadata, shareQuota);
using var message = CreateUpdateRequest(resourceGroupName, accountName, shareName, fileShare);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
@ -644,24 +644,14 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(deletedShareVersion));
}
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.Restore");
scope.Start();
try
using var message = CreateRestoreRequest(resourceGroupName, accountName, shareName, deletedShareName, deletedShareVersion);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateRestoreRequest(resourceGroupName, accountName, shareName, deletedShareName, deletedShareVersion);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 200:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -695,24 +685,14 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(deletedShareVersion));
}
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.Restore");
scope.Start();
try
using var message = CreateRestoreRequest(resourceGroupName, accountName, shareName, deletedShareName, deletedShareVersion);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateRestoreRequest(resourceGroupName, accountName, shareName, deletedShareName, deletedShareVersion);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 200:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}

Просмотреть файл

@ -42,7 +42,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<ObjectReplicationPolicy>> GetAsync(string resourceGroupName, string accountName, string objectReplicationPolicyId, CancellationToken cancellationToken = default)
{
return await RestClient.GetAsync(resourceGroupName, accountName, objectReplicationPolicyId, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesClient.Get");
scope.Start();
try
{
return await RestClient.GetAsync(resourceGroupName, accountName, objectReplicationPolicyId, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get the object replication policy of the storage account by policy ID. </summary>
@ -52,7 +62,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<ObjectReplicationPolicy> Get(string resourceGroupName, string accountName, string objectReplicationPolicyId, CancellationToken cancellationToken = default)
{
return RestClient.Get(resourceGroupName, accountName, objectReplicationPolicyId, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesClient.Get");
scope.Start();
try
{
return RestClient.Get(resourceGroupName, accountName, objectReplicationPolicyId, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create or update the object replication policy of the storage account. </summary>
@ -63,7 +83,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<ObjectReplicationPolicy>> CreateOrUpdateAsync(string resourceGroupName, string accountName, string objectReplicationPolicyId, ObjectReplicationPolicy properties, CancellationToken cancellationToken = default)
{
return await RestClient.CreateOrUpdateAsync(resourceGroupName, accountName, objectReplicationPolicyId, properties, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesClient.CreateOrUpdate");
scope.Start();
try
{
return await RestClient.CreateOrUpdateAsync(resourceGroupName, accountName, objectReplicationPolicyId, properties, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create or update the object replication policy of the storage account. </summary>
@ -74,7 +104,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<ObjectReplicationPolicy> CreateOrUpdate(string resourceGroupName, string accountName, string objectReplicationPolicyId, ObjectReplicationPolicy properties, CancellationToken cancellationToken = default)
{
return RestClient.CreateOrUpdate(resourceGroupName, accountName, objectReplicationPolicyId, properties, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesClient.CreateOrUpdate");
scope.Start();
try
{
return RestClient.CreateOrUpdate(resourceGroupName, accountName, objectReplicationPolicyId, properties, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes the object replication policy associated with the specified storage account. </summary>
@ -84,7 +124,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> DeleteAsync(string resourceGroupName, string accountName, string objectReplicationPolicyId, CancellationToken cancellationToken = default)
{
return await RestClient.DeleteAsync(resourceGroupName, accountName, objectReplicationPolicyId, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesClient.Delete");
scope.Start();
try
{
return await RestClient.DeleteAsync(resourceGroupName, accountName, objectReplicationPolicyId, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes the object replication policy associated with the specified storage account. </summary>
@ -94,7 +144,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response Delete(string resourceGroupName, string accountName, string objectReplicationPolicyId, CancellationToken cancellationToken = default)
{
return RestClient.Delete(resourceGroupName, accountName, objectReplicationPolicyId, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesClient.Delete");
scope.Start();
try
{
return RestClient.Delete(resourceGroupName, accountName, objectReplicationPolicyId, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> List the object replication policies associated with the storage account. </summary>
@ -114,8 +174,18 @@ namespace Azure.Management.Storage
async Task<Page<ObjectReplicationPolicy>> FirstPageFunc(int? pageSizeHint)
{
var response = await RestClient.ListAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesClient.List");
scope.Start();
try
{
var response = await RestClient.ListAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
}
@ -137,8 +207,18 @@ namespace Azure.Management.Storage
Page<ObjectReplicationPolicy> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.List(resourceGroupName, accountName, cancellationToken);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesClient.List");
scope.Start();
try
{
var response = RestClient.List(resourceGroupName, accountName, cancellationToken);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
}

Просмотреть файл

@ -81,36 +81,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesClient.List");
scope.Start();
try
using var message = CreateListRequest(resourceGroupName, accountName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListRequest(resourceGroupName, accountName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
ObjectReplicationPolicies value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ObjectReplicationPolicies value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = ObjectReplicationPolicies.DeserializeObjectReplicationPolicies(document.RootElement);
}
return Response.FromValue(value, message.Response);
value = null;
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
else
{
value = ObjectReplicationPolicies.DeserializeObjectReplicationPolicies(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -129,36 +119,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesClient.List");
scope.Start();
try
using var message = CreateListRequest(resourceGroupName, accountName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListRequest(resourceGroupName, accountName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
ObjectReplicationPolicies value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ObjectReplicationPolicies value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = ObjectReplicationPolicies.DeserializeObjectReplicationPolicies(document.RootElement);
}
return Response.FromValue(value, message.Response);
value = null;
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
else
{
value = ObjectReplicationPolicies.DeserializeObjectReplicationPolicies(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -202,36 +182,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(objectReplicationPolicyId));
}
using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesClient.Get");
scope.Start();
try
using var message = CreateGetRequest(resourceGroupName, accountName, objectReplicationPolicyId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetRequest(resourceGroupName, accountName, objectReplicationPolicyId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
ObjectReplicationPolicy value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ObjectReplicationPolicy value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = ObjectReplicationPolicy.DeserializeObjectReplicationPolicy(document.RootElement);
}
return Response.FromValue(value, message.Response);
value = null;
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
else
{
value = ObjectReplicationPolicy.DeserializeObjectReplicationPolicy(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -255,36 +225,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(objectReplicationPolicyId));
}
using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesClient.Get");
scope.Start();
try
using var message = CreateGetRequest(resourceGroupName, accountName, objectReplicationPolicyId);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetRequest(resourceGroupName, accountName, objectReplicationPolicyId);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
ObjectReplicationPolicy value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ObjectReplicationPolicy value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = ObjectReplicationPolicy.DeserializeObjectReplicationPolicy(document.RootElement);
}
return Response.FromValue(value, message.Response);
value = null;
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
else
{
value = ObjectReplicationPolicy.DeserializeObjectReplicationPolicy(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -337,36 +297,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(properties));
}
using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesClient.CreateOrUpdate");
scope.Start();
try
using var message = CreateCreateOrUpdateRequest(resourceGroupName, accountName, objectReplicationPolicyId, properties);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateOrUpdateRequest(resourceGroupName, accountName, objectReplicationPolicyId, properties);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
ObjectReplicationPolicy value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ObjectReplicationPolicy value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = ObjectReplicationPolicy.DeserializeObjectReplicationPolicy(document.RootElement);
}
return Response.FromValue(value, message.Response);
value = null;
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
else
{
value = ObjectReplicationPolicy.DeserializeObjectReplicationPolicy(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -395,36 +345,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(properties));
}
using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesClient.CreateOrUpdate");
scope.Start();
try
using var message = CreateCreateOrUpdateRequest(resourceGroupName, accountName, objectReplicationPolicyId, properties);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateOrUpdateRequest(resourceGroupName, accountName, objectReplicationPolicyId, properties);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
ObjectReplicationPolicy value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ObjectReplicationPolicy value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = ObjectReplicationPolicy.DeserializeObjectReplicationPolicy(document.RootElement);
}
return Response.FromValue(value, message.Response);
value = null;
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
else
{
value = ObjectReplicationPolicy.DeserializeObjectReplicationPolicy(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -468,25 +408,15 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(objectReplicationPolicyId));
}
using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(resourceGroupName, accountName, objectReplicationPolicyId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(resourceGroupName, accountName, objectReplicationPolicyId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 204:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 200:
case 204:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -510,25 +440,15 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(objectReplicationPolicyId));
}
using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(resourceGroupName, accountName, objectReplicationPolicyId);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(resourceGroupName, accountName, objectReplicationPolicyId);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 204:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 200:
case 204:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

Просмотреть файл

@ -625,7 +625,7 @@ namespace Azure.Storage.Tables
var headers = new TableInternalUpdateEntityHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
case 204:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
@ -661,7 +661,7 @@ namespace Azure.Storage.Tables
var headers = new TableInternalUpdateEntityHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
case 204:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);

25
samples/SignalR/SignalR/Generated/HealthApiClient.cs сгенерированный
Просмотреть файл

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -34,14 +35,34 @@ namespace SignalR
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> HeadIndexAsync(CancellationToken cancellationToken = default)
{
return await RestClient.HeadIndexAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("HealthApiClient.HeadIndex");
scope.Start();
try
{
return await RestClient.HeadIndexAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get service health status. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response HeadIndex(CancellationToken cancellationToken = default)
{
return RestClient.HeadIndex(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("HealthApiClient.HeadIndex");
scope.Start();
try
{
return RestClient.HeadIndex(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

Просмотреть файл

@ -49,25 +49,15 @@ namespace SignalR
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> HeadIndexAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("HealthApiClient.HeadIndex");
scope.Start();
try
using var message = CreateHeadIndexRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateHeadIndexRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 503:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 200:
case 503:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -75,25 +65,15 @@ namespace SignalR
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response HeadIndex(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("HealthApiClient.HeadIndex");
scope.Start();
try
using var message = CreateHeadIndexRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateHeadIndexRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 503:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 200:
case 503:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу