Merge branch 'feature/v3' into update-samples-and-smoke-tests

# Conflicts:
#	samples/Azure.Management.Storage/Azure.Management.Storage/Generated/FileSharesClient.cs
#	samples/Azure.Management.Storage/Azure.Management.Storage/Generated/FileSharesRestClient.cs
#	samples/Azure.Storage.Tables/Azure.Storage.Tables/Generated/TableInternalRestClient.cs
#	samples/SignalR/SignalR/Generated/ServiceClient.cs
#	samples/SignalR/SignalR/Generated/ServiceRestClient.cs
This commit is contained in:
Michael Yanni 2020-05-01 15:35:00 -07:00
Родитель 4b6467a9ad 58ca9f34e1
Коммит e693ecda7c
210 изменённых файлов: 45777 добавлений и 45598 удалений

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@ -40,7 +41,17 @@ namespace AppConfiguration
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> CheckKeysAsync(string name = null, string after = null, string acceptDatetime = null, CancellationToken cancellationToken = default)
{
return (await RestClient.CheckKeysAsync(name, after, acceptDatetime, cancellationToken).ConfigureAwait(false)).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("ServiceClient.CheckKeys");
scope.Start();
try
{
return (await RestClient.CheckKeysAsync(name, after, acceptDatetime, cancellationToken).ConfigureAwait(false)).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Requests the headers and status of the given resource. </summary>
@ -50,7 +61,17 @@ namespace AppConfiguration
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response CheckKeys(string name = null, string after = null, string acceptDatetime = null, CancellationToken cancellationToken = default)
{
return RestClient.CheckKeys(name, after, acceptDatetime, cancellationToken).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("ServiceClient.CheckKeys");
scope.Start();
try
{
return RestClient.CheckKeys(name, after, acceptDatetime, cancellationToken).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Requests the headers and status of the given resource. </summary>
@ -62,7 +83,17 @@ namespace AppConfiguration
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> CheckKeyValuesAsync(string key = null, string label = null, string after = null, string acceptDatetime = null, IEnumerable<Head6ItemsItem> select = null, CancellationToken cancellationToken = default)
{
return (await RestClient.CheckKeyValuesAsync(key, label, after, acceptDatetime, select, cancellationToken).ConfigureAwait(false)).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("ServiceClient.CheckKeyValues");
scope.Start();
try
{
return (await RestClient.CheckKeyValuesAsync(key, label, after, acceptDatetime, select, cancellationToken).ConfigureAwait(false)).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Requests the headers and status of the given resource. </summary>
@ -74,7 +105,17 @@ namespace AppConfiguration
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response CheckKeyValues(string key = null, string label = null, string after = null, string acceptDatetime = null, IEnumerable<Head6ItemsItem> select = null, CancellationToken cancellationToken = default)
{
return RestClient.CheckKeyValues(key, label, after, acceptDatetime, select, cancellationToken).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("ServiceClient.CheckKeyValues");
scope.Start();
try
{
return RestClient.CheckKeyValues(key, label, after, acceptDatetime, select, cancellationToken).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets a single key-value. </summary>
@ -87,7 +128,17 @@ namespace AppConfiguration
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<KeyValue>> GetKeyValueAsync(string key, string label = null, string acceptDatetime = null, string ifMatch = null, string ifNoneMatch = null, IEnumerable<Get7ItemsItem> select = null, CancellationToken cancellationToken = default)
{
return await RestClient.GetKeyValueAsync(key, label, acceptDatetime, ifMatch, ifNoneMatch, select, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetKeyValue");
scope.Start();
try
{
return await RestClient.GetKeyValueAsync(key, label, acceptDatetime, ifMatch, ifNoneMatch, select, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets a single key-value. </summary>
@ -100,7 +151,17 @@ namespace AppConfiguration
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<KeyValue> GetKeyValue(string key, string label = null, string acceptDatetime = null, string ifMatch = null, string ifNoneMatch = null, IEnumerable<Get7ItemsItem> select = null, CancellationToken cancellationToken = default)
{
return RestClient.GetKeyValue(key, label, acceptDatetime, ifMatch, ifNoneMatch, select, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetKeyValue");
scope.Start();
try
{
return RestClient.GetKeyValue(key, label, acceptDatetime, ifMatch, ifNoneMatch, select, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a key-value. </summary>
@ -112,7 +173,17 @@ namespace AppConfiguration
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<KeyValue>> PutKeyValueAsync(string key, string label = null, string ifMatch = null, string ifNoneMatch = null, KeyValue entity = null, CancellationToken cancellationToken = default)
{
return await RestClient.PutKeyValueAsync(key, label, ifMatch, ifNoneMatch, entity, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.PutKeyValue");
scope.Start();
try
{
return await RestClient.PutKeyValueAsync(key, label, ifMatch, ifNoneMatch, entity, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a key-value. </summary>
@ -124,7 +195,17 @@ namespace AppConfiguration
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<KeyValue> PutKeyValue(string key, string label = null, string ifMatch = null, string ifNoneMatch = null, KeyValue entity = null, CancellationToken cancellationToken = default)
{
return RestClient.PutKeyValue(key, label, ifMatch, ifNoneMatch, entity, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.PutKeyValue");
scope.Start();
try
{
return RestClient.PutKeyValue(key, label, ifMatch, ifNoneMatch, entity, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes a key-value. </summary>
@ -134,7 +215,17 @@ namespace AppConfiguration
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<KeyValue>> DeleteKeyValueAsync(string key, string label = null, string ifMatch = null, CancellationToken cancellationToken = default)
{
return await RestClient.DeleteKeyValueAsync(key, label, ifMatch, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.DeleteKeyValue");
scope.Start();
try
{
return await RestClient.DeleteKeyValueAsync(key, label, ifMatch, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes a key-value. </summary>
@ -144,7 +235,17 @@ namespace AppConfiguration
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<KeyValue> DeleteKeyValue(string key, string label = null, string ifMatch = null, CancellationToken cancellationToken = default)
{
return RestClient.DeleteKeyValue(key, label, ifMatch, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.DeleteKeyValue");
scope.Start();
try
{
return RestClient.DeleteKeyValue(key, label, ifMatch, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Requests the headers and status of the given resource. </summary>
@ -157,7 +258,17 @@ namespace AppConfiguration
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> CheckKeyValueAsync(string key, string label = null, string acceptDatetime = null, string ifMatch = null, string ifNoneMatch = null, IEnumerable<Head7ItemsItem> select = null, CancellationToken cancellationToken = default)
{
return (await RestClient.CheckKeyValueAsync(key, label, acceptDatetime, ifMatch, ifNoneMatch, select, cancellationToken).ConfigureAwait(false)).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("ServiceClient.CheckKeyValue");
scope.Start();
try
{
return (await RestClient.CheckKeyValueAsync(key, label, acceptDatetime, ifMatch, ifNoneMatch, select, cancellationToken).ConfigureAwait(false)).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Requests the headers and status of the given resource. </summary>
@ -170,7 +281,17 @@ namespace AppConfiguration
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response CheckKeyValue(string key, string label = null, string acceptDatetime = null, string ifMatch = null, string ifNoneMatch = null, IEnumerable<Head7ItemsItem> select = null, CancellationToken cancellationToken = default)
{
return RestClient.CheckKeyValue(key, label, acceptDatetime, ifMatch, ifNoneMatch, select, cancellationToken).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("ServiceClient.CheckKeyValue");
scope.Start();
try
{
return RestClient.CheckKeyValue(key, label, acceptDatetime, ifMatch, ifNoneMatch, select, cancellationToken).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Requests the headers and status of the given resource. </summary>
@ -181,7 +302,17 @@ namespace AppConfiguration
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> CheckLabelsAsync(string name = null, string after = null, string acceptDatetime = null, IEnumerable<string> select = null, CancellationToken cancellationToken = default)
{
return (await RestClient.CheckLabelsAsync(name, after, acceptDatetime, select, cancellationToken).ConfigureAwait(false)).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("ServiceClient.CheckLabels");
scope.Start();
try
{
return (await RestClient.CheckLabelsAsync(name, after, acceptDatetime, select, cancellationToken).ConfigureAwait(false)).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Requests the headers and status of the given resource. </summary>
@ -192,7 +323,17 @@ namespace AppConfiguration
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response CheckLabels(string name = null, string after = null, string acceptDatetime = null, IEnumerable<string> select = null, CancellationToken cancellationToken = default)
{
return RestClient.CheckLabels(name, after, acceptDatetime, select, cancellationToken).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("ServiceClient.CheckLabels");
scope.Start();
try
{
return RestClient.CheckLabels(name, after, acceptDatetime, select, cancellationToken).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Locks a key-value. </summary>
@ -203,7 +344,17 @@ namespace AppConfiguration
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<KeyValue>> PutLockAsync(string key, string label = null, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default)
{
return await RestClient.PutLockAsync(key, label, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.PutLock");
scope.Start();
try
{
return await RestClient.PutLockAsync(key, label, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Locks a key-value. </summary>
@ -214,7 +365,17 @@ namespace AppConfiguration
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<KeyValue> PutLock(string key, string label = null, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default)
{
return RestClient.PutLock(key, label, ifMatch, ifNoneMatch, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.PutLock");
scope.Start();
try
{
return RestClient.PutLock(key, label, ifMatch, ifNoneMatch, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Unlocks a key-value. </summary>
@ -225,7 +386,17 @@ namespace AppConfiguration
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<KeyValue>> DeleteLockAsync(string key, string label = null, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default)
{
return await RestClient.DeleteLockAsync(key, label, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.DeleteLock");
scope.Start();
try
{
return await RestClient.DeleteLockAsync(key, label, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Unlocks a key-value. </summary>
@ -236,7 +407,17 @@ namespace AppConfiguration
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<KeyValue> DeleteLock(string key, string label = null, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default)
{
return RestClient.DeleteLock(key, label, ifMatch, ifNoneMatch, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.DeleteLock");
scope.Start();
try
{
return RestClient.DeleteLock(key, label, ifMatch, ifNoneMatch, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Requests the headers and status of the given resource. </summary>
@ -248,7 +429,17 @@ namespace AppConfiguration
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> CheckRevisionsAsync(string key = null, string label = null, string after = null, string acceptDatetime = null, IEnumerable<Enum5> select = null, CancellationToken cancellationToken = default)
{
return (await RestClient.CheckRevisionsAsync(key, label, after, acceptDatetime, select, cancellationToken).ConfigureAwait(false)).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("ServiceClient.CheckRevisions");
scope.Start();
try
{
return (await RestClient.CheckRevisionsAsync(key, label, after, acceptDatetime, select, cancellationToken).ConfigureAwait(false)).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Requests the headers and status of the given resource. </summary>
@ -260,7 +451,17 @@ namespace AppConfiguration
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response CheckRevisions(string key = null, string label = null, string after = null, string acceptDatetime = null, IEnumerable<Enum5> select = null, CancellationToken cancellationToken = default)
{
return RestClient.CheckRevisions(key, label, after, acceptDatetime, select, cancellationToken).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("ServiceClient.CheckRevisions");
scope.Start();
try
{
return RestClient.CheckRevisions(key, label, after, acceptDatetime, select, cancellationToken).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets a list of keys. </summary>
@ -272,13 +473,33 @@ namespace AppConfiguration
{
async Task<Page<Key>> FirstPageFunc(int? pageSizeHint)
{
var response = await RestClient.GetKeysAsync(name, after, acceptDatetime, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetKeys");
scope.Start();
try
{
var response = await RestClient.GetKeysAsync(name, after, acceptDatetime, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
async Task<Page<Key>> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = await RestClient.GetKeysNextPageAsync(nextLink, name, after, acceptDatetime, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetKeys");
scope.Start();
try
{
var response = await RestClient.GetKeysNextPageAsync(nextLink, name, after, acceptDatetime, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
}
@ -292,13 +513,33 @@ namespace AppConfiguration
{
Page<Key> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.GetKeys(name, after, acceptDatetime, cancellationToken);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetKeys");
scope.Start();
try
{
var response = RestClient.GetKeys(name, after, acceptDatetime, cancellationToken);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
Page<Key> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = RestClient.GetKeysNextPage(nextLink, name, after, acceptDatetime, cancellationToken);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetKeys");
scope.Start();
try
{
var response = RestClient.GetKeysNextPage(nextLink, name, after, acceptDatetime, cancellationToken);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
}
@ -314,13 +555,33 @@ namespace AppConfiguration
{
async Task<Page<KeyValue>> FirstPageFunc(int? pageSizeHint)
{
var response = await RestClient.GetKeyValuesAsync(key, label, after, acceptDatetime, select, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetKeyValues");
scope.Start();
try
{
var response = await RestClient.GetKeyValuesAsync(key, label, after, acceptDatetime, select, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
async Task<Page<KeyValue>> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = await RestClient.GetKeyValuesNextPageAsync(nextLink, key, label, after, acceptDatetime, select, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetKeyValues");
scope.Start();
try
{
var response = await RestClient.GetKeyValuesNextPageAsync(nextLink, key, label, after, acceptDatetime, select, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
}
@ -336,13 +597,33 @@ namespace AppConfiguration
{
Page<KeyValue> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.GetKeyValues(key, label, after, acceptDatetime, select, cancellationToken);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetKeyValues");
scope.Start();
try
{
var response = RestClient.GetKeyValues(key, label, after, acceptDatetime, select, cancellationToken);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
Page<KeyValue> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = RestClient.GetKeyValuesNextPage(nextLink, key, label, after, acceptDatetime, select, cancellationToken);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetKeyValues");
scope.Start();
try
{
var response = RestClient.GetKeyValuesNextPage(nextLink, key, label, after, acceptDatetime, select, cancellationToken);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
}
@ -357,13 +638,33 @@ namespace AppConfiguration
{
async Task<Page<Label>> FirstPageFunc(int? pageSizeHint)
{
var response = await RestClient.GetLabelsAsync(name, after, acceptDatetime, select, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetLabels");
scope.Start();
try
{
var response = await RestClient.GetLabelsAsync(name, after, acceptDatetime, select, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
async Task<Page<Label>> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = await RestClient.GetLabelsNextPageAsync(nextLink, name, after, acceptDatetime, select, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetLabels");
scope.Start();
try
{
var response = await RestClient.GetLabelsNextPageAsync(nextLink, name, after, acceptDatetime, select, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
}
@ -378,13 +679,33 @@ namespace AppConfiguration
{
Page<Label> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.GetLabels(name, after, acceptDatetime, select, cancellationToken);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetLabels");
scope.Start();
try
{
var response = RestClient.GetLabels(name, after, acceptDatetime, select, cancellationToken);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
Page<Label> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = RestClient.GetLabelsNextPage(nextLink, name, after, acceptDatetime, select, cancellationToken);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetLabels");
scope.Start();
try
{
var response = RestClient.GetLabelsNextPage(nextLink, name, after, acceptDatetime, select, cancellationToken);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
}
@ -400,13 +721,33 @@ namespace AppConfiguration
{
async Task<Page<KeyValue>> FirstPageFunc(int? pageSizeHint)
{
var response = await RestClient.GetRevisionsAsync(key, label, after, acceptDatetime, select, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetRevisions");
scope.Start();
try
{
var response = await RestClient.GetRevisionsAsync(key, label, after, acceptDatetime, select, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
async Task<Page<KeyValue>> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = await RestClient.GetRevisionsNextPageAsync(nextLink, key, label, after, acceptDatetime, select, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetRevisions");
scope.Start();
try
{
var response = await RestClient.GetRevisionsNextPageAsync(nextLink, key, label, after, acceptDatetime, select, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
}
@ -422,13 +763,33 @@ namespace AppConfiguration
{
Page<KeyValue> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.GetRevisions(key, label, after, acceptDatetime, select, cancellationToken);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetRevisions");
scope.Start();
try
{
var response = RestClient.GetRevisions(key, label, after, acceptDatetime, select, cancellationToken);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
Page<KeyValue> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = RestClient.GetRevisionsNextPage(nextLink, key, label, after, acceptDatetime, select, cancellationToken);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetRevisions");
scope.Start();
try
{
var response = RestClient.GetRevisionsNextPage(nextLink, key, label, after, acceptDatetime, select, cancellationToken);
return Page.FromValues(response.Value.Items, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
}

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

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

@ -39,7 +39,17 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> TrainCustomModelAsyncAsync(TrainRequest trainRequest, CancellationToken cancellationToken = default)
{
return (await RestClient.TrainCustomModelAsyncAsync(trainRequest, cancellationToken).ConfigureAwait(false)).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("ServiceClient.TrainCustomModelAsync");
scope.Start();
try
{
return (await RestClient.TrainCustomModelAsyncAsync(trainRequest, cancellationToken).ConfigureAwait(false)).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create and train a custom model. The request must include a source parameter that is either an externally accessible Azure storage blob container Uri (preferably a Shared Access Signature Uri) or valid path to a data folder in a locally mounted drive. When local paths are specified, they must follow the Linux/Unix path format and be an absolute path rooted to the input mount configuration setting value e.g., if &apos;{Mounts:Input}&apos; configuration setting value is &apos;/input&apos; then a valid source path would be &apos;/input/contosodataset&apos;. All data to be trained is expected to be under the source folder or sub folders under it. Models are trained using documents that are of the following content type - &apos;application/pdf&apos;, &apos;image/jpeg&apos;, &apos;image/png&apos;, &apos;image/tiff&apos;. Other type of content is ignored. </summary>
@ -47,7 +57,17 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response TrainCustomModelAsync(TrainRequest trainRequest, CancellationToken cancellationToken = default)
{
return RestClient.TrainCustomModelAsync(trainRequest, cancellationToken).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("ServiceClient.TrainCustomModelAsync");
scope.Start();
try
{
return RestClient.TrainCustomModelAsync(trainRequest, cancellationToken).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get detailed information about a custom model. </summary>
@ -56,7 +76,17 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<Model>> GetCustomModelAsync(Guid modelId, bool? includeKeys = null, CancellationToken cancellationToken = default)
{
return await RestClient.GetCustomModelAsync(modelId, includeKeys, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetCustomModel");
scope.Start();
try
{
return await RestClient.GetCustomModelAsync(modelId, includeKeys, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get detailed information about a custom model. </summary>
@ -65,7 +95,17 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<Model> GetCustomModel(Guid modelId, bool? includeKeys = null, CancellationToken cancellationToken = default)
{
return RestClient.GetCustomModel(modelId, includeKeys, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetCustomModel");
scope.Start();
try
{
return RestClient.GetCustomModel(modelId, includeKeys, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Mark model for deletion. Model artifacts will be permanently removed within a predetermined period. </summary>
@ -73,7 +113,17 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> DeleteCustomModelAsync(Guid modelId, CancellationToken cancellationToken = default)
{
return await RestClient.DeleteCustomModelAsync(modelId, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.DeleteCustomModel");
scope.Start();
try
{
return await RestClient.DeleteCustomModelAsync(modelId, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Mark model for deletion. Model artifacts will be permanently removed within a predetermined period. </summary>
@ -81,7 +131,17 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response DeleteCustomModel(Guid modelId, CancellationToken cancellationToken = default)
{
return RestClient.DeleteCustomModel(modelId, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.DeleteCustomModel");
scope.Start();
try
{
return RestClient.DeleteCustomModel(modelId, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Obtain current status and the result of the analyze form operation. </summary>
@ -90,7 +150,17 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<AnalyzeOperationResult>> GetAnalyzeFormResultAsync(Guid modelId, Guid resultId, CancellationToken cancellationToken = default)
{
return await RestClient.GetAnalyzeFormResultAsync(modelId, resultId, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetAnalyzeFormResult");
scope.Start();
try
{
return await RestClient.GetAnalyzeFormResultAsync(modelId, resultId, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Obtain current status and the result of the analyze form operation. </summary>
@ -99,7 +169,17 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<AnalyzeOperationResult> GetAnalyzeFormResult(Guid modelId, Guid resultId, CancellationToken cancellationToken = default)
{
return RestClient.GetAnalyzeFormResult(modelId, resultId, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetAnalyzeFormResult");
scope.Start();
try
{
return RestClient.GetAnalyzeFormResult(modelId, resultId, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Obtain current status and the result of a custom model copy operation. </summary>
@ -139,7 +219,17 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<AnalyzeOperationResult>> GetAnalyzeReceiptResultAsync(Guid resultId, CancellationToken cancellationToken = default)
{
return await RestClient.GetAnalyzeReceiptResultAsync(resultId, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetAnalyzeReceiptResult");
scope.Start();
try
{
return await RestClient.GetAnalyzeReceiptResultAsync(resultId, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Track the progress and obtain the result of the analyze receipt operation. </summary>
@ -147,7 +237,17 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<AnalyzeOperationResult> GetAnalyzeReceiptResult(Guid resultId, CancellationToken cancellationToken = default)
{
return RestClient.GetAnalyzeReceiptResult(resultId, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetAnalyzeReceiptResult");
scope.Start();
try
{
return RestClient.GetAnalyzeReceiptResult(resultId, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Track the progress and obtain the result of the analyze layout operation. </summary>
@ -155,7 +255,17 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<AnalyzeOperationResult>> GetAnalyzeLayoutResultAsync(Guid resultId, CancellationToken cancellationToken = default)
{
return await RestClient.GetAnalyzeLayoutResultAsync(resultId, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetAnalyzeLayoutResult");
scope.Start();
try
{
return await RestClient.GetAnalyzeLayoutResultAsync(resultId, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Track the progress and obtain the result of the analyze layout operation. </summary>
@ -163,21 +273,51 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<AnalyzeOperationResult> GetAnalyzeLayoutResult(Guid resultId, CancellationToken cancellationToken = default)
{
return RestClient.GetAnalyzeLayoutResult(resultId, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetAnalyzeLayoutResult");
scope.Start();
try
{
return RestClient.GetAnalyzeLayoutResult(resultId, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get information about all custom models. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<Models.Models>> GetCustomModelsAsync(CancellationToken cancellationToken = default)
{
return await RestClient.GetCustomModelsAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetCustomModels");
scope.Start();
try
{
return await RestClient.GetCustomModelsAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get information about all custom models. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<Models.Models> GetCustomModels(CancellationToken cancellationToken = default)
{
return RestClient.GetCustomModels(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetCustomModels");
scope.Start();
try
{
return RestClient.GetCustomModels(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get information about all custom models. </summary>
@ -186,13 +326,33 @@ namespace Azure.AI.FormRecognizer
{
async Task<Page<ModelInfo>> FirstPageFunc(int? pageSizeHint)
{
var response = await RestClient.ListCustomModelsAsync(cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.ModelList, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ServiceClient.ListCustomModels");
scope.Start();
try
{
var response = await RestClient.ListCustomModelsAsync(cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.ModelList, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
async Task<Page<ModelInfo>> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = await RestClient.ListCustomModelsNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.ModelList, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ServiceClient.ListCustomModels");
scope.Start();
try
{
var response = await RestClient.ListCustomModelsNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.ModelList, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
}
@ -203,13 +363,33 @@ namespace Azure.AI.FormRecognizer
{
Page<ModelInfo> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.ListCustomModels(cancellationToken);
return Page.FromValues(response.Value.ModelList, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ServiceClient.ListCustomModels");
scope.Start();
try
{
var response = RestClient.ListCustomModels(cancellationToken);
return Page.FromValues(response.Value.ModelList, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
Page<ModelInfo> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = RestClient.ListCustomModelsNextPage(nextLink, cancellationToken);
return Page.FromValues(response.Value.ModelList, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("ServiceClient.ListCustomModels");
scope.Start();
try
{
var response = RestClient.ListCustomModelsNextPage(nextLink, cancellationToken);
return Page.FromValues(response.Value.ModelList, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
}
@ -228,7 +408,7 @@ namespace Azure.AI.FormRecognizer
throw new ArgumentNullException(nameof(createOriginalHttpMessage));
}
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Post, "ServiceClient.AnalyzeWithCustomModel", OperationFinalStateVia.Location, createOriginalHttpMessage);
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Post, "ServiceClient.StartAnalyzeWithCustomModel", OperationFinalStateVia.Location, createOriginalHttpMessage);
}
/// <summary> Extract key-value pairs, tables, and semantic values from a given 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>
@ -244,8 +424,18 @@ namespace Azure.AI.FormRecognizer
throw new ArgumentNullException(nameof(fileStream));
}
var originalResponse = await RestClient.AnalyzeWithCustomModelAsync(modelId, contentType, fileStream, includeTextDetails, cancellationToken).ConfigureAwait(false);
return CreateAnalyzeWithCustomModel(originalResponse, () => RestClient.CreateAnalyzeWithCustomModelRequest(modelId, contentType, fileStream, includeTextDetails));
using var scope = _clientDiagnostics.CreateScope("ServiceClient.StartAnalyzeWithCustomModel");
scope.Start();
try
{
var originalResponse = await RestClient.AnalyzeWithCustomModelAsync(modelId, contentType, fileStream, includeTextDetails, cancellationToken).ConfigureAwait(false);
return CreateAnalyzeWithCustomModel(originalResponse, () => RestClient.CreateAnalyzeWithCustomModelRequest(modelId, contentType, fileStream, includeTextDetails));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Extract key-value pairs, tables, and semantic values from a given 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>
@ -261,8 +451,18 @@ namespace Azure.AI.FormRecognizer
throw new ArgumentNullException(nameof(fileStream));
}
var originalResponse = RestClient.AnalyzeWithCustomModel(modelId, contentType, fileStream, includeTextDetails, cancellationToken);
return CreateAnalyzeWithCustomModel(originalResponse, () => RestClient.CreateAnalyzeWithCustomModelRequest(modelId, contentType, fileStream, includeTextDetails));
using var scope = _clientDiagnostics.CreateScope("ServiceClient.StartAnalyzeWithCustomModel");
scope.Start();
try
{
var originalResponse = RestClient.AnalyzeWithCustomModel(modelId, contentType, fileStream, includeTextDetails, cancellationToken);
return CreateAnalyzeWithCustomModel(originalResponse, () => RestClient.CreateAnalyzeWithCustomModelRequest(modelId, contentType, fileStream, includeTextDetails));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Extract key-value pairs, tables, and semantic values from a given 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>
@ -272,8 +472,18 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async ValueTask<Operation<Response>> StartAnalyzeWithCustomModelAsync(Guid modelId, bool? includeTextDetails = null, SourcePath fileStream = null, CancellationToken cancellationToken = default)
{
var originalResponse = await RestClient.AnalyzeWithCustomModelAsync(modelId, includeTextDetails, fileStream, cancellationToken).ConfigureAwait(false);
return CreateAnalyzeWithCustomModel(originalResponse, () => RestClient.CreateAnalyzeWithCustomModelRequest(modelId, includeTextDetails, fileStream));
using var scope = _clientDiagnostics.CreateScope("ServiceClient.StartAnalyzeWithCustomModel");
scope.Start();
try
{
var originalResponse = await RestClient.AnalyzeWithCustomModelAsync(modelId, includeTextDetails, fileStream, cancellationToken).ConfigureAwait(false);
return CreateAnalyzeWithCustomModel(originalResponse, () => RestClient.CreateAnalyzeWithCustomModelRequest(modelId, includeTextDetails, fileStream));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Extract key-value pairs, tables, and semantic values from a given 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>
@ -283,8 +493,18 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Operation<Response> StartAnalyzeWithCustomModel(Guid modelId, bool? includeTextDetails = null, SourcePath fileStream = null, CancellationToken cancellationToken = default)
{
var originalResponse = RestClient.AnalyzeWithCustomModel(modelId, includeTextDetails, fileStream, cancellationToken);
return CreateAnalyzeWithCustomModel(originalResponse, () => RestClient.CreateAnalyzeWithCustomModelRequest(modelId, includeTextDetails, fileStream));
using var scope = _clientDiagnostics.CreateScope("ServiceClient.StartAnalyzeWithCustomModel");
scope.Start();
try
{
var originalResponse = RestClient.AnalyzeWithCustomModel(modelId, includeTextDetails, fileStream, cancellationToken);
return CreateAnalyzeWithCustomModel(originalResponse, () => RestClient.CreateAnalyzeWithCustomModelRequest(modelId, includeTextDetails, fileStream));
}
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>
@ -348,7 +568,7 @@ namespace Azure.AI.FormRecognizer
throw new ArgumentNullException(nameof(createOriginalHttpMessage));
}
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Post, "ServiceClient.AnalyzeReceiptAsync", OperationFinalStateVia.Location, createOriginalHttpMessage);
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Post, "ServiceClient.StartAnalyzeReceiptAsync", OperationFinalStateVia.Location, createOriginalHttpMessage);
}
/// <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>
@ -363,8 +583,18 @@ namespace Azure.AI.FormRecognizer
throw new ArgumentNullException(nameof(fileStream));
}
var originalResponse = await RestClient.AnalyzeReceiptAsyncAsync(contentType, fileStream, includeTextDetails, cancellationToken).ConfigureAwait(false);
return CreateAnalyzeReceiptAsync(originalResponse, () => RestClient.CreateAnalyzeReceiptAsyncRequest(contentType, fileStream, includeTextDetails));
using var scope = _clientDiagnostics.CreateScope("ServiceClient.StartAnalyzeReceiptAsync");
scope.Start();
try
{
var originalResponse = await RestClient.AnalyzeReceiptAsyncAsync(contentType, fileStream, includeTextDetails, cancellationToken).ConfigureAwait(false);
return CreateAnalyzeReceiptAsync(originalResponse, () => RestClient.CreateAnalyzeReceiptAsyncRequest(contentType, fileStream, includeTextDetails));
}
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>
@ -379,8 +609,18 @@ namespace Azure.AI.FormRecognizer
throw new ArgumentNullException(nameof(fileStream));
}
var originalResponse = RestClient.AnalyzeReceiptAsync(contentType, fileStream, includeTextDetails, cancellationToken);
return CreateAnalyzeReceiptAsync(originalResponse, () => RestClient.CreateAnalyzeReceiptAsyncRequest(contentType, fileStream, includeTextDetails));
using var scope = _clientDiagnostics.CreateScope("ServiceClient.StartAnalyzeReceiptAsync");
scope.Start();
try
{
var originalResponse = RestClient.AnalyzeReceiptAsync(contentType, fileStream, includeTextDetails, cancellationToken);
return CreateAnalyzeReceiptAsync(originalResponse, () => RestClient.CreateAnalyzeReceiptAsyncRequest(contentType, fileStream, includeTextDetails));
}
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>
@ -389,8 +629,18 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async ValueTask<Operation<Response>> StartAnalyzeReceiptAsyncAsync(bool? includeTextDetails = null, SourcePath fileStream = null, CancellationToken cancellationToken = default)
{
var originalResponse = await RestClient.AnalyzeReceiptAsyncAsync(includeTextDetails, fileStream, cancellationToken).ConfigureAwait(false);
return CreateAnalyzeReceiptAsync(originalResponse, () => RestClient.CreateAnalyzeReceiptAsyncRequest(includeTextDetails, fileStream));
using var scope = _clientDiagnostics.CreateScope("ServiceClient.StartAnalyzeReceiptAsync");
scope.Start();
try
{
var originalResponse = await RestClient.AnalyzeReceiptAsyncAsync(includeTextDetails, fileStream, cancellationToken).ConfigureAwait(false);
return CreateAnalyzeReceiptAsync(originalResponse, () => RestClient.CreateAnalyzeReceiptAsyncRequest(includeTextDetails, fileStream));
}
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>
@ -399,8 +649,18 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Operation<Response> StartAnalyzeReceiptAsync(bool? includeTextDetails = null, SourcePath fileStream = null, CancellationToken cancellationToken = default)
{
var originalResponse = RestClient.AnalyzeReceiptAsync(includeTextDetails, fileStream, cancellationToken);
return CreateAnalyzeReceiptAsync(originalResponse, () => RestClient.CreateAnalyzeReceiptAsyncRequest(includeTextDetails, fileStream));
using var scope = _clientDiagnostics.CreateScope("ServiceClient.StartAnalyzeReceiptAsync");
scope.Start();
try
{
var originalResponse = RestClient.AnalyzeReceiptAsync(includeTextDetails, fileStream, cancellationToken);
return CreateAnalyzeReceiptAsync(originalResponse, () => RestClient.CreateAnalyzeReceiptAsyncRequest(includeTextDetails, fileStream));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Extract text and layout information from a given 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>
@ -417,7 +677,7 @@ namespace Azure.AI.FormRecognizer
throw new ArgumentNullException(nameof(createOriginalHttpMessage));
}
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Post, "ServiceClient.AnalyzeLayoutAsync", OperationFinalStateVia.Location, createOriginalHttpMessage);
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Post, "ServiceClient.StartAnalyzeLayoutAsync", OperationFinalStateVia.Location, createOriginalHttpMessage);
}
/// <summary> Extract text and layout information from a given 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>
@ -431,8 +691,18 @@ namespace Azure.AI.FormRecognizer
throw new ArgumentNullException(nameof(fileStream));
}
var originalResponse = await RestClient.AnalyzeLayoutAsyncAsync(contentType, fileStream, cancellationToken).ConfigureAwait(false);
return CreateAnalyzeLayoutAsync(originalResponse, () => RestClient.CreateAnalyzeLayoutAsyncRequest(contentType, fileStream));
using var scope = _clientDiagnostics.CreateScope("ServiceClient.StartAnalyzeLayoutAsync");
scope.Start();
try
{
var originalResponse = await RestClient.AnalyzeLayoutAsyncAsync(contentType, fileStream, cancellationToken).ConfigureAwait(false);
return CreateAnalyzeLayoutAsync(originalResponse, () => RestClient.CreateAnalyzeLayoutAsyncRequest(contentType, fileStream));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Extract text and layout information from a given 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>
@ -446,8 +716,18 @@ namespace Azure.AI.FormRecognizer
throw new ArgumentNullException(nameof(fileStream));
}
var originalResponse = RestClient.AnalyzeLayoutAsync(contentType, fileStream, cancellationToken);
return CreateAnalyzeLayoutAsync(originalResponse, () => RestClient.CreateAnalyzeLayoutAsyncRequest(contentType, fileStream));
using var scope = _clientDiagnostics.CreateScope("ServiceClient.StartAnalyzeLayoutAsync");
scope.Start();
try
{
var originalResponse = RestClient.AnalyzeLayoutAsync(contentType, fileStream, cancellationToken);
return CreateAnalyzeLayoutAsync(originalResponse, () => RestClient.CreateAnalyzeLayoutAsyncRequest(contentType, fileStream));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Extract text and layout information from a given 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>
@ -455,8 +735,18 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async ValueTask<Operation<Response>> StartAnalyzeLayoutAsyncAsync(SourcePath fileStream = null, CancellationToken cancellationToken = default)
{
var originalResponse = await RestClient.AnalyzeLayoutAsyncAsync(fileStream, cancellationToken).ConfigureAwait(false);
return CreateAnalyzeLayoutAsync(originalResponse, () => RestClient.CreateAnalyzeLayoutAsyncRequest(fileStream));
using var scope = _clientDiagnostics.CreateScope("ServiceClient.StartAnalyzeLayoutAsync");
scope.Start();
try
{
var originalResponse = await RestClient.AnalyzeLayoutAsyncAsync(fileStream, cancellationToken).ConfigureAwait(false);
return CreateAnalyzeLayoutAsync(originalResponse, () => RestClient.CreateAnalyzeLayoutAsyncRequest(fileStream));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Extract text and layout information from a given 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>
@ -464,8 +754,18 @@ namespace Azure.AI.FormRecognizer
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Operation<Response> StartAnalyzeLayoutAsync(SourcePath fileStream = null, CancellationToken cancellationToken = default)
{
var originalResponse = RestClient.AnalyzeLayoutAsync(fileStream, cancellationToken);
return CreateAnalyzeLayoutAsync(originalResponse, () => RestClient.CreateAnalyzeLayoutAsyncRequest(fileStream));
using var scope = _clientDiagnostics.CreateScope("ServiceClient.StartAnalyzeLayoutAsync");
scope.Start();
try
{
var originalResponse = RestClient.AnalyzeLayoutAsync(fileStream, cancellationToken);
return CreateAnalyzeLayoutAsync(originalResponse, () => RestClient.CreateAnalyzeLayoutAsyncRequest(fileStream));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

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

@ -44,7 +44,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<BlobContainer>> CreateAsync(string resourceGroupName, string accountName, string containerName, BlobContainer blobContainer, CancellationToken cancellationToken = default)
{
return await RestClient.CreateAsync(resourceGroupName, accountName, containerName, blobContainer, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.Create");
scope.Start();
try
{
return await RestClient.CreateAsync(resourceGroupName, accountName, containerName, blobContainer, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. </summary>
@ -55,7 +65,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<BlobContainer> Create(string resourceGroupName, string accountName, string containerName, BlobContainer blobContainer, CancellationToken cancellationToken = default)
{
return RestClient.Create(resourceGroupName, accountName, containerName, blobContainer, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.Create");
scope.Start();
try
{
return RestClient.Create(resourceGroupName, accountName, containerName, blobContainer, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn&apos;t already exist. </summary>
@ -66,7 +86,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<BlobContainer>> UpdateAsync(string resourceGroupName, string accountName, string containerName, BlobContainer blobContainer, CancellationToken cancellationToken = default)
{
return await RestClient.UpdateAsync(resourceGroupName, accountName, containerName, blobContainer, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.Update");
scope.Start();
try
{
return await RestClient.UpdateAsync(resourceGroupName, accountName, containerName, blobContainer, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn&apos;t already exist. </summary>
@ -77,7 +107,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<BlobContainer> Update(string resourceGroupName, string accountName, string containerName, BlobContainer blobContainer, CancellationToken cancellationToken = default)
{
return RestClient.Update(resourceGroupName, accountName, containerName, blobContainer, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.Update");
scope.Start();
try
{
return RestClient.Update(resourceGroupName, accountName, containerName, blobContainer, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets properties of a specified container. </summary>
@ -87,7 +127,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<BlobContainer>> GetAsync(string resourceGroupName, string accountName, string containerName, CancellationToken cancellationToken = default)
{
return await RestClient.GetAsync(resourceGroupName, accountName, containerName, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.Get");
scope.Start();
try
{
return await RestClient.GetAsync(resourceGroupName, accountName, containerName, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets properties of a specified container. </summary>
@ -97,7 +147,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<BlobContainer> Get(string resourceGroupName, string accountName, string containerName, CancellationToken cancellationToken = default)
{
return RestClient.Get(resourceGroupName, accountName, containerName, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.Get");
scope.Start();
try
{
return RestClient.Get(resourceGroupName, accountName, containerName, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes specified container under its account. </summary>
@ -107,7 +167,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 containerName, CancellationToken cancellationToken = default)
{
return await RestClient.DeleteAsync(resourceGroupName, accountName, containerName, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.Delete");
scope.Start();
try
{
return await RestClient.DeleteAsync(resourceGroupName, accountName, containerName, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes specified container under its account. </summary>
@ -117,7 +187,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response Delete(string resourceGroupName, string accountName, string containerName, CancellationToken cancellationToken = default)
{
return RestClient.Delete(resourceGroupName, accountName, containerName, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.Delete");
scope.Start();
try
{
return RestClient.Delete(resourceGroupName, accountName, containerName, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. </summary>
@ -128,7 +208,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<LegalHold>> SetLegalHoldAsync(string resourceGroupName, string accountName, string containerName, IEnumerable<string> tags, CancellationToken cancellationToken = default)
{
return await RestClient.SetLegalHoldAsync(resourceGroupName, accountName, containerName, tags, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.SetLegalHold");
scope.Start();
try
{
return await RestClient.SetLegalHoldAsync(resourceGroupName, accountName, containerName, tags, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. </summary>
@ -139,7 +229,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<LegalHold> SetLegalHold(string resourceGroupName, string accountName, string containerName, IEnumerable<string> tags, CancellationToken cancellationToken = default)
{
return RestClient.SetLegalHold(resourceGroupName, accountName, containerName, tags, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.SetLegalHold");
scope.Start();
try
{
return RestClient.SetLegalHold(resourceGroupName, accountName, containerName, tags, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. </summary>
@ -150,7 +250,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<LegalHold>> ClearLegalHoldAsync(string resourceGroupName, string accountName, string containerName, IEnumerable<string> tags, CancellationToken cancellationToken = default)
{
return await RestClient.ClearLegalHoldAsync(resourceGroupName, accountName, containerName, tags, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.ClearLegalHold");
scope.Start();
try
{
return await RestClient.ClearLegalHoldAsync(resourceGroupName, accountName, containerName, tags, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. </summary>
@ -161,7 +271,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<LegalHold> ClearLegalHold(string resourceGroupName, string accountName, string containerName, IEnumerable<string> tags, CancellationToken cancellationToken = default)
{
return RestClient.ClearLegalHold(resourceGroupName, accountName, containerName, tags, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.ClearLegalHold");
scope.Start();
try
{
return RestClient.ClearLegalHold(resourceGroupName, accountName, containerName, tags, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. </summary>
@ -174,7 +294,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<ImmutabilityPolicy>> CreateOrUpdateImmutabilityPolicyAsync(string resourceGroupName, string accountName, string containerName, string ifMatch = null, int? immutabilityPeriodSinceCreationInDays = null, bool? allowProtectedAppendWrites = null, CancellationToken cancellationToken = default)
{
return await RestClient.CreateOrUpdateImmutabilityPolicyAsync(resourceGroupName, accountName, containerName, ifMatch, immutabilityPeriodSinceCreationInDays, allowProtectedAppendWrites, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.CreateOrUpdateImmutabilityPolicy");
scope.Start();
try
{
return await RestClient.CreateOrUpdateImmutabilityPolicyAsync(resourceGroupName, accountName, containerName, ifMatch, immutabilityPeriodSinceCreationInDays, allowProtectedAppendWrites, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. </summary>
@ -187,7 +317,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<ImmutabilityPolicy> CreateOrUpdateImmutabilityPolicy(string resourceGroupName, string accountName, string containerName, string ifMatch = null, int? immutabilityPeriodSinceCreationInDays = null, bool? allowProtectedAppendWrites = null, CancellationToken cancellationToken = default)
{
return RestClient.CreateOrUpdateImmutabilityPolicy(resourceGroupName, accountName, containerName, ifMatch, immutabilityPeriodSinceCreationInDays, allowProtectedAppendWrites, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.CreateOrUpdateImmutabilityPolicy");
scope.Start();
try
{
return RestClient.CreateOrUpdateImmutabilityPolicy(resourceGroupName, accountName, containerName, ifMatch, immutabilityPeriodSinceCreationInDays, allowProtectedAppendWrites, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets the existing immutability policy along with the corresponding ETag in response headers and body. </summary>
@ -198,7 +338,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<ImmutabilityPolicy>> GetImmutabilityPolicyAsync(string resourceGroupName, string accountName, string containerName, string ifMatch = null, CancellationToken cancellationToken = default)
{
return await RestClient.GetImmutabilityPolicyAsync(resourceGroupName, accountName, containerName, ifMatch, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.GetImmutabilityPolicy");
scope.Start();
try
{
return await RestClient.GetImmutabilityPolicyAsync(resourceGroupName, accountName, containerName, ifMatch, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets the existing immutability policy along with the corresponding ETag in response headers and body. </summary>
@ -209,7 +359,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<ImmutabilityPolicy> GetImmutabilityPolicy(string resourceGroupName, string accountName, string containerName, string ifMatch = null, CancellationToken cancellationToken = default)
{
return RestClient.GetImmutabilityPolicy(resourceGroupName, accountName, containerName, ifMatch, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.GetImmutabilityPolicy");
scope.Start();
try
{
return RestClient.GetImmutabilityPolicy(resourceGroupName, accountName, containerName, ifMatch, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, only way is to delete the container after deleting all blobs inside the container. </summary>
@ -220,7 +380,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<ImmutabilityPolicy>> DeleteImmutabilityPolicyAsync(string resourceGroupName, string accountName, string containerName, string ifMatch, CancellationToken cancellationToken = default)
{
return await RestClient.DeleteImmutabilityPolicyAsync(resourceGroupName, accountName, containerName, ifMatch, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.DeleteImmutabilityPolicy");
scope.Start();
try
{
return await RestClient.DeleteImmutabilityPolicyAsync(resourceGroupName, accountName, containerName, ifMatch, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, only way is to delete the container after deleting all blobs inside the container. </summary>
@ -231,7 +401,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<ImmutabilityPolicy> DeleteImmutabilityPolicy(string resourceGroupName, string accountName, string containerName, string ifMatch, CancellationToken cancellationToken = default)
{
return RestClient.DeleteImmutabilityPolicy(resourceGroupName, accountName, containerName, ifMatch, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.DeleteImmutabilityPolicy");
scope.Start();
try
{
return RestClient.DeleteImmutabilityPolicy(resourceGroupName, accountName, containerName, ifMatch, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. </summary>
@ -242,7 +422,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<ImmutabilityPolicy>> LockImmutabilityPolicyAsync(string resourceGroupName, string accountName, string containerName, string ifMatch, CancellationToken cancellationToken = default)
{
return await RestClient.LockImmutabilityPolicyAsync(resourceGroupName, accountName, containerName, ifMatch, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.LockImmutabilityPolicy");
scope.Start();
try
{
return await RestClient.LockImmutabilityPolicyAsync(resourceGroupName, accountName, containerName, ifMatch, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. </summary>
@ -253,7 +443,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<ImmutabilityPolicy> LockImmutabilityPolicy(string resourceGroupName, string accountName, string containerName, string ifMatch, CancellationToken cancellationToken = default)
{
return RestClient.LockImmutabilityPolicy(resourceGroupName, accountName, containerName, ifMatch, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.LockImmutabilityPolicy");
scope.Start();
try
{
return RestClient.LockImmutabilityPolicy(resourceGroupName, accountName, containerName, ifMatch, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. </summary>
@ -266,7 +466,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<ImmutabilityPolicy>> ExtendImmutabilityPolicyAsync(string resourceGroupName, string accountName, string containerName, string ifMatch, int? immutabilityPeriodSinceCreationInDays = null, bool? allowProtectedAppendWrites = null, CancellationToken cancellationToken = default)
{
return await RestClient.ExtendImmutabilityPolicyAsync(resourceGroupName, accountName, containerName, ifMatch, immutabilityPeriodSinceCreationInDays, allowProtectedAppendWrites, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.ExtendImmutabilityPolicy");
scope.Start();
try
{
return await RestClient.ExtendImmutabilityPolicyAsync(resourceGroupName, accountName, containerName, ifMatch, immutabilityPeriodSinceCreationInDays, allowProtectedAppendWrites, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. </summary>
@ -279,7 +489,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<ImmutabilityPolicy> ExtendImmutabilityPolicy(string resourceGroupName, string accountName, string containerName, string ifMatch, int? immutabilityPeriodSinceCreationInDays = null, bool? allowProtectedAppendWrites = null, CancellationToken cancellationToken = default)
{
return RestClient.ExtendImmutabilityPolicy(resourceGroupName, accountName, containerName, ifMatch, immutabilityPeriodSinceCreationInDays, allowProtectedAppendWrites, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.ExtendImmutabilityPolicy");
scope.Start();
try
{
return RestClient.ExtendImmutabilityPolicy(resourceGroupName, accountName, containerName, ifMatch, immutabilityPeriodSinceCreationInDays, allowProtectedAppendWrites, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. </summary>
@ -290,7 +510,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<LeaseContainerResponse>> LeaseAsync(string resourceGroupName, string accountName, string containerName, LeaseContainerRequest parameters = null, CancellationToken cancellationToken = default)
{
return await RestClient.LeaseAsync(resourceGroupName, accountName, containerName, parameters, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.Lease");
scope.Start();
try
{
return await RestClient.LeaseAsync(resourceGroupName, accountName, containerName, parameters, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. </summary>
@ -301,7 +531,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<LeaseContainerResponse> Lease(string resourceGroupName, string accountName, string containerName, LeaseContainerRequest parameters = null, CancellationToken cancellationToken = default)
{
return RestClient.Lease(resourceGroupName, accountName, containerName, parameters, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.Lease");
scope.Start();
try
{
return RestClient.Lease(resourceGroupName, accountName, containerName, parameters, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. </summary>
@ -323,13 +563,33 @@ namespace Azure.Management.Storage
async Task<Page<ListContainerItem>> FirstPageFunc(int? pageSizeHint)
{
var response = await RestClient.ListAsync(resourceGroupName, accountName, maxpagesize, filter, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.List");
scope.Start();
try
{
var response = await RestClient.ListAsync(resourceGroupName, accountName, maxpagesize, filter, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
async Task<Page<ListContainerItem>> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, accountName, maxpagesize, filter, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.List");
scope.Start();
try
{
var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, accountName, maxpagesize, filter, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
}
@ -353,13 +613,33 @@ namespace Azure.Management.Storage
Page<ListContainerItem> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.List(resourceGroupName, accountName, maxpagesize, filter, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.List");
scope.Start();
try
{
var response = RestClient.List(resourceGroupName, accountName, maxpagesize, filter, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
Page<ListContainerItem> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = RestClient.ListNextPage(nextLink, resourceGroupName, accountName, maxpagesize, filter, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("BlobContainersClient.List");
scope.Start();
try
{
var response = RestClient.ListNextPage(nextLink, resourceGroupName, accountName, maxpagesize, filter, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
}

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

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

@ -42,7 +42,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<BlobServiceProperties>> SetServicePropertiesAsync(string resourceGroupName, string accountName, BlobServiceProperties parameters, CancellationToken cancellationToken = default)
{
return await RestClient.SetServicePropertiesAsync(resourceGroupName, accountName, parameters, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("BlobServicesClient.SetServiceProperties");
scope.Start();
try
{
return await RestClient.SetServicePropertiesAsync(resourceGroupName, accountName, parameters, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Sets the properties of a storage accounts Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. </summary>
@ -52,7 +62,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<BlobServiceProperties> SetServiceProperties(string resourceGroupName, string accountName, BlobServiceProperties parameters, CancellationToken cancellationToken = default)
{
return RestClient.SetServiceProperties(resourceGroupName, accountName, parameters, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("BlobServicesClient.SetServiceProperties");
scope.Start();
try
{
return RestClient.SetServiceProperties(resourceGroupName, accountName, parameters, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets the properties of a storage accounts Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. </summary>
@ -61,7 +81,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<BlobServiceProperties>> GetServicePropertiesAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
return await RestClient.GetServicePropertiesAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("BlobServicesClient.GetServiceProperties");
scope.Start();
try
{
return await RestClient.GetServicePropertiesAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets the properties of a storage accounts Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. </summary>
@ -70,7 +100,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<BlobServiceProperties> GetServiceProperties(string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
return RestClient.GetServiceProperties(resourceGroupName, accountName, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("BlobServicesClient.GetServiceProperties");
scope.Start();
try
{
return RestClient.GetServiceProperties(resourceGroupName, accountName, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> List blob services of storage account. It returns a collection of one object named default. </summary>
@ -90,8 +130,18 @@ namespace Azure.Management.Storage
async Task<Page<BlobServiceProperties>> 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("BlobServicesClient.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);
}
@ -113,8 +163,18 @@ namespace Azure.Management.Storage
Page<BlobServiceProperties> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.List(resourceGroupName, accountName, cancellationToken);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("BlobServicesClient.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("BlobServicesClient.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:
{
BlobServiceItems value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
BlobServiceItems 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 = BlobServiceItems.DeserializeBlobServiceItems(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 = BlobServiceItems.DeserializeBlobServiceItems(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("BlobServicesClient.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:
{
BlobServiceItems value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
BlobServiceItems value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = BlobServiceItems.DeserializeBlobServiceItems(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 = BlobServiceItems.DeserializeBlobServiceItems(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -206,36 +186,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(parameters));
}
using var scope = _clientDiagnostics.CreateScope("BlobServicesClient.SetServiceProperties");
scope.Start();
try
using var message = CreateSetServicePropertiesRequest(resourceGroupName, accountName, parameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateSetServicePropertiesRequest(resourceGroupName, accountName, parameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
BlobServiceProperties value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
BlobServiceProperties 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 = BlobServiceProperties.DeserializeBlobServiceProperties(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 = BlobServiceProperties.DeserializeBlobServiceProperties(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -259,36 +229,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(parameters));
}
using var scope = _clientDiagnostics.CreateScope("BlobServicesClient.SetServiceProperties");
scope.Start();
try
using var message = CreateSetServicePropertiesRequest(resourceGroupName, accountName, parameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateSetServicePropertiesRequest(resourceGroupName, accountName, parameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
BlobServiceProperties value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
BlobServiceProperties value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = BlobServiceProperties.DeserializeBlobServiceProperties(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 = BlobServiceProperties.DeserializeBlobServiceProperties(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -327,36 +287,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("BlobServicesClient.GetServiceProperties");
scope.Start();
try
using var message = CreateGetServicePropertiesRequest(resourceGroupName, accountName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetServicePropertiesRequest(resourceGroupName, accountName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
BlobServiceProperties value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
BlobServiceProperties 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 = BlobServiceProperties.DeserializeBlobServiceProperties(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 = BlobServiceProperties.DeserializeBlobServiceProperties(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -375,36 +325,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("BlobServicesClient.GetServiceProperties");
scope.Start();
try
using var message = CreateGetServicePropertiesRequest(resourceGroupName, accountName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetServicePropertiesRequest(resourceGroupName, accountName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
BlobServiceProperties value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
BlobServiceProperties value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = BlobServiceProperties.DeserializeBlobServiceProperties(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 = BlobServiceProperties.DeserializeBlobServiceProperties(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -43,7 +43,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<EncryptionScope>> PutAsync(string resourceGroupName, string accountName, string encryptionScopeName, EncryptionScope encryptionScope, CancellationToken cancellationToken = default)
{
return await RestClient.PutAsync(resourceGroupName, accountName, encryptionScopeName, encryptionScope, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("EncryptionScopesClient.Put");
scope.Start();
try
{
return await RestClient.PutAsync(resourceGroupName, accountName, encryptionScopeName, encryptionScope, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. </summary>
@ -54,7 +64,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<EncryptionScope> Put(string resourceGroupName, string accountName, string encryptionScopeName, EncryptionScope encryptionScope, CancellationToken cancellationToken = default)
{
return RestClient.Put(resourceGroupName, accountName, encryptionScopeName, encryptionScope, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("EncryptionScopesClient.Put");
scope.Start();
try
{
return RestClient.Put(resourceGroupName, accountName, encryptionScopeName, encryptionScope, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope does not already exist. </summary>
@ -65,7 +85,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<EncryptionScope>> PatchAsync(string resourceGroupName, string accountName, string encryptionScopeName, EncryptionScope encryptionScope, CancellationToken cancellationToken = default)
{
return await RestClient.PatchAsync(resourceGroupName, accountName, encryptionScopeName, encryptionScope, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("EncryptionScopesClient.Patch");
scope.Start();
try
{
return await RestClient.PatchAsync(resourceGroupName, accountName, encryptionScopeName, encryptionScope, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope does not already exist. </summary>
@ -76,7 +106,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<EncryptionScope> Patch(string resourceGroupName, string accountName, string encryptionScopeName, EncryptionScope encryptionScope, CancellationToken cancellationToken = default)
{
return RestClient.Patch(resourceGroupName, accountName, encryptionScopeName, encryptionScope, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("EncryptionScopesClient.Patch");
scope.Start();
try
{
return RestClient.Patch(resourceGroupName, accountName, encryptionScopeName, encryptionScope, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Returns the properties for the specified encryption scope. </summary>
@ -86,7 +126,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<EncryptionScope>> GetAsync(string resourceGroupName, string accountName, string encryptionScopeName, CancellationToken cancellationToken = default)
{
return await RestClient.GetAsync(resourceGroupName, accountName, encryptionScopeName, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("EncryptionScopesClient.Get");
scope.Start();
try
{
return await RestClient.GetAsync(resourceGroupName, accountName, encryptionScopeName, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Returns the properties for the specified encryption scope. </summary>
@ -96,7 +146,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<EncryptionScope> Get(string resourceGroupName, string accountName, string encryptionScopeName, CancellationToken cancellationToken = default)
{
return RestClient.Get(resourceGroupName, accountName, encryptionScopeName, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("EncryptionScopesClient.Get");
scope.Start();
try
{
return RestClient.Get(resourceGroupName, accountName, encryptionScopeName, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Lists all the encryption scopes available under the specified storage account. </summary>
@ -116,13 +176,33 @@ namespace Azure.Management.Storage
async Task<Page<EncryptionScope>> FirstPageFunc(int? pageSizeHint)
{
var response = await RestClient.ListAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("EncryptionScopesClient.List");
scope.Start();
try
{
var response = await RestClient.ListAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
async Task<Page<EncryptionScope>> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("EncryptionScopesClient.List");
scope.Start();
try
{
var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
}
@ -144,13 +224,33 @@ namespace Azure.Management.Storage
Page<EncryptionScope> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.List(resourceGroupName, accountName, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("EncryptionScopesClient.List");
scope.Start();
try
{
var response = RestClient.List(resourceGroupName, accountName, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
Page<EncryptionScope> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = RestClient.ListNextPage(nextLink, resourceGroupName, accountName, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("EncryptionScopesClient.List");
scope.Start();
try
{
var response = RestClient.ListNextPage(nextLink, resourceGroupName, accountName, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
}

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

@ -96,37 +96,27 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(encryptionScope));
}
using var scope = _clientDiagnostics.CreateScope("EncryptionScopesClient.Put");
scope.Start();
try
using var message = CreatePutRequest(resourceGroupName, accountName, encryptionScopeName, encryptionScope);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreatePutRequest(resourceGroupName, accountName, encryptionScopeName, encryptionScope);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 201:
case 200:
case 201:
{
EncryptionScope value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
EncryptionScope 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 = EncryptionScope.DeserializeEncryptionScope(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 = EncryptionScope.DeserializeEncryptionScope(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -155,37 +145,27 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(encryptionScope));
}
using var scope = _clientDiagnostics.CreateScope("EncryptionScopesClient.Put");
scope.Start();
try
using var message = CreatePutRequest(resourceGroupName, accountName, encryptionScopeName, encryptionScope);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreatePutRequest(resourceGroupName, accountName, encryptionScopeName, encryptionScope);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 201:
case 200:
case 201:
{
EncryptionScope value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
EncryptionScope value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = EncryptionScope.DeserializeEncryptionScope(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 = EncryptionScope.DeserializeEncryptionScope(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -238,36 +218,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(encryptionScope));
}
using var scope = _clientDiagnostics.CreateScope("EncryptionScopesClient.Patch");
scope.Start();
try
using var message = CreatePatchRequest(resourceGroupName, accountName, encryptionScopeName, encryptionScope);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreatePatchRequest(resourceGroupName, accountName, encryptionScopeName, encryptionScope);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
EncryptionScope value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
EncryptionScope 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 = EncryptionScope.DeserializeEncryptionScope(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 = EncryptionScope.DeserializeEncryptionScope(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -296,36 +266,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(encryptionScope));
}
using var scope = _clientDiagnostics.CreateScope("EncryptionScopesClient.Patch");
scope.Start();
try
using var message = CreatePatchRequest(resourceGroupName, accountName, encryptionScopeName, encryptionScope);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreatePatchRequest(resourceGroupName, accountName, encryptionScopeName, encryptionScope);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
EncryptionScope value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
EncryptionScope value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = EncryptionScope.DeserializeEncryptionScope(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 = EncryptionScope.DeserializeEncryptionScope(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -369,36 +329,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(encryptionScopeName));
}
using var scope = _clientDiagnostics.CreateScope("EncryptionScopesClient.Get");
scope.Start();
try
using var message = CreateGetRequest(resourceGroupName, accountName, encryptionScopeName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetRequest(resourceGroupName, accountName, encryptionScopeName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
EncryptionScope value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
EncryptionScope 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 = EncryptionScope.DeserializeEncryptionScope(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 = EncryptionScope.DeserializeEncryptionScope(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -422,36 +372,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(encryptionScopeName));
}
using var scope = _clientDiagnostics.CreateScope("EncryptionScopesClient.Get");
scope.Start();
try
using var message = CreateGetRequest(resourceGroupName, accountName, encryptionScopeName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetRequest(resourceGroupName, accountName, encryptionScopeName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
EncryptionScope value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
EncryptionScope value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = EncryptionScope.DeserializeEncryptionScope(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 = EncryptionScope.DeserializeEncryptionScope(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -489,36 +429,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("EncryptionScopesClient.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:
{
EncryptionScopeListResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
EncryptionScopeListResult 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 = EncryptionScopeListResult.DeserializeEncryptionScopeListResult(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 = EncryptionScopeListResult.DeserializeEncryptionScopeListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -537,36 +467,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("EncryptionScopesClient.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:
{
EncryptionScopeListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
EncryptionScopeListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = EncryptionScopeListResult.DeserializeEncryptionScopeListResult(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 = EncryptionScopeListResult.DeserializeEncryptionScopeListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -602,36 +522,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("EncryptionScopesClient.List");
scope.Start();
try
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, accountName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, accountName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
EncryptionScopeListResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
EncryptionScopeListResult 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 = EncryptionScopeListResult.DeserializeEncryptionScopeListResult(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 = EncryptionScopeListResult.DeserializeEncryptionScopeListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -655,36 +565,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("EncryptionScopesClient.List");
scope.Start();
try
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, accountName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, accountName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
EncryptionScopeListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
EncryptionScopeListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = EncryptionScopeListResult.DeserializeEncryptionScopeListResult(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 = EncryptionScopeListResult.DeserializeEncryptionScopeListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -40,7 +41,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<FileServiceItems>> ListAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
return await RestClient.ListAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("FileServicesClient.List");
scope.Start();
try
{
return await RestClient.ListAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> List all file services in storage accounts. </summary>
@ -49,7 +60,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<FileServiceItems> List(string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
return RestClient.List(resourceGroupName, accountName, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("FileServicesClient.List");
scope.Start();
try
{
return RestClient.List(resourceGroupName, accountName, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. </summary>
@ -60,7 +81,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<FileServiceProperties>> SetServicePropertiesAsync(string resourceGroupName, string accountName, CorsRules cors = null, DeleteRetentionPolicy shareDeleteRetentionPolicy = null, CancellationToken cancellationToken = default)
{
return await RestClient.SetServicePropertiesAsync(resourceGroupName, accountName, cors, shareDeleteRetentionPolicy, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("FileServicesClient.SetServiceProperties");
scope.Start();
try
{
return await RestClient.SetServicePropertiesAsync(resourceGroupName, accountName, cors, shareDeleteRetentionPolicy, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. </summary>
@ -71,7 +102,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<FileServiceProperties> SetServiceProperties(string resourceGroupName, string accountName, CorsRules cors = null, DeleteRetentionPolicy shareDeleteRetentionPolicy = null, CancellationToken cancellationToken = default)
{
return RestClient.SetServiceProperties(resourceGroupName, accountName, cors, shareDeleteRetentionPolicy, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("FileServicesClient.SetServiceProperties");
scope.Start();
try
{
return RestClient.SetServiceProperties(resourceGroupName, accountName, cors, shareDeleteRetentionPolicy, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. </summary>
@ -80,7 +121,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<FileServiceProperties>> GetServicePropertiesAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
return await RestClient.GetServicePropertiesAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("FileServicesClient.GetServiceProperties");
scope.Start();
try
{
return await RestClient.GetServicePropertiesAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. </summary>
@ -89,7 +140,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<FileServiceProperties> GetServiceProperties(string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
return RestClient.GetServiceProperties(resourceGroupName, accountName, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("FileServicesClient.GetServiceProperties");
scope.Start();
try
{
return RestClient.GetServiceProperties(resourceGroupName, accountName, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -81,36 +81,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("FileServicesClient.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:
{
FileServiceItems value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
FileServiceItems 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 = FileServiceItems.DeserializeFileServiceItems(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 = FileServiceItems.DeserializeFileServiceItems(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("FileServicesClient.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:
{
FileServiceItems value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
FileServiceItems value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = FileServiceItems.DeserializeFileServiceItems(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 = FileServiceItems.DeserializeFileServiceItems(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -208,36 +188,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("FileServicesClient.SetServiceProperties");
scope.Start();
try
using var message = CreateSetServicePropertiesRequest(resourceGroupName, accountName, cors, shareDeleteRetentionPolicy);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateSetServicePropertiesRequest(resourceGroupName, accountName, cors, shareDeleteRetentionPolicy);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
FileServiceProperties value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
FileServiceProperties 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 = FileServiceProperties.DeserializeFileServiceProperties(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 = FileServiceProperties.DeserializeFileServiceProperties(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -258,36 +228,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("FileServicesClient.SetServiceProperties");
scope.Start();
try
using var message = CreateSetServicePropertiesRequest(resourceGroupName, accountName, cors, shareDeleteRetentionPolicy);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateSetServicePropertiesRequest(resourceGroupName, accountName, cors, shareDeleteRetentionPolicy);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
FileServiceProperties value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
FileServiceProperties value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = FileServiceProperties.DeserializeFileServiceProperties(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 = FileServiceProperties.DeserializeFileServiceProperties(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -326,36 +286,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("FileServicesClient.GetServiceProperties");
scope.Start();
try
using var message = CreateGetServicePropertiesRequest(resourceGroupName, accountName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetServicePropertiesRequest(resourceGroupName, accountName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
FileServiceProperties value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
FileServiceProperties 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 = FileServiceProperties.DeserializeFileServiceProperties(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 = FileServiceProperties.DeserializeFileServiceProperties(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -374,36 +324,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("FileServicesClient.GetServiceProperties");
scope.Start();
try
using var message = CreateGetServicePropertiesRequest(resourceGroupName, accountName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetServicePropertiesRequest(resourceGroupName, accountName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
FileServiceProperties value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
FileServiceProperties value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = FileServiceProperties.DeserializeFileServiceProperties(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 = FileServiceProperties.DeserializeFileServiceProperties(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -43,7 +43,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<FileShare>> CreateAsync(string resourceGroupName, string accountName, string shareName, FileShare fileShare, CancellationToken cancellationToken = default)
{
return await RestClient.CreateAsync(resourceGroupName, accountName, shareName, fileShare, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.Create");
scope.Start();
try
{
return await RestClient.CreateAsync(resourceGroupName, accountName, shareName, metadata, shareQuota, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. </summary>
@ -54,7 +64,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<FileShare> Create(string resourceGroupName, string accountName, string shareName, FileShare fileShare, CancellationToken cancellationToken = default)
{
return RestClient.Create(resourceGroupName, accountName, shareName, fileShare, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.Create");
scope.Start();
try
{
return RestClient.Create(resourceGroupName, accountName, shareName, metadata, shareQuota, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. </summary>
@ -65,7 +85,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<FileShare>> UpdateAsync(string resourceGroupName, string accountName, string shareName, FileShare fileShare, CancellationToken cancellationToken = default)
{
return await RestClient.UpdateAsync(resourceGroupName, accountName, shareName, fileShare, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.Update");
scope.Start();
try
{
return await RestClient.UpdateAsync(resourceGroupName, accountName, shareName, metadata, shareQuota, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. </summary>
@ -76,7 +106,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<FileShare> Update(string resourceGroupName, string accountName, string shareName, FileShare fileShare, CancellationToken cancellationToken = default)
{
return RestClient.Update(resourceGroupName, accountName, shareName, fileShare, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.Update");
scope.Start();
try
{
return RestClient.Update(resourceGroupName, accountName, shareName, metadata, shareQuota, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets properties of a specified share. </summary>
@ -86,7 +126,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<FileShare>> GetAsync(string resourceGroupName, string accountName, string shareName, CancellationToken cancellationToken = default)
{
return await RestClient.GetAsync(resourceGroupName, accountName, shareName, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.Get");
scope.Start();
try
{
return await RestClient.GetAsync(resourceGroupName, accountName, shareName, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets properties of a specified share. </summary>
@ -96,7 +146,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<FileShare> Get(string resourceGroupName, string accountName, string shareName, CancellationToken cancellationToken = default)
{
return RestClient.Get(resourceGroupName, accountName, shareName, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.Get");
scope.Start();
try
{
return RestClient.Get(resourceGroupName, accountName, shareName, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes specified share under its account. </summary>
@ -106,7 +166,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 shareName, CancellationToken cancellationToken = default)
{
return await RestClient.DeleteAsync(resourceGroupName, accountName, shareName, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.Delete");
scope.Start();
try
{
return await RestClient.DeleteAsync(resourceGroupName, accountName, shareName, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes specified share under its account. </summary>
@ -116,7 +186,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response Delete(string resourceGroupName, string accountName, string shareName, CancellationToken cancellationToken = default)
{
return RestClient.Delete(resourceGroupName, accountName, shareName, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.Delete");
scope.Start();
try
{
return RestClient.Delete(resourceGroupName, accountName, shareName, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Restore a file share within a valid retention days if share soft delete is enabled. </summary>
@ -162,13 +242,33 @@ namespace Azure.Management.Storage
async Task<Page<FileShareItem>> FirstPageFunc(int? pageSizeHint)
{
var response = await RestClient.ListAsync(resourceGroupName, accountName, maxpagesize, filter, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.List");
scope.Start();
try
{
var response = await RestClient.ListAsync(resourceGroupName, accountName, maxpagesize, filter, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
async Task<Page<FileShareItem>> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, accountName, maxpagesize, filter, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.List");
scope.Start();
try
{
var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, accountName, maxpagesize, filter, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
}
@ -192,13 +292,33 @@ namespace Azure.Management.Storage
Page<FileShareItem> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.List(resourceGroupName, accountName, maxpagesize, filter, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.List");
scope.Start();
try
{
var response = RestClient.List(resourceGroupName, accountName, maxpagesize, filter, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
Page<FileShareItem> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = RestClient.ListNextPage(nextLink, resourceGroupName, accountName, maxpagesize, filter, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.List");
scope.Start();
try
{
var response = RestClient.ListNextPage(nextLink, resourceGroupName, accountName, maxpagesize, filter, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
}

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

@ -92,36 +92,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.List");
scope.Start();
try
using var message = CreateListRequest(resourceGroupName, accountName, maxpagesize, filter);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListRequest(resourceGroupName, accountName, maxpagesize, filter);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
FileShareItems value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
FileShareItems 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 = FileShareItems.DeserializeFileShareItems(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 = FileShareItems.DeserializeFileShareItems(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -142,36 +132,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.List");
scope.Start();
try
using var message = CreateListRequest(resourceGroupName, accountName, maxpagesize, filter);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListRequest(resourceGroupName, accountName, maxpagesize, filter);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
FileShareItems value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
FileShareItems value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = FileShareItems.DeserializeFileShareItems(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 = FileShareItems.DeserializeFileShareItems(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -224,37 +204,27 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(fileShare));
}
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.Create");
scope.Start();
try
using var message = CreateCreateRequest(resourceGroupName, accountName, shareName, metadata, shareQuota);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateRequest(resourceGroupName, accountName, shareName, fileShare);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 201:
case 200:
case 201:
{
FileShare value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
FileShare 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 = FileShare.DeserializeFileShare(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 = FileShare.DeserializeFileShare(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -283,37 +253,27 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(fileShare));
}
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.Create");
scope.Start();
try
using var message = CreateCreateRequest(resourceGroupName, accountName, shareName, metadata, shareQuota);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateRequest(resourceGroupName, accountName, shareName, fileShare);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 201:
case 200:
case 201:
{
FileShare value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
FileShare value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = FileShare.DeserializeFileShare(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 = FileShare.DeserializeFileShare(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -366,36 +326,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(fileShare));
}
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.Update");
scope.Start();
try
using var message = CreateUpdateRequest(resourceGroupName, accountName, shareName, metadata, shareQuota);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateUpdateRequest(resourceGroupName, accountName, shareName, fileShare);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
FileShare value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
FileShare 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 = FileShare.DeserializeFileShare(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 = FileShare.DeserializeFileShare(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -424,36 +374,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(fileShare));
}
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.Update");
scope.Start();
try
using var message = CreateUpdateRequest(resourceGroupName, accountName, shareName, metadata, shareQuota);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateUpdateRequest(resourceGroupName, accountName, shareName, fileShare);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
FileShare value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
FileShare value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = FileShare.DeserializeFileShare(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 = FileShare.DeserializeFileShare(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -498,36 +438,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(shareName));
}
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.Get");
scope.Start();
try
using var message = CreateGetRequest(resourceGroupName, accountName, shareName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetRequest(resourceGroupName, accountName, shareName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
FileShare value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
FileShare 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 = FileShare.DeserializeFileShare(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 = FileShare.DeserializeFileShare(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -551,36 +481,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(shareName));
}
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.Get");
scope.Start();
try
using var message = CreateGetRequest(resourceGroupName, accountName, shareName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetRequest(resourceGroupName, accountName, shareName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
FileShare value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
FileShare value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = FileShare.DeserializeFileShare(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 = FileShare.DeserializeFileShare(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -624,25 +544,15 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(shareName));
}
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(resourceGroupName, accountName, shareName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(resourceGroupName, accountName, shareName);
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);
}
}
@ -666,25 +576,15 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(shareName));
}
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(resourceGroupName, accountName, shareName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(resourceGroupName, accountName, shareName);
_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);
}
}
@ -850,36 +750,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.List");
scope.Start();
try
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, accountName, maxpagesize, filter);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, accountName, maxpagesize, filter);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
FileShareItems value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
FileShareItems 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 = FileShareItems.DeserializeFileShareItems(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 = FileShareItems.DeserializeFileShareItems(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -905,36 +795,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("FileSharesClient.List");
scope.Start();
try
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, accountName, maxpagesize, filter);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, accountName, maxpagesize, filter);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
FileShareItems value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
FileShareItems value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = FileShareItems.DeserializeFileShareItems(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 = FileShareItems.DeserializeFileShareItems(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -40,7 +41,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<ManagementPolicy>> GetAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
return await RestClient.GetAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ManagementPoliciesClient.Get");
scope.Start();
try
{
return await RestClient.GetAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets the managementpolicy associated with the specified storage account. </summary>
@ -49,7 +60,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<ManagementPolicy> Get(string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
return RestClient.Get(resourceGroupName, accountName, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ManagementPoliciesClient.Get");
scope.Start();
try
{
return RestClient.Get(resourceGroupName, accountName, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Sets the managementpolicy to the specified storage account. </summary>
@ -59,7 +80,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<ManagementPolicy>> CreateOrUpdateAsync(string resourceGroupName, string accountName, ManagementPolicySchema policy = null, CancellationToken cancellationToken = default)
{
return await RestClient.CreateOrUpdateAsync(resourceGroupName, accountName, policy, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ManagementPoliciesClient.CreateOrUpdate");
scope.Start();
try
{
return await RestClient.CreateOrUpdateAsync(resourceGroupName, accountName, policy, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Sets the managementpolicy to the specified storage account. </summary>
@ -69,7 +100,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<ManagementPolicy> CreateOrUpdate(string resourceGroupName, string accountName, ManagementPolicySchema policy = null, CancellationToken cancellationToken = default)
{
return RestClient.CreateOrUpdate(resourceGroupName, accountName, policy, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ManagementPoliciesClient.CreateOrUpdate");
scope.Start();
try
{
return RestClient.CreateOrUpdate(resourceGroupName, accountName, policy, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes the managementpolicy associated with the specified storage account. </summary>
@ -78,7 +119,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> DeleteAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
return await RestClient.DeleteAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ManagementPoliciesClient.Delete");
scope.Start();
try
{
return await RestClient.DeleteAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes the managementpolicy associated with the specified storage account. </summary>
@ -87,7 +138,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response Delete(string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
return RestClient.Delete(resourceGroupName, accountName, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ManagementPoliciesClient.Delete");
scope.Start();
try
{
return RestClient.Delete(resourceGroupName, accountName, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -82,36 +82,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("ManagementPoliciesClient.Get");
scope.Start();
try
using var message = CreateGetRequest(resourceGroupName, accountName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetRequest(resourceGroupName, accountName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
ManagementPolicy value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ManagementPolicy 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 = ManagementPolicy.DeserializeManagementPolicy(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 = ManagementPolicy.DeserializeManagementPolicy(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -130,36 +120,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("ManagementPoliciesClient.Get");
scope.Start();
try
using var message = CreateGetRequest(resourceGroupName, accountName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetRequest(resourceGroupName, accountName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
ManagementPolicy value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ManagementPolicy value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = ManagementPolicy.DeserializeManagementPolicy(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 = ManagementPolicy.DeserializeManagementPolicy(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -207,36 +187,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("ManagementPoliciesClient.CreateOrUpdate");
scope.Start();
try
using var message = CreateCreateOrUpdateRequest(resourceGroupName, accountName, policy);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateOrUpdateRequest(resourceGroupName, accountName, policy);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
ManagementPolicy value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ManagementPolicy 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 = ManagementPolicy.DeserializeManagementPolicy(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 = ManagementPolicy.DeserializeManagementPolicy(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -256,36 +226,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("ManagementPoliciesClient.CreateOrUpdate");
scope.Start();
try
using var message = CreateCreateOrUpdateRequest(resourceGroupName, accountName, policy);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateOrUpdateRequest(resourceGroupName, accountName, policy);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
ManagementPolicy value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ManagementPolicy value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = ManagementPolicy.DeserializeManagementPolicy(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 = ManagementPolicy.DeserializeManagementPolicy(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -324,25 +284,15 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("ManagementPoliciesClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(resourceGroupName, accountName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(resourceGroupName, accountName);
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);
}
}
@ -361,25 +311,15 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("ManagementPoliciesClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(resourceGroupName, accountName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(resourceGroupName, accountName);
_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);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -40,8 +41,18 @@ namespace Azure.Management.Storage
{
async Task<Page<Operation>> FirstPageFunc(int? pageSizeHint)
{
var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("OperationsClient.List");
scope.Start();
try
{
var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
}
@ -52,8 +63,18 @@ namespace Azure.Management.Storage
{
Page<Operation> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.List(cancellationToken);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("OperationsClient.List");
scope.Start();
try
{
var response = RestClient.List(cancellationToken);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
}

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

@ -58,36 +58,26 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response<OperationListResult>> ListAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("OperationsClient.List");
scope.Start();
try
using var message = CreateListRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
OperationListResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
OperationListResult 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 = OperationListResult.DeserializeOperationListResult(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 = OperationListResult.DeserializeOperationListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -95,36 +85,26 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response<OperationListResult> List(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("OperationsClient.List");
scope.Start();
try
using var message = CreateListRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
OperationListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
OperationListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = OperationListResult.DeserializeOperationListResult(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 = OperationListResult.DeserializeOperationListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -41,7 +42,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<PrivateEndpointConnection>> GetAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default)
{
return await RestClient.GetAsync(resourceGroupName, accountName, privateEndpointConnectionName, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsClient.Get");
scope.Start();
try
{
return await RestClient.GetAsync(resourceGroupName, accountName, privateEndpointConnectionName, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets the specified private endpoint connection associated with the storage account. </summary>
@ -51,7 +62,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<PrivateEndpointConnection> Get(string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default)
{
return RestClient.Get(resourceGroupName, accountName, privateEndpointConnectionName, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsClient.Get");
scope.Start();
try
{
return RestClient.Get(resourceGroupName, accountName, privateEndpointConnectionName, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Update the state of specified private endpoint connection associated with the storage account. </summary>
@ -63,7 +84,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<PrivateEndpointConnection>> PutAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpoint privateEndpoint = null, PrivateLinkServiceConnectionState privateLinkServiceConnectionState = null, CancellationToken cancellationToken = default)
{
return await RestClient.PutAsync(resourceGroupName, accountName, privateEndpointConnectionName, privateEndpoint, privateLinkServiceConnectionState, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsClient.Put");
scope.Start();
try
{
return await RestClient.PutAsync(resourceGroupName, accountName, privateEndpointConnectionName, privateEndpoint, privateLinkServiceConnectionState, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Update the state of specified private endpoint connection associated with the storage account. </summary>
@ -75,7 +106,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<PrivateEndpointConnection> Put(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpoint privateEndpoint = null, PrivateLinkServiceConnectionState privateLinkServiceConnectionState = null, CancellationToken cancellationToken = default)
{
return RestClient.Put(resourceGroupName, accountName, privateEndpointConnectionName, privateEndpoint, privateLinkServiceConnectionState, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsClient.Put");
scope.Start();
try
{
return RestClient.Put(resourceGroupName, accountName, privateEndpointConnectionName, privateEndpoint, privateLinkServiceConnectionState, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes the specified private endpoint connection associated with the storage account. </summary>
@ -85,7 +126,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 privateEndpointConnectionName, CancellationToken cancellationToken = default)
{
return await RestClient.DeleteAsync(resourceGroupName, accountName, privateEndpointConnectionName, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsClient.Delete");
scope.Start();
try
{
return await RestClient.DeleteAsync(resourceGroupName, accountName, privateEndpointConnectionName, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes the specified private endpoint connection associated with the storage account. </summary>
@ -95,7 +146,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response Delete(string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default)
{
return RestClient.Delete(resourceGroupName, accountName, privateEndpointConnectionName, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsClient.Delete");
scope.Start();
try
{
return RestClient.Delete(resourceGroupName, accountName, privateEndpointConnectionName, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -87,36 +87,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(privateEndpointConnectionName));
}
using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsClient.Get");
scope.Start();
try
using var message = CreateGetRequest(resourceGroupName, accountName, privateEndpointConnectionName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetRequest(resourceGroupName, accountName, privateEndpointConnectionName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
PrivateEndpointConnection value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
PrivateEndpointConnection 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 = PrivateEndpointConnection.DeserializePrivateEndpointConnection(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 = PrivateEndpointConnection.DeserializePrivateEndpointConnection(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -140,36 +130,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(privateEndpointConnectionName));
}
using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsClient.Get");
scope.Start();
try
using var message = CreateGetRequest(resourceGroupName, accountName, privateEndpointConnectionName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetRequest(resourceGroupName, accountName, privateEndpointConnectionName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
PrivateEndpointConnection value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
PrivateEndpointConnection value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = PrivateEndpointConnection.DeserializePrivateEndpointConnection(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 = PrivateEndpointConnection.DeserializePrivateEndpointConnection(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -224,36 +204,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(privateEndpointConnectionName));
}
using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsClient.Put");
scope.Start();
try
using var message = CreatePutRequest(resourceGroupName, accountName, privateEndpointConnectionName, privateEndpoint, privateLinkServiceConnectionState);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreatePutRequest(resourceGroupName, accountName, privateEndpointConnectionName, privateEndpoint, privateLinkServiceConnectionState);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
PrivateEndpointConnection value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
PrivateEndpointConnection 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 = PrivateEndpointConnection.DeserializePrivateEndpointConnection(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 = PrivateEndpointConnection.DeserializePrivateEndpointConnection(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -279,36 +249,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(privateEndpointConnectionName));
}
using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsClient.Put");
scope.Start();
try
using var message = CreatePutRequest(resourceGroupName, accountName, privateEndpointConnectionName, privateEndpoint, privateLinkServiceConnectionState);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreatePutRequest(resourceGroupName, accountName, privateEndpointConnectionName, privateEndpoint, privateLinkServiceConnectionState);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
PrivateEndpointConnection value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
PrivateEndpointConnection value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = PrivateEndpointConnection.DeserializePrivateEndpointConnection(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 = PrivateEndpointConnection.DeserializePrivateEndpointConnection(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -352,25 +312,15 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(privateEndpointConnectionName));
}
using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(resourceGroupName, accountName, privateEndpointConnectionName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(resourceGroupName, accountName, privateEndpointConnectionName);
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);
}
}
@ -394,25 +344,15 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(privateEndpointConnectionName));
}
using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(resourceGroupName, accountName, privateEndpointConnectionName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(resourceGroupName, accountName, privateEndpointConnectionName);
_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);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -40,7 +41,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<PrivateLinkResourceListResult>> ListByStorageAccountAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
return await RestClient.ListByStorageAccountAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("PrivateLinkResourcesClient.ListByStorageAccount");
scope.Start();
try
{
return await RestClient.ListByStorageAccountAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets the private link resources that need to be created for a storage account. </summary>
@ -49,7 +60,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<PrivateLinkResourceListResult> ListByStorageAccount(string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
return RestClient.ListByStorageAccount(resourceGroupName, accountName, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("PrivateLinkResourcesClient.ListByStorageAccount");
scope.Start();
try
{
return RestClient.ListByStorageAccount(resourceGroupName, accountName, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -81,36 +81,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
using var scope = _clientDiagnostics.CreateScope("PrivateLinkResourcesClient.ListByStorageAccount");
scope.Start();
try
using var message = CreateListByStorageAccountRequest(resourceGroupName, accountName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListByStorageAccountRequest(resourceGroupName, accountName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
PrivateLinkResourceListResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
PrivateLinkResourceListResult 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 = PrivateLinkResourceListResult.DeserializePrivateLinkResourceListResult(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 = PrivateLinkResourceListResult.DeserializePrivateLinkResourceListResult(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("PrivateLinkResourcesClient.ListByStorageAccount");
scope.Start();
try
using var message = CreateListByStorageAccountRequest(resourceGroupName, accountName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListByStorageAccountRequest(resourceGroupName, accountName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
PrivateLinkResourceListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
PrivateLinkResourceListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = PrivateLinkResourceListResult.DeserializePrivateLinkResourceListResult(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 = PrivateLinkResourceListResult.DeserializePrivateLinkResourceListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -40,8 +41,18 @@ namespace Azure.Management.Storage
{
async Task<Page<SkuInformation>> FirstPageFunc(int? pageSizeHint)
{
var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("SkusClient.List");
scope.Start();
try
{
var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
}
@ -52,8 +63,18 @@ namespace Azure.Management.Storage
{
Page<SkuInformation> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.List(cancellationToken);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("SkusClient.List");
scope.Start();
try
{
var response = RestClient.List(cancellationToken);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
}

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

@ -66,36 +66,26 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response<StorageSkuListResult>> ListAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SkusClient.List");
scope.Start();
try
using var message = CreateListRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
StorageSkuListResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
StorageSkuListResult 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 = StorageSkuListResult.DeserializeStorageSkuListResult(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 = StorageSkuListResult.DeserializeStorageSkuListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -103,36 +93,26 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response<StorageSkuListResult> List(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SkusClient.List");
scope.Start();
try
using var message = CreateListRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
StorageSkuListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
StorageSkuListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = StorageSkuListResult.DeserializeStorageSkuListResult(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 = StorageSkuListResult.DeserializeStorageSkuListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -43,7 +43,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<CheckNameAvailabilityResult>> CheckNameAvailabilityAsync(string name, string type = "Microsoft.Storage/storageAccounts", CancellationToken cancellationToken = default)
{
return await RestClient.CheckNameAvailabilityAsync(name, type, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.CheckNameAvailability");
scope.Start();
try
{
return await RestClient.CheckNameAvailabilityAsync(name, type, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Checks that the storage account name is valid and is not already in use. </summary>
@ -52,7 +62,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<CheckNameAvailabilityResult> CheckNameAvailability(string name, string type = "Microsoft.Storage/storageAccounts", CancellationToken cancellationToken = default)
{
return RestClient.CheckNameAvailability(name, type, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.CheckNameAvailability");
scope.Start();
try
{
return RestClient.CheckNameAvailability(name, type, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes a storage account in Microsoft Azure. </summary>
@ -61,7 +81,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> DeleteAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
return await RestClient.DeleteAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.Delete");
scope.Start();
try
{
return await RestClient.DeleteAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes a storage account in Microsoft Azure. </summary>
@ -70,7 +100,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response Delete(string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
return RestClient.Delete(resourceGroupName, accountName, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.Delete");
scope.Start();
try
{
return RestClient.Delete(resourceGroupName, accountName, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. </summary>
@ -80,7 +120,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<StorageAccount>> GetPropertiesAsync(string resourceGroupName, string accountName, StorageAccountExpand? expand = null, CancellationToken cancellationToken = default)
{
return await RestClient.GetPropertiesAsync(resourceGroupName, accountName, expand, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.GetProperties");
scope.Start();
try
{
return await RestClient.GetPropertiesAsync(resourceGroupName, accountName, expand, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. </summary>
@ -90,7 +140,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<StorageAccount> GetProperties(string resourceGroupName, string accountName, StorageAccountExpand? expand = null, CancellationToken cancellationToken = default)
{
return RestClient.GetProperties(resourceGroupName, accountName, expand, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.GetProperties");
scope.Start();
try
{
return RestClient.GetProperties(resourceGroupName, accountName, expand, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. </summary>
@ -100,7 +160,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<StorageAccount>> UpdateAsync(string resourceGroupName, string accountName, StorageAccountUpdateParameters parameters, CancellationToken cancellationToken = default)
{
return await RestClient.UpdateAsync(resourceGroupName, accountName, parameters, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.Update");
scope.Start();
try
{
return await RestClient.UpdateAsync(resourceGroupName, accountName, parameters, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. </summary>
@ -110,7 +180,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<StorageAccount> Update(string resourceGroupName, string accountName, StorageAccountUpdateParameters parameters, CancellationToken cancellationToken = default)
{
return RestClient.Update(resourceGroupName, accountName, parameters, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.Update");
scope.Start();
try
{
return RestClient.Update(resourceGroupName, accountName, parameters, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. </summary>
@ -119,7 +199,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<StorageAccountListKeysResult>> ListKeysAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
return await RestClient.ListKeysAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.ListKeys");
scope.Start();
try
{
return await RestClient.ListKeysAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. </summary>
@ -128,7 +218,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<StorageAccountListKeysResult> ListKeys(string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
return RestClient.ListKeys(resourceGroupName, accountName, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.ListKeys");
scope.Start();
try
{
return RestClient.ListKeys(resourceGroupName, accountName, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Regenerates one of the access keys or Kerberos keys for the specified storage account. </summary>
@ -138,7 +238,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<StorageAccountListKeysResult>> RegenerateKeyAsync(string resourceGroupName, string accountName, string keyName, CancellationToken cancellationToken = default)
{
return await RestClient.RegenerateKeyAsync(resourceGroupName, accountName, keyName, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.RegenerateKey");
scope.Start();
try
{
return await RestClient.RegenerateKeyAsync(resourceGroupName, accountName, keyName, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Regenerates one of the access keys or Kerberos keys for the specified storage account. </summary>
@ -148,7 +258,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<StorageAccountListKeysResult> RegenerateKey(string resourceGroupName, string accountName, string keyName, CancellationToken cancellationToken = default)
{
return RestClient.RegenerateKey(resourceGroupName, accountName, keyName, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.RegenerateKey");
scope.Start();
try
{
return RestClient.RegenerateKey(resourceGroupName, accountName, keyName, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> List SAS credentials of a storage account. </summary>
@ -158,7 +278,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<ListAccountSasResponse>> ListAccountSASAsync(string resourceGroupName, string accountName, AccountSasParameters parameters, CancellationToken cancellationToken = default)
{
return await RestClient.ListAccountSASAsync(resourceGroupName, accountName, parameters, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.ListAccountSAS");
scope.Start();
try
{
return await RestClient.ListAccountSASAsync(resourceGroupName, accountName, parameters, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> List SAS credentials of a storage account. </summary>
@ -168,7 +298,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<ListAccountSasResponse> ListAccountSAS(string resourceGroupName, string accountName, AccountSasParameters parameters, CancellationToken cancellationToken = default)
{
return RestClient.ListAccountSAS(resourceGroupName, accountName, parameters, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.ListAccountSAS");
scope.Start();
try
{
return RestClient.ListAccountSAS(resourceGroupName, accountName, parameters, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> List service SAS credentials of a specific resource. </summary>
@ -178,7 +318,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<ListServiceSasResponse>> ListServiceSASAsync(string resourceGroupName, string accountName, ServiceSasParameters parameters, CancellationToken cancellationToken = default)
{
return await RestClient.ListServiceSASAsync(resourceGroupName, accountName, parameters, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.ListServiceSAS");
scope.Start();
try
{
return await RestClient.ListServiceSASAsync(resourceGroupName, accountName, parameters, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> List service SAS credentials of a specific resource. </summary>
@ -188,7 +338,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<ListServiceSasResponse> ListServiceSAS(string resourceGroupName, string accountName, ServiceSasParameters parameters, CancellationToken cancellationToken = default)
{
return RestClient.ListServiceSAS(resourceGroupName, accountName, parameters, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.ListServiceSAS");
scope.Start();
try
{
return RestClient.ListServiceSAS(resourceGroupName, accountName, parameters, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Revoke user delegation keys. </summary>
@ -197,7 +357,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> RevokeUserDelegationKeysAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
return await RestClient.RevokeUserDelegationKeysAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.RevokeUserDelegationKeys");
scope.Start();
try
{
return await RestClient.RevokeUserDelegationKeysAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Revoke user delegation keys. </summary>
@ -206,7 +376,17 @@ namespace Azure.Management.Storage
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response RevokeUserDelegationKeys(string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
return RestClient.RevokeUserDelegationKeys(resourceGroupName, accountName, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.RevokeUserDelegationKeys");
scope.Start();
try
{
return RestClient.RevokeUserDelegationKeys(resourceGroupName, accountName, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. </summary>
@ -215,13 +395,33 @@ namespace Azure.Management.Storage
{
async Task<Page<StorageAccount>> FirstPageFunc(int? pageSizeHint)
{
var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.List");
scope.Start();
try
{
var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
async Task<Page<StorageAccount>> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.List");
scope.Start();
try
{
var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
}
@ -232,13 +432,33 @@ namespace Azure.Management.Storage
{
Page<StorageAccount> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.List(cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.List");
scope.Start();
try
{
var response = RestClient.List(cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
Page<StorageAccount> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = RestClient.ListNextPage(nextLink, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.List");
scope.Start();
try
{
var response = RestClient.ListNextPage(nextLink, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
}
@ -255,8 +475,18 @@ namespace Azure.Management.Storage
async Task<Page<StorageAccount>> FirstPageFunc(int? pageSizeHint)
{
var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.ListByResourceGroup");
scope.Start();
try
{
var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
}
@ -273,8 +503,18 @@ namespace Azure.Management.Storage
Page<StorageAccount> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.ListByResourceGroup");
scope.Start();
try
{
var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
}
@ -293,7 +533,7 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(createOriginalHttpMessage));
}
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Put, "StorageAccountsClient.Create", OperationFinalStateVia.Location, createOriginalHttpMessage,
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Put, "StorageAccountsClient.StartCreate", OperationFinalStateVia.Location, createOriginalHttpMessage,
(response, cancellationToken) =>
{
using var document = JsonDocument.Parse(response.ContentStream);
@ -340,8 +580,18 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(parameters));
}
var originalResponse = await RestClient.CreateAsync(resourceGroupName, accountName, parameters, cancellationToken).ConfigureAwait(false);
return CreateCreate(originalResponse, () => RestClient.CreateCreateRequest(resourceGroupName, accountName, parameters));
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.StartCreate");
scope.Start();
try
{
var originalResponse = await RestClient.CreateAsync(resourceGroupName, accountName, parameters, cancellationToken).ConfigureAwait(false);
return CreateCreate(originalResponse, () => RestClient.CreateCreateRequest(resourceGroupName, accountName, parameters));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. </summary>
@ -364,8 +614,18 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(parameters));
}
var originalResponse = RestClient.Create(resourceGroupName, accountName, parameters, cancellationToken);
return CreateCreate(originalResponse, () => RestClient.CreateCreateRequest(resourceGroupName, accountName, parameters));
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.StartCreate");
scope.Start();
try
{
var originalResponse = RestClient.Create(resourceGroupName, accountName, parameters, cancellationToken);
return CreateCreate(originalResponse, () => RestClient.CreateCreateRequest(resourceGroupName, accountName, parameters));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account&apos;s primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. </summary>
@ -382,7 +642,7 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(createOriginalHttpMessage));
}
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Post, "StorageAccountsClient.Failover", OperationFinalStateVia.Location, createOriginalHttpMessage);
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Post, "StorageAccountsClient.StartFailover", OperationFinalStateVia.Location, createOriginalHttpMessage);
}
/// <summary> Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account&apos;s primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. </summary>
@ -400,8 +660,18 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
var originalResponse = await RestClient.FailoverAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
return CreateFailover(originalResponse, () => RestClient.CreateFailoverRequest(resourceGroupName, accountName));
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.StartFailover");
scope.Start();
try
{
var originalResponse = await RestClient.FailoverAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false);
return CreateFailover(originalResponse, () => RestClient.CreateFailoverRequest(resourceGroupName, accountName));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account&apos;s primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. </summary>
@ -419,8 +689,18 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(accountName));
}
var originalResponse = RestClient.Failover(resourceGroupName, accountName, cancellationToken);
return CreateFailover(originalResponse, () => RestClient.CreateFailoverRequest(resourceGroupName, accountName));
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.StartFailover");
scope.Start();
try
{
var originalResponse = RestClient.Failover(resourceGroupName, accountName, cancellationToken);
return CreateFailover(originalResponse, () => RestClient.CreateFailoverRequest(resourceGroupName, accountName));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Restore blobs in the specified blob ranges. </summary>
@ -437,7 +717,7 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(createOriginalHttpMessage));
}
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Post, "StorageAccountsClient.RestoreBlobRanges", OperationFinalStateVia.Location, createOriginalHttpMessage,
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Post, "StorageAccountsClient.StartRestoreBlobRanges", OperationFinalStateVia.Location, createOriginalHttpMessage,
(response, cancellationToken) =>
{
using var document = JsonDocument.Parse(response.ContentStream);
@ -485,8 +765,18 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(blobRanges));
}
var originalResponse = await RestClient.RestoreBlobRangesAsync(resourceGroupName, accountName, timeToRestore, blobRanges, cancellationToken).ConfigureAwait(false);
return CreateRestoreBlobRanges(originalResponse, () => RestClient.CreateRestoreBlobRangesRequest(resourceGroupName, accountName, timeToRestore, blobRanges));
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.StartRestoreBlobRanges");
scope.Start();
try
{
var originalResponse = await RestClient.RestoreBlobRangesAsync(resourceGroupName, accountName, timeToRestore, blobRanges, cancellationToken).ConfigureAwait(false);
return CreateRestoreBlobRanges(originalResponse, () => RestClient.CreateRestoreBlobRangesRequest(resourceGroupName, accountName, timeToRestore, blobRanges));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Restore blobs in the specified blob ranges. </summary>
@ -510,8 +800,18 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(blobRanges));
}
var originalResponse = RestClient.RestoreBlobRanges(resourceGroupName, accountName, timeToRestore, blobRanges, cancellationToken);
return CreateRestoreBlobRanges(originalResponse, () => RestClient.CreateRestoreBlobRangesRequest(resourceGroupName, accountName, timeToRestore, blobRanges));
using var scope = _clientDiagnostics.CreateScope("StorageAccountsClient.StartRestoreBlobRanges");
scope.Start();
try
{
var originalResponse = RestClient.RestoreBlobRanges(resourceGroupName, accountName, timeToRestore, blobRanges, cancellationToken);
return CreateRestoreBlobRanges(originalResponse, () => RestClient.CreateRestoreBlobRangesRequest(resourceGroupName, accountName, timeToRestore, blobRanges));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

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

@ -47,8 +47,18 @@ namespace Azure.Management.Storage
async Task<Page<Usage>> FirstPageFunc(int? pageSizeHint)
{
var response = await RestClient.ListByLocationAsync(location, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("UsagesClient.ListByLocation");
scope.Start();
try
{
var response = await RestClient.ListByLocationAsync(location, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
}
@ -65,8 +75,18 @@ namespace Azure.Management.Storage
Page<Usage> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.ListByLocation(location, cancellationToken);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("UsagesClient.ListByLocation");
scope.Start();
try
{
var response = RestClient.ListByLocation(location, cancellationToken);
return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
}

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

@ -74,36 +74,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(location));
}
using var scope = _clientDiagnostics.CreateScope("UsagesClient.ListByLocation");
scope.Start();
try
using var message = CreateListByLocationRequest(location);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListByLocationRequest(location);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
UsageListResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
UsageListResult 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 = UsageListResult.DeserializeUsageListResult(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 = UsageListResult.DeserializeUsageListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -117,36 +107,26 @@ namespace Azure.Management.Storage
throw new ArgumentNullException(nameof(location));
}
using var scope = _clientDiagnostics.CreateScope("UsagesClient.ListByLocation");
scope.Start();
try
using var message = CreateListByLocationRequest(location);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListByLocationRequest(location);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
UsageListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
UsageListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = UsageListResult.DeserializeUsageListResult(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 = UsageListResult.DeserializeUsageListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -40,7 +40,17 @@ namespace Azure.Network.Management.Interface
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<NetworkInterfaceIPConfiguration>> GetAsync(string resourceGroupName, string networkInterfaceName, string ipConfigurationName, CancellationToken cancellationToken = default)
{
return await RestClient.GetAsync(resourceGroupName, networkInterfaceName, ipConfigurationName, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceIPConfigurationsClient.Get");
scope.Start();
try
{
return await RestClient.GetAsync(resourceGroupName, networkInterfaceName, ipConfigurationName, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets the specified network interface ip configuration. </summary>
@ -50,7 +60,17 @@ namespace Azure.Network.Management.Interface
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<NetworkInterfaceIPConfiguration> Get(string resourceGroupName, string networkInterfaceName, string ipConfigurationName, CancellationToken cancellationToken = default)
{
return RestClient.Get(resourceGroupName, networkInterfaceName, ipConfigurationName, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceIPConfigurationsClient.Get");
scope.Start();
try
{
return RestClient.Get(resourceGroupName, networkInterfaceName, ipConfigurationName, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get all ip configurations in a network interface. </summary>
@ -70,13 +90,33 @@ namespace Azure.Network.Management.Interface
async Task<Page<NetworkInterfaceIPConfiguration>> FirstPageFunc(int? pageSizeHint)
{
var response = await RestClient.ListAsync(resourceGroupName, networkInterfaceName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceIPConfigurationsClient.List");
scope.Start();
try
{
var response = await RestClient.ListAsync(resourceGroupName, networkInterfaceName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
async Task<Page<NetworkInterfaceIPConfiguration>> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, networkInterfaceName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceIPConfigurationsClient.List");
scope.Start();
try
{
var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, networkInterfaceName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
}
@ -98,13 +138,33 @@ namespace Azure.Network.Management.Interface
Page<NetworkInterfaceIPConfiguration> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.List(resourceGroupName, networkInterfaceName, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceIPConfigurationsClient.List");
scope.Start();
try
{
var response = RestClient.List(resourceGroupName, networkInterfaceName, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
Page<NetworkInterfaceIPConfiguration> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = RestClient.ListNextPage(nextLink, resourceGroupName, networkInterfaceName, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceIPConfigurationsClient.List");
scope.Start();
try
{
var response = RestClient.ListNextPage(nextLink, resourceGroupName, networkInterfaceName, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
}

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

@ -81,36 +81,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceIPConfigurationsClient.List");
scope.Start();
try
using var message = CreateListRequest(resourceGroupName, networkInterfaceName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListRequest(resourceGroupName, networkInterfaceName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceIPConfigurationListResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceIPConfigurationListResult 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 = NetworkInterfaceIPConfigurationListResult.DeserializeNetworkInterfaceIPConfigurationListResult(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 = NetworkInterfaceIPConfigurationListResult.DeserializeNetworkInterfaceIPConfigurationListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -129,36 +119,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceIPConfigurationsClient.List");
scope.Start();
try
using var message = CreateListRequest(resourceGroupName, networkInterfaceName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListRequest(resourceGroupName, networkInterfaceName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceIPConfigurationListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceIPConfigurationListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = NetworkInterfaceIPConfigurationListResult.DeserializeNetworkInterfaceIPConfigurationListResult(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 = NetworkInterfaceIPConfigurationListResult.DeserializeNetworkInterfaceIPConfigurationListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -202,36 +182,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(ipConfigurationName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceIPConfigurationsClient.Get");
scope.Start();
try
using var message = CreateGetRequest(resourceGroupName, networkInterfaceName, ipConfigurationName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetRequest(resourceGroupName, networkInterfaceName, ipConfigurationName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceIPConfiguration value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceIPConfiguration 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 = NetworkInterfaceIPConfiguration.DeserializeNetworkInterfaceIPConfiguration(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 = NetworkInterfaceIPConfiguration.DeserializeNetworkInterfaceIPConfiguration(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -255,36 +225,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(ipConfigurationName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceIPConfigurationsClient.Get");
scope.Start();
try
using var message = CreateGetRequest(resourceGroupName, networkInterfaceName, ipConfigurationName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetRequest(resourceGroupName, networkInterfaceName, ipConfigurationName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceIPConfiguration value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceIPConfiguration value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = NetworkInterfaceIPConfiguration.DeserializeNetworkInterfaceIPConfiguration(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 = NetworkInterfaceIPConfiguration.DeserializeNetworkInterfaceIPConfiguration(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -320,36 +280,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceIPConfigurationsClient.List");
scope.Start();
try
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, networkInterfaceName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, networkInterfaceName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceIPConfigurationListResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceIPConfigurationListResult 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 = NetworkInterfaceIPConfigurationListResult.DeserializeNetworkInterfaceIPConfigurationListResult(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 = NetworkInterfaceIPConfigurationListResult.DeserializeNetworkInterfaceIPConfigurationListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -373,36 +323,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceIPConfigurationsClient.List");
scope.Start();
try
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, networkInterfaceName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, networkInterfaceName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceIPConfigurationListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceIPConfigurationListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = NetworkInterfaceIPConfigurationListResult.DeserializeNetworkInterfaceIPConfigurationListResult(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 = NetworkInterfaceIPConfigurationListResult.DeserializeNetworkInterfaceIPConfigurationListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -50,13 +50,33 @@ namespace Azure.Network.Management.Interface
async Task<Page<LoadBalancer>> FirstPageFunc(int? pageSizeHint)
{
var response = await RestClient.ListAsync(resourceGroupName, networkInterfaceName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceLoadBalancersClient.List");
scope.Start();
try
{
var response = await RestClient.ListAsync(resourceGroupName, networkInterfaceName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
async Task<Page<LoadBalancer>> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, networkInterfaceName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceLoadBalancersClient.List");
scope.Start();
try
{
var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, networkInterfaceName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
}
@ -78,13 +98,33 @@ namespace Azure.Network.Management.Interface
Page<LoadBalancer> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.List(resourceGroupName, networkInterfaceName, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceLoadBalancersClient.List");
scope.Start();
try
{
var response = RestClient.List(resourceGroupName, networkInterfaceName, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
Page<LoadBalancer> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = RestClient.ListNextPage(nextLink, resourceGroupName, networkInterfaceName, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceLoadBalancersClient.List");
scope.Start();
try
{
var response = RestClient.ListNextPage(nextLink, resourceGroupName, networkInterfaceName, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
}

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

@ -81,36 +81,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceLoadBalancersClient.List");
scope.Start();
try
using var message = CreateListRequest(resourceGroupName, networkInterfaceName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListRequest(resourceGroupName, networkInterfaceName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceLoadBalancerListResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceLoadBalancerListResult 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 = NetworkInterfaceLoadBalancerListResult.DeserializeNetworkInterfaceLoadBalancerListResult(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 = NetworkInterfaceLoadBalancerListResult.DeserializeNetworkInterfaceLoadBalancerListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -129,36 +119,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceLoadBalancersClient.List");
scope.Start();
try
using var message = CreateListRequest(resourceGroupName, networkInterfaceName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListRequest(resourceGroupName, networkInterfaceName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceLoadBalancerListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceLoadBalancerListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = NetworkInterfaceLoadBalancerListResult.DeserializeNetworkInterfaceLoadBalancerListResult(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 = NetworkInterfaceLoadBalancerListResult.DeserializeNetworkInterfaceLoadBalancerListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -194,36 +174,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceLoadBalancersClient.List");
scope.Start();
try
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, networkInterfaceName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, networkInterfaceName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceLoadBalancerListResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceLoadBalancerListResult 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 = NetworkInterfaceLoadBalancerListResult.DeserializeNetworkInterfaceLoadBalancerListResult(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 = NetworkInterfaceLoadBalancerListResult.DeserializeNetworkInterfaceLoadBalancerListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -247,36 +217,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceLoadBalancersClient.List");
scope.Start();
try
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, networkInterfaceName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, networkInterfaceName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceLoadBalancerListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceLoadBalancerListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = NetworkInterfaceLoadBalancerListResult.DeserializeNetworkInterfaceLoadBalancerListResult(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 = NetworkInterfaceLoadBalancerListResult.DeserializeNetworkInterfaceLoadBalancerListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -41,7 +41,17 @@ namespace Azure.Network.Management.Interface
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<NetworkInterfaceTapConfiguration>> GetAsync(string resourceGroupName, string networkInterfaceName, string tapConfigurationName, CancellationToken cancellationToken = default)
{
return await RestClient.GetAsync(resourceGroupName, networkInterfaceName, tapConfigurationName, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationsClient.Get");
scope.Start();
try
{
return await RestClient.GetAsync(resourceGroupName, networkInterfaceName, tapConfigurationName, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get the specified tap configuration on a network interface. </summary>
@ -51,7 +61,17 @@ namespace Azure.Network.Management.Interface
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<NetworkInterfaceTapConfiguration> Get(string resourceGroupName, string networkInterfaceName, string tapConfigurationName, CancellationToken cancellationToken = default)
{
return RestClient.Get(resourceGroupName, networkInterfaceName, tapConfigurationName, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationsClient.Get");
scope.Start();
try
{
return RestClient.Get(resourceGroupName, networkInterfaceName, tapConfigurationName, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get all Tap configurations in a network interface. </summary>
@ -71,13 +91,33 @@ namespace Azure.Network.Management.Interface
async Task<Page<NetworkInterfaceTapConfiguration>> FirstPageFunc(int? pageSizeHint)
{
var response = await RestClient.ListAsync(resourceGroupName, networkInterfaceName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationsClient.List");
scope.Start();
try
{
var response = await RestClient.ListAsync(resourceGroupName, networkInterfaceName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
async Task<Page<NetworkInterfaceTapConfiguration>> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, networkInterfaceName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationsClient.List");
scope.Start();
try
{
var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, networkInterfaceName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
}
@ -99,13 +139,33 @@ namespace Azure.Network.Management.Interface
Page<NetworkInterfaceTapConfiguration> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.List(resourceGroupName, networkInterfaceName, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationsClient.List");
scope.Start();
try
{
var response = RestClient.List(resourceGroupName, networkInterfaceName, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
Page<NetworkInterfaceTapConfiguration> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = RestClient.ListNextPage(nextLink, resourceGroupName, networkInterfaceName, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationsClient.List");
scope.Start();
try
{
var response = RestClient.ListNextPage(nextLink, resourceGroupName, networkInterfaceName, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
}
@ -124,7 +184,7 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(createOriginalHttpMessage));
}
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Delete, "NetworkInterfaceTapConfigurationsClient.Delete", OperationFinalStateVia.Location, createOriginalHttpMessage);
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Delete, "NetworkInterfaceTapConfigurationsClient.StartDelete", OperationFinalStateVia.Location, createOriginalHttpMessage);
}
/// <summary> Deletes the specified tap configuration from the NetworkInterface. </summary>
@ -147,8 +207,18 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(tapConfigurationName));
}
var originalResponse = await RestClient.DeleteAsync(resourceGroupName, networkInterfaceName, tapConfigurationName, cancellationToken).ConfigureAwait(false);
return CreateDelete(originalResponse, () => RestClient.CreateDeleteRequest(resourceGroupName, networkInterfaceName, tapConfigurationName));
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationsClient.StartDelete");
scope.Start();
try
{
var originalResponse = await RestClient.DeleteAsync(resourceGroupName, networkInterfaceName, tapConfigurationName, cancellationToken).ConfigureAwait(false);
return CreateDelete(originalResponse, () => RestClient.CreateDeleteRequest(resourceGroupName, networkInterfaceName, tapConfigurationName));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes the specified tap configuration from the NetworkInterface. </summary>
@ -171,8 +241,18 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(tapConfigurationName));
}
var originalResponse = RestClient.Delete(resourceGroupName, networkInterfaceName, tapConfigurationName, cancellationToken);
return CreateDelete(originalResponse, () => RestClient.CreateDeleteRequest(resourceGroupName, networkInterfaceName, tapConfigurationName));
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationsClient.StartDelete");
scope.Start();
try
{
var originalResponse = RestClient.Delete(resourceGroupName, networkInterfaceName, tapConfigurationName, cancellationToken);
return CreateDelete(originalResponse, () => RestClient.CreateDeleteRequest(resourceGroupName, networkInterfaceName, tapConfigurationName));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates or updates a Tap configuration in the specified NetworkInterface. </summary>
@ -189,7 +269,7 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(createOriginalHttpMessage));
}
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Put, "NetworkInterfaceTapConfigurationsClient.CreateOrUpdate", OperationFinalStateVia.AzureAsyncOperation, createOriginalHttpMessage,
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Put, "NetworkInterfaceTapConfigurationsClient.StartCreateOrUpdate", OperationFinalStateVia.AzureAsyncOperation, createOriginalHttpMessage,
(response, cancellationToken) =>
{
using var document = JsonDocument.Parse(response.ContentStream);
@ -241,8 +321,18 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(tapConfigurationParameters));
}
var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters, cancellationToken).ConfigureAwait(false);
return CreateCreateOrUpdate(originalResponse, () => RestClient.CreateCreateOrUpdateRequest(resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters));
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationsClient.StartCreateOrUpdate");
scope.Start();
try
{
var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters, cancellationToken).ConfigureAwait(false);
return CreateCreateOrUpdate(originalResponse, () => RestClient.CreateCreateOrUpdateRequest(resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates or updates a Tap configuration in the specified NetworkInterface. </summary>
@ -270,8 +360,18 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(tapConfigurationParameters));
}
var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters, cancellationToken);
return CreateCreateOrUpdate(originalResponse, () => RestClient.CreateCreateOrUpdateRequest(resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters));
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationsClient.StartCreateOrUpdate");
scope.Start();
try
{
var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters, cancellationToken);
return CreateCreateOrUpdate(originalResponse, () => RestClient.CreateCreateOrUpdateRequest(resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -87,25 +87,15 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(tapConfigurationName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationsClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(resourceGroupName, networkInterfaceName, tapConfigurationName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(resourceGroupName, networkInterfaceName, tapConfigurationName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 202:
case 200:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 202:
case 200:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -129,25 +119,15 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(tapConfigurationName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationsClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(resourceGroupName, networkInterfaceName, tapConfigurationName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(resourceGroupName, networkInterfaceName, tapConfigurationName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 202:
case 200:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 202:
case 200:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -191,36 +171,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(tapConfigurationName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationsClient.Get");
scope.Start();
try
using var message = CreateGetRequest(resourceGroupName, networkInterfaceName, tapConfigurationName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetRequest(resourceGroupName, networkInterfaceName, tapConfigurationName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceTapConfiguration value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceTapConfiguration 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 = NetworkInterfaceTapConfiguration.DeserializeNetworkInterfaceTapConfiguration(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 = NetworkInterfaceTapConfiguration.DeserializeNetworkInterfaceTapConfiguration(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -244,36 +214,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(tapConfigurationName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationsClient.Get");
scope.Start();
try
using var message = CreateGetRequest(resourceGroupName, networkInterfaceName, tapConfigurationName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetRequest(resourceGroupName, networkInterfaceName, tapConfigurationName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceTapConfiguration value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceTapConfiguration value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = NetworkInterfaceTapConfiguration.DeserializeNetworkInterfaceTapConfiguration(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 = NetworkInterfaceTapConfiguration.DeserializeNetworkInterfaceTapConfiguration(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -326,25 +286,15 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(tapConfigurationParameters));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationsClient.CreateOrUpdate");
scope.Start();
try
using var message = CreateCreateOrUpdateRequest(resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateOrUpdateRequest(resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 201:
case 200:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 201:
case 200:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -373,25 +323,15 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(tapConfigurationParameters));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationsClient.CreateOrUpdate");
scope.Start();
try
using var message = CreateCreateOrUpdateRequest(resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateOrUpdateRequest(resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 201:
case 200:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 201:
case 200:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -429,36 +369,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationsClient.List");
scope.Start();
try
using var message = CreateListRequest(resourceGroupName, networkInterfaceName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListRequest(resourceGroupName, networkInterfaceName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceTapConfigurationListResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceTapConfigurationListResult 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 = NetworkInterfaceTapConfigurationListResult.DeserializeNetworkInterfaceTapConfigurationListResult(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 = NetworkInterfaceTapConfigurationListResult.DeserializeNetworkInterfaceTapConfigurationListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -477,36 +407,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationsClient.List");
scope.Start();
try
using var message = CreateListRequest(resourceGroupName, networkInterfaceName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListRequest(resourceGroupName, networkInterfaceName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceTapConfigurationListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceTapConfigurationListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = NetworkInterfaceTapConfigurationListResult.DeserializeNetworkInterfaceTapConfigurationListResult(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 = NetworkInterfaceTapConfigurationListResult.DeserializeNetworkInterfaceTapConfigurationListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -542,36 +462,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationsClient.List");
scope.Start();
try
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, networkInterfaceName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, networkInterfaceName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceTapConfigurationListResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceTapConfigurationListResult 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 = NetworkInterfaceTapConfigurationListResult.DeserializeNetworkInterfaceTapConfigurationListResult(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 = NetworkInterfaceTapConfigurationListResult.DeserializeNetworkInterfaceTapConfigurationListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -595,36 +505,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationsClient.List");
scope.Start();
try
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, networkInterfaceName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, networkInterfaceName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceTapConfigurationListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceTapConfigurationListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = NetworkInterfaceTapConfigurationListResult.DeserializeNetworkInterfaceTapConfigurationListResult(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 = NetworkInterfaceTapConfigurationListResult.DeserializeNetworkInterfaceTapConfigurationListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -41,7 +41,17 @@ namespace Azure.Network.Management.Interface
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<NetworkInterface>> GetAsync(string resourceGroupName, string networkInterfaceName, string expand = null, CancellationToken cancellationToken = default)
{
return await RestClient.GetAsync(resourceGroupName, networkInterfaceName, expand, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.Get");
scope.Start();
try
{
return await RestClient.GetAsync(resourceGroupName, networkInterfaceName, expand, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets information about the specified network interface. </summary>
@ -51,7 +61,17 @@ namespace Azure.Network.Management.Interface
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<NetworkInterface> Get(string resourceGroupName, string networkInterfaceName, string expand = null, CancellationToken cancellationToken = default)
{
return RestClient.Get(resourceGroupName, networkInterfaceName, expand, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.Get");
scope.Start();
try
{
return RestClient.Get(resourceGroupName, networkInterfaceName, expand, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Updates a network interface tags. </summary>
@ -61,7 +81,17 @@ namespace Azure.Network.Management.Interface
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<NetworkInterface>> UpdateTagsAsync(string resourceGroupName, string networkInterfaceName, TagsObject parameters, CancellationToken cancellationToken = default)
{
return await RestClient.UpdateTagsAsync(resourceGroupName, networkInterfaceName, parameters, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.UpdateTags");
scope.Start();
try
{
return await RestClient.UpdateTagsAsync(resourceGroupName, networkInterfaceName, parameters, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Updates a network interface tags. </summary>
@ -71,7 +101,17 @@ namespace Azure.Network.Management.Interface
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<NetworkInterface> UpdateTags(string resourceGroupName, string networkInterfaceName, TagsObject parameters, CancellationToken cancellationToken = default)
{
return RestClient.UpdateTags(resourceGroupName, networkInterfaceName, parameters, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.UpdateTags");
scope.Start();
try
{
return RestClient.UpdateTags(resourceGroupName, networkInterfaceName, parameters, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets all network interfaces in a subscription. </summary>
@ -80,13 +120,33 @@ namespace Azure.Network.Management.Interface
{
async Task<Page<NetworkInterface>> FirstPageFunc(int? pageSizeHint)
{
var response = await RestClient.ListAllAsync(cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.ListAll");
scope.Start();
try
{
var response = await RestClient.ListAllAsync(cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
async Task<Page<NetworkInterface>> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = await RestClient.ListAllNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.ListAll");
scope.Start();
try
{
var response = await RestClient.ListAllNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
}
@ -97,13 +157,33 @@ namespace Azure.Network.Management.Interface
{
Page<NetworkInterface> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.ListAll(cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.ListAll");
scope.Start();
try
{
var response = RestClient.ListAll(cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
Page<NetworkInterface> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = RestClient.ListAllNextPage(nextLink, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.ListAll");
scope.Start();
try
{
var response = RestClient.ListAllNextPage(nextLink, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
}
@ -120,13 +200,33 @@ namespace Azure.Network.Management.Interface
async Task<Page<NetworkInterface>> FirstPageFunc(int? pageSizeHint)
{
var response = await RestClient.ListAsync(resourceGroupName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.List");
scope.Start();
try
{
var response = await RestClient.ListAsync(resourceGroupName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
async Task<Page<NetworkInterface>> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.List");
scope.Start();
try
{
var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
}
@ -143,13 +243,33 @@ namespace Azure.Network.Management.Interface
Page<NetworkInterface> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.List(resourceGroupName, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.List");
scope.Start();
try
{
var response = RestClient.List(resourceGroupName, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
Page<NetworkInterface> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = RestClient.ListNextPage(nextLink, resourceGroupName, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.List");
scope.Start();
try
{
var response = RestClient.ListNextPage(nextLink, resourceGroupName, cancellationToken);
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
}
@ -168,7 +288,7 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(createOriginalHttpMessage));
}
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Delete, "NetworkInterfacesClient.Delete", OperationFinalStateVia.Location, createOriginalHttpMessage);
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Delete, "NetworkInterfacesClient.StartDelete", OperationFinalStateVia.Location, createOriginalHttpMessage);
}
/// <summary> Deletes the specified network interface. </summary>
@ -186,8 +306,18 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
var originalResponse = await RestClient.DeleteAsync(resourceGroupName, networkInterfaceName, cancellationToken).ConfigureAwait(false);
return CreateDelete(originalResponse, () => RestClient.CreateDeleteRequest(resourceGroupName, networkInterfaceName));
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.StartDelete");
scope.Start();
try
{
var originalResponse = await RestClient.DeleteAsync(resourceGroupName, networkInterfaceName, cancellationToken).ConfigureAwait(false);
return CreateDelete(originalResponse, () => RestClient.CreateDeleteRequest(resourceGroupName, networkInterfaceName));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes the specified network interface. </summary>
@ -205,8 +335,18 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
var originalResponse = RestClient.Delete(resourceGroupName, networkInterfaceName, cancellationToken);
return CreateDelete(originalResponse, () => RestClient.CreateDeleteRequest(resourceGroupName, networkInterfaceName));
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.StartDelete");
scope.Start();
try
{
var originalResponse = RestClient.Delete(resourceGroupName, networkInterfaceName, cancellationToken);
return CreateDelete(originalResponse, () => RestClient.CreateDeleteRequest(resourceGroupName, networkInterfaceName));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates or updates a network interface. </summary>
@ -223,7 +363,7 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(createOriginalHttpMessage));
}
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Put, "NetworkInterfacesClient.CreateOrUpdate", OperationFinalStateVia.AzureAsyncOperation, createOriginalHttpMessage,
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Put, "NetworkInterfacesClient.StartCreateOrUpdate", OperationFinalStateVia.AzureAsyncOperation, createOriginalHttpMessage,
(response, cancellationToken) =>
{
using var document = JsonDocument.Parse(response.ContentStream);
@ -270,8 +410,18 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(parameters));
}
var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, networkInterfaceName, parameters, cancellationToken).ConfigureAwait(false);
return CreateCreateOrUpdate(originalResponse, () => RestClient.CreateCreateOrUpdateRequest(resourceGroupName, networkInterfaceName, parameters));
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.StartCreateOrUpdate");
scope.Start();
try
{
var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, networkInterfaceName, parameters, cancellationToken).ConfigureAwait(false);
return CreateCreateOrUpdate(originalResponse, () => RestClient.CreateCreateOrUpdateRequest(resourceGroupName, networkInterfaceName, parameters));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates or updates a network interface. </summary>
@ -294,8 +444,18 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(parameters));
}
var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, networkInterfaceName, parameters, cancellationToken);
return CreateCreateOrUpdate(originalResponse, () => RestClient.CreateCreateOrUpdateRequest(resourceGroupName, networkInterfaceName, parameters));
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.StartCreateOrUpdate");
scope.Start();
try
{
var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, networkInterfaceName, parameters, cancellationToken);
return CreateCreateOrUpdate(originalResponse, () => RestClient.CreateCreateOrUpdateRequest(resourceGroupName, networkInterfaceName, parameters));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets all route tables applied to a network interface. </summary>
@ -312,7 +472,7 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(createOriginalHttpMessage));
}
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Post, "NetworkInterfacesClient.GetEffectiveRouteTable", OperationFinalStateVia.Location, createOriginalHttpMessage,
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Post, "NetworkInterfacesClient.StartGetEffectiveRouteTable", OperationFinalStateVia.Location, createOriginalHttpMessage,
(response, cancellationToken) =>
{
using var document = JsonDocument.Parse(response.ContentStream);
@ -354,8 +514,18 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
var originalResponse = await RestClient.GetEffectiveRouteTableAsync(resourceGroupName, networkInterfaceName, cancellationToken).ConfigureAwait(false);
return CreateGetEffectiveRouteTable(originalResponse, () => RestClient.CreateGetEffectiveRouteTableRequest(resourceGroupName, networkInterfaceName));
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.StartGetEffectiveRouteTable");
scope.Start();
try
{
var originalResponse = await RestClient.GetEffectiveRouteTableAsync(resourceGroupName, networkInterfaceName, cancellationToken).ConfigureAwait(false);
return CreateGetEffectiveRouteTable(originalResponse, () => RestClient.CreateGetEffectiveRouteTableRequest(resourceGroupName, networkInterfaceName));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets all route tables applied to a network interface. </summary>
@ -373,8 +543,18 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
var originalResponse = RestClient.GetEffectiveRouteTable(resourceGroupName, networkInterfaceName, cancellationToken);
return CreateGetEffectiveRouteTable(originalResponse, () => RestClient.CreateGetEffectiveRouteTableRequest(resourceGroupName, networkInterfaceName));
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.StartGetEffectiveRouteTable");
scope.Start();
try
{
var originalResponse = RestClient.GetEffectiveRouteTable(resourceGroupName, networkInterfaceName, cancellationToken);
return CreateGetEffectiveRouteTable(originalResponse, () => RestClient.CreateGetEffectiveRouteTableRequest(resourceGroupName, networkInterfaceName));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets all network security groups applied to a network interface. </summary>
@ -391,7 +571,7 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(createOriginalHttpMessage));
}
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Post, "NetworkInterfacesClient.ListEffectiveNetworkSecurityGroups", OperationFinalStateVia.Location, createOriginalHttpMessage,
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Post, "NetworkInterfacesClient.StartListEffectiveNetworkSecurityGroups", OperationFinalStateVia.Location, createOriginalHttpMessage,
(response, cancellationToken) =>
{
using var document = JsonDocument.Parse(response.ContentStream);
@ -433,8 +613,18 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
var originalResponse = await RestClient.ListEffectiveNetworkSecurityGroupsAsync(resourceGroupName, networkInterfaceName, cancellationToken).ConfigureAwait(false);
return CreateListEffectiveNetworkSecurityGroups(originalResponse, () => RestClient.CreateListEffectiveNetworkSecurityGroupsRequest(resourceGroupName, networkInterfaceName));
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.StartListEffectiveNetworkSecurityGroups");
scope.Start();
try
{
var originalResponse = await RestClient.ListEffectiveNetworkSecurityGroupsAsync(resourceGroupName, networkInterfaceName, cancellationToken).ConfigureAwait(false);
return CreateListEffectiveNetworkSecurityGroups(originalResponse, () => RestClient.CreateListEffectiveNetworkSecurityGroupsRequest(resourceGroupName, networkInterfaceName));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets all network security groups applied to a network interface. </summary>
@ -452,8 +642,18 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
var originalResponse = RestClient.ListEffectiveNetworkSecurityGroups(resourceGroupName, networkInterfaceName, cancellationToken);
return CreateListEffectiveNetworkSecurityGroups(originalResponse, () => RestClient.CreateListEffectiveNetworkSecurityGroupsRequest(resourceGroupName, networkInterfaceName));
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.StartListEffectiveNetworkSecurityGroups");
scope.Start();
try
{
var originalResponse = RestClient.ListEffectiveNetworkSecurityGroups(resourceGroupName, networkInterfaceName, cancellationToken);
return CreateListEffectiveNetworkSecurityGroups(originalResponse, () => RestClient.CreateListEffectiveNetworkSecurityGroupsRequest(resourceGroupName, networkInterfaceName));
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -80,25 +80,15 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(resourceGroupName, networkInterfaceName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(resourceGroupName, networkInterfaceName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 202:
case 200:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 202:
case 200:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -117,25 +107,15 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(resourceGroupName, networkInterfaceName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(resourceGroupName, networkInterfaceName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 202:
case 200:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 202:
case 200:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -177,36 +157,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.Get");
scope.Start();
try
using var message = CreateGetRequest(resourceGroupName, networkInterfaceName, expand);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetRequest(resourceGroupName, networkInterfaceName, expand);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterface value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterface 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 = NetworkInterface.DeserializeNetworkInterface(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 = NetworkInterface.DeserializeNetworkInterface(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -226,36 +196,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.Get");
scope.Start();
try
using var message = CreateGetRequest(resourceGroupName, networkInterfaceName, expand);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetRequest(resourceGroupName, networkInterfaceName, expand);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterface value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterface value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = NetworkInterface.DeserializeNetworkInterface(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 = NetworkInterface.DeserializeNetworkInterface(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -301,25 +261,15 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(parameters));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.CreateOrUpdate");
scope.Start();
try
using var message = CreateCreateOrUpdateRequest(resourceGroupName, networkInterfaceName, parameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateOrUpdateRequest(resourceGroupName, networkInterfaceName, parameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 201:
case 200:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 201:
case 200:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -343,25 +293,15 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(parameters));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.CreateOrUpdate");
scope.Start();
try
using var message = CreateCreateOrUpdateRequest(resourceGroupName, networkInterfaceName, parameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateOrUpdateRequest(resourceGroupName, networkInterfaceName, parameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 201:
case 200:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 201:
case 200:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -407,36 +347,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(parameters));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.UpdateTags");
scope.Start();
try
using var message = CreateUpdateTagsRequest(resourceGroupName, networkInterfaceName, parameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateUpdateTagsRequest(resourceGroupName, networkInterfaceName, parameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterface value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterface 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 = NetworkInterface.DeserializeNetworkInterface(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 = NetworkInterface.DeserializeNetworkInterface(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -460,36 +390,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(parameters));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.UpdateTags");
scope.Start();
try
using var message = CreateUpdateTagsRequest(resourceGroupName, networkInterfaceName, parameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateUpdateTagsRequest(resourceGroupName, networkInterfaceName, parameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterface value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterface value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = NetworkInterface.DeserializeNetworkInterface(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 = NetworkInterface.DeserializeNetworkInterface(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -512,36 +432,26 @@ namespace Azure.Network.Management.Interface
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response<NetworkInterfaceListResult>> ListAllAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.ListAll");
scope.Start();
try
using var message = CreateListAllRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListAllRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceListResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceListResult 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 = NetworkInterfaceListResult.DeserializeNetworkInterfaceListResult(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 = NetworkInterfaceListResult.DeserializeNetworkInterfaceListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -549,36 +459,26 @@ namespace Azure.Network.Management.Interface
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response<NetworkInterfaceListResult> ListAll(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.ListAll");
scope.Start();
try
using var message = CreateListAllRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListAllRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = NetworkInterfaceListResult.DeserializeNetworkInterfaceListResult(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 = NetworkInterfaceListResult.DeserializeNetworkInterfaceListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -609,36 +509,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(resourceGroupName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.List");
scope.Start();
try
using var message = CreateListRequest(resourceGroupName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListRequest(resourceGroupName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceListResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceListResult 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 = NetworkInterfaceListResult.DeserializeNetworkInterfaceListResult(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 = NetworkInterfaceListResult.DeserializeNetworkInterfaceListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -652,36 +542,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(resourceGroupName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.List");
scope.Start();
try
using var message = CreateListRequest(resourceGroupName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListRequest(resourceGroupName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = NetworkInterfaceListResult.DeserializeNetworkInterfaceListResult(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 = NetworkInterfaceListResult.DeserializeNetworkInterfaceListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -719,25 +599,15 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.GetEffectiveRouteTable");
scope.Start();
try
using var message = CreateGetEffectiveRouteTableRequest(resourceGroupName, networkInterfaceName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetEffectiveRouteTableRequest(resourceGroupName, networkInterfaceName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 202:
case 200:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 202:
case 200:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -756,25 +626,15 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.GetEffectiveRouteTable");
scope.Start();
try
using var message = CreateGetEffectiveRouteTableRequest(resourceGroupName, networkInterfaceName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetEffectiveRouteTableRequest(resourceGroupName, networkInterfaceName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 202:
case 200:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 202:
case 200:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -812,25 +672,15 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.ListEffectiveNetworkSecurityGroups");
scope.Start();
try
using var message = CreateListEffectiveNetworkSecurityGroupsRequest(resourceGroupName, networkInterfaceName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListEffectiveNetworkSecurityGroupsRequest(resourceGroupName, networkInterfaceName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 202:
case 200:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 202:
case 200:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -849,25 +699,15 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(networkInterfaceName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.ListEffectiveNetworkSecurityGroups");
scope.Start();
try
using var message = CreateListEffectiveNetworkSecurityGroupsRequest(resourceGroupName, networkInterfaceName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListEffectiveNetworkSecurityGroupsRequest(resourceGroupName, networkInterfaceName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 202:
case 200:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 202:
case 200:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -893,36 +733,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(nextLink));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.ListAll");
scope.Start();
try
using var message = CreateListAllNextPageRequest(nextLink);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListAllNextPageRequest(nextLink);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceListResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceListResult 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 = NetworkInterfaceListResult.DeserializeNetworkInterfaceListResult(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 = NetworkInterfaceListResult.DeserializeNetworkInterfaceListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -936,36 +766,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(nextLink));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.ListAll");
scope.Start();
try
using var message = CreateListAllNextPageRequest(nextLink);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListAllNextPageRequest(nextLink);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = NetworkInterfaceListResult.DeserializeNetworkInterfaceListResult(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 = NetworkInterfaceListResult.DeserializeNetworkInterfaceListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -996,36 +816,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(resourceGroupName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.List");
scope.Start();
try
using var message = CreateListNextPageRequest(nextLink, resourceGroupName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListNextPageRequest(nextLink, resourceGroupName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceListResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceListResult 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 = NetworkInterfaceListResult.DeserializeNetworkInterfaceListResult(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 = NetworkInterfaceListResult.DeserializeNetworkInterfaceListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -1044,36 +854,26 @@ namespace Azure.Network.Management.Interface
throw new ArgumentNullException(nameof(resourceGroupName));
}
using var scope = _clientDiagnostics.CreateScope("NetworkInterfacesClient.List");
scope.Start();
try
using var message = CreateListNextPageRequest(nextLink, resourceGroupName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListNextPageRequest(nextLink, resourceGroupName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
NetworkInterfaceListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
NetworkInterfaceListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = NetworkInterfaceListResult.DeserializeNetworkInterfaceListResult(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 = NetworkInterfaceListResult.DeserializeNetworkInterfaceListResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -38,7 +39,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> SetPropertiesAsync(StorageServiceProperties storageServiceProperties, int? timeout = null, string requestId = null, CancellationToken cancellationToken = default)
{
return (await RestClient.SetPropertiesAsync(storageServiceProperties, timeout, requestId, cancellationToken).ConfigureAwait(false)).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("ServiceClient.SetProperties");
scope.Start();
try
{
return (await RestClient.SetPropertiesAsync(storageServiceProperties, timeout, requestId, cancellationToken).ConfigureAwait(false)).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Sets properties for a storage account&apos;s Table service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. </summary>
@ -48,7 +59,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response SetProperties(StorageServiceProperties storageServiceProperties, int? timeout = null, string requestId = null, CancellationToken cancellationToken = default)
{
return RestClient.SetProperties(storageServiceProperties, timeout, requestId, cancellationToken).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("ServiceClient.SetProperties");
scope.Start();
try
{
return RestClient.SetProperties(storageServiceProperties, timeout, requestId, cancellationToken).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> gets the properties of a storage account&apos;s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. </summary>
@ -57,7 +78,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<StorageServiceProperties>> GetPropertiesAsync(int? timeout = null, string requestId = null, CancellationToken cancellationToken = default)
{
return await RestClient.GetPropertiesAsync(timeout, requestId, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetProperties");
scope.Start();
try
{
return await RestClient.GetPropertiesAsync(timeout, requestId, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> gets the properties of a storage account&apos;s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. </summary>
@ -66,7 +97,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<StorageServiceProperties> GetProperties(int? timeout = null, string requestId = null, CancellationToken cancellationToken = default)
{
return RestClient.GetProperties(timeout, requestId, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetProperties");
scope.Start();
try
{
return RestClient.GetProperties(timeout, requestId, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Retrieves statistics related to replication for the Table service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account. </summary>
@ -75,7 +116,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<StorageServiceStats>> GetStatisticsAsync(int? timeout = null, string requestId = null, CancellationToken cancellationToken = default)
{
return await RestClient.GetStatisticsAsync(timeout, requestId, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetStatistics");
scope.Start();
try
{
return await RestClient.GetStatisticsAsync(timeout, requestId, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Retrieves statistics related to replication for the Table service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account. </summary>
@ -84,7 +135,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<StorageServiceStats> GetStatistics(int? timeout = null, string requestId = null, CancellationToken cancellationToken = default)
{
return RestClient.GetStatistics(timeout, requestId, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetStatistics");
scope.Start();
try
{
return RestClient.GetStatistics(timeout, requestId, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -79,25 +79,15 @@ namespace Azure.Storage.Tables
throw new ArgumentNullException(nameof(storageServiceProperties));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.SetProperties");
scope.Start();
try
using var message = CreateSetPropertiesRequest(storageServiceProperties, timeout, requestId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new ServiceSetPropertiesHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateSetPropertiesRequest(storageServiceProperties, timeout, requestId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new ServiceSetPropertiesHeaders(message.Response);
switch (message.Response.Status)
{
case 202:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 202:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -113,25 +103,15 @@ namespace Azure.Storage.Tables
throw new ArgumentNullException(nameof(storageServiceProperties));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.SetProperties");
scope.Start();
try
using var message = CreateSetPropertiesRequest(storageServiceProperties, timeout, requestId);
_pipeline.Send(message, cancellationToken);
var headers = new ServiceSetPropertiesHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateSetPropertiesRequest(storageServiceProperties, timeout, requestId);
_pipeline.Send(message, cancellationToken);
var headers = new ServiceSetPropertiesHeaders(message.Response);
switch (message.Response.Status)
{
case 202:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 202:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -164,33 +144,23 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<ResponseWithHeaders<StorageServiceProperties, ServiceGetPropertiesHeaders>> GetPropertiesAsync(int? timeout = null, string requestId = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetProperties");
scope.Start();
try
using var message = CreateGetPropertiesRequest(timeout, requestId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new ServiceGetPropertiesHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateGetPropertiesRequest(timeout, requestId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new ServiceGetPropertiesHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
case 200:
{
StorageServiceProperties value = default;
var document = XDocument.Load(message.Response.ContentStream, LoadOptions.PreserveWhitespace);
if (document.Element("StorageServiceProperties") is XElement storageServicePropertiesElement)
{
StorageServiceProperties value = default;
var document = XDocument.Load(message.Response.ContentStream, LoadOptions.PreserveWhitespace);
if (document.Element("StorageServiceProperties") is XElement storageServicePropertiesElement)
{
value = StorageServiceProperties.DeserializeStorageServiceProperties(storageServicePropertiesElement);
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
value = StorageServiceProperties.DeserializeStorageServiceProperties(storageServicePropertiesElement);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
return ResponseWithHeaders.FromValue(value, headers, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -200,33 +170,23 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public ResponseWithHeaders<StorageServiceProperties, ServiceGetPropertiesHeaders> GetProperties(int? timeout = null, string requestId = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetProperties");
scope.Start();
try
using var message = CreateGetPropertiesRequest(timeout, requestId);
_pipeline.Send(message, cancellationToken);
var headers = new ServiceGetPropertiesHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateGetPropertiesRequest(timeout, requestId);
_pipeline.Send(message, cancellationToken);
var headers = new ServiceGetPropertiesHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
case 200:
{
StorageServiceProperties value = default;
var document = XDocument.Load(message.Response.ContentStream, LoadOptions.PreserveWhitespace);
if (document.Element("StorageServiceProperties") is XElement storageServicePropertiesElement)
{
StorageServiceProperties value = default;
var document = XDocument.Load(message.Response.ContentStream, LoadOptions.PreserveWhitespace);
if (document.Element("StorageServiceProperties") is XElement storageServicePropertiesElement)
{
value = StorageServiceProperties.DeserializeStorageServiceProperties(storageServicePropertiesElement);
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
value = StorageServiceProperties.DeserializeStorageServiceProperties(storageServicePropertiesElement);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
return ResponseWithHeaders.FromValue(value, headers, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -259,33 +219,23 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<ResponseWithHeaders<StorageServiceStats, ServiceGetStatisticsHeaders>> GetStatisticsAsync(int? timeout = null, string requestId = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetStatistics");
scope.Start();
try
using var message = CreateGetStatisticsRequest(timeout, requestId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new ServiceGetStatisticsHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateGetStatisticsRequest(timeout, requestId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new ServiceGetStatisticsHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
case 200:
{
StorageServiceStats value = default;
var document = XDocument.Load(message.Response.ContentStream, LoadOptions.PreserveWhitespace);
if (document.Element("StorageServiceStats") is XElement storageServiceStatsElement)
{
StorageServiceStats value = default;
var document = XDocument.Load(message.Response.ContentStream, LoadOptions.PreserveWhitespace);
if (document.Element("StorageServiceStats") is XElement storageServiceStatsElement)
{
value = StorageServiceStats.DeserializeStorageServiceStats(storageServiceStatsElement);
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
value = StorageServiceStats.DeserializeStorageServiceStats(storageServiceStatsElement);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
return ResponseWithHeaders.FromValue(value, headers, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -295,33 +245,23 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public ResponseWithHeaders<StorageServiceStats, ServiceGetStatisticsHeaders> GetStatistics(int? timeout = null, string requestId = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetStatistics");
scope.Start();
try
using var message = CreateGetStatisticsRequest(timeout, requestId);
_pipeline.Send(message, cancellationToken);
var headers = new ServiceGetStatisticsHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateGetStatisticsRequest(timeout, requestId);
_pipeline.Send(message, cancellationToken);
var headers = new ServiceGetStatisticsHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
case 200:
{
StorageServiceStats value = default;
var document = XDocument.Load(message.Response.ContentStream, LoadOptions.PreserveWhitespace);
if (document.Element("StorageServiceStats") is XElement storageServiceStatsElement)
{
StorageServiceStats value = default;
var document = XDocument.Load(message.Response.ContentStream, LoadOptions.PreserveWhitespace);
if (document.Element("StorageServiceStats") is XElement storageServiceStatsElement)
{
value = StorageServiceStats.DeserializeStorageServiceStats(storageServiceStatsElement);
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
value = StorageServiceStats.DeserializeStorageServiceStats(storageServiceStatsElement);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
return ResponseWithHeaders.FromValue(value, headers, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@ -38,7 +39,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<TableQueryResponse>> QueryAsync(string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.QueryAsync(requestId, queryOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.Query");
scope.Start();
try
{
return await RestClient.QueryAsync(requestId, queryOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Queries tables under the given account. </summary>
@ -47,7 +58,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<TableQueryResponse> Query(string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.Query(requestId, queryOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.Query");
scope.Start();
try
{
return RestClient.Query(requestId, queryOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a new table under the given account. </summary>
@ -57,7 +78,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<TableResponse>> CreateAsync(TableProperties tableProperties, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.CreateAsync(tableProperties, requestId, queryOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.Create");
scope.Start();
try
{
return await RestClient.CreateAsync(tableProperties, requestId, queryOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a new table under the given account. </summary>
@ -67,7 +98,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<TableResponse> Create(TableProperties tableProperties, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.Create(tableProperties, requestId, queryOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.Create");
scope.Start();
try
{
return RestClient.Create(tableProperties, requestId, queryOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Operation permanently deletes the specified table. </summary>
@ -76,7 +117,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> DeleteAsync(string table, string requestId = null, CancellationToken cancellationToken = default)
{
return (await RestClient.DeleteAsync(table, requestId, cancellationToken).ConfigureAwait(false)).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.Delete");
scope.Start();
try
{
return (await RestClient.DeleteAsync(table, requestId, cancellationToken).ConfigureAwait(false)).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Operation permanently deletes the specified table. </summary>
@ -85,7 +136,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response Delete(string table, string requestId = null, CancellationToken cancellationToken = default)
{
return RestClient.Delete(table, requestId, cancellationToken).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.Delete");
scope.Start();
try
{
return RestClient.Delete(table, requestId, cancellationToken).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Queries entities in a table. </summary>
@ -96,7 +157,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<TableEntityQueryResponse>> QueryEntitiesAsync(string table, int? timeout = null, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.QueryEntitiesAsync(table, timeout, requestId, queryOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.QueryEntities");
scope.Start();
try
{
return await RestClient.QueryEntitiesAsync(table, timeout, requestId, queryOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Queries entities in a table. </summary>
@ -107,7 +178,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<TableEntityQueryResponse> QueryEntities(string table, int? timeout = null, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.QueryEntities(table, timeout, requestId, queryOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.QueryEntities");
scope.Start();
try
{
return RestClient.QueryEntities(table, timeout, requestId, queryOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Queries entities in a table. </summary>
@ -120,7 +201,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<TableEntityQueryResponse>> QueryEntitiesWithPartitionAndRowKeyAsync(string table, string partitionKey, string rowKey, int? timeout = null, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.QueryEntitiesWithPartitionAndRowKeyAsync(table, partitionKey, rowKey, timeout, requestId, queryOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.QueryEntitiesWithPartitionAndRowKey");
scope.Start();
try
{
return await RestClient.QueryEntitiesWithPartitionAndRowKeyAsync(table, partitionKey, rowKey, timeout, requestId, queryOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Queries entities in a table. </summary>
@ -133,7 +224,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<TableEntityQueryResponse> QueryEntitiesWithPartitionAndRowKey(string table, string partitionKey, string rowKey, int? timeout = null, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.QueryEntitiesWithPartitionAndRowKey(table, partitionKey, rowKey, timeout, requestId, queryOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.QueryEntitiesWithPartitionAndRowKey");
scope.Start();
try
{
return RestClient.QueryEntitiesWithPartitionAndRowKey(table, partitionKey, rowKey, timeout, requestId, queryOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Update entity in a table. </summary>
@ -147,7 +248,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> UpdateEntityAsync(string table, string partitionKey, string rowKey, int? timeout = null, string requestId = null, IDictionary<string, object> tableEntityProperties = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
{
return (await RestClient.UpdateEntityAsync(table, partitionKey, rowKey, timeout, requestId, tableEntityProperties, queryOptions, cancellationToken).ConfigureAwait(false)).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.UpdateEntity");
scope.Start();
try
{
return (await RestClient.UpdateEntityAsync(table, partitionKey, rowKey, timeout, requestId, tableEntityProperties, queryOptions, cancellationToken).ConfigureAwait(false)).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Update entity in a table. </summary>
@ -161,7 +272,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response UpdateEntity(string table, string partitionKey, string rowKey, int? timeout = null, string requestId = null, IDictionary<string, object> tableEntityProperties = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.UpdateEntity(table, partitionKey, rowKey, timeout, requestId, tableEntityProperties, queryOptions, cancellationToken).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.UpdateEntity");
scope.Start();
try
{
return RestClient.UpdateEntity(table, partitionKey, rowKey, timeout, requestId, tableEntityProperties, queryOptions, cancellationToken).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes the specified entity in a table. </summary>
@ -174,7 +295,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> DeleteEntityAsync(string table, string partitionKey, string rowKey, int? timeout = null, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
{
return (await RestClient.DeleteEntityAsync(table, partitionKey, rowKey, timeout, requestId, queryOptions, cancellationToken).ConfigureAwait(false)).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.DeleteEntity");
scope.Start();
try
{
return (await RestClient.DeleteEntityAsync(table, partitionKey, rowKey, timeout, requestId, queryOptions, cancellationToken).ConfigureAwait(false)).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes the specified entity in a table. </summary>
@ -187,7 +318,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response DeleteEntity(string table, string partitionKey, string rowKey, int? timeout = null, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.DeleteEntity(table, partitionKey, rowKey, timeout, requestId, queryOptions, cancellationToken).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.DeleteEntity");
scope.Start();
try
{
return RestClient.DeleteEntity(table, partitionKey, rowKey, timeout, requestId, queryOptions, cancellationToken).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Insert entity in a table. </summary>
@ -199,7 +340,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<IReadOnlyDictionary<string, object>>> InsertEntityAsync(string table, int? timeout = null, string requestId = null, IDictionary<string, object> tableEntityProperties = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.InsertEntityAsync(table, timeout, requestId, tableEntityProperties, queryOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.InsertEntity");
scope.Start();
try
{
return await RestClient.InsertEntityAsync(table, timeout, requestId, tableEntityProperties, queryOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Insert entity in a table. </summary>
@ -211,7 +362,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<IReadOnlyDictionary<string, object>> InsertEntity(string table, int? timeout = null, string requestId = null, IDictionary<string, object> tableEntityProperties = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.InsertEntity(table, timeout, requestId, tableEntityProperties, queryOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.InsertEntity");
scope.Start();
try
{
return RestClient.InsertEntity(table, timeout, requestId, tableEntityProperties, queryOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Retrieves details about any stored access policies specified on the table that may be used wit Shared Access Signatures. </summary>
@ -221,7 +382,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<IReadOnlyList<SignedIdentifier>>> GetAccessPolicyAsync(string table, int? timeout = null, string requestId = null, CancellationToken cancellationToken = default)
{
return await RestClient.GetAccessPolicyAsync(table, timeout, requestId, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.GetAccessPolicy");
scope.Start();
try
{
return await RestClient.GetAccessPolicyAsync(table, timeout, requestId, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Retrieves details about any stored access policies specified on the table that may be used wit Shared Access Signatures. </summary>
@ -231,7 +402,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<IReadOnlyList<SignedIdentifier>> GetAccessPolicy(string table, int? timeout = null, string requestId = null, CancellationToken cancellationToken = default)
{
return RestClient.GetAccessPolicy(table, timeout, requestId, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.GetAccessPolicy");
scope.Start();
try
{
return RestClient.GetAccessPolicy(table, timeout, requestId, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> sets stored access policies for the table that may be used with Shared Access Signatures. </summary>
@ -242,7 +423,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> SetAccessPolicyAsync(string table, int? timeout = null, string requestId = null, IEnumerable<SignedIdentifier> tableAcl = null, CancellationToken cancellationToken = default)
{
return (await RestClient.SetAccessPolicyAsync(table, timeout, requestId, tableAcl, cancellationToken).ConfigureAwait(false)).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.SetAccessPolicy");
scope.Start();
try
{
return (await RestClient.SetAccessPolicyAsync(table, timeout, requestId, tableAcl, cancellationToken).ConfigureAwait(false)).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> sets stored access policies for the table that may be used with Shared Access Signatures. </summary>
@ -253,7 +444,17 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response SetAccessPolicy(string table, int? timeout = null, string requestId = null, IEnumerable<SignedIdentifier> tableAcl = null, CancellationToken cancellationToken = default)
{
return RestClient.SetAccessPolicy(table, timeout, requestId, tableAcl, cancellationToken).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.SetAccessPolicy");
scope.Start();
try
{
return RestClient.SetAccessPolicy(table, timeout, requestId, tableAcl, cancellationToken).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -82,37 +82,27 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<ResponseWithHeaders<TableQueryResponse, TableInternalQueryHeaders>> QueryAsync(string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.Query");
scope.Start();
try
using var message = CreateQueryRequest(requestId, queryOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new TableInternalQueryHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateQueryRequest(requestId, queryOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new TableInternalQueryHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
case 200:
{
TableQueryResponse value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
TableQueryResponse 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 = TableQueryResponse.DeserializeTableQueryResponse(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 = TableQueryResponse.DeserializeTableQueryResponse(document.RootElement);
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -122,37 +112,27 @@ namespace Azure.Storage.Tables
/// <param name="cancellationToken"> The cancellation token to use. </param>
public ResponseWithHeaders<TableQueryResponse, TableInternalQueryHeaders> Query(string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.Query");
scope.Start();
try
using var message = CreateQueryRequest(requestId, queryOptions);
_pipeline.Send(message, cancellationToken);
var headers = new TableInternalQueryHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateQueryRequest(requestId, queryOptions);
_pipeline.Send(message, cancellationToken);
var headers = new TableInternalQueryHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
case 200:
{
TableQueryResponse value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
TableQueryResponse value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = TableQueryResponse.DeserializeTableQueryResponse(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 = TableQueryResponse.DeserializeTableQueryResponse(document.RootElement);
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -194,39 +174,29 @@ namespace Azure.Storage.Tables
throw new ArgumentNullException(nameof(tableProperties));
}
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.Create");
scope.Start();
try
using var message = CreateCreateRequest(tableProperties, requestId, queryOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new TableInternalCreateHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateCreateRequest(tableProperties, requestId, queryOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new TableInternalCreateHeaders(message.Response);
switch (message.Response.Status)
{
case 201:
case 201:
{
TableResponse value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
TableResponse 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 = TableResponse.DeserializeTableResponse(document.RootElement);
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
value = null;
}
case 204:
return ResponseWithHeaders.FromValue<TableResponse, TableInternalCreateHeaders>(null, headers, message.Response);
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
else
{
value = TableResponse.DeserializeTableResponse(document.RootElement);
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
}
case 204:
return ResponseWithHeaders.FromValue<TableResponse, TableInternalCreateHeaders>(null, headers, message.Response);
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -242,39 +212,29 @@ namespace Azure.Storage.Tables
throw new ArgumentNullException(nameof(tableProperties));
}
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.Create");
scope.Start();
try
using var message = CreateCreateRequest(tableProperties, requestId, queryOptions);
_pipeline.Send(message, cancellationToken);
var headers = new TableInternalCreateHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateCreateRequest(tableProperties, requestId, queryOptions);
_pipeline.Send(message, cancellationToken);
var headers = new TableInternalCreateHeaders(message.Response);
switch (message.Response.Status)
{
case 201:
case 201:
{
TableResponse value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
TableResponse value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = TableResponse.DeserializeTableResponse(document.RootElement);
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
value = null;
}
case 204:
return ResponseWithHeaders.FromValue<TableResponse, TableInternalCreateHeaders>(null, headers, message.Response);
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
else
{
value = TableResponse.DeserializeTableResponse(document.RootElement);
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
}
case 204:
return ResponseWithHeaders.FromValue<TableResponse, TableInternalCreateHeaders>(null, headers, message.Response);
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -308,25 +268,15 @@ namespace Azure.Storage.Tables
throw new ArgumentNullException(nameof(table));
}
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(table, requestId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new TableInternalDeleteHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(table, requestId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new TableInternalDeleteHeaders(message.Response);
switch (message.Response.Status)
{
case 204:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 204:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -341,25 +291,15 @@ namespace Azure.Storage.Tables
throw new ArgumentNullException(nameof(table));
}
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(table, requestId);
_pipeline.Send(message, cancellationToken);
var headers = new TableInternalDeleteHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(table, requestId);
_pipeline.Send(message, cancellationToken);
var headers = new TableInternalDeleteHeaders(message.Response);
switch (message.Response.Status)
{
case 204:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 204:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -416,37 +356,27 @@ namespace Azure.Storage.Tables
throw new ArgumentNullException(nameof(table));
}
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.QueryEntities");
scope.Start();
try
using var message = CreateQueryEntitiesRequest(table, timeout, requestId, queryOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new TableInternalQueryEntitiesHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateQueryEntitiesRequest(table, timeout, requestId, queryOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new TableInternalQueryEntitiesHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
case 200:
{
TableEntityQueryResponse value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
TableEntityQueryResponse 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 = TableEntityQueryResponse.DeserializeTableEntityQueryResponse(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 = TableEntityQueryResponse.DeserializeTableEntityQueryResponse(document.RootElement);
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -463,37 +393,27 @@ namespace Azure.Storage.Tables
throw new ArgumentNullException(nameof(table));
}
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.QueryEntities");
scope.Start();
try
using var message = CreateQueryEntitiesRequest(table, timeout, requestId, queryOptions);
_pipeline.Send(message, cancellationToken);
var headers = new TableInternalQueryEntitiesHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateQueryEntitiesRequest(table, timeout, requestId, queryOptions);
_pipeline.Send(message, cancellationToken);
var headers = new TableInternalQueryEntitiesHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
case 200:
{
TableEntityQueryResponse value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
TableEntityQueryResponse value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = TableEntityQueryResponse.DeserializeTableEntityQueryResponse(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 = TableEntityQueryResponse.DeserializeTableEntityQueryResponse(document.RootElement);
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -560,37 +480,27 @@ namespace Azure.Storage.Tables
throw new ArgumentNullException(nameof(rowKey));
}
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.QueryEntitiesWithPartitionAndRowKey");
scope.Start();
try
using var message = CreateQueryEntitiesWithPartitionAndRowKeyRequest(table, partitionKey, rowKey, timeout, requestId, queryOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new TableInternalQueryEntitiesWithPartitionAndRowKeyHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateQueryEntitiesWithPartitionAndRowKeyRequest(table, partitionKey, rowKey, timeout, requestId, queryOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new TableInternalQueryEntitiesWithPartitionAndRowKeyHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
case 200:
{
TableEntityQueryResponse value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
TableEntityQueryResponse 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 = TableEntityQueryResponse.DeserializeTableEntityQueryResponse(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 = TableEntityQueryResponse.DeserializeTableEntityQueryResponse(document.RootElement);
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -617,37 +527,27 @@ namespace Azure.Storage.Tables
throw new ArgumentNullException(nameof(rowKey));
}
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.QueryEntitiesWithPartitionAndRowKey");
scope.Start();
try
using var message = CreateQueryEntitiesWithPartitionAndRowKeyRequest(table, partitionKey, rowKey, timeout, requestId, queryOptions);
_pipeline.Send(message, cancellationToken);
var headers = new TableInternalQueryEntitiesWithPartitionAndRowKeyHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateQueryEntitiesWithPartitionAndRowKeyRequest(table, partitionKey, rowKey, timeout, requestId, queryOptions);
_pipeline.Send(message, cancellationToken);
var headers = new TableInternalQueryEntitiesWithPartitionAndRowKeyHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
case 200:
{
TableEntityQueryResponse value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
TableEntityQueryResponse value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = TableEntityQueryResponse.DeserializeTableEntityQueryResponse(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 = TableEntityQueryResponse.DeserializeTableEntityQueryResponse(document.RootElement);
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -720,25 +620,15 @@ namespace Azure.Storage.Tables
throw new ArgumentNullException(nameof(rowKey));
}
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.UpdateEntity");
scope.Start();
try
using var message = CreateUpdateEntityRequest(table, partitionKey, rowKey, timeout, requestId, tableEntityProperties, queryOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new TableInternalUpdateEntityHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateUpdateEntityRequest(table, partitionKey, rowKey, timeout, requestId, tableEntityProperties, queryOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new TableInternalUpdateEntityHeaders(message.Response);
switch (message.Response.Status)
{
case 204:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 200:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -766,25 +656,15 @@ namespace Azure.Storage.Tables
throw new ArgumentNullException(nameof(rowKey));
}
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.UpdateEntity");
scope.Start();
try
using var message = CreateUpdateEntityRequest(table, partitionKey, rowKey, timeout, requestId, tableEntityProperties, queryOptions);
_pipeline.Send(message, cancellationToken);
var headers = new TableInternalUpdateEntityHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateUpdateEntityRequest(table, partitionKey, rowKey, timeout, requestId, tableEntityProperties, queryOptions);
_pipeline.Send(message, cancellationToken);
var headers = new TableInternalUpdateEntityHeaders(message.Response);
switch (message.Response.Status)
{
case 204:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 200:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -843,25 +723,15 @@ namespace Azure.Storage.Tables
throw new ArgumentNullException(nameof(rowKey));
}
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.DeleteEntity");
scope.Start();
try
using var message = CreateDeleteEntityRequest(table, partitionKey, rowKey, timeout, requestId, queryOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new TableInternalDeleteEntityHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateDeleteEntityRequest(table, partitionKey, rowKey, timeout, requestId, queryOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new TableInternalDeleteEntityHeaders(message.Response);
switch (message.Response.Status)
{
case 204:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 204:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -888,25 +758,15 @@ namespace Azure.Storage.Tables
throw new ArgumentNullException(nameof(rowKey));
}
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.DeleteEntity");
scope.Start();
try
using var message = CreateDeleteEntityRequest(table, partitionKey, rowKey, timeout, requestId, queryOptions);
_pipeline.Send(message, cancellationToken);
var headers = new TableInternalDeleteEntityHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateDeleteEntityRequest(table, partitionKey, rowKey, timeout, requestId, queryOptions);
_pipeline.Send(message, cancellationToken);
var headers = new TableInternalDeleteEntityHeaders(message.Response);
switch (message.Response.Status)
{
case 204:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 204:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -964,49 +824,39 @@ namespace Azure.Storage.Tables
throw new ArgumentNullException(nameof(table));
}
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.InsertEntity");
scope.Start();
try
using var message = CreateInsertEntityRequest(table, timeout, requestId, tableEntityProperties, queryOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new TableInternalInsertEntityHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateInsertEntityRequest(table, timeout, requestId, tableEntityProperties, queryOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new TableInternalInsertEntityHeaders(message.Response);
switch (message.Response.Status)
{
case 201:
case 201:
{
IReadOnlyDictionary<string, object> value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
IReadOnlyDictionary<string, object> value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
Dictionary<string, object> dictionary = new Dictionary<string, object>();
foreach (var property in document.RootElement.EnumerateObject())
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
dictionary.Add(property.Name, null);
}
else
{
dictionary.Add(property.Name, property.Value.GetObject());
}
}
value = dictionary;
}
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
{
Dictionary<string, object> dictionary = new Dictionary<string, object>();
foreach (var property in document.RootElement.EnumerateObject())
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
dictionary.Add(property.Name, null);
}
else
{
dictionary.Add(property.Name, property.Value.GetObject());
}
}
value = dictionary;
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -1024,49 +874,39 @@ namespace Azure.Storage.Tables
throw new ArgumentNullException(nameof(table));
}
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.InsertEntity");
scope.Start();
try
using var message = CreateInsertEntityRequest(table, timeout, requestId, tableEntityProperties, queryOptions);
_pipeline.Send(message, cancellationToken);
var headers = new TableInternalInsertEntityHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateInsertEntityRequest(table, timeout, requestId, tableEntityProperties, queryOptions);
_pipeline.Send(message, cancellationToken);
var headers = new TableInternalInsertEntityHeaders(message.Response);
switch (message.Response.Status)
{
case 201:
case 201:
{
IReadOnlyDictionary<string, object> value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
IReadOnlyDictionary<string, object> value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
Dictionary<string, object> dictionary = new Dictionary<string, object>();
foreach (var property in document.RootElement.EnumerateObject())
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
dictionary.Add(property.Name, null);
}
else
{
dictionary.Add(property.Name, property.Value.GetObject());
}
}
value = dictionary;
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
value = null;
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
else
{
Dictionary<string, object> dictionary = new Dictionary<string, object>();
foreach (var property in document.RootElement.EnumerateObject())
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
dictionary.Add(property.Name, null);
}
else
{
dictionary.Add(property.Name, property.Value.GetObject());
}
}
value = dictionary;
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -1105,38 +945,28 @@ namespace Azure.Storage.Tables
throw new ArgumentNullException(nameof(table));
}
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.GetAccessPolicy");
scope.Start();
try
using var message = CreateGetAccessPolicyRequest(table, timeout, requestId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new TableInternalGetAccessPolicyHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateGetAccessPolicyRequest(table, timeout, requestId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new TableInternalGetAccessPolicyHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
case 200:
{
IReadOnlyList<SignedIdentifier> value = default;
var document = XDocument.Load(message.Response.ContentStream, LoadOptions.PreserveWhitespace);
if (document.Element("SignedIdentifiers") is XElement signedIdentifiersElement)
{
IReadOnlyList<SignedIdentifier> value = default;
var document = XDocument.Load(message.Response.ContentStream, LoadOptions.PreserveWhitespace);
if (document.Element("SignedIdentifiers") is XElement signedIdentifiersElement)
var array = new List<SignedIdentifier>();
foreach (var e in signedIdentifiersElement.Elements("SignedIdentifier"))
{
var array = new List<SignedIdentifier>();
foreach (var e in signedIdentifiersElement.Elements("SignedIdentifier"))
{
array.Add(SignedIdentifier.DeserializeSignedIdentifier(e));
}
value = array;
array.Add(SignedIdentifier.DeserializeSignedIdentifier(e));
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
value = array;
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
return ResponseWithHeaders.FromValue(value, headers, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -1152,38 +982,28 @@ namespace Azure.Storage.Tables
throw new ArgumentNullException(nameof(table));
}
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.GetAccessPolicy");
scope.Start();
try
using var message = CreateGetAccessPolicyRequest(table, timeout, requestId);
_pipeline.Send(message, cancellationToken);
var headers = new TableInternalGetAccessPolicyHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateGetAccessPolicyRequest(table, timeout, requestId);
_pipeline.Send(message, cancellationToken);
var headers = new TableInternalGetAccessPolicyHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
case 200:
{
IReadOnlyList<SignedIdentifier> value = default;
var document = XDocument.Load(message.Response.ContentStream, LoadOptions.PreserveWhitespace);
if (document.Element("SignedIdentifiers") is XElement signedIdentifiersElement)
{
IReadOnlyList<SignedIdentifier> value = default;
var document = XDocument.Load(message.Response.ContentStream, LoadOptions.PreserveWhitespace);
if (document.Element("SignedIdentifiers") is XElement signedIdentifiersElement)
var array = new List<SignedIdentifier>();
foreach (var e in signedIdentifiersElement.Elements("SignedIdentifier"))
{
var array = new List<SignedIdentifier>();
foreach (var e in signedIdentifiersElement.Elements("SignedIdentifier"))
{
array.Add(SignedIdentifier.DeserializeSignedIdentifier(e));
}
value = array;
array.Add(SignedIdentifier.DeserializeSignedIdentifier(e));
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
value = array;
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
return ResponseWithHeaders.FromValue(value, headers, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -1235,25 +1055,15 @@ namespace Azure.Storage.Tables
throw new ArgumentNullException(nameof(table));
}
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.SetAccessPolicy");
scope.Start();
try
using var message = CreateSetAccessPolicyRequest(table, timeout, requestId, tableAcl);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new TableInternalSetAccessPolicyHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateSetAccessPolicyRequest(table, timeout, requestId, tableAcl);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new TableInternalSetAccessPolicyHeaders(message.Response);
switch (message.Response.Status)
{
case 204:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 204:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -1270,25 +1080,15 @@ namespace Azure.Storage.Tables
throw new ArgumentNullException(nameof(table));
}
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.SetAccessPolicy");
scope.Start();
try
using var message = CreateSetAccessPolicyRequest(table, timeout, requestId, tableAcl);
_pipeline.Send(message, cancellationToken);
var headers = new TableInternalSetAccessPolicyHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateSetAccessPolicyRequest(table, timeout, requestId, tableAcl);
_pipeline.Send(message, cancellationToken);
var headers = new TableInternalSetAccessPolicyHeaders(message.Response);
switch (message.Response.Status)
{
case 204:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 204:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -39,7 +40,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<DataSource>> CreateOrUpdateAsync(string dataSourceName, DataSource dataSource, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
{
return await RestClient.CreateOrUpdateAsync(dataSourceName, dataSource, requestOptions, accessCondition, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("DataSourcesClient.CreateOrUpdate");
scope.Start();
try
{
return await RestClient.CreateOrUpdateAsync(dataSourceName, dataSource, requestOptions, accessCondition, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a new datasource or updates a datasource if it already exists. </summary>
@ -50,7 +61,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<DataSource> CreateOrUpdate(string dataSourceName, DataSource dataSource, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
{
return RestClient.CreateOrUpdate(dataSourceName, dataSource, requestOptions, accessCondition, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("DataSourcesClient.CreateOrUpdate");
scope.Start();
try
{
return RestClient.CreateOrUpdate(dataSourceName, dataSource, requestOptions, accessCondition, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes a datasource. </summary>
@ -60,7 +81,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> DeleteAsync(string dataSourceName, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
{
return await RestClient.DeleteAsync(dataSourceName, requestOptions, accessCondition, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("DataSourcesClient.Delete");
scope.Start();
try
{
return await RestClient.DeleteAsync(dataSourceName, requestOptions, accessCondition, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes a datasource. </summary>
@ -70,7 +101,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response Delete(string dataSourceName, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
{
return RestClient.Delete(dataSourceName, requestOptions, accessCondition, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("DataSourcesClient.Delete");
scope.Start();
try
{
return RestClient.Delete(dataSourceName, requestOptions, accessCondition, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Retrieves a datasource definition. </summary>
@ -79,7 +120,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<DataSource>> GetAsync(string dataSourceName, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.GetAsync(dataSourceName, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("DataSourcesClient.Get");
scope.Start();
try
{
return await RestClient.GetAsync(dataSourceName, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Retrieves a datasource definition. </summary>
@ -88,7 +139,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<DataSource> Get(string dataSourceName, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.Get(dataSourceName, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("DataSourcesClient.Get");
scope.Start();
try
{
return RestClient.Get(dataSourceName, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Lists all datasources available for a search service. </summary>
@ -97,7 +158,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<ListDataSourcesResult>> ListAsync(string select = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.ListAsync(select, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("DataSourcesClient.List");
scope.Start();
try
{
return await RestClient.ListAsync(select, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Lists all datasources available for a search service. </summary>
@ -106,7 +177,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<ListDataSourcesResult> List(string select = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.List(select, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("DataSourcesClient.List");
scope.Start();
try
{
return RestClient.List(select, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a new datasource. </summary>
@ -115,7 +196,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<DataSource>> CreateAsync(DataSource dataSource, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.CreateAsync(dataSource, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("DataSourcesClient.Create");
scope.Start();
try
{
return await RestClient.CreateAsync(dataSource, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a new datasource. </summary>
@ -124,7 +215,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<DataSource> Create(DataSource dataSource, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.Create(dataSource, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("DataSourcesClient.Create");
scope.Start();
try
{
return RestClient.Create(dataSource, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -90,37 +90,27 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(dataSource));
}
using var scope = _clientDiagnostics.CreateScope("DataSourcesClient.CreateOrUpdate");
scope.Start();
try
using var message = CreateCreateOrUpdateRequest(dataSourceName, dataSource, requestOptions, accessCondition);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateOrUpdateRequest(dataSourceName, dataSource, requestOptions, accessCondition);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 201:
case 200:
case 201:
{
DataSource value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
DataSource 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 = DataSource.DeserializeDataSource(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 = DataSource.DeserializeDataSource(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -141,37 +131,27 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(dataSource));
}
using var scope = _clientDiagnostics.CreateScope("DataSourcesClient.CreateOrUpdate");
scope.Start();
try
using var message = CreateCreateOrUpdateRequest(dataSourceName, dataSource, requestOptions, accessCondition);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateOrUpdateRequest(dataSourceName, dataSource, requestOptions, accessCondition);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 201:
case 200:
case 201:
{
DataSource value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
DataSource value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = DataSource.DeserializeDataSource(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 = DataSource.DeserializeDataSource(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -214,25 +194,15 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(dataSourceName));
}
using var scope = _clientDiagnostics.CreateScope("DataSourcesClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(dataSourceName, requestOptions, accessCondition);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(dataSourceName, requestOptions, accessCondition);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 204:
case 404:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 204:
case 404:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -248,25 +218,15 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(dataSourceName));
}
using var scope = _clientDiagnostics.CreateScope("DataSourcesClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(dataSourceName, requestOptions, accessCondition);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(dataSourceName, requestOptions, accessCondition);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 204:
case 404:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 204:
case 404:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -300,36 +260,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(dataSourceName));
}
using var scope = _clientDiagnostics.CreateScope("DataSourcesClient.Get");
scope.Start();
try
using var message = CreateGetRequest(dataSourceName, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetRequest(dataSourceName, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
DataSource value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
DataSource 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 = DataSource.DeserializeDataSource(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 = DataSource.DeserializeDataSource(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -344,36 +294,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(dataSourceName));
}
using var scope = _clientDiagnostics.CreateScope("DataSourcesClient.Get");
scope.Start();
try
using var message = CreateGetRequest(dataSourceName, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetRequest(dataSourceName, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
DataSource value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
DataSource value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = DataSource.DeserializeDataSource(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 = DataSource.DeserializeDataSource(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -404,36 +344,26 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response<ListDataSourcesResult>> ListAsync(string select = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("DataSourcesClient.List");
scope.Start();
try
using var message = CreateListRequest(select, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListRequest(select, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
ListDataSourcesResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ListDataSourcesResult 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 = ListDataSourcesResult.DeserializeListDataSourcesResult(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 = ListDataSourcesResult.DeserializeListDataSourcesResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -443,36 +373,26 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response<ListDataSourcesResult> List(string select = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("DataSourcesClient.List");
scope.Start();
try
using var message = CreateListRequest(select, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListRequest(select, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
ListDataSourcesResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ListDataSourcesResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = ListDataSourcesResult.DeserializeListDataSourcesResult(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 = ListDataSourcesResult.DeserializeListDataSourcesResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -508,36 +428,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(dataSource));
}
using var scope = _clientDiagnostics.CreateScope("DataSourcesClient.Create");
scope.Start();
try
using var message = CreateCreateRequest(dataSource, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateRequest(dataSource, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 201:
case 201:
{
DataSource value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
DataSource 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 = DataSource.DeserializeDataSource(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 = DataSource.DeserializeDataSource(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -552,36 +462,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(dataSource));
}
using var scope = _clientDiagnostics.CreateScope("DataSourcesClient.Create");
scope.Start();
try
using var message = CreateCreateRequest(dataSource, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateRequest(dataSource, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 201:
case 201:
{
DataSource value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
DataSource value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = DataSource.DeserializeDataSource(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 = DataSource.DeserializeDataSource(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@ -37,7 +38,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<long>> CountAsync(RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.CountAsync(requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.Count");
scope.Start();
try
{
return await RestClient.CountAsync(requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Queries the number of documents in the index. </summary>
@ -45,7 +56,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<long> Count(RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.Count(requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.Count");
scope.Start();
try
{
return RestClient.Count(requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Searches for documents in the index. </summary>
@ -55,7 +76,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<SearchDocumentsResult>> SearchGetAsync(string searchText = null, SearchOptions searchOptions = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.SearchGetAsync(searchText, searchOptions, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.SearchGet");
scope.Start();
try
{
return await RestClient.SearchGetAsync(searchText, searchOptions, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Searches for documents in the index. </summary>
@ -65,7 +96,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<SearchDocumentsResult> SearchGet(string searchText = null, SearchOptions searchOptions = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.SearchGet(searchText, searchOptions, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.SearchGet");
scope.Start();
try
{
return RestClient.SearchGet(searchText, searchOptions, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Searches for documents in the index. </summary>
@ -74,7 +115,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<SearchDocumentsResult>> SearchPostAsync(SearchRequest searchRequest, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.SearchPostAsync(searchRequest, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.SearchPost");
scope.Start();
try
{
return await RestClient.SearchPostAsync(searchRequest, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Searches for documents in the index. </summary>
@ -83,7 +134,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<SearchDocumentsResult> SearchPost(SearchRequest searchRequest, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.SearchPost(searchRequest, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.SearchPost");
scope.Start();
try
{
return RestClient.SearchPost(searchRequest, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Retrieves a document from the index. </summary>
@ -93,7 +154,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<object>> GetAsync(string key, IEnumerable<string> selectedFields = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.GetAsync(key, selectedFields, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.Get");
scope.Start();
try
{
return await RestClient.GetAsync(key, selectedFields, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Retrieves a document from the index. </summary>
@ -103,7 +174,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<object> Get(string key, IEnumerable<string> selectedFields = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.Get(key, selectedFields, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.Get");
scope.Start();
try
{
return RestClient.Get(key, selectedFields, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Suggests documents in the index that match the given partial query text. </summary>
@ -114,7 +195,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<SuggestDocumentsResult>> SuggestGetAsync(string searchText, string suggesterName, SuggestOptions suggestOptions = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.SuggestGetAsync(searchText, suggesterName, suggestOptions, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.SuggestGet");
scope.Start();
try
{
return await RestClient.SuggestGetAsync(searchText, suggesterName, suggestOptions, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Suggests documents in the index that match the given partial query text. </summary>
@ -125,7 +216,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<SuggestDocumentsResult> SuggestGet(string searchText, string suggesterName, SuggestOptions suggestOptions = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.SuggestGet(searchText, suggesterName, suggestOptions, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.SuggestGet");
scope.Start();
try
{
return RestClient.SuggestGet(searchText, suggesterName, suggestOptions, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Suggests documents in the index that match the given partial query text. </summary>
@ -134,7 +235,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<SuggestDocumentsResult>> SuggestPostAsync(SuggestRequest suggestRequest, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.SuggestPostAsync(suggestRequest, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.SuggestPost");
scope.Start();
try
{
return await RestClient.SuggestPostAsync(suggestRequest, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Suggests documents in the index that match the given partial query text. </summary>
@ -143,7 +254,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<SuggestDocumentsResult> SuggestPost(SuggestRequest suggestRequest, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.SuggestPost(suggestRequest, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.SuggestPost");
scope.Start();
try
{
return RestClient.SuggestPost(suggestRequest, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Sends a batch of document write actions to the index. </summary>
@ -152,7 +273,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<IndexDocumentsResult>> IndexAsync(IndexBatch batch, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.IndexAsync(batch, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.Index");
scope.Start();
try
{
return await RestClient.IndexAsync(batch, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Sends a batch of document write actions to the index. </summary>
@ -161,7 +292,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<IndexDocumentsResult> Index(IndexBatch batch, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.Index(batch, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.Index");
scope.Start();
try
{
return RestClient.Index(batch, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Autocompletes incomplete query terms based on input text and matching terms in the index. </summary>
@ -172,7 +313,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<AutocompleteResult>> AutocompleteGetAsync(string searchText, string suggesterName, RequestOptions requestOptions = null, AutocompleteOptions autocompleteOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.AutocompleteGetAsync(searchText, suggesterName, requestOptions, autocompleteOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.AutocompleteGet");
scope.Start();
try
{
return await RestClient.AutocompleteGetAsync(searchText, suggesterName, requestOptions, autocompleteOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Autocompletes incomplete query terms based on input text and matching terms in the index. </summary>
@ -183,7 +334,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<AutocompleteResult> AutocompleteGet(string searchText, string suggesterName, RequestOptions requestOptions = null, AutocompleteOptions autocompleteOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.AutocompleteGet(searchText, suggesterName, requestOptions, autocompleteOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.AutocompleteGet");
scope.Start();
try
{
return RestClient.AutocompleteGet(searchText, suggesterName, requestOptions, autocompleteOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Autocompletes incomplete query terms based on input text and matching terms in the index. </summary>
@ -192,7 +353,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<AutocompleteResult>> AutocompletePostAsync(AutocompleteRequest autocompleteRequest, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.AutocompletePostAsync(autocompleteRequest, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.AutocompletePost");
scope.Start();
try
{
return await RestClient.AutocompletePostAsync(autocompleteRequest, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Autocompletes incomplete query terms based on input text and matching terms in the index. </summary>
@ -201,7 +372,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<AutocompleteResult> AutocompletePost(AutocompleteRequest autocompleteRequest, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.AutocompletePost(autocompleteRequest, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.AutocompletePost");
scope.Start();
try
{
return RestClient.AutocompletePost(autocompleteRequest, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -73,29 +73,19 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response<long>> CountAsync(RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.Count");
scope.Start();
try
using var message = CreateCountRequest(requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCountRequest(requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
{
long value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = document.RootElement.GetInt64();
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 200:
{
long value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = document.RootElement.GetInt64();
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -104,29 +94,19 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response<long> Count(RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.Count");
scope.Start();
try
using var message = CreateCountRequest(requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCountRequest(requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
{
long value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = document.RootElement.GetInt64();
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 200:
{
long value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = document.RootElement.GetInt64();
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -225,36 +205,26 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response<SearchDocumentsResult>> SearchGetAsync(string searchText = null, SearchOptions searchOptions = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.SearchGet");
scope.Start();
try
using var message = CreateSearchGetRequest(searchText, searchOptions, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateSearchGetRequest(searchText, searchOptions, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
SearchDocumentsResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
SearchDocumentsResult 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 = SearchDocumentsResult.DeserializeSearchDocumentsResult(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 = SearchDocumentsResult.DeserializeSearchDocumentsResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -265,36 +235,26 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response<SearchDocumentsResult> SearchGet(string searchText = null, SearchOptions searchOptions = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.SearchGet");
scope.Start();
try
using var message = CreateSearchGetRequest(searchText, searchOptions, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateSearchGetRequest(searchText, searchOptions, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
SearchDocumentsResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
SearchDocumentsResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = SearchDocumentsResult.DeserializeSearchDocumentsResult(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 = SearchDocumentsResult.DeserializeSearchDocumentsResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -333,36 +293,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(searchRequest));
}
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.SearchPost");
scope.Start();
try
using var message = CreateSearchPostRequest(searchRequest, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateSearchPostRequest(searchRequest, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
SearchDocumentsResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
SearchDocumentsResult 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 = SearchDocumentsResult.DeserializeSearchDocumentsResult(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 = SearchDocumentsResult.DeserializeSearchDocumentsResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -377,36 +327,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(searchRequest));
}
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.SearchPost");
scope.Start();
try
using var message = CreateSearchPostRequest(searchRequest, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateSearchPostRequest(searchRequest, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
SearchDocumentsResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
SearchDocumentsResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = SearchDocumentsResult.DeserializeSearchDocumentsResult(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 = SearchDocumentsResult.DeserializeSearchDocumentsResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -448,36 +388,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(key));
}
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.Get");
scope.Start();
try
using var message = CreateGetRequest(key, selectedFields, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetRequest(key, selectedFields, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
object value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
object 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 = document.RootElement.GetObject();
}
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 = document.RootElement.GetObject();
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -493,36 +423,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(key));
}
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.Get");
scope.Start();
try
using var message = CreateGetRequest(key, selectedFields, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetRequest(key, selectedFields, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
object value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
object value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = document.RootElement.GetObject();
}
return Response.FromValue(value, message.Response);
value = null;
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
else
{
value = document.RootElement.GetObject();
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -601,36 +521,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(suggesterName));
}
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.SuggestGet");
scope.Start();
try
using var message = CreateSuggestGetRequest(searchText, suggesterName, suggestOptions, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateSuggestGetRequest(searchText, suggesterName, suggestOptions, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
SuggestDocumentsResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
SuggestDocumentsResult 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 = SuggestDocumentsResult.DeserializeSuggestDocumentsResult(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 = SuggestDocumentsResult.DeserializeSuggestDocumentsResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -651,36 +561,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(suggesterName));
}
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.SuggestGet");
scope.Start();
try
using var message = CreateSuggestGetRequest(searchText, suggesterName, suggestOptions, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateSuggestGetRequest(searchText, suggesterName, suggestOptions, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
SuggestDocumentsResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
SuggestDocumentsResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = SuggestDocumentsResult.DeserializeSuggestDocumentsResult(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 = SuggestDocumentsResult.DeserializeSuggestDocumentsResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -719,36 +619,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(suggestRequest));
}
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.SuggestPost");
scope.Start();
try
using var message = CreateSuggestPostRequest(suggestRequest, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateSuggestPostRequest(suggestRequest, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
SuggestDocumentsResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
SuggestDocumentsResult 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 = SuggestDocumentsResult.DeserializeSuggestDocumentsResult(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 = SuggestDocumentsResult.DeserializeSuggestDocumentsResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -763,36 +653,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(suggestRequest));
}
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.SuggestPost");
scope.Start();
try
using var message = CreateSuggestPostRequest(suggestRequest, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateSuggestPostRequest(suggestRequest, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
SuggestDocumentsResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
SuggestDocumentsResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = SuggestDocumentsResult.DeserializeSuggestDocumentsResult(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 = SuggestDocumentsResult.DeserializeSuggestDocumentsResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -831,37 +711,27 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(batch));
}
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.Index");
scope.Start();
try
using var message = CreateIndexRequest(batch, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateIndexRequest(batch, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 207:
case 200:
case 207:
{
IndexDocumentsResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
IndexDocumentsResult 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 = IndexDocumentsResult.DeserializeIndexDocumentsResult(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 = IndexDocumentsResult.DeserializeIndexDocumentsResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -876,37 +746,27 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(batch));
}
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.Index");
scope.Start();
try
using var message = CreateIndexRequest(batch, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateIndexRequest(batch, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 207:
case 200:
case 207:
{
IndexDocumentsResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
IndexDocumentsResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = IndexDocumentsResult.DeserializeIndexDocumentsResult(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 = IndexDocumentsResult.DeserializeIndexDocumentsResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -981,36 +841,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(suggesterName));
}
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.AutocompleteGet");
scope.Start();
try
using var message = CreateAutocompleteGetRequest(searchText, suggesterName, requestOptions, autocompleteOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateAutocompleteGetRequest(searchText, suggesterName, requestOptions, autocompleteOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
AutocompleteResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
AutocompleteResult 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 = AutocompleteResult.DeserializeAutocompleteResult(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 = AutocompleteResult.DeserializeAutocompleteResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -1031,36 +881,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(suggesterName));
}
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.AutocompleteGet");
scope.Start();
try
using var message = CreateAutocompleteGetRequest(searchText, suggesterName, requestOptions, autocompleteOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateAutocompleteGetRequest(searchText, suggesterName, requestOptions, autocompleteOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
AutocompleteResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
AutocompleteResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = AutocompleteResult.DeserializeAutocompleteResult(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 = AutocompleteResult.DeserializeAutocompleteResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -1099,36 +939,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(autocompleteRequest));
}
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.AutocompletePost");
scope.Start();
try
using var message = CreateAutocompletePostRequest(autocompleteRequest, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateAutocompletePostRequest(autocompleteRequest, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
AutocompleteResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
AutocompleteResult 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 = AutocompleteResult.DeserializeAutocompleteResult(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 = AutocompleteResult.DeserializeAutocompleteResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -1143,36 +973,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(autocompleteRequest));
}
using var scope = _clientDiagnostics.CreateScope("DocumentsClient.AutocompletePost");
scope.Start();
try
using var message = CreateAutocompletePostRequest(autocompleteRequest, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateAutocompletePostRequest(autocompleteRequest, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
AutocompleteResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
AutocompleteResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = AutocompleteResult.DeserializeAutocompleteResult(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 = AutocompleteResult.DeserializeAutocompleteResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -37,7 +38,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> ResetAsync(string indexerName, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.ResetAsync(indexerName, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("IndexersClient.Reset");
scope.Start();
try
{
return await RestClient.ResetAsync(indexerName, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Resets the change tracking state associated with an indexer. </summary>
@ -46,7 +57,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response Reset(string indexerName, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.Reset(indexerName, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("IndexersClient.Reset");
scope.Start();
try
{
return RestClient.Reset(indexerName, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Runs an indexer on-demand. </summary>
@ -55,7 +76,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> RunAsync(string indexerName, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.RunAsync(indexerName, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("IndexersClient.Run");
scope.Start();
try
{
return await RestClient.RunAsync(indexerName, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Runs an indexer on-demand. </summary>
@ -64,7 +95,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response Run(string indexerName, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.Run(indexerName, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("IndexersClient.Run");
scope.Start();
try
{
return RestClient.Run(indexerName, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a new indexer or updates an indexer if it already exists. </summary>
@ -75,7 +116,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<Indexer>> CreateOrUpdateAsync(string indexerName, Indexer indexer, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
{
return await RestClient.CreateOrUpdateAsync(indexerName, indexer, requestOptions, accessCondition, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("IndexersClient.CreateOrUpdate");
scope.Start();
try
{
return await RestClient.CreateOrUpdateAsync(indexerName, indexer, requestOptions, accessCondition, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a new indexer or updates an indexer if it already exists. </summary>
@ -86,7 +137,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<Indexer> CreateOrUpdate(string indexerName, Indexer indexer, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
{
return RestClient.CreateOrUpdate(indexerName, indexer, requestOptions, accessCondition, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("IndexersClient.CreateOrUpdate");
scope.Start();
try
{
return RestClient.CreateOrUpdate(indexerName, indexer, requestOptions, accessCondition, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes an indexer. </summary>
@ -96,7 +157,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> DeleteAsync(string indexerName, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
{
return await RestClient.DeleteAsync(indexerName, requestOptions, accessCondition, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("IndexersClient.Delete");
scope.Start();
try
{
return await RestClient.DeleteAsync(indexerName, requestOptions, accessCondition, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes an indexer. </summary>
@ -106,7 +177,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response Delete(string indexerName, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
{
return RestClient.Delete(indexerName, requestOptions, accessCondition, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("IndexersClient.Delete");
scope.Start();
try
{
return RestClient.Delete(indexerName, requestOptions, accessCondition, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Retrieves an indexer definition. </summary>
@ -115,7 +196,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<Indexer>> GetAsync(string indexerName, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.GetAsync(indexerName, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("IndexersClient.Get");
scope.Start();
try
{
return await RestClient.GetAsync(indexerName, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Retrieves an indexer definition. </summary>
@ -124,7 +215,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<Indexer> Get(string indexerName, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.Get(indexerName, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("IndexersClient.Get");
scope.Start();
try
{
return RestClient.Get(indexerName, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Lists all indexers available for a search service. </summary>
@ -133,7 +234,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<ListIndexersResult>> ListAsync(string select = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.ListAsync(select, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("IndexersClient.List");
scope.Start();
try
{
return await RestClient.ListAsync(select, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Lists all indexers available for a search service. </summary>
@ -142,7 +253,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<ListIndexersResult> List(string select = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.List(select, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("IndexersClient.List");
scope.Start();
try
{
return RestClient.List(select, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a new indexer. </summary>
@ -151,7 +272,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<Indexer>> CreateAsync(Indexer indexer, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.CreateAsync(indexer, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("IndexersClient.Create");
scope.Start();
try
{
return await RestClient.CreateAsync(indexer, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a new indexer. </summary>
@ -160,7 +291,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<Indexer> Create(Indexer indexer, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.Create(indexer, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("IndexersClient.Create");
scope.Start();
try
{
return RestClient.Create(indexer, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Returns the current status and execution history of an indexer. </summary>
@ -169,7 +310,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<IndexerExecutionInfo>> GetStatusAsync(string indexerName, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.GetStatusAsync(indexerName, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("IndexersClient.GetStatus");
scope.Start();
try
{
return await RestClient.GetStatusAsync(indexerName, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Returns the current status and execution history of an indexer. </summary>
@ -178,7 +329,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<IndexerExecutionInfo> GetStatus(string indexerName, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.GetStatus(indexerName, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("IndexersClient.GetStatus");
scope.Start();
try
{
return RestClient.GetStatus(indexerName, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -71,24 +71,14 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(indexerName));
}
using var scope = _clientDiagnostics.CreateScope("IndexersClient.Reset");
scope.Start();
try
using var message = CreateResetRequest(indexerName, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateResetRequest(indexerName, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 204:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 204:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -103,24 +93,14 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(indexerName));
}
using var scope = _clientDiagnostics.CreateScope("IndexersClient.Reset");
scope.Start();
try
using var message = CreateResetRequest(indexerName, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateResetRequest(indexerName, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 204:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 204:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -154,24 +134,14 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(indexerName));
}
using var scope = _clientDiagnostics.CreateScope("IndexersClient.Run");
scope.Start();
try
using var message = CreateRunRequest(indexerName, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateRunRequest(indexerName, requestOptions);
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);
}
}
@ -186,24 +156,14 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(indexerName));
}
using var scope = _clientDiagnostics.CreateScope("IndexersClient.Run");
scope.Start();
try
using var message = CreateRunRequest(indexerName, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateRunRequest(indexerName, requestOptions);
_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);
}
}
@ -256,37 +216,27 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(indexer));
}
using var scope = _clientDiagnostics.CreateScope("IndexersClient.CreateOrUpdate");
scope.Start();
try
using var message = CreateCreateOrUpdateRequest(indexerName, indexer, requestOptions, accessCondition);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateOrUpdateRequest(indexerName, indexer, requestOptions, accessCondition);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 201:
case 200:
case 201:
{
Indexer value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
Indexer 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 = Indexer.DeserializeIndexer(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 = Indexer.DeserializeIndexer(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -307,37 +257,27 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(indexer));
}
using var scope = _clientDiagnostics.CreateScope("IndexersClient.CreateOrUpdate");
scope.Start();
try
using var message = CreateCreateOrUpdateRequest(indexerName, indexer, requestOptions, accessCondition);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateOrUpdateRequest(indexerName, indexer, requestOptions, accessCondition);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 201:
case 200:
case 201:
{
Indexer value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
Indexer value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = Indexer.DeserializeIndexer(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 = Indexer.DeserializeIndexer(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -380,25 +320,15 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(indexerName));
}
using var scope = _clientDiagnostics.CreateScope("IndexersClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(indexerName, requestOptions, accessCondition);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(indexerName, requestOptions, accessCondition);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 204:
case 404:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 204:
case 404:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -414,25 +344,15 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(indexerName));
}
using var scope = _clientDiagnostics.CreateScope("IndexersClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(indexerName, requestOptions, accessCondition);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(indexerName, requestOptions, accessCondition);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 204:
case 404:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 204:
case 404:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -466,36 +386,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(indexerName));
}
using var scope = _clientDiagnostics.CreateScope("IndexersClient.Get");
scope.Start();
try
using var message = CreateGetRequest(indexerName, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetRequest(indexerName, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
Indexer value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
Indexer 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 = Indexer.DeserializeIndexer(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 = Indexer.DeserializeIndexer(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -510,36 +420,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(indexerName));
}
using var scope = _clientDiagnostics.CreateScope("IndexersClient.Get");
scope.Start();
try
using var message = CreateGetRequest(indexerName, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetRequest(indexerName, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
Indexer value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
Indexer value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = Indexer.DeserializeIndexer(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 = Indexer.DeserializeIndexer(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -570,36 +470,26 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response<ListIndexersResult>> ListAsync(string select = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("IndexersClient.List");
scope.Start();
try
using var message = CreateListRequest(select, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListRequest(select, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
ListIndexersResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ListIndexersResult 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 = ListIndexersResult.DeserializeListIndexersResult(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 = ListIndexersResult.DeserializeListIndexersResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -609,36 +499,26 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response<ListIndexersResult> List(string select = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("IndexersClient.List");
scope.Start();
try
using var message = CreateListRequest(select, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListRequest(select, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
ListIndexersResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ListIndexersResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = ListIndexersResult.DeserializeListIndexersResult(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 = ListIndexersResult.DeserializeListIndexersResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -674,36 +554,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(indexer));
}
using var scope = _clientDiagnostics.CreateScope("IndexersClient.Create");
scope.Start();
try
using var message = CreateCreateRequest(indexer, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateRequest(indexer, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 201:
case 201:
{
Indexer value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
Indexer 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 = Indexer.DeserializeIndexer(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 = Indexer.DeserializeIndexer(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -718,36 +588,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(indexer));
}
using var scope = _clientDiagnostics.CreateScope("IndexersClient.Create");
scope.Start();
try
using var message = CreateCreateRequest(indexer, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateRequest(indexer, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 201:
case 201:
{
Indexer value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
Indexer value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = Indexer.DeserializeIndexer(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 = Indexer.DeserializeIndexer(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -781,36 +641,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(indexerName));
}
using var scope = _clientDiagnostics.CreateScope("IndexersClient.GetStatus");
scope.Start();
try
using var message = CreateGetStatusRequest(indexerName, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetStatusRequest(indexerName, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
IndexerExecutionInfo value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
IndexerExecutionInfo 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 = IndexerExecutionInfo.DeserializeIndexerExecutionInfo(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 = IndexerExecutionInfo.DeserializeIndexerExecutionInfo(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -825,36 +675,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(indexerName));
}
using var scope = _clientDiagnostics.CreateScope("IndexersClient.GetStatus");
scope.Start();
try
using var message = CreateGetStatusRequest(indexerName, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetStatusRequest(indexerName, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
IndexerExecutionInfo value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
IndexerExecutionInfo value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = IndexerExecutionInfo.DeserializeIndexerExecutionInfo(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 = IndexerExecutionInfo.DeserializeIndexerExecutionInfo(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -35,18 +36,38 @@ namespace CognitiveSearch
/// <param name="index"> The definition of the index to create. </param>
/// <param name="requestOptions"> Parameter group. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<Index>> CreateAsync(Index index, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
public virtual async Task<Response<Models.Index>> CreateAsync(Models.Index index, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.CreateAsync(index, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("IndexesClient.Create");
scope.Start();
try
{
return await RestClient.CreateAsync(index, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a new search index. </summary>
/// <param name="index"> The definition of the index to create. </param>
/// <param name="requestOptions"> Parameter group. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<Index> Create(Index index, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
public virtual Response<Models.Index> Create(Models.Index index, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.Create(index, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("IndexesClient.Create");
scope.Start();
try
{
return RestClient.Create(index, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Lists all indexes available for a search service. </summary>
@ -55,7 +76,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<ListIndexesResult>> ListAsync(string select = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.ListAsync(select, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("IndexesClient.List");
scope.Start();
try
{
return await RestClient.ListAsync(select, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Lists all indexes available for a search service. </summary>
@ -64,7 +95,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<ListIndexesResult> List(string select = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.List(select, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("IndexesClient.List");
scope.Start();
try
{
return RestClient.List(select, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a new search index or updates an index if it already exists. </summary>
@ -74,9 +115,19 @@ namespace CognitiveSearch
/// <param name="requestOptions"> Parameter group. </param>
/// <param name="accessCondition"> Parameter group. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<Index>> CreateOrUpdateAsync(string indexName, Index index, bool? allowIndexDowntime = null, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
public virtual async Task<Response<Models.Index>> CreateOrUpdateAsync(string indexName, Models.Index index, bool? allowIndexDowntime = null, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
{
return await RestClient.CreateOrUpdateAsync(indexName, index, allowIndexDowntime, requestOptions, accessCondition, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("IndexesClient.CreateOrUpdate");
scope.Start();
try
{
return await RestClient.CreateOrUpdateAsync(indexName, index, allowIndexDowntime, requestOptions, accessCondition, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a new search index or updates an index if it already exists. </summary>
@ -86,9 +137,19 @@ namespace CognitiveSearch
/// <param name="requestOptions"> Parameter group. </param>
/// <param name="accessCondition"> Parameter group. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<Index> CreateOrUpdate(string indexName, Index index, bool? allowIndexDowntime = null, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
public virtual Response<Models.Index> CreateOrUpdate(string indexName, Models.Index index, bool? allowIndexDowntime = null, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
{
return RestClient.CreateOrUpdate(indexName, index, allowIndexDowntime, requestOptions, accessCondition, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("IndexesClient.CreateOrUpdate");
scope.Start();
try
{
return RestClient.CreateOrUpdate(indexName, index, allowIndexDowntime, requestOptions, accessCondition, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes a search index and all the documents it contains. </summary>
@ -98,7 +159,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> DeleteAsync(string indexName, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
{
return await RestClient.DeleteAsync(indexName, requestOptions, accessCondition, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("IndexesClient.Delete");
scope.Start();
try
{
return await RestClient.DeleteAsync(indexName, requestOptions, accessCondition, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes a search index and all the documents it contains. </summary>
@ -108,25 +179,55 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response Delete(string indexName, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
{
return RestClient.Delete(indexName, requestOptions, accessCondition, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("IndexesClient.Delete");
scope.Start();
try
{
return RestClient.Delete(indexName, requestOptions, accessCondition, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Retrieves an index definition. </summary>
/// <param name="indexName"> The name of the index to retrieve. </param>
/// <param name="requestOptions"> Parameter group. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<Index>> GetAsync(string indexName, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
public virtual async Task<Response<Models.Index>> GetAsync(string indexName, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.GetAsync(indexName, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("IndexesClient.Get");
scope.Start();
try
{
return await RestClient.GetAsync(indexName, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Retrieves an index definition. </summary>
/// <param name="indexName"> The name of the index to retrieve. </param>
/// <param name="requestOptions"> Parameter group. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<Index> Get(string indexName, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
public virtual Response<Models.Index> Get(string indexName, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.Get(indexName, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("IndexesClient.Get");
scope.Start();
try
{
return RestClient.Get(indexName, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Returns statistics for the given index, including a document count and storage usage. </summary>
@ -135,7 +236,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<GetIndexStatisticsResult>> GetStatisticsAsync(string indexName, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.GetStatisticsAsync(indexName, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("IndexesClient.GetStatistics");
scope.Start();
try
{
return await RestClient.GetStatisticsAsync(indexName, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Returns statistics for the given index, including a document count and storage usage. </summary>
@ -144,7 +255,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<GetIndexStatisticsResult> GetStatistics(string indexName, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.GetStatistics(indexName, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("IndexesClient.GetStatistics");
scope.Start();
try
{
return RestClient.GetStatistics(indexName, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Shows how an analyzer breaks text into tokens. </summary>
@ -154,7 +275,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<AnalyzeResult>> AnalyzeAsync(string indexName, AnalyzeRequest request, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.AnalyzeAsync(indexName, request, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("IndexesClient.Analyze");
scope.Start();
try
{
return await RestClient.AnalyzeAsync(indexName, request, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Shows how an analyzer breaks text into tokens. </summary>
@ -164,7 +295,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<AnalyzeResult> Analyze(string indexName, AnalyzeRequest request, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.Analyze(indexName, request, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("IndexesClient.Analyze");
scope.Start();
try
{
return RestClient.Analyze(indexName, request, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -73,36 +73,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(index));
}
using var scope = _clientDiagnostics.CreateScope("IndexesClient.Create");
scope.Start();
try
using var message = CreateCreateRequest(index, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateRequest(index, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 201:
case 201:
{
Models.Index value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
Models.Index 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 = Models.Index.DeserializeIndex(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 = Models.Index.DeserializeIndex(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -117,36 +107,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(index));
}
using var scope = _clientDiagnostics.CreateScope("IndexesClient.Create");
scope.Start();
try
using var message = CreateCreateRequest(index, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateRequest(index, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 201:
case 201:
{
Models.Index value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
Models.Index value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = Models.Index.DeserializeIndex(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 = Models.Index.DeserializeIndex(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -177,36 +157,26 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response<ListIndexesResult>> ListAsync(string select = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("IndexesClient.List");
scope.Start();
try
using var message = CreateListRequest(select, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListRequest(select, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
ListIndexesResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ListIndexesResult 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 = ListIndexesResult.DeserializeListIndexesResult(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 = ListIndexesResult.DeserializeListIndexesResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -216,36 +186,26 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response<ListIndexesResult> List(string select = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("IndexesClient.List");
scope.Start();
try
using var message = CreateListRequest(select, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListRequest(select, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
ListIndexesResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ListIndexesResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = ListIndexesResult.DeserializeListIndexesResult(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 = ListIndexesResult.DeserializeListIndexesResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -303,37 +263,27 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(index));
}
using var scope = _clientDiagnostics.CreateScope("IndexesClient.CreateOrUpdate");
scope.Start();
try
using var message = CreateCreateOrUpdateRequest(indexName, index, allowIndexDowntime, requestOptions, accessCondition);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateOrUpdateRequest(indexName, index, allowIndexDowntime, requestOptions, accessCondition);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 201:
case 200:
case 201:
{
Models.Index value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
Models.Index 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 = Models.Index.DeserializeIndex(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 = Models.Index.DeserializeIndex(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -355,37 +305,27 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(index));
}
using var scope = _clientDiagnostics.CreateScope("IndexesClient.CreateOrUpdate");
scope.Start();
try
using var message = CreateCreateOrUpdateRequest(indexName, index, allowIndexDowntime, requestOptions, accessCondition);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateOrUpdateRequest(indexName, index, allowIndexDowntime, requestOptions, accessCondition);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 201:
case 200:
case 201:
{
Models.Index value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
Models.Index value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = Models.Index.DeserializeIndex(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 = Models.Index.DeserializeIndex(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -428,25 +368,15 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(indexName));
}
using var scope = _clientDiagnostics.CreateScope("IndexesClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(indexName, requestOptions, accessCondition);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(indexName, requestOptions, accessCondition);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 204:
case 404:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 204:
case 404:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -462,25 +392,15 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(indexName));
}
using var scope = _clientDiagnostics.CreateScope("IndexesClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(indexName, requestOptions, accessCondition);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(indexName, requestOptions, accessCondition);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 204:
case 404:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 204:
case 404:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -514,36 +434,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(indexName));
}
using var scope = _clientDiagnostics.CreateScope("IndexesClient.Get");
scope.Start();
try
using var message = CreateGetRequest(indexName, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetRequest(indexName, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
Models.Index value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
Models.Index 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 = Models.Index.DeserializeIndex(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 = Models.Index.DeserializeIndex(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -558,36 +468,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(indexName));
}
using var scope = _clientDiagnostics.CreateScope("IndexesClient.Get");
scope.Start();
try
using var message = CreateGetRequest(indexName, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetRequest(indexName, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
Models.Index value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
Models.Index value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = Models.Index.DeserializeIndex(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 = Models.Index.DeserializeIndex(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -621,36 +521,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(indexName));
}
using var scope = _clientDiagnostics.CreateScope("IndexesClient.GetStatistics");
scope.Start();
try
using var message = CreateGetStatisticsRequest(indexName, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetStatisticsRequest(indexName, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
GetIndexStatisticsResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
GetIndexStatisticsResult 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 = GetIndexStatisticsResult.DeserializeGetIndexStatisticsResult(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 = GetIndexStatisticsResult.DeserializeGetIndexStatisticsResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -665,36 +555,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(indexName));
}
using var scope = _clientDiagnostics.CreateScope("IndexesClient.GetStatistics");
scope.Start();
try
using var message = CreateGetStatisticsRequest(indexName, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetStatisticsRequest(indexName, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
GetIndexStatisticsResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
GetIndexStatisticsResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = GetIndexStatisticsResult.DeserializeGetIndexStatisticsResult(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 = GetIndexStatisticsResult.DeserializeGetIndexStatisticsResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -737,36 +617,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(request));
}
using var scope = _clientDiagnostics.CreateScope("IndexesClient.Analyze");
scope.Start();
try
using var message = CreateAnalyzeRequest(indexName, request, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateAnalyzeRequest(indexName, request, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
AnalyzeResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
AnalyzeResult 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 = AnalyzeResult.DeserializeAnalyzeResult(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 = AnalyzeResult.DeserializeAnalyzeResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -786,36 +656,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(request));
}
using var scope = _clientDiagnostics.CreateScope("IndexesClient.Analyze");
scope.Start();
try
using var message = CreateAnalyzeRequest(indexName, request, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateAnalyzeRequest(indexName, request, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
AnalyzeResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
AnalyzeResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = AnalyzeResult.DeserializeAnalyzeResult(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 = AnalyzeResult.DeserializeAnalyzeResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -36,7 +37,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<ServiceStatistics>> GetServiceStatisticsAsync(RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.GetServiceStatisticsAsync(requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetServiceStatistics");
scope.Start();
try
{
return await RestClient.GetServiceStatisticsAsync(requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Gets service level statistics for a search service. </summary>
@ -44,7 +55,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<ServiceStatistics> GetServiceStatistics(RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.GetServiceStatistics(requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetServiceStatistics");
scope.Start();
try
{
return RestClient.GetServiceStatistics(requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -63,36 +63,26 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response<ServiceStatistics>> GetServiceStatisticsAsync(RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetServiceStatistics");
scope.Start();
try
using var message = CreateGetServiceStatisticsRequest(requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetServiceStatisticsRequest(requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
ServiceStatistics value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ServiceStatistics 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 = ServiceStatistics.DeserializeServiceStatistics(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 = ServiceStatistics.DeserializeServiceStatistics(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -101,36 +91,26 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response<ServiceStatistics> GetServiceStatistics(RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetServiceStatistics");
scope.Start();
try
using var message = CreateGetServiceStatisticsRequest(requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetServiceStatisticsRequest(requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
ServiceStatistics value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ServiceStatistics value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = ServiceStatistics.DeserializeServiceStatistics(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 = ServiceStatistics.DeserializeServiceStatistics(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -39,7 +40,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<Skillset>> CreateOrUpdateAsync(string skillsetName, Skillset skillset, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
{
return await RestClient.CreateOrUpdateAsync(skillsetName, skillset, requestOptions, accessCondition, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.CreateOrUpdate");
scope.Start();
try
{
return await RestClient.CreateOrUpdateAsync(skillsetName, skillset, requestOptions, accessCondition, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a new skillset in a search service or updates the skillset if it already exists. </summary>
@ -50,7 +61,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<Skillset> CreateOrUpdate(string skillsetName, Skillset skillset, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
{
return RestClient.CreateOrUpdate(skillsetName, skillset, requestOptions, accessCondition, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.CreateOrUpdate");
scope.Start();
try
{
return RestClient.CreateOrUpdate(skillsetName, skillset, requestOptions, accessCondition, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes a skillset in a search service. </summary>
@ -60,7 +81,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> DeleteAsync(string skillsetName, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
{
return await RestClient.DeleteAsync(skillsetName, requestOptions, accessCondition, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.Delete");
scope.Start();
try
{
return await RestClient.DeleteAsync(skillsetName, requestOptions, accessCondition, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes a skillset in a search service. </summary>
@ -70,7 +101,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response Delete(string skillsetName, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
{
return RestClient.Delete(skillsetName, requestOptions, accessCondition, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.Delete");
scope.Start();
try
{
return RestClient.Delete(skillsetName, requestOptions, accessCondition, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Retrieves a skillset in a search service. </summary>
@ -79,7 +120,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<Skillset>> GetAsync(string skillsetName, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.GetAsync(skillsetName, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.Get");
scope.Start();
try
{
return await RestClient.GetAsync(skillsetName, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Retrieves a skillset in a search service. </summary>
@ -88,7 +139,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<Skillset> Get(string skillsetName, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.Get(skillsetName, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.Get");
scope.Start();
try
{
return RestClient.Get(skillsetName, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> List all skillsets in a search service. </summary>
@ -97,7 +158,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<ListSkillsetsResult>> ListAsync(string select = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.ListAsync(select, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.List");
scope.Start();
try
{
return await RestClient.ListAsync(select, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> List all skillsets in a search service. </summary>
@ -106,7 +177,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<ListSkillsetsResult> List(string select = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.List(select, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.List");
scope.Start();
try
{
return RestClient.List(select, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a new skillset in a search service. </summary>
@ -115,7 +196,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<Skillset>> CreateAsync(Skillset skillset, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.CreateAsync(skillset, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.Create");
scope.Start();
try
{
return await RestClient.CreateAsync(skillset, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a new skillset in a search service. </summary>
@ -124,7 +215,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<Skillset> Create(Skillset skillset, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.Create(skillset, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.Create");
scope.Start();
try
{
return RestClient.Create(skillset, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -90,37 +90,27 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(skillset));
}
using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.CreateOrUpdate");
scope.Start();
try
using var message = CreateCreateOrUpdateRequest(skillsetName, skillset, requestOptions, accessCondition);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateOrUpdateRequest(skillsetName, skillset, requestOptions, accessCondition);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 201:
case 200:
case 201:
{
Skillset value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
Skillset 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 = Skillset.DeserializeSkillset(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 = Skillset.DeserializeSkillset(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -141,37 +131,27 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(skillset));
}
using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.CreateOrUpdate");
scope.Start();
try
using var message = CreateCreateOrUpdateRequest(skillsetName, skillset, requestOptions, accessCondition);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateOrUpdateRequest(skillsetName, skillset, requestOptions, accessCondition);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 201:
case 200:
case 201:
{
Skillset value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
Skillset value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = Skillset.DeserializeSkillset(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 = Skillset.DeserializeSkillset(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -214,25 +194,15 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(skillsetName));
}
using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(skillsetName, requestOptions, accessCondition);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(skillsetName, requestOptions, accessCondition);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 204:
case 404:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 204:
case 404:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -248,25 +218,15 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(skillsetName));
}
using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(skillsetName, requestOptions, accessCondition);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(skillsetName, requestOptions, accessCondition);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 204:
case 404:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 204:
case 404:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -300,36 +260,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(skillsetName));
}
using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.Get");
scope.Start();
try
using var message = CreateGetRequest(skillsetName, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetRequest(skillsetName, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
Skillset value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
Skillset 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 = Skillset.DeserializeSkillset(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 = Skillset.DeserializeSkillset(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -344,36 +294,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(skillsetName));
}
using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.Get");
scope.Start();
try
using var message = CreateGetRequest(skillsetName, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetRequest(skillsetName, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
Skillset value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
Skillset value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = Skillset.DeserializeSkillset(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 = Skillset.DeserializeSkillset(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -404,36 +344,26 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response<ListSkillsetsResult>> ListAsync(string select = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.List");
scope.Start();
try
using var message = CreateListRequest(select, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListRequest(select, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
ListSkillsetsResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ListSkillsetsResult 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 = ListSkillsetsResult.DeserializeListSkillsetsResult(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 = ListSkillsetsResult.DeserializeListSkillsetsResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -443,36 +373,26 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response<ListSkillsetsResult> List(string select = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.List");
scope.Start();
try
using var message = CreateListRequest(select, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListRequest(select, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
ListSkillsetsResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ListSkillsetsResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = ListSkillsetsResult.DeserializeListSkillsetsResult(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 = ListSkillsetsResult.DeserializeListSkillsetsResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -508,36 +428,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(skillset));
}
using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.Create");
scope.Start();
try
using var message = CreateCreateRequest(skillset, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateRequest(skillset, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 201:
case 201:
{
Skillset value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
Skillset 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 = Skillset.DeserializeSkillset(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 = Skillset.DeserializeSkillset(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -552,36 +462,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(skillset));
}
using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.Create");
scope.Start();
try
using var message = CreateCreateRequest(skillset, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateRequest(skillset, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 201:
case 201:
{
Skillset value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
Skillset value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = Skillset.DeserializeSkillset(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 = Skillset.DeserializeSkillset(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -39,7 +40,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<SynonymMap>> CreateOrUpdateAsync(string synonymMapName, SynonymMap synonymMap, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
{
return await RestClient.CreateOrUpdateAsync(synonymMapName, synonymMap, requestOptions, accessCondition, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SynonymMapsClient.CreateOrUpdate");
scope.Start();
try
{
return await RestClient.CreateOrUpdateAsync(synonymMapName, synonymMap, requestOptions, accessCondition, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a new synonym map or updates a synonym map if it already exists. </summary>
@ -50,7 +61,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<SynonymMap> CreateOrUpdate(string synonymMapName, SynonymMap synonymMap, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
{
return RestClient.CreateOrUpdate(synonymMapName, synonymMap, requestOptions, accessCondition, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SynonymMapsClient.CreateOrUpdate");
scope.Start();
try
{
return RestClient.CreateOrUpdate(synonymMapName, synonymMap, requestOptions, accessCondition, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes a synonym map. </summary>
@ -60,7 +81,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> DeleteAsync(string synonymMapName, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
{
return await RestClient.DeleteAsync(synonymMapName, requestOptions, accessCondition, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SynonymMapsClient.Delete");
scope.Start();
try
{
return await RestClient.DeleteAsync(synonymMapName, requestOptions, accessCondition, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Deletes a synonym map. </summary>
@ -70,7 +101,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response Delete(string synonymMapName, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
{
return RestClient.Delete(synonymMapName, requestOptions, accessCondition, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SynonymMapsClient.Delete");
scope.Start();
try
{
return RestClient.Delete(synonymMapName, requestOptions, accessCondition, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Retrieves a synonym map definition. </summary>
@ -79,7 +120,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<SynonymMap>> GetAsync(string synonymMapName, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.GetAsync(synonymMapName, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SynonymMapsClient.Get");
scope.Start();
try
{
return await RestClient.GetAsync(synonymMapName, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Retrieves a synonym map definition. </summary>
@ -88,7 +139,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<SynonymMap> Get(string synonymMapName, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.Get(synonymMapName, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SynonymMapsClient.Get");
scope.Start();
try
{
return RestClient.Get(synonymMapName, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Lists all synonym maps available for a search service. </summary>
@ -97,7 +158,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<ListSynonymMapsResult>> ListAsync(string select = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.ListAsync(select, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SynonymMapsClient.List");
scope.Start();
try
{
return await RestClient.ListAsync(select, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Lists all synonym maps available for a search service. </summary>
@ -106,7 +177,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<ListSynonymMapsResult> List(string select = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.List(select, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SynonymMapsClient.List");
scope.Start();
try
{
return RestClient.List(select, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a new synonym map. </summary>
@ -115,7 +196,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<SynonymMap>> CreateAsync(SynonymMap synonymMap, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return await RestClient.CreateAsync(synonymMap, requestOptions, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SynonymMapsClient.Create");
scope.Start();
try
{
return await RestClient.CreateAsync(synonymMap, requestOptions, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Creates a new synonym map. </summary>
@ -124,7 +215,17 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<SynonymMap> Create(SynonymMap synonymMap, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return RestClient.Create(synonymMap, requestOptions, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SynonymMapsClient.Create");
scope.Start();
try
{
return RestClient.Create(synonymMap, requestOptions, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -90,37 +90,27 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(synonymMap));
}
using var scope = _clientDiagnostics.CreateScope("SynonymMapsClient.CreateOrUpdate");
scope.Start();
try
using var message = CreateCreateOrUpdateRequest(synonymMapName, synonymMap, requestOptions, accessCondition);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateOrUpdateRequest(synonymMapName, synonymMap, requestOptions, accessCondition);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 201:
case 200:
case 201:
{
SynonymMap value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
SynonymMap 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 = SynonymMap.DeserializeSynonymMap(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 = SynonymMap.DeserializeSynonymMap(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -141,37 +131,27 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(synonymMap));
}
using var scope = _clientDiagnostics.CreateScope("SynonymMapsClient.CreateOrUpdate");
scope.Start();
try
using var message = CreateCreateOrUpdateRequest(synonymMapName, synonymMap, requestOptions, accessCondition);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateOrUpdateRequest(synonymMapName, synonymMap, requestOptions, accessCondition);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 201:
case 200:
case 201:
{
SynonymMap value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
SynonymMap value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = SynonymMap.DeserializeSynonymMap(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 = SynonymMap.DeserializeSynonymMap(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -214,25 +194,15 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(synonymMapName));
}
using var scope = _clientDiagnostics.CreateScope("SynonymMapsClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(synonymMapName, requestOptions, accessCondition);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(synonymMapName, requestOptions, accessCondition);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 204:
case 404:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 204:
case 404:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -248,25 +218,15 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(synonymMapName));
}
using var scope = _clientDiagnostics.CreateScope("SynonymMapsClient.Delete");
scope.Start();
try
using var message = CreateDeleteRequest(synonymMapName, requestOptions, accessCondition);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateDeleteRequest(synonymMapName, requestOptions, accessCondition);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 204:
case 404:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 204:
case 404:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -300,36 +260,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(synonymMapName));
}
using var scope = _clientDiagnostics.CreateScope("SynonymMapsClient.Get");
scope.Start();
try
using var message = CreateGetRequest(synonymMapName, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetRequest(synonymMapName, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
SynonymMap value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
SynonymMap 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 = SynonymMap.DeserializeSynonymMap(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 = SynonymMap.DeserializeSynonymMap(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -344,36 +294,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(synonymMapName));
}
using var scope = _clientDiagnostics.CreateScope("SynonymMapsClient.Get");
scope.Start();
try
using var message = CreateGetRequest(synonymMapName, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetRequest(synonymMapName, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
SynonymMap value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
SynonymMap value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = SynonymMap.DeserializeSynonymMap(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 = SynonymMap.DeserializeSynonymMap(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -404,36 +344,26 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response<ListSynonymMapsResult>> ListAsync(string select = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SynonymMapsClient.List");
scope.Start();
try
using var message = CreateListRequest(select, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateListRequest(select, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
ListSynonymMapsResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ListSynonymMapsResult 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 = ListSynonymMapsResult.DeserializeListSynonymMapsResult(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 = ListSynonymMapsResult.DeserializeListSynonymMapsResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -443,36 +373,26 @@ namespace CognitiveSearch
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response<ListSynonymMapsResult> List(string select = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SynonymMapsClient.List");
scope.Start();
try
using var message = CreateListRequest(select, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateListRequest(select, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
ListSynonymMapsResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
ListSynonymMapsResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = ListSynonymMapsResult.DeserializeListSynonymMapsResult(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 = ListSynonymMapsResult.DeserializeListSynonymMapsResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -508,36 +428,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(synonymMap));
}
using var scope = _clientDiagnostics.CreateScope("SynonymMapsClient.Create");
scope.Start();
try
using var message = CreateCreateRequest(synonymMap, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateRequest(synonymMap, requestOptions);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 201:
case 201:
{
SynonymMap value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
SynonymMap 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 = SynonymMap.DeserializeSynonymMap(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 = SynonymMap.DeserializeSynonymMap(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -552,36 +462,26 @@ namespace CognitiveSearch
throw new ArgumentNullException(nameof(synonymMap));
}
using var scope = _clientDiagnostics.CreateScope("SynonymMapsClient.Create");
scope.Start();
try
using var message = CreateCreateRequest(synonymMap, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateRequest(synonymMap, requestOptions);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 201:
case 201:
{
SynonymMap value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
SynonymMap value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = SynonymMap.DeserializeSynonymMap(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 = SynonymMap.DeserializeSynonymMap(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -38,7 +39,17 @@ namespace CognitiveServices.TextAnalytics
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<EntitiesResult>> EntitiesRecognitionGeneralAsync(MultiLanguageBatchInput input, string modelVersion = null, bool? showStats = null, CancellationToken cancellationToken = default)
{
return await RestClient.EntitiesRecognitionGeneralAsync(input, modelVersion, showStats, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.EntitiesRecognitionGeneral");
scope.Start();
try
{
return await RestClient.EntitiesRecognitionGeneralAsync(input, modelVersion, showStats, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> The API returns a list of general named entities in a given document. For the list of supported entity types, check &lt;a href=&quot;https://aka.ms/taner&quot;&gt;Supported Entity Types in Text Analytics API&lt;/a&gt;. See the &lt;a href=&quot;https://aka.ms/talangs&quot;&gt;Supported languages in Text Analytics API&lt;/a&gt; for the list of enabled languages. </summary>
@ -48,7 +59,17 @@ namespace CognitiveServices.TextAnalytics
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<EntitiesResult> EntitiesRecognitionGeneral(MultiLanguageBatchInput input, string modelVersion = null, bool? showStats = null, CancellationToken cancellationToken = default)
{
return RestClient.EntitiesRecognitionGeneral(input, modelVersion, showStats, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.EntitiesRecognitionGeneral");
scope.Start();
try
{
return RestClient.EntitiesRecognitionGeneral(input, modelVersion, showStats, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary>
@ -61,7 +82,17 @@ namespace CognitiveServices.TextAnalytics
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<EntitiesResult>> EntitiesRecognitionPiiAsync(MultiLanguageBatchInput input, string modelVersion = null, bool? showStats = null, CancellationToken cancellationToken = default)
{
return await RestClient.EntitiesRecognitionPiiAsync(input, modelVersion, showStats, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.EntitiesRecognitionPii");
scope.Start();
try
{
return await RestClient.EntitiesRecognitionPiiAsync(input, modelVersion, showStats, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary>
@ -74,7 +105,17 @@ namespace CognitiveServices.TextAnalytics
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<EntitiesResult> EntitiesRecognitionPii(MultiLanguageBatchInput input, string modelVersion = null, bool? showStats = null, CancellationToken cancellationToken = default)
{
return RestClient.EntitiesRecognitionPii(input, modelVersion, showStats, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.EntitiesRecognitionPii");
scope.Start();
try
{
return RestClient.EntitiesRecognitionPii(input, modelVersion, showStats, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> The API returns a list of recognized entities with links to a well-known knowledge base. See the &lt;a href=&quot;https://aka.ms/talangs&quot;&gt;Supported languages in Text Analytics API&lt;/a&gt; for the list of enabled languages. </summary>
@ -84,7 +125,17 @@ namespace CognitiveServices.TextAnalytics
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<EntityLinkingResult>> EntitiesLinkingAsync(MultiLanguageBatchInput input, string modelVersion = null, bool? showStats = null, CancellationToken cancellationToken = default)
{
return await RestClient.EntitiesLinkingAsync(input, modelVersion, showStats, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.EntitiesLinking");
scope.Start();
try
{
return await RestClient.EntitiesLinkingAsync(input, modelVersion, showStats, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> The API returns a list of recognized entities with links to a well-known knowledge base. See the &lt;a href=&quot;https://aka.ms/talangs&quot;&gt;Supported languages in Text Analytics API&lt;/a&gt; for the list of enabled languages. </summary>
@ -94,7 +145,17 @@ namespace CognitiveServices.TextAnalytics
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<EntityLinkingResult> EntitiesLinking(MultiLanguageBatchInput input, string modelVersion = null, bool? showStats = null, CancellationToken cancellationToken = default)
{
return RestClient.EntitiesLinking(input, modelVersion, showStats, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.EntitiesLinking");
scope.Start();
try
{
return RestClient.EntitiesLinking(input, modelVersion, showStats, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> The API returns a list of strings denoting the key phrases in the input text. See the &lt;a href=&quot;https://aka.ms/talangs&quot;&gt;Supported languages in Text Analytics API&lt;/a&gt; for the list of enabled languages. </summary>
@ -104,7 +165,17 @@ namespace CognitiveServices.TextAnalytics
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<KeyPhraseResult>> KeyPhrasesAsync(MultiLanguageBatchInput input, string modelVersion = null, bool? showStats = null, CancellationToken cancellationToken = default)
{
return await RestClient.KeyPhrasesAsync(input, modelVersion, showStats, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.KeyPhrases");
scope.Start();
try
{
return await RestClient.KeyPhrasesAsync(input, modelVersion, showStats, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> The API returns a list of strings denoting the key phrases in the input text. See the &lt;a href=&quot;https://aka.ms/talangs&quot;&gt;Supported languages in Text Analytics API&lt;/a&gt; for the list of enabled languages. </summary>
@ -114,7 +185,17 @@ namespace CognitiveServices.TextAnalytics
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<KeyPhraseResult> KeyPhrases(MultiLanguageBatchInput input, string modelVersion = null, bool? showStats = null, CancellationToken cancellationToken = default)
{
return RestClient.KeyPhrases(input, modelVersion, showStats, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.KeyPhrases");
scope.Start();
try
{
return RestClient.KeyPhrases(input, modelVersion, showStats, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> The API returns the detected language and a numeric score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true. See the &lt;a href=&quot;https://aka.ms/talangs&quot;&gt;Supported languages in Text Analytics API&lt;/a&gt; for the list of enabled languages. </summary>
@ -124,7 +205,17 @@ namespace CognitiveServices.TextAnalytics
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<LanguageResult>> LanguagesAsync(LanguageBatchInput input, string modelVersion = null, bool? showStats = null, CancellationToken cancellationToken = default)
{
return await RestClient.LanguagesAsync(input, modelVersion, showStats, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Languages");
scope.Start();
try
{
return await RestClient.LanguagesAsync(input, modelVersion, showStats, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> The API returns the detected language and a numeric score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true. See the &lt;a href=&quot;https://aka.ms/talangs&quot;&gt;Supported languages in Text Analytics API&lt;/a&gt; for the list of enabled languages. </summary>
@ -134,7 +225,17 @@ namespace CognitiveServices.TextAnalytics
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<LanguageResult> Languages(LanguageBatchInput input, string modelVersion = null, bool? showStats = null, CancellationToken cancellationToken = default)
{
return RestClient.Languages(input, modelVersion, showStats, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Languages");
scope.Start();
try
{
return RestClient.Languages(input, modelVersion, showStats, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> The API returns a sentiment prediction, as well as sentiment scores for each sentiment class (Positive, Negative, and Neutral) for the document and each sentence within it. See the &lt;a href=&quot;https://aka.ms/talangs&quot;&gt;Supported languages in Text Analytics API&lt;/a&gt; for the list of enabled languages. </summary>
@ -144,7 +245,17 @@ namespace CognitiveServices.TextAnalytics
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<SentimentResponse>> SentimentAsync(MultiLanguageBatchInput input, string modelVersion = null, bool? showStats = null, CancellationToken cancellationToken = default)
{
return await RestClient.SentimentAsync(input, modelVersion, showStats, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Sentiment");
scope.Start();
try
{
return await RestClient.SentimentAsync(input, modelVersion, showStats, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> The API returns a sentiment prediction, as well as sentiment scores for each sentiment class (Positive, Negative, and Neutral) for the document and each sentence within it. See the &lt;a href=&quot;https://aka.ms/talangs&quot;&gt;Supported languages in Text Analytics API&lt;/a&gt; for the list of enabled languages. </summary>
@ -154,7 +265,17 @@ namespace CognitiveServices.TextAnalytics
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<SentimentResponse> Sentiment(MultiLanguageBatchInput input, string modelVersion = null, bool? showStats = null, CancellationToken cancellationToken = default)
{
return RestClient.Sentiment(input, modelVersion, showStats, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Sentiment");
scope.Start();
try
{
return RestClient.Sentiment(input, modelVersion, showStats, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -72,36 +72,26 @@ namespace CognitiveServices.TextAnalytics
throw new ArgumentNullException(nameof(input));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.EntitiesRecognitionGeneral");
scope.Start();
try
using var message = CreateEntitiesRecognitionGeneralRequest(input, modelVersion, showStats);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateEntitiesRecognitionGeneralRequest(input, modelVersion, showStats);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
EntitiesResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
EntitiesResult 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 = EntitiesResult.DeserializeEntitiesResult(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 = EntitiesResult.DeserializeEntitiesResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -117,36 +107,26 @@ namespace CognitiveServices.TextAnalytics
throw new ArgumentNullException(nameof(input));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.EntitiesRecognitionGeneral");
scope.Start();
try
using var message = CreateEntitiesRecognitionGeneralRequest(input, modelVersion, showStats);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateEntitiesRecognitionGeneralRequest(input, modelVersion, showStats);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
EntitiesResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
EntitiesResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = EntitiesResult.DeserializeEntitiesResult(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 = EntitiesResult.DeserializeEntitiesResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -190,36 +170,26 @@ namespace CognitiveServices.TextAnalytics
throw new ArgumentNullException(nameof(input));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.EntitiesRecognitionPii");
scope.Start();
try
using var message = CreateEntitiesRecognitionPiiRequest(input, modelVersion, showStats);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateEntitiesRecognitionPiiRequest(input, modelVersion, showStats);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
EntitiesResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
EntitiesResult 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 = EntitiesResult.DeserializeEntitiesResult(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 = EntitiesResult.DeserializeEntitiesResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -238,36 +208,26 @@ namespace CognitiveServices.TextAnalytics
throw new ArgumentNullException(nameof(input));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.EntitiesRecognitionPii");
scope.Start();
try
using var message = CreateEntitiesRecognitionPiiRequest(input, modelVersion, showStats);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateEntitiesRecognitionPiiRequest(input, modelVersion, showStats);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
EntitiesResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
EntitiesResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = EntitiesResult.DeserializeEntitiesResult(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 = EntitiesResult.DeserializeEntitiesResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -308,36 +268,26 @@ namespace CognitiveServices.TextAnalytics
throw new ArgumentNullException(nameof(input));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.EntitiesLinking");
scope.Start();
try
using var message = CreateEntitiesLinkingRequest(input, modelVersion, showStats);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateEntitiesLinkingRequest(input, modelVersion, showStats);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
EntityLinkingResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
EntityLinkingResult 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 = EntityLinkingResult.DeserializeEntityLinkingResult(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 = EntityLinkingResult.DeserializeEntityLinkingResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -353,36 +303,26 @@ namespace CognitiveServices.TextAnalytics
throw new ArgumentNullException(nameof(input));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.EntitiesLinking");
scope.Start();
try
using var message = CreateEntitiesLinkingRequest(input, modelVersion, showStats);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateEntitiesLinkingRequest(input, modelVersion, showStats);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
EntityLinkingResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
EntityLinkingResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = EntityLinkingResult.DeserializeEntityLinkingResult(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 = EntityLinkingResult.DeserializeEntityLinkingResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -423,36 +363,26 @@ namespace CognitiveServices.TextAnalytics
throw new ArgumentNullException(nameof(input));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.KeyPhrases");
scope.Start();
try
using var message = CreateKeyPhrasesRequest(input, modelVersion, showStats);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateKeyPhrasesRequest(input, modelVersion, showStats);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
KeyPhraseResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
KeyPhraseResult 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 = KeyPhraseResult.DeserializeKeyPhraseResult(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 = KeyPhraseResult.DeserializeKeyPhraseResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -468,36 +398,26 @@ namespace CognitiveServices.TextAnalytics
throw new ArgumentNullException(nameof(input));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.KeyPhrases");
scope.Start();
try
using var message = CreateKeyPhrasesRequest(input, modelVersion, showStats);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateKeyPhrasesRequest(input, modelVersion, showStats);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
KeyPhraseResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
KeyPhraseResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = KeyPhraseResult.DeserializeKeyPhraseResult(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 = KeyPhraseResult.DeserializeKeyPhraseResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -538,36 +458,26 @@ namespace CognitiveServices.TextAnalytics
throw new ArgumentNullException(nameof(input));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Languages");
scope.Start();
try
using var message = CreateLanguagesRequest(input, modelVersion, showStats);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateLanguagesRequest(input, modelVersion, showStats);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
LanguageResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
LanguageResult 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 = LanguageResult.DeserializeLanguageResult(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 = LanguageResult.DeserializeLanguageResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -583,36 +493,26 @@ namespace CognitiveServices.TextAnalytics
throw new ArgumentNullException(nameof(input));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Languages");
scope.Start();
try
using var message = CreateLanguagesRequest(input, modelVersion, showStats);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateLanguagesRequest(input, modelVersion, showStats);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
LanguageResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
LanguageResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = LanguageResult.DeserializeLanguageResult(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 = LanguageResult.DeserializeLanguageResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -653,36 +553,26 @@ namespace CognitiveServices.TextAnalytics
throw new ArgumentNullException(nameof(input));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Sentiment");
scope.Start();
try
using var message = CreateSentimentRequest(input, modelVersion, showStats);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateSentimentRequest(input, modelVersion, showStats);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
SentimentResponse value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
SentimentResponse 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 = SentimentResponse.DeserializeSentimentResponse(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 = SentimentResponse.DeserializeSentimentResponse(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -698,36 +588,26 @@ namespace CognitiveServices.TextAnalytics
throw new ArgumentNullException(nameof(input));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Sentiment");
scope.Start();
try
using var message = CreateSentimentRequest(input, modelVersion, showStats);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateSentimentRequest(input, modelVersion, showStats);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
SentimentResponse value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
SentimentResponse value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = SentimentResponse.DeserializeSentimentResponse(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 = SentimentResponse.DeserializeSentimentResponse(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -20,6 +20,7 @@ using AutoRest.CSharp.V3.Utilities;
using Azure;
using Azure.Core;
using Azure.Core.Pipeline;
using Microsoft.CodeAnalysis.Operations;
using Response = Azure.Response;
namespace AutoRest.CSharp.V3.Generation.Writers
@ -157,32 +158,35 @@ namespace AutoRest.CSharp.V3.Generation.Writers
using (writer.Scope())
{
writer.Append($"return (");
if (async)
WriteDiagnosticScope(writer, clientMethod.Diagnostics, writer =>
{
writer.Append($"await ");
}
writer.Append($"return (");
if (async)
{
writer.Append($"await ");
}
writer.Append($"RestClient.{CreateMethodName(clientMethod.RestClientMethod.Name, async)}(");
foreach (var parameter in clientMethod.RestClientMethod.Parameters)
{
writer.Append($"{parameter.Name:I}, ");
}
writer.Append($"cancellationToken)");
writer.Append($"RestClient.{CreateMethodName(clientMethod.RestClientMethod.Name, async)}(");
foreach (var parameter in clientMethod.RestClientMethod.Parameters)
{
writer.Append($"{parameter.Name:I}, ");
}
writer.Append($"cancellationToken)");
if (async)
{
writer.Append($".ConfigureAwait(false)");
}
if (async)
{
writer.Append($".ConfigureAwait(false)");
}
writer.Append($")");
writer.Append($")");
if (bodyType == null && clientMethod.RestClientMethod.HeaderModel != null)
{
writer.Append($".GetRawResponse()");
}
if (bodyType == null && clientMethod.RestClientMethod.HeaderModel != null)
{
writer.Append($".GetRawResponse()");
}
writer.Line($";");
writer.Line($";");
});
}
writer.Line();
@ -235,7 +239,7 @@ namespace AutoRest.CSharp.V3.Generation.Writers
writer.Line();
}
private void WritePagingOperation(CodeWriter writer, PagingInfo pagingMethod, bool async)
private void WritePagingOperation(CodeWriter writer, PagingMethod pagingMethod, bool async)
{
var pageType = pagingMethod.ItemType;
CSharpType responseType = async ? new CSharpType(typeof(AsyncPageable<>), pageType) : new CSharpType(typeof(Pageable<>), pageType);
@ -272,13 +276,17 @@ namespace AutoRest.CSharp.V3.Generation.Writers
var configureAwaitText = async ? ".ConfigureAwait(false)" : string.Empty;
using (writer.Scope($"{asyncText} {funcType} FirstPageFunc({nullableInt} pageSizeHint)"))
{
writer.Append($"var response = {awaitText} RestClient.{CreateMethodName(pagingMethod.Method.Name, async)}(");
foreach (Parameter parameter in parameters)
WriteDiagnosticScope(writer, pagingMethod.Diagnostics, writer =>
{
writer.Append($"{parameter.Name}, ");
}
writer.Line($"cancellationToken){configureAwaitText};");
writer.Line($"return {typeof(Page)}.FromValues(response.Value.{pagingMethod.ItemName}, {continuationTokenText}, response.GetRawResponse());");
writer.Append($"var response = {awaitText} RestClient.{CreateMethodName(pagingMethod.Method.Name, async)}(");
foreach (Parameter parameter in parameters)
{
writer.Append($"{parameter.Name}, ");
}
writer.Line($"cancellationToken){configureAwaitText};");
writer.Line($"return {typeof(Page)}.FromValues(response.Value.{pagingMethod.ItemName}, {continuationTokenText}, response.GetRawResponse());");
});
}
var nextPageFunctionName = "null";
@ -288,13 +296,16 @@ namespace AutoRest.CSharp.V3.Generation.Writers
var nextPageParameters = pagingMethod.NextPageMethod.Parameters;
using (writer.Scope($"{asyncText} {funcType} {nextPageFunctionName}({typeof(string)} nextLink, {nullableInt} pageSizeHint)"))
{
writer.Append($"var response = {awaitText} RestClient.{CreateMethodName(pagingMethod.NextPageMethod.Name, async)}(");
foreach (Parameter parameter in nextPageParameters)
WriteDiagnosticScope(writer, pagingMethod.Diagnostics, writer =>
{
writer.Append($"{parameter.Name}, ");
}
writer.Line($"cancellationToken){configureAwaitText};");
writer.Line($"return {typeof(Page)}.FromValues(response.Value.{pagingMethod.ItemName}, {continuationTokenText}, response.GetRawResponse());");
writer.Append($"var response = {awaitText} RestClient.{CreateMethodName(pagingMethod.NextPageMethod.Name, async)}(");
foreach (Parameter parameter in nextPageParameters)
{
writer.Append($"{parameter.Name}, ");
}
writer.Line($"cancellationToken){configureAwaitText};");
writer.Line($"return {typeof(Page)}.FromValues(response.Value.{pagingMethod.ItemName}, {continuationTokenText}, response.GetRawResponse());");
});
}
}
writer.Line($"return {typeof(PageableHelpers)}.Create{(async ? "Async" : string.Empty)}Enumerable(FirstPageFunc, {nextPageFunctionName});");
@ -329,7 +340,7 @@ namespace AutoRest.CSharp.V3.Generation.Writers
writer.WriteParameterNullChecks(parameters);
writer.Append($"return {typeof(ArmOperationHelpers)}.Create(");
writer.Append($"_pipeline, _clientDiagnostics, originalResponse, {typeof(RequestMethod)}.{originalMethod.Request.HttpMethod.ToRequestMethodName()}, {originalMethod.Diagnostics.ScopeName:L}, {typeof(OperationFinalStateVia)}.{lroMethod.FinalStateVia}, createOriginalHttpMessage");
writer.Append($"_pipeline, _clientDiagnostics, originalResponse, {typeof(RequestMethod)}.{originalMethod.Request.HttpMethod.ToRequestMethodName()}, {lroMethod.Diagnostics.ScopeName:L}, {typeof(OperationFinalStateVia)}.{lroMethod.FinalStateVia}, createOriginalHttpMessage");
if (responseBodyType != null)
{
@ -367,6 +378,32 @@ namespace AutoRest.CSharp.V3.Generation.Writers
writer.Line();
}
private void WriteDiagnosticScope(CodeWriter writer, Diagnostic diagnostic, CodeWriterDelegate inner)
{
var scopeVariable = new CodeWriterDeclaration("scope");
writer.Line($"using var {scopeVariable:D} = _clientDiagnostics.CreateScope({diagnostic.ScopeName:L});");
foreach (DiagnosticAttribute diagnosticScopeAttributes in diagnostic.Attributes)
{
writer.Append($"{scopeVariable}.AddAttribute({diagnosticScopeAttributes.Name:L},");
writer.WriteReferenceOrConstant(diagnosticScopeAttributes.Value);
writer.Line($");");
}
writer.Line($"{scopeVariable}.Start();");
using (writer.Scope($"try"))
{
inner(writer);
}
using (writer.Scope($"catch ({typeof(Exception)} e)"))
{
writer.Line($"{scopeVariable}.Failed(e);");
writer.Line($"throw;");
}
}
private void WriteStartOperationOperation(CodeWriter writer, LongRunningOperation lroMethod, bool async)
{
RestClientMethod originalMethod = lroMethod.OriginalMethod;
@ -394,22 +431,27 @@ namespace AutoRest.CSharp.V3.Generation.Writers
{
writer.WriteParameterNullChecks(parameters);
string awaitText = async ? "await" : string.Empty;
string configureText = async ? ".ConfigureAwait(false)" : string.Empty;
writer.Append($"var originalResponse = {awaitText} RestClient.{CreateMethodName(originalMethod.Name, async)}(");
foreach (Parameter parameter in parameters)
WriteDiagnosticScope(writer, lroMethod.Diagnostics, writer =>
{
writer.Append($"{parameter.Name}, ");
}
writer.Line($"cancellationToken){configureText};");
string awaitText = async ? "await" : string.Empty;
string configureText = async ? ".ConfigureAwait(false)" : string.Empty;
writer.Append($"var originalResponse = {awaitText} RestClient.{CreateMethodName(originalMethod.Name, async)}(");
foreach (Parameter parameter in parameters)
{
writer.Append($"{parameter.Name}, ");
}
writer.Line($"cancellationToken){configureText};");
writer.Append($"return {CreateCreateOperationName(lroMethod.Name)}(originalResponse, () => RestClient.{CreateRequestMethodName(originalMethod.Name)}(");
foreach (Parameter parameter in parameters)
{
writer.Append($"{parameter.Name}, ");
}
writer.RemoveTrailingComma();
writer.Line($"));");
});
writer.Append($"return {CreateCreateOperationName(lroMethod.Name)}(originalResponse, () => RestClient.{CreateRequestMethodName(originalMethod.Name)}(");
foreach (Parameter parameter in parameters)
{
writer.Append($"{parameter.Name}, ");
}
writer.RemoveTrailingComma();
writer.Line($"));");
}
writer.Line();
}

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

@ -274,47 +274,28 @@ namespace AutoRest.CSharp.V3.Generation.Writers
{
writer.WriteParameterNullChecks(parameters);
var scopeVariable = new CodeWriterDeclaration("scope");
writer.Line($"using var {scopeVariable:D} = _clientDiagnostics.CreateScope({operation.Diagnostics.ScopeName:L});");
foreach (DiagnosticAttribute diagnosticScopeAttributes in operation.Diagnostics.Attributes)
var messageVariable = new CodeWriterDeclaration("message");
var requestMethodName = CreateRequestMethodName(operation.Name);
writer.Append($"using var {messageVariable:D} = {requestMethodName}(");
foreach (Parameter parameter in parameters)
{
writer.Append($"{scopeVariable}.AddAttribute({diagnosticScopeAttributes.Name:L},");
WriteConstantOrParameter(writer, diagnosticScopeAttributes.Value);
writer.Line($");");
}
writer.Line($"{scopeVariable}.Start();");
using (writer.Scope($"try"))
{
var messageVariable = new CodeWriterDeclaration("message");
var requestMethodName = CreateRequestMethodName(operation.Name);
writer.Append($"using var {messageVariable:D} = {requestMethodName}(");
foreach (Parameter parameter in parameters)
{
writer.Append($"{parameter.Name:I}, ");
}
writer.RemoveTrailingComma();
writer.Line($");");
if (async)
{
writer.Line($"await _pipeline.SendAsync({messageVariable}, cancellationToken).ConfigureAwait(false);");
}
else
{
writer.Line($"_pipeline.Send({messageVariable}, cancellationToken);");
}
WriteStatusCodeSwitch(writer, messageVariable, operation, async);
writer.Append($"{parameter.Name:I}, ");
}
using (writer.Scope($"catch ({typeof(Exception)} e)"))
writer.RemoveTrailingComma();
writer.Line($");");
if (async)
{
writer.Line($"{scopeVariable}.Failed(e);");
writer.Line($"throw;");
writer.Line($"await _pipeline.SendAsync({messageVariable}, cancellationToken).ConfigureAwait(false);");
}
else
{
writer.Line($"_pipeline.Send({messageVariable}, cancellationToken);");
}
WriteStatusCodeSwitch(writer, messageVariable, operation, async);
}
writer.Line();
}

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

@ -79,14 +79,14 @@ namespace AutoRest.CSharp.V3.Output.Builders
}
List<RestClientMethod> nextPageMethods = new List<RestClientMethod>();
List<PagingInfo> pagingMethods = new List<PagingInfo>();
List<PagingMethod> pagingMethods = new List<PagingMethod>();
List<LongRunningOperation> longRunningOperationMethods = new List<LongRunningOperation>();
List<ClientMethod> clientMethods = new List<ClientMethod>();
foreach ((Operation operation, RestClientMethod method) in operationMethods)
{
if (operation.IsLongRunning)
{
longRunningOperationMethods.Add(BuildLongRunningOperation(operation, method));
longRunningOperationMethods.Add(BuildLongRunningOperation(clientName, operation, method));
continue;
}
@ -125,17 +125,18 @@ namespace AutoRest.CSharp.V3.Output.Builders
throw new InvalidOperationException($"The return type of {method.Name} has to be an object schema to be used in paging");
}
PagingInfo pagingInfo = GetPagingInfo(method, nextPageMethod, paging, objectType);
pagingMethods.Add(pagingInfo);
PagingMethod pagingMethod = GetPagingMethod(clientName, method, nextPageMethod, paging, objectType);
pagingMethods.Add(pagingMethod);
continue;
}
var operationName = operation.CSharpName();
clientMethods.Add(new ClientMethod(
operation.CSharpName(),
operationName,
method,
BuilderHelpers.EscapeXmlDescription(operation.Language.Default.Description)
));
BuilderHelpers.EscapeXmlDescription(operation.Language.Default.Description),
new Diagnostic($"{clientName}.{operationName}", Array.Empty<DiagnosticAttribute>())));
}
RestClientMethod[] methods = operationMethods.Select(om => om.Method).Concat(nextPageMethods).ToArray();
@ -377,8 +378,7 @@ namespace AutoRest.CSharp.V3.Output.Builders
request,
OrderParameters(methodParameters.Values),
clientResponse.ToArray(),
responseHeaderModel,
new Diagnostic($"{clientName}.{operationName}", Array.Empty<DiagnosticAttribute>())
responseHeaderModel
);
}
@ -462,11 +462,10 @@ namespace AutoRest.CSharp.V3.Output.Builders
request,
parameters,
method.Responses,
method.HeaderModel,
method.Diagnostics);
method.HeaderModel);
}
private PagingInfo GetPagingInfo(RestClientMethod method, RestClientMethod? nextPageMethod, Paging paging, ObjectType type)
private PagingMethod GetPagingMethod(string clientName, RestClientMethod method, RestClientMethod? nextPageMethod, Paging paging, ObjectType type)
{
string? nextLinkName = paging.NextLinkName;
string itemName = paging.ItemName ?? "value";
@ -482,13 +481,20 @@ namespace AutoRest.CSharp.V3.Output.Builders
if (itemProperty.SchemaProperty?.Schema is ArraySchema arraySchema)
{
CSharpType itemType = _typeFactory.CreateType(arraySchema.ElementType, false);
return new PagingInfo(method, nextPageMethod, method.Name, nextLinkProperty?.Declaration.Name, itemProperty.Declaration.Name, itemType);
return new PagingMethod(
method,
nextPageMethod,
method.Name,
nextLinkProperty?.Declaration.Name,
itemProperty.Declaration.Name,
itemType,
new Diagnostic($"{clientName}.{method.Name}"));
}
throw new InvalidOperationException($"{itemName} property has to be an array schema, actual {itemProperty.SchemaProperty}");
}
private LongRunningOperation BuildLongRunningOperation(Operation operation, RestClientMethod startMethod)
private LongRunningOperation BuildLongRunningOperation(string clientName, Operation operation, RestClientMethod startMethod)
{
var originalResponseParameter = new Parameter(
"originalResponse",
@ -522,7 +528,8 @@ namespace AutoRest.CSharp.V3.Output.Builders
finalResponse.HttpResponse.IntStatusCodes),
name,
new[] { originalResponseParameter, httpMessageParameter },
finalStateVia);
finalStateVia,
new Diagnostic($"{clientName}.Start{name}"));
}
private Parameter BuildParameter(RequestParameter requestParameter)

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

@ -9,7 +9,7 @@ namespace AutoRest.CSharp.V3.Output.Models
{
internal class Client: ITypeProvider
{
public Client(TypeDeclarationOptions declaredType, string description, RestClient restClient, ClientMethod[] methods, PagingInfo[] pagingMethods, LongRunningOperation[] longRunningOperationMethods)
public Client(TypeDeclarationOptions declaredType, string description, RestClient restClient, ClientMethod[] methods, PagingMethod[] pagingMethods, LongRunningOperation[] longRunningOperationMethods)
{
DeclaredType = declaredType;
Description = description;
@ -23,7 +23,7 @@ namespace AutoRest.CSharp.V3.Output.Models
public string Description { get; }
public RestClient RestClient { get; }
public ClientMethod[] Methods { get; }
public PagingInfo[] PagingMethods { get; }
public PagingMethod[] PagingMethods { get; }
public LongRunningOperation[] LongRunningOperationMethods { get; }
public CSharpType Type => new CSharpType(this, DeclaredType.Namespace, DeclaredType.Name);
}

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

@ -7,15 +7,17 @@ namespace AutoRest.CSharp.V3.Output.Models
{
internal class ClientMethod
{
public ClientMethod(string name, RestClientMethod restClientMethod, string? description)
public ClientMethod(string name, RestClientMethod restClientMethod, string? description, Diagnostic diagnostics)
{
Name = name;
RestClientMethod = restClientMethod;
Description = description;
Diagnostics = diagnostics;
}
public string Name { get; }
public RestClientMethod RestClientMethod { get; }
public string? Description { get; }
public Diagnostic Diagnostics { get; }
}
}

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

@ -1,14 +1,16 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
namespace AutoRest.CSharp.V3.Output.Models.Requests
{
internal class Diagnostic
{
public Diagnostic(string scopeName, DiagnosticAttribute[] attributes)
public Diagnostic(string scopeName, DiagnosticAttribute[]? attributes = null)
{
ScopeName = scopeName;
Attributes = attributes;
Attributes = attributes ?? Array.Empty<DiagnosticAttribute>();
}
public string ScopeName { get; }

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

@ -9,13 +9,14 @@ namespace AutoRest.CSharp.V3.Output.Models.Requests
{
internal class LongRunningOperation
{
public LongRunningOperation(RestClientMethod originalMethod, Response originalResponse, string name, Parameter[] createParameters, OperationFinalStateVia finalStateVia)
public LongRunningOperation(RestClientMethod originalMethod, Response originalResponse, string name, Parameter[] createParameters, OperationFinalStateVia finalStateVia, Diagnostic diagnostics)
{
OriginalMethod = originalMethod;
OriginalResponse = originalResponse;
Name = name;
CreateParameters = createParameters;
FinalStateVia = finalStateVia;
Diagnostics = diagnostics;
}
public string Name { get; }
@ -23,5 +24,6 @@ namespace AutoRest.CSharp.V3.Output.Models.Requests
public Response OriginalResponse { get; }
public Parameter[] CreateParameters { get; }
public OperationFinalStateVia FinalStateVia { get; }
public Diagnostic Diagnostics { get; set; }
}
}

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

@ -6,9 +6,9 @@ using AutoRest.CSharp.V3.Generation.Types;
namespace AutoRest.CSharp.V3.Output.Models.Requests
{
internal class PagingInfo
internal class PagingMethod
{
public PagingInfo(RestClientMethod method, RestClientMethod? nextPageMethod, string name, string? nextLinkName, string itemName, CSharpType itemType)
public PagingMethod(RestClientMethod method, RestClientMethod? nextPageMethod, string name, string? nextLinkName, string itemName, CSharpType itemType, Diagnostic diagnostics)
{
Method = method;
NextPageMethod = nextPageMethod;
@ -16,6 +16,7 @@ namespace AutoRest.CSharp.V3.Output.Models.Requests
NextLinkName = nextLinkName;
ItemName = itemName;
ItemType = itemType;
Diagnostics = diagnostics;
}
public string Name { get; }
@ -24,5 +25,6 @@ namespace AutoRest.CSharp.V3.Output.Models.Requests
public string? NextLinkName { get; }
public string ItemName { get; }
public CSharpType ItemType { get; }
public Diagnostic Diagnostics { get; set; }
}
}

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

@ -9,14 +9,13 @@ namespace AutoRest.CSharp.V3.Output.Models.Requests
{
internal class RestClientMethod
{
public RestClientMethod(string name, string? description, CSharpType? returnType, Request request, Parameter[] parameters, Response[] responseType, ResponseHeaderGroupType? headerModel, Diagnostic diagnostics)
public RestClientMethod(string name, string? description, CSharpType? returnType, Request request, Parameter[] parameters, Response[] responseType, ResponseHeaderGroupType? headerModel)
{
Name = name;
Request = request;
Parameters = parameters;
Responses = responseType;
Description = description;
Diagnostics = diagnostics;
ReturnType = returnType;
HeaderModel = headerModel;
}
@ -27,7 +26,6 @@ namespace AutoRest.CSharp.V3.Output.Models.Requests
public Parameter[] Parameters { get; }
public Response[] Responses { get; }
public ResponseHeaderGroupType? HeaderModel { get; }
public Diagnostic Diagnostics { get; }
public CSharpType? ReturnType { get; }
}
}

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

@ -8,13 +8,7 @@ using System.Text;
namespace Azure.Core.Pipeline
{
#if !TESTFRAMEWORK
internal static class ContentTypeUtilities
#else
#pragma warning disable SA1649 // File name should match first type name
internal static class TestFrameworkContentTypeUtilities
#pragma warning restore SA1649 // File name should match first type name
#endif
{
public static bool TryGetTextEncoding(string contentType, out Encoding encoding)
{

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using AdditionalPropertiesEx.Models;
@ -36,7 +37,17 @@ namespace AdditionalPropertiesEx
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> WriteOnlyAsync(InputAdditionalPropertiesModel createParameters, CancellationToken cancellationToken = default)
{
return await RestClient.WriteOnlyAsync(createParameters, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("APClient.WriteOnly");
scope.Start();
try
{
return await RestClient.WriteOnlyAsync(createParameters, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create a Pet which contains more properties than what is defined. </summary>
@ -44,21 +55,51 @@ namespace AdditionalPropertiesEx
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response WriteOnly(InputAdditionalPropertiesModel createParameters, CancellationToken cancellationToken = default)
{
return RestClient.WriteOnly(createParameters, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("APClient.WriteOnly");
scope.Start();
try
{
return RestClient.WriteOnly(createParameters, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create a Pet which contains more properties than what is defined. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<OutputAdditionalPropertiesModel>> ReadOnlyAsync(CancellationToken cancellationToken = default)
{
return await RestClient.ReadOnlyAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("APClient.ReadOnly");
scope.Start();
try
{
return await RestClient.ReadOnlyAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create a Pet which contains more properties than what is defined. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<OutputAdditionalPropertiesModel> ReadOnly(CancellationToken cancellationToken = default)
{
return RestClient.ReadOnly(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("APClient.ReadOnly");
scope.Start();
try
{
return RestClient.ReadOnly(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create a Pet which contains more properties than what is defined. </summary>
@ -66,7 +107,17 @@ namespace AdditionalPropertiesEx
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> WriteOnlyStructAsync(InputAdditionalPropertiesModelStruct createParameters, CancellationToken cancellationToken = default)
{
return await RestClient.WriteOnlyStructAsync(createParameters, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("APClient.WriteOnlyStruct");
scope.Start();
try
{
return await RestClient.WriteOnlyStructAsync(createParameters, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create a Pet which contains more properties than what is defined. </summary>
@ -74,21 +125,51 @@ namespace AdditionalPropertiesEx
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response WriteOnlyStruct(InputAdditionalPropertiesModelStruct createParameters, CancellationToken cancellationToken = default)
{
return RestClient.WriteOnlyStruct(createParameters, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("APClient.WriteOnlyStruct");
scope.Start();
try
{
return RestClient.WriteOnlyStruct(createParameters, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create a Pet which contains more properties than what is defined. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<OutputAdditionalPropertiesModelStruct>> ReadOnlyStructAsync(CancellationToken cancellationToken = default)
{
return await RestClient.ReadOnlyStructAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("APClient.ReadOnlyStruct");
scope.Start();
try
{
return await RestClient.ReadOnlyStructAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create a Pet which contains more properties than what is defined. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<OutputAdditionalPropertiesModelStruct> ReadOnlyStruct(CancellationToken cancellationToken = default)
{
return RestClient.ReadOnlyStruct(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("APClient.ReadOnlyStruct");
scope.Start();
try
{
return RestClient.ReadOnlyStruct(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -61,24 +61,14 @@ namespace AdditionalPropertiesEx
throw new ArgumentNullException(nameof(createParameters));
}
using var scope = _clientDiagnostics.CreateScope("APClient.WriteOnly");
scope.Start();
try
using var message = CreateWriteOnlyRequest(createParameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateWriteOnlyRequest(createParameters);
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);
}
}
@ -92,24 +82,14 @@ namespace AdditionalPropertiesEx
throw new ArgumentNullException(nameof(createParameters));
}
using var scope = _clientDiagnostics.CreateScope("APClient.WriteOnly");
scope.Start();
try
using var message = CreateWriteOnlyRequest(createParameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateWriteOnlyRequest(createParameters);
_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);
}
}
@ -129,36 +109,26 @@ namespace AdditionalPropertiesEx
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response<OutputAdditionalPropertiesModel>> ReadOnlyAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("APClient.ReadOnly");
scope.Start();
try
using var message = CreateReadOnlyRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateReadOnlyRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
OutputAdditionalPropertiesModel value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
OutputAdditionalPropertiesModel 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 = OutputAdditionalPropertiesModel.DeserializeOutputAdditionalPropertiesModel(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 = OutputAdditionalPropertiesModel.DeserializeOutputAdditionalPropertiesModel(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -166,36 +136,26 @@ namespace AdditionalPropertiesEx
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response<OutputAdditionalPropertiesModel> ReadOnly(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("APClient.ReadOnly");
scope.Start();
try
using var message = CreateReadOnlyRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateReadOnlyRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
OutputAdditionalPropertiesModel value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
OutputAdditionalPropertiesModel value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = OutputAdditionalPropertiesModel.DeserializeOutputAdditionalPropertiesModel(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 = OutputAdditionalPropertiesModel.DeserializeOutputAdditionalPropertiesModel(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -220,24 +180,14 @@ namespace AdditionalPropertiesEx
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> WriteOnlyStructAsync(InputAdditionalPropertiesModelStruct createParameters, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("APClient.WriteOnlyStruct");
scope.Start();
try
using var message = CreateWriteOnlyStructRequest(createParameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateWriteOnlyStructRequest(createParameters);
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);
}
}
@ -246,24 +196,14 @@ namespace AdditionalPropertiesEx
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response WriteOnlyStruct(InputAdditionalPropertiesModelStruct createParameters, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("APClient.WriteOnlyStruct");
scope.Start();
try
using var message = CreateWriteOnlyStructRequest(createParameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateWriteOnlyStructRequest(createParameters);
_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);
}
}
@ -283,29 +223,19 @@ namespace AdditionalPropertiesEx
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response<OutputAdditionalPropertiesModelStruct>> ReadOnlyStructAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("APClient.ReadOnlyStruct");
scope.Start();
try
using var message = CreateReadOnlyStructRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateReadOnlyStructRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
{
OutputAdditionalPropertiesModelStruct value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = OutputAdditionalPropertiesModelStruct.DeserializeOutputAdditionalPropertiesModelStruct(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 200:
{
OutputAdditionalPropertiesModelStruct value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = OutputAdditionalPropertiesModelStruct.DeserializeOutputAdditionalPropertiesModelStruct(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -313,29 +243,19 @@ namespace AdditionalPropertiesEx
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response<OutputAdditionalPropertiesModelStruct> ReadOnlyStruct(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("APClient.ReadOnlyStruct");
scope.Start();
try
using var message = CreateReadOnlyStructRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateReadOnlyStructRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
{
OutputAdditionalPropertiesModelStruct value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = OutputAdditionalPropertiesModelStruct.DeserializeOutputAdditionalPropertiesModelStruct(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 200:
{
OutputAdditionalPropertiesModelStruct value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = OutputAdditionalPropertiesModelStruct.DeserializeOutputAdditionalPropertiesModelStruct(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -37,7 +38,17 @@ namespace ExtensionClientName
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<RenamedSchema>> RenamedOperationAsync(string renamedPathParameter, string renamedQueryParameter, RenamedSchema renamedBodyParameter, CancellationToken cancellationToken = default)
{
return await RestClient.RenamedOperationAsync(renamedPathParameter, renamedQueryParameter, renamedBodyParameter, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.RenamedOperation");
scope.Start();
try
{
return await RestClient.RenamedOperationAsync(renamedPathParameter, renamedQueryParameter, renamedBodyParameter, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <param name="renamedPathParameter"> The String to use. </param>
@ -46,7 +57,17 @@ namespace ExtensionClientName
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<RenamedSchema> RenamedOperation(string renamedPathParameter, string renamedQueryParameter, RenamedSchema renamedBodyParameter, CancellationToken cancellationToken = default)
{
return RestClient.RenamedOperation(renamedPathParameter, renamedQueryParameter, renamedBodyParameter, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.RenamedOperation");
scope.Start();
try
{
return RestClient.RenamedOperation(renamedPathParameter, renamedQueryParameter, renamedBodyParameter, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -71,37 +71,27 @@ namespace ExtensionClientName
throw new ArgumentNullException(nameof(renamedBodyParameter));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.RenamedOperation");
scope.Start();
try
using var message = CreateRenamedOperationRequest(renamedPathParameter, renamedQueryParameter, renamedBodyParameter);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new ServiceRenamedOperationHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateRenamedOperationRequest(renamedPathParameter, renamedQueryParameter, renamedBodyParameter);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new ServiceRenamedOperationHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
case 200:
{
RenamedSchema value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
RenamedSchema 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 = RenamedSchema.DeserializeRenamedSchema(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 = RenamedSchema.DeserializeRenamedSchema(document.RootElement);
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -124,37 +114,27 @@ namespace ExtensionClientName
throw new ArgumentNullException(nameof(renamedBodyParameter));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.RenamedOperation");
scope.Start();
try
using var message = CreateRenamedOperationRequest(renamedPathParameter, renamedQueryParameter, renamedBodyParameter);
_pipeline.Send(message, cancellationToken);
var headers = new ServiceRenamedOperationHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateRenamedOperationRequest(renamedPathParameter, renamedQueryParameter, renamedBodyParameter);
_pipeline.Send(message, cancellationToken);
var headers = new ServiceRenamedOperationHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
case 200:
{
RenamedSchema value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
RenamedSchema value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = RenamedSchema.DeserializeRenamedSchema(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 = RenamedSchema.DeserializeRenamedSchema(document.RootElement);
}
return ResponseWithHeaders.FromValue(value, headers, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -35,40 +36,100 @@ namespace ModelShapes
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> InputAsync(InputModel value, CancellationToken cancellationToken = default)
{
return await RestClient.InputAsync(value, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Input");
scope.Start();
try
{
return await RestClient.InputAsync(value, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <param name="value"> The InputModel to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response Input(InputModel value, CancellationToken cancellationToken = default)
{
return RestClient.Input(value, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Input");
scope.Start();
try
{
return RestClient.Input(value, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <param name="value"> The MixedModel to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<MixedModel>> MixedAsync(MixedModel value, CancellationToken cancellationToken = default)
{
return await RestClient.MixedAsync(value, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Mixed");
scope.Start();
try
{
return await RestClient.MixedAsync(value, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <param name="value"> The MixedModel to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<MixedModel> Mixed(MixedModel value, CancellationToken cancellationToken = default)
{
return RestClient.Mixed(value, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Mixed");
scope.Start();
try
{
return RestClient.Mixed(value, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<OutputModel>> OutputAsync(CancellationToken cancellationToken = default)
{
return await RestClient.OutputAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Output");
scope.Start();
try
{
return await RestClient.OutputAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<OutputModel> Output(CancellationToken cancellationToken = default)
{
return RestClient.Output(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Output");
scope.Start();
try
{
return RestClient.Output(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -60,24 +60,14 @@ namespace ModelShapes
throw new ArgumentNullException(nameof(value));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Input");
scope.Start();
try
using var message = CreateInputRequest(value);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateInputRequest(value);
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);
}
}
@ -90,24 +80,14 @@ namespace ModelShapes
throw new ArgumentNullException(nameof(value));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Input");
scope.Start();
try
using var message = CreateInputRequest(value);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateInputRequest(value);
_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);
}
}
@ -136,36 +116,26 @@ namespace ModelShapes
throw new ArgumentNullException(nameof(value));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Mixed");
scope.Start();
try
using var message = CreateMixedRequest(value);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateMixedRequest(value);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
MixedModel value0 = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
MixedModel value0 = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value0 = null;
}
else
{
value0 = MixedModel.DeserializeMixedModel(document.RootElement);
}
return Response.FromValue(value0, message.Response);
value0 = null;
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
else
{
value0 = MixedModel.DeserializeMixedModel(document.RootElement);
}
return Response.FromValue(value0, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -178,36 +148,26 @@ namespace ModelShapes
throw new ArgumentNullException(nameof(value));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Mixed");
scope.Start();
try
using var message = CreateMixedRequest(value);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateMixedRequest(value);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
MixedModel value0 = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
MixedModel value0 = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value0 = null;
}
else
{
value0 = MixedModel.DeserializeMixedModel(document.RootElement);
}
return Response.FromValue(value0, message.Response);
value0 = null;
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
else
{
value0 = MixedModel.DeserializeMixedModel(document.RootElement);
}
return Response.FromValue(value0, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -226,72 +186,52 @@ namespace ModelShapes
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response<OutputModel>> OutputAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Output");
scope.Start();
try
using var message = CreateOutputRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateOutputRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
OutputModel value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
OutputModel 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 = OutputModel.DeserializeOutputModel(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 = OutputModel.DeserializeOutputModel(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response<OutputModel> Output(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Output");
scope.Start();
try
using var message = CreateOutputRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateOutputRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
OutputModel value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
OutputModel value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = OutputModel.DeserializeOutputModel(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 = OutputModel.DeserializeOutputModel(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -44,7 +44,17 @@ namespace NameConflicts
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<Struct>> OperationAsync(string request, string message, string scope, string uri, string pipeline, string clientDiagnostics, Class @class, CancellationToken cancellationToken = default)
{
return await RestClient.OperationAsync(request, message, scope, uri, pipeline, clientDiagnostics, @class, cancellationToken).ConfigureAwait(false);
using var scope0 = _clientDiagnostics.CreateScope("ServiceClient.Operation");
scope0.Start();
try
{
return await RestClient.OperationAsync(request, message, scope, uri, pipeline, clientDiagnostics, @class, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope0.Failed(e);
throw;
}
}
/// <param name="request"> The String to use. </param>
@ -57,7 +67,17 @@ namespace NameConflicts
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<Struct> Operation(string request, string message, string scope, string uri, string pipeline, string clientDiagnostics, Class @class, CancellationToken cancellationToken = default)
{
return RestClient.Operation(request, message, scope, uri, pipeline, clientDiagnostics, @class, cancellationToken);
using var scope0 = _clientDiagnostics.CreateScope("ServiceClient.Operation");
scope0.Start();
try
{
return RestClient.Operation(request, message, scope, uri, pipeline, clientDiagnostics, @class, cancellationToken);
}
catch (Exception e)
{
scope0.Failed(e);
throw;
}
}
/// <summary> Analyze body, that could be different media types. </summary>
@ -74,7 +94,7 @@ namespace NameConflicts
throw new ArgumentNullException(nameof(createOriginalHttpMessage));
}
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Post, "ServiceClient.AnalyzeBody", OperationFinalStateVia.Location, createOriginalHttpMessage);
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Post, "ServiceClient.StartAnalyzeBody", OperationFinalStateVia.Location, createOriginalHttpMessage);
}
/// <summary> Analyze body, that could be different media types. </summary>
@ -87,8 +107,18 @@ namespace NameConflicts
throw new ArgumentNullException(nameof(stringBody));
}
var originalResponse = await RestClient.AnalyzeBodyAsync(stringBody, cancellationToken).ConfigureAwait(false);
return CreateAnalyzeBody(originalResponse, () => RestClient.CreateAnalyzeBodyRequest(stringBody));
using var scope0 = _clientDiagnostics.CreateScope("ServiceClient.StartAnalyzeBody");
scope0.Start();
try
{
var originalResponse = await RestClient.AnalyzeBodyAsync(stringBody, cancellationToken).ConfigureAwait(false);
return CreateAnalyzeBody(originalResponse, () => RestClient.CreateAnalyzeBodyRequest(stringBody));
}
catch (Exception e)
{
scope0.Failed(e);
throw;
}
}
/// <summary> Analyze body, that could be different media types. </summary>
@ -101,8 +131,18 @@ namespace NameConflicts
throw new ArgumentNullException(nameof(stringBody));
}
var originalResponse = RestClient.AnalyzeBody(stringBody, cancellationToken);
return CreateAnalyzeBody(originalResponse, () => RestClient.CreateAnalyzeBodyRequest(stringBody));
using var scope0 = _clientDiagnostics.CreateScope("ServiceClient.StartAnalyzeBody");
scope0.Start();
try
{
var originalResponse = RestClient.AnalyzeBody(stringBody, cancellationToken);
return CreateAnalyzeBody(originalResponse, () => RestClient.CreateAnalyzeBodyRequest(stringBody));
}
catch (Exception e)
{
scope0.Failed(e);
throw;
}
}
/// <summary> Analyze body, that could be different media types. </summary>
@ -110,8 +150,18 @@ namespace NameConflicts
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async ValueTask<Operation<Response>> StartAnalyzeBodyAsync(string stringBody = null, CancellationToken cancellationToken = default)
{
var originalResponse = await RestClient.AnalyzeBodyAsync(stringBody, cancellationToken).ConfigureAwait(false);
return CreateAnalyzeBody(originalResponse, () => RestClient.CreateAnalyzeBodyRequest(stringBody));
using var scope0 = _clientDiagnostics.CreateScope("ServiceClient.StartAnalyzeBody");
scope0.Start();
try
{
var originalResponse = await RestClient.AnalyzeBodyAsync(stringBody, cancellationToken).ConfigureAwait(false);
return CreateAnalyzeBody(originalResponse, () => RestClient.CreateAnalyzeBodyRequest(stringBody));
}
catch (Exception e)
{
scope0.Failed(e);
throw;
}
}
/// <summary> Analyze body, that could be different media types. </summary>
@ -119,8 +169,18 @@ namespace NameConflicts
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Operation<Response> StartAnalyzeBody(string stringBody = null, CancellationToken cancellationToken = default)
{
var originalResponse = RestClient.AnalyzeBody(stringBody, cancellationToken);
return CreateAnalyzeBody(originalResponse, () => RestClient.CreateAnalyzeBodyRequest(stringBody));
using var scope0 = _clientDiagnostics.CreateScope("ServiceClient.StartAnalyzeBody");
scope0.Start();
try
{
var originalResponse = RestClient.AnalyzeBody(stringBody, cancellationToken);
return CreateAnalyzeBody(originalResponse, () => RestClient.CreateAnalyzeBodyRequest(stringBody));
}
catch (Exception e)
{
scope0.Failed(e);
throw;
}
}
}
}

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

@ -97,36 +97,26 @@ namespace NameConflicts
throw new ArgumentNullException(nameof(@class));
}
using var scope0 = _clientDiagnostics.CreateScope("ServiceClient.Operation");
scope0.Start();
try
using var message0 = CreateOperationRequest(request, message, scope, uri, pipeline, clientDiagnostics, @class);
await _pipeline.SendAsync(message0, cancellationToken).ConfigureAwait(false);
switch (message0.Response.Status)
{
using var message0 = CreateOperationRequest(request, message, scope, uri, pipeline, clientDiagnostics, @class);
await _pipeline.SendAsync(message0, cancellationToken).ConfigureAwait(false);
switch (message0.Response.Status)
{
case 200:
case 200:
{
Struct value = default;
using var document = await JsonDocument.ParseAsync(message0.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
Struct value = default;
using var document = await JsonDocument.ParseAsync(message0.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = Struct.DeserializeStruct(document.RootElement);
}
return Response.FromValue(value, message0.Response);
value = null;
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message0.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope0.Failed(e);
throw;
else
{
value = Struct.DeserializeStruct(document.RootElement);
}
return Response.FromValue(value, message0.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message0.Response).ConfigureAwait(false);
}
}
@ -169,36 +159,26 @@ namespace NameConflicts
throw new ArgumentNullException(nameof(@class));
}
using var scope0 = _clientDiagnostics.CreateScope("ServiceClient.Operation");
scope0.Start();
try
using var message0 = CreateOperationRequest(request, message, scope, uri, pipeline, clientDiagnostics, @class);
_pipeline.Send(message0, cancellationToken);
switch (message0.Response.Status)
{
using var message0 = CreateOperationRequest(request, message, scope, uri, pipeline, clientDiagnostics, @class);
_pipeline.Send(message0, cancellationToken);
switch (message0.Response.Status)
{
case 200:
case 200:
{
Struct value = default;
using var document = JsonDocument.Parse(message0.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
Struct value = default;
using var document = JsonDocument.Parse(message0.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = Struct.DeserializeStruct(document.RootElement);
}
return Response.FromValue(value, message0.Response);
value = null;
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message0.Response);
}
}
catch (Exception e)
{
scope0.Failed(e);
throw;
else
{
value = Struct.DeserializeStruct(document.RootElement);
}
return Response.FromValue(value, message0.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message0.Response);
}
}
@ -226,24 +206,14 @@ namespace NameConflicts
throw new ArgumentNullException(nameof(stringBody));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.AnalyzeBody");
scope.Start();
try
using var message = CreateAnalyzeBodyRequest(stringBody);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateAnalyzeBodyRequest(stringBody);
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);
}
}
@ -257,24 +227,14 @@ namespace NameConflicts
throw new ArgumentNullException(nameof(stringBody));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.AnalyzeBody");
scope.Start();
try
using var message = CreateAnalyzeBodyRequest(stringBody);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateAnalyzeBodyRequest(stringBody);
_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);
}
}
@ -302,24 +262,14 @@ namespace NameConflicts
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> AnalyzeBodyAsync(string stringBody = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ServiceClient.AnalyzeBody");
scope.Start();
try
using var message = CreateAnalyzeBodyRequest(stringBody);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateAnalyzeBodyRequest(stringBody);
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);
}
}
@ -328,24 +278,14 @@ namespace NameConflicts
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response AnalyzeBody(string stringBody = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ServiceClient.AnalyzeBody");
scope.Start();
try
using var message = CreateAnalyzeBodyRequest(stringBody);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateAnalyzeBodyRequest(stringBody);
_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);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -35,28 +36,68 @@ namespace SerializationCustomization
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<AlwaysInitializeTestModel>> Operation1Async(AlwaysInitializeTestModel model, CancellationToken cancellationToken = default)
{
return await RestClient.Operation1Async(model, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Operation1");
scope.Start();
try
{
return await RestClient.Operation1Async(model, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <param name="model"> The AlwaysInitializeTestModel to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<AlwaysInitializeTestModel> Operation1(AlwaysInitializeTestModel model, CancellationToken cancellationToken = default)
{
return RestClient.Operation1(model, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Operation1");
scope.Start();
try
{
return RestClient.Operation1(model, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <param name="model"> The EmptyAsUndefinedTestModel to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<EmptyAsUndefinedTestModel>> Operation2Async(EmptyAsUndefinedTestModel model, CancellationToken cancellationToken = default)
{
return await RestClient.Operation2Async(model, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Operation2");
scope.Start();
try
{
return await RestClient.Operation2Async(model, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <param name="model"> The EmptyAsUndefinedTestModel to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<EmptyAsUndefinedTestModel> Operation2(EmptyAsUndefinedTestModel model, CancellationToken cancellationToken = default)
{
return RestClient.Operation2(model, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Operation2");
scope.Start();
try
{
return RestClient.Operation2(model, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -60,36 +60,26 @@ namespace SerializationCustomization
throw new ArgumentNullException(nameof(model));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Operation1");
scope.Start();
try
using var message = CreateOperation1Request(model);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateOperation1Request(model);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
AlwaysInitializeTestModel value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
AlwaysInitializeTestModel 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 = AlwaysInitializeTestModel.DeserializeAlwaysInitializeTestModel(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 = AlwaysInitializeTestModel.DeserializeAlwaysInitializeTestModel(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -102,36 +92,26 @@ namespace SerializationCustomization
throw new ArgumentNullException(nameof(model));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Operation1");
scope.Start();
try
using var message = CreateOperation1Request(model);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateOperation1Request(model);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
AlwaysInitializeTestModel value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
AlwaysInitializeTestModel value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = AlwaysInitializeTestModel.DeserializeAlwaysInitializeTestModel(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 = AlwaysInitializeTestModel.DeserializeAlwaysInitializeTestModel(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -160,36 +140,26 @@ namespace SerializationCustomization
throw new ArgumentNullException(nameof(model));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Operation2");
scope.Start();
try
using var message = CreateOperation2Request(model);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateOperation2Request(model);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
EmptyAsUndefinedTestModel value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
EmptyAsUndefinedTestModel 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 = EmptyAsUndefinedTestModel.DeserializeEmptyAsUndefinedTestModel(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 = EmptyAsUndefinedTestModel.DeserializeEmptyAsUndefinedTestModel(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -202,36 +172,26 @@ namespace SerializationCustomization
throw new ArgumentNullException(nameof(model));
}
using var scope = _clientDiagnostics.CreateScope("ServiceClient.Operation2");
scope.Start();
try
using var message = CreateOperation2Request(model);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateOperation2Request(model);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
EmptyAsUndefinedTestModel value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
EmptyAsUndefinedTestModel value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = EmptyAsUndefinedTestModel.DeserializeEmptyAsUndefinedTestModel(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 = EmptyAsUndefinedTestModel.DeserializeEmptyAsUndefinedTestModel(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -36,42 +37,102 @@ namespace CustomNamespace
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<CustomizedModel>> OperationAsync(CustomizedModel body = null, CancellationToken cancellationToken = default)
{
return await RestClient.OperationAsync(body, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("MainClient.Operation");
scope.Start();
try
{
return await RestClient.OperationAsync(body, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <param name="body"> The Model to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<CustomizedModel> Operation(CustomizedModel body = null, CancellationToken cancellationToken = default)
{
return RestClient.Operation(body, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("MainClient.Operation");
scope.Start();
try
{
return RestClient.Operation(body, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <param name="body"> The ModelStruct to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<RenamedModelStruct>> OperationStructAsync(RenamedModelStruct? body = null, CancellationToken cancellationToken = default)
{
return await RestClient.OperationStructAsync(body, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("MainClient.OperationStruct");
scope.Start();
try
{
return await RestClient.OperationStructAsync(body, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <param name="body"> The ModelStruct to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<RenamedModelStruct> OperationStruct(RenamedModelStruct? body = null, CancellationToken cancellationToken = default)
{
return RestClient.OperationStruct(body, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("MainClient.OperationStruct");
scope.Start();
try
{
return RestClient.OperationStruct(body, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <param name="body"> The SecondModel to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<SecondModel>> OperationSecondModelAsync(SecondModel body = null, CancellationToken cancellationToken = default)
{
return await RestClient.OperationSecondModelAsync(body, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("MainClient.OperationSecondModel");
scope.Start();
try
{
return await RestClient.OperationSecondModelAsync(body, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <param name="body"> The SecondModel to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<SecondModel> OperationSecondModel(SecondModel body = null, CancellationToken cancellationToken = default)
{
return RestClient.OperationSecondModel(body, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("MainClient.OperationSecondModel");
scope.Start();
try
{
return RestClient.OperationSecondModel(body, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -59,36 +59,26 @@ namespace TypeSchemaMapping
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response<CustomizedModel>> OperationAsync(CustomizedModel body = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("MainClient.Operation");
scope.Start();
try
using var message = CreateOperationRequest(body);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateOperationRequest(body);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
CustomizedModel value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
CustomizedModel 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 = CustomizedModel.DeserializeCustomizedModel(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 = CustomizedModel.DeserializeCustomizedModel(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -96,36 +86,26 @@ namespace TypeSchemaMapping
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response<CustomizedModel> Operation(CustomizedModel body = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("MainClient.Operation");
scope.Start();
try
using var message = CreateOperationRequest(body);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateOperationRequest(body);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
CustomizedModel value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
CustomizedModel value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = CustomizedModel.DeserializeCustomizedModel(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 = CustomizedModel.DeserializeCustomizedModel(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -152,29 +132,19 @@ namespace TypeSchemaMapping
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response<RenamedModelStruct>> OperationStructAsync(RenamedModelStruct? body = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("MainClient.OperationStruct");
scope.Start();
try
using var message = CreateOperationStructRequest(body);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateOperationStructRequest(body);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
{
RenamedModelStruct value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = RenamedModelStruct.DeserializeRenamedModelStruct(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 200:
{
RenamedModelStruct value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = RenamedModelStruct.DeserializeRenamedModelStruct(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -182,29 +152,19 @@ namespace TypeSchemaMapping
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response<RenamedModelStruct> OperationStruct(RenamedModelStruct? body = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("MainClient.OperationStruct");
scope.Start();
try
using var message = CreateOperationStructRequest(body);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateOperationStructRequest(body);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
{
RenamedModelStruct value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = RenamedModelStruct.DeserializeRenamedModelStruct(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 200:
{
RenamedModelStruct value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = RenamedModelStruct.DeserializeRenamedModelStruct(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -231,36 +191,26 @@ namespace TypeSchemaMapping
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response<SecondModel>> OperationSecondModelAsync(SecondModel body = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("MainClient.OperationSecondModel");
scope.Start();
try
using var message = CreateOperationSecondModelRequest(body);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateOperationSecondModelRequest(body);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
SecondModel value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
SecondModel 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 = SecondModel.DeserializeSecondModel(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 = SecondModel.DeserializeSecondModel(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -268,36 +218,26 @@ namespace TypeSchemaMapping
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response<SecondModel> OperationSecondModel(SecondModel body = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("MainClient.OperationSecondModel");
scope.Start();
try
using var message = CreateOperationSecondModelRequest(body);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateOperationSecondModelRequest(body);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
SecondModel value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
SecondModel value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = SecondModel.DeserializeSecondModel(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 = SecondModel.DeserializeSecondModel(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using additionalProperties.Models;
@ -36,7 +37,17 @@ namespace additionalProperties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<PetAPTrue>> CreateAPTrueAsync(PetAPTrue createParameters, CancellationToken cancellationToken = default)
{
return await RestClient.CreateAPTrueAsync(createParameters, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPTrue");
scope.Start();
try
{
return await RestClient.CreateAPTrueAsync(createParameters, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create a Pet which contains more properties than what is defined. </summary>
@ -44,7 +55,17 @@ namespace additionalProperties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<PetAPTrue> CreateAPTrue(PetAPTrue createParameters, CancellationToken cancellationToken = default)
{
return RestClient.CreateAPTrue(createParameters, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPTrue");
scope.Start();
try
{
return RestClient.CreateAPTrue(createParameters, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create a CatAPTrue which contains more properties than what is defined. </summary>
@ -52,7 +73,17 @@ namespace additionalProperties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<CatAPTrue>> CreateCatAPTrueAsync(CatAPTrue createParameters, CancellationToken cancellationToken = default)
{
return await RestClient.CreateCatAPTrueAsync(createParameters, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateCatAPTrue");
scope.Start();
try
{
return await RestClient.CreateCatAPTrueAsync(createParameters, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create a CatAPTrue which contains more properties than what is defined. </summary>
@ -60,7 +91,17 @@ namespace additionalProperties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<CatAPTrue> CreateCatAPTrue(CatAPTrue createParameters, CancellationToken cancellationToken = default)
{
return RestClient.CreateCatAPTrue(createParameters, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateCatAPTrue");
scope.Start();
try
{
return RestClient.CreateCatAPTrue(createParameters, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create a Pet which contains more properties than what is defined. </summary>
@ -68,7 +109,17 @@ namespace additionalProperties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<PetAPObject>> CreateAPObjectAsync(PetAPObject createParameters, CancellationToken cancellationToken = default)
{
return await RestClient.CreateAPObjectAsync(createParameters, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPObject");
scope.Start();
try
{
return await RestClient.CreateAPObjectAsync(createParameters, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create a Pet which contains more properties than what is defined. </summary>
@ -76,7 +127,17 @@ namespace additionalProperties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<PetAPObject> CreateAPObject(PetAPObject createParameters, CancellationToken cancellationToken = default)
{
return RestClient.CreateAPObject(createParameters, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPObject");
scope.Start();
try
{
return RestClient.CreateAPObject(createParameters, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create a Pet which contains more properties than what is defined. </summary>
@ -84,7 +145,17 @@ namespace additionalProperties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<PetAPString>> CreateAPStringAsync(PetAPString createParameters, CancellationToken cancellationToken = default)
{
return await RestClient.CreateAPStringAsync(createParameters, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPString");
scope.Start();
try
{
return await RestClient.CreateAPStringAsync(createParameters, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create a Pet which contains more properties than what is defined. </summary>
@ -92,7 +163,17 @@ namespace additionalProperties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<PetAPString> CreateAPString(PetAPString createParameters, CancellationToken cancellationToken = default)
{
return RestClient.CreateAPString(createParameters, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPString");
scope.Start();
try
{
return RestClient.CreateAPString(createParameters, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create a Pet which contains more properties than what is defined. </summary>
@ -100,7 +181,17 @@ namespace additionalProperties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<PetAPInProperties>> CreateAPInPropertiesAsync(PetAPInProperties createParameters, CancellationToken cancellationToken = default)
{
return await RestClient.CreateAPInPropertiesAsync(createParameters, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPInProperties");
scope.Start();
try
{
return await RestClient.CreateAPInPropertiesAsync(createParameters, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create a Pet which contains more properties than what is defined. </summary>
@ -108,7 +199,17 @@ namespace additionalProperties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<PetAPInProperties> CreateAPInProperties(PetAPInProperties createParameters, CancellationToken cancellationToken = default)
{
return RestClient.CreateAPInProperties(createParameters, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPInProperties");
scope.Start();
try
{
return RestClient.CreateAPInProperties(createParameters, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create a Pet which contains more properties than what is defined. </summary>
@ -116,7 +217,17 @@ namespace additionalProperties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<PetAPInPropertiesWithAPString>> CreateAPInPropertiesWithAPStringAsync(PetAPInPropertiesWithAPString createParameters, CancellationToken cancellationToken = default)
{
return await RestClient.CreateAPInPropertiesWithAPStringAsync(createParameters, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPInPropertiesWithAPString");
scope.Start();
try
{
return await RestClient.CreateAPInPropertiesWithAPStringAsync(createParameters, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create a Pet which contains more properties than what is defined. </summary>
@ -124,7 +235,17 @@ namespace additionalProperties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<PetAPInPropertiesWithAPString> CreateAPInPropertiesWithAPString(PetAPInPropertiesWithAPString createParameters, CancellationToken cancellationToken = default)
{
return RestClient.CreateAPInPropertiesWithAPString(createParameters, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPInPropertiesWithAPString");
scope.Start();
try
{
return RestClient.CreateAPInPropertiesWithAPString(createParameters, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -61,36 +61,26 @@ namespace additionalProperties
throw new ArgumentNullException(nameof(createParameters));
}
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPTrue");
scope.Start();
try
using var message = CreateCreateAPTrueRequest(createParameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateAPTrueRequest(createParameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
PetAPTrue value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
PetAPTrue 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 = PetAPTrue.DeserializePetAPTrue(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 = PetAPTrue.DeserializePetAPTrue(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -104,36 +94,26 @@ namespace additionalProperties
throw new ArgumentNullException(nameof(createParameters));
}
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPTrue");
scope.Start();
try
using var message = CreateCreateAPTrueRequest(createParameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateAPTrueRequest(createParameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
PetAPTrue value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
PetAPTrue value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = PetAPTrue.DeserializePetAPTrue(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 = PetAPTrue.DeserializePetAPTrue(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -163,36 +143,26 @@ namespace additionalProperties
throw new ArgumentNullException(nameof(createParameters));
}
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateCatAPTrue");
scope.Start();
try
using var message = CreateCreateCatAPTrueRequest(createParameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateCatAPTrueRequest(createParameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
CatAPTrue value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
CatAPTrue 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 = CatAPTrue.DeserializeCatAPTrue(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 = CatAPTrue.DeserializeCatAPTrue(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -206,36 +176,26 @@ namespace additionalProperties
throw new ArgumentNullException(nameof(createParameters));
}
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateCatAPTrue");
scope.Start();
try
using var message = CreateCreateCatAPTrueRequest(createParameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateCatAPTrueRequest(createParameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
CatAPTrue value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
CatAPTrue value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = CatAPTrue.DeserializeCatAPTrue(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 = CatAPTrue.DeserializeCatAPTrue(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -265,36 +225,26 @@ namespace additionalProperties
throw new ArgumentNullException(nameof(createParameters));
}
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPObject");
scope.Start();
try
using var message = CreateCreateAPObjectRequest(createParameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateAPObjectRequest(createParameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
PetAPObject value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
PetAPObject 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 = PetAPObject.DeserializePetAPObject(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 = PetAPObject.DeserializePetAPObject(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -308,36 +258,26 @@ namespace additionalProperties
throw new ArgumentNullException(nameof(createParameters));
}
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPObject");
scope.Start();
try
using var message = CreateCreateAPObjectRequest(createParameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateAPObjectRequest(createParameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
PetAPObject value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
PetAPObject value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = PetAPObject.DeserializePetAPObject(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 = PetAPObject.DeserializePetAPObject(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -367,36 +307,26 @@ namespace additionalProperties
throw new ArgumentNullException(nameof(createParameters));
}
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPString");
scope.Start();
try
using var message = CreateCreateAPStringRequest(createParameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateAPStringRequest(createParameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
PetAPString value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
PetAPString 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 = PetAPString.DeserializePetAPString(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 = PetAPString.DeserializePetAPString(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -410,36 +340,26 @@ namespace additionalProperties
throw new ArgumentNullException(nameof(createParameters));
}
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPString");
scope.Start();
try
using var message = CreateCreateAPStringRequest(createParameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateAPStringRequest(createParameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
PetAPString value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
PetAPString value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = PetAPString.DeserializePetAPString(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 = PetAPString.DeserializePetAPString(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -469,36 +389,26 @@ namespace additionalProperties
throw new ArgumentNullException(nameof(createParameters));
}
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPInProperties");
scope.Start();
try
using var message = CreateCreateAPInPropertiesRequest(createParameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateAPInPropertiesRequest(createParameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
PetAPInProperties value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
PetAPInProperties 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 = PetAPInProperties.DeserializePetAPInProperties(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 = PetAPInProperties.DeserializePetAPInProperties(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -512,36 +422,26 @@ namespace additionalProperties
throw new ArgumentNullException(nameof(createParameters));
}
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPInProperties");
scope.Start();
try
using var message = CreateCreateAPInPropertiesRequest(createParameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateAPInPropertiesRequest(createParameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
PetAPInProperties value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
PetAPInProperties value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = PetAPInProperties.DeserializePetAPInProperties(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 = PetAPInProperties.DeserializePetAPInProperties(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -571,36 +471,26 @@ namespace additionalProperties
throw new ArgumentNullException(nameof(createParameters));
}
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPInPropertiesWithAPString");
scope.Start();
try
using var message = CreateCreateAPInPropertiesWithAPStringRequest(createParameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateCreateAPInPropertiesWithAPStringRequest(createParameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 200:
{
PetAPInPropertiesWithAPString value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
PetAPInPropertiesWithAPString 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 = PetAPInPropertiesWithAPString.DeserializePetAPInPropertiesWithAPString(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 = PetAPInPropertiesWithAPString.DeserializePetAPInPropertiesWithAPString(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -614,36 +504,26 @@ namespace additionalProperties
throw new ArgumentNullException(nameof(createParameters));
}
using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPInPropertiesWithAPString");
scope.Start();
try
using var message = CreateCreateAPInPropertiesWithAPStringRequest(createParameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateCreateAPInPropertiesWithAPStringRequest(createParameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 200:
{
PetAPInPropertiesWithAPString value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
PetAPInPropertiesWithAPString value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = PetAPInPropertiesWithAPString.DeserializePetAPInPropertiesWithAPString(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 = PetAPInPropertiesWithAPString.DeserializePetAPInPropertiesWithAPString(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -36,7 +37,17 @@ namespace azure_parameter_grouping
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> PostRequiredAsync(ParameterGroupingPostRequiredParameters parameterGroupingPostRequiredParameters, CancellationToken cancellationToken = default)
{
return await RestClient.PostRequiredAsync(parameterGroupingPostRequiredParameters, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ParameterGroupingClient.PostRequired");
scope.Start();
try
{
return await RestClient.PostRequiredAsync(parameterGroupingPostRequiredParameters, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Post a bunch of required parameters grouped. </summary>
@ -44,7 +55,17 @@ namespace azure_parameter_grouping
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response PostRequired(ParameterGroupingPostRequiredParameters parameterGroupingPostRequiredParameters, CancellationToken cancellationToken = default)
{
return RestClient.PostRequired(parameterGroupingPostRequiredParameters, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ParameterGroupingClient.PostRequired");
scope.Start();
try
{
return RestClient.PostRequired(parameterGroupingPostRequiredParameters, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Post a bunch of optional parameters grouped. </summary>
@ -52,7 +73,17 @@ namespace azure_parameter_grouping
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> PostOptionalAsync(ParameterGroupingPostOptionalParameters parameterGroupingPostOptionalParameters = null, CancellationToken cancellationToken = default)
{
return await RestClient.PostOptionalAsync(parameterGroupingPostOptionalParameters, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ParameterGroupingClient.PostOptional");
scope.Start();
try
{
return await RestClient.PostOptionalAsync(parameterGroupingPostOptionalParameters, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Post a bunch of optional parameters grouped. </summary>
@ -60,7 +91,17 @@ namespace azure_parameter_grouping
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response PostOptional(ParameterGroupingPostOptionalParameters parameterGroupingPostOptionalParameters = null, CancellationToken cancellationToken = default)
{
return RestClient.PostOptional(parameterGroupingPostOptionalParameters, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ParameterGroupingClient.PostOptional");
scope.Start();
try
{
return RestClient.PostOptional(parameterGroupingPostOptionalParameters, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Post parameters from multiple different parameter groups. </summary>
@ -69,7 +110,17 @@ namespace azure_parameter_grouping
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> PostMultiParamGroupsAsync(FirstParameterGroup firstParameterGroup = null, ParameterGroupingPostMultiParamGroupsSecondParamGroup parameterGroupingPostMultiParamGroupsSecondParamGroup = null, CancellationToken cancellationToken = default)
{
return await RestClient.PostMultiParamGroupsAsync(firstParameterGroup, parameterGroupingPostMultiParamGroupsSecondParamGroup, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ParameterGroupingClient.PostMultiParamGroups");
scope.Start();
try
{
return await RestClient.PostMultiParamGroupsAsync(firstParameterGroup, parameterGroupingPostMultiParamGroupsSecondParamGroup, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Post parameters from multiple different parameter groups. </summary>
@ -78,7 +129,17 @@ namespace azure_parameter_grouping
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response PostMultiParamGroups(FirstParameterGroup firstParameterGroup = null, ParameterGroupingPostMultiParamGroupsSecondParamGroup parameterGroupingPostMultiParamGroupsSecondParamGroup = null, CancellationToken cancellationToken = default)
{
return RestClient.PostMultiParamGroups(firstParameterGroup, parameterGroupingPostMultiParamGroupsSecondParamGroup, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ParameterGroupingClient.PostMultiParamGroups");
scope.Start();
try
{
return RestClient.PostMultiParamGroups(firstParameterGroup, parameterGroupingPostMultiParamGroupsSecondParamGroup, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Post parameters with a shared parameter group object. </summary>
@ -86,7 +147,17 @@ namespace azure_parameter_grouping
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> PostSharedParameterGroupObjectAsync(FirstParameterGroup firstParameterGroup = null, CancellationToken cancellationToken = default)
{
return await RestClient.PostSharedParameterGroupObjectAsync(firstParameterGroup, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ParameterGroupingClient.PostSharedParameterGroupObject");
scope.Start();
try
{
return await RestClient.PostSharedParameterGroupObjectAsync(firstParameterGroup, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Post parameters with a shared parameter group object. </summary>
@ -94,7 +165,17 @@ namespace azure_parameter_grouping
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response PostSharedParameterGroupObject(FirstParameterGroup firstParameterGroup = null, CancellationToken cancellationToken = default)
{
return RestClient.PostSharedParameterGroupObject(firstParameterGroup, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ParameterGroupingClient.PostSharedParameterGroupObject");
scope.Start();
try
{
return RestClient.PostSharedParameterGroupObject(firstParameterGroup, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -69,24 +69,14 @@ namespace azure_parameter_grouping
throw new ArgumentNullException(nameof(parameterGroupingPostRequiredParameters));
}
using var scope = _clientDiagnostics.CreateScope("ParameterGroupingClient.PostRequired");
scope.Start();
try
using var message = CreatePostRequiredRequest(parameterGroupingPostRequiredParameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreatePostRequiredRequest(parameterGroupingPostRequiredParameters);
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);
}
}
@ -100,24 +90,14 @@ namespace azure_parameter_grouping
throw new ArgumentNullException(nameof(parameterGroupingPostRequiredParameters));
}
using var scope = _clientDiagnostics.CreateScope("ParameterGroupingClient.PostRequired");
scope.Start();
try
using var message = CreatePostRequiredRequest(parameterGroupingPostRequiredParameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreatePostRequiredRequest(parameterGroupingPostRequiredParameters);
_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);
}
}
@ -146,24 +126,14 @@ namespace azure_parameter_grouping
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> PostOptionalAsync(ParameterGroupingPostOptionalParameters parameterGroupingPostOptionalParameters = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ParameterGroupingClient.PostOptional");
scope.Start();
try
using var message = CreatePostOptionalRequest(parameterGroupingPostOptionalParameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreatePostOptionalRequest(parameterGroupingPostOptionalParameters);
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);
}
}
@ -172,24 +142,14 @@ namespace azure_parameter_grouping
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response PostOptional(ParameterGroupingPostOptionalParameters parameterGroupingPostOptionalParameters = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ParameterGroupingClient.PostOptional");
scope.Start();
try
using var message = CreatePostOptionalRequest(parameterGroupingPostOptionalParameters);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreatePostOptionalRequest(parameterGroupingPostOptionalParameters);
_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);
}
}
@ -227,24 +187,14 @@ namespace azure_parameter_grouping
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> PostMultiParamGroupsAsync(FirstParameterGroup firstParameterGroup = null, ParameterGroupingPostMultiParamGroupsSecondParamGroup parameterGroupingPostMultiParamGroupsSecondParamGroup = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ParameterGroupingClient.PostMultiParamGroups");
scope.Start();
try
using var message = CreatePostMultiParamGroupsRequest(firstParameterGroup, parameterGroupingPostMultiParamGroupsSecondParamGroup);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreatePostMultiParamGroupsRequest(firstParameterGroup, parameterGroupingPostMultiParamGroupsSecondParamGroup);
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);
}
}
@ -254,24 +204,14 @@ namespace azure_parameter_grouping
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response PostMultiParamGroups(FirstParameterGroup firstParameterGroup = null, ParameterGroupingPostMultiParamGroupsSecondParamGroup parameterGroupingPostMultiParamGroupsSecondParamGroup = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ParameterGroupingClient.PostMultiParamGroups");
scope.Start();
try
using var message = CreatePostMultiParamGroupsRequest(firstParameterGroup, parameterGroupingPostMultiParamGroupsSecondParamGroup);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreatePostMultiParamGroupsRequest(firstParameterGroup, parameterGroupingPostMultiParamGroupsSecondParamGroup);
_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);
}
}
@ -300,24 +240,14 @@ namespace azure_parameter_grouping
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> PostSharedParameterGroupObjectAsync(FirstParameterGroup firstParameterGroup = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ParameterGroupingClient.PostSharedParameterGroupObject");
scope.Start();
try
using var message = CreatePostSharedParameterGroupObjectRequest(firstParameterGroup);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreatePostSharedParameterGroupObjectRequest(firstParameterGroup);
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);
}
}
@ -326,24 +256,14 @@ namespace azure_parameter_grouping
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response PostSharedParameterGroupObject(FirstParameterGroup firstParameterGroup = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ParameterGroupingClient.PostSharedParameterGroupObject");
scope.Start();
try
using var message = CreatePostSharedParameterGroupObjectRequest(firstParameterGroup);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreatePostSharedParameterGroupObjectRequest(firstParameterGroup);
_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);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -34,56 +35,136 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> GetMethodGlobalValidAsync(CancellationToken cancellationToken = default)
{
return await RestClient.GetMethodGlobalValidAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ApiVersionDefaultClient.GetMethodGlobalValid");
scope.Start();
try
{
return await RestClient.GetMethodGlobalValidAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> GET method with api-version modeled in global settings. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response GetMethodGlobalValid(CancellationToken cancellationToken = default)
{
return RestClient.GetMethodGlobalValid(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ApiVersionDefaultClient.GetMethodGlobalValid");
scope.Start();
try
{
return RestClient.GetMethodGlobalValid(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> GET method with api-version modeled in global settings. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> GetMethodGlobalNotProvidedValidAsync(CancellationToken cancellationToken = default)
{
return await RestClient.GetMethodGlobalNotProvidedValidAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ApiVersionDefaultClient.GetMethodGlobalNotProvidedValid");
scope.Start();
try
{
return await RestClient.GetMethodGlobalNotProvidedValidAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> GET method with api-version modeled in global settings. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response GetMethodGlobalNotProvidedValid(CancellationToken cancellationToken = default)
{
return RestClient.GetMethodGlobalNotProvidedValid(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ApiVersionDefaultClient.GetMethodGlobalNotProvidedValid");
scope.Start();
try
{
return RestClient.GetMethodGlobalNotProvidedValid(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> GET method with api-version modeled in global settings. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> GetPathGlobalValidAsync(CancellationToken cancellationToken = default)
{
return await RestClient.GetPathGlobalValidAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ApiVersionDefaultClient.GetPathGlobalValid");
scope.Start();
try
{
return await RestClient.GetPathGlobalValidAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> GET method with api-version modeled in global settings. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response GetPathGlobalValid(CancellationToken cancellationToken = default)
{
return RestClient.GetPathGlobalValid(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ApiVersionDefaultClient.GetPathGlobalValid");
scope.Start();
try
{
return RestClient.GetPathGlobalValid(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> GET method with api-version modeled in global settings. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> GetSwaggerGlobalValidAsync(CancellationToken cancellationToken = default)
{
return await RestClient.GetSwaggerGlobalValidAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ApiVersionDefaultClient.GetSwaggerGlobalValid");
scope.Start();
try
{
return await RestClient.GetSwaggerGlobalValidAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> GET method with api-version modeled in global settings. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response GetSwaggerGlobalValid(CancellationToken cancellationToken = default)
{
return RestClient.GetSwaggerGlobalValid(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ApiVersionDefaultClient.GetSwaggerGlobalValid");
scope.Start();
try
{
return RestClient.GetSwaggerGlobalValid(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -56,24 +56,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> GetMethodGlobalValidAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ApiVersionDefaultClient.GetMethodGlobalValid");
scope.Start();
try
using var message = CreateGetMethodGlobalValidRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetMethodGlobalValidRequest();
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);
}
}
@ -81,24 +71,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response GetMethodGlobalValid(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ApiVersionDefaultClient.GetMethodGlobalValid");
scope.Start();
try
using var message = CreateGetMethodGlobalValidRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetMethodGlobalValidRequest();
_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);
}
}
@ -119,24 +99,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> GetMethodGlobalNotProvidedValidAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ApiVersionDefaultClient.GetMethodGlobalNotProvidedValid");
scope.Start();
try
using var message = CreateGetMethodGlobalNotProvidedValidRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetMethodGlobalNotProvidedValidRequest();
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);
}
}
@ -144,24 +114,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response GetMethodGlobalNotProvidedValid(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ApiVersionDefaultClient.GetMethodGlobalNotProvidedValid");
scope.Start();
try
using var message = CreateGetMethodGlobalNotProvidedValidRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetMethodGlobalNotProvidedValidRequest();
_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);
}
}
@ -182,24 +142,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> GetPathGlobalValidAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ApiVersionDefaultClient.GetPathGlobalValid");
scope.Start();
try
using var message = CreateGetPathGlobalValidRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetPathGlobalValidRequest();
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);
}
}
@ -207,24 +157,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response GetPathGlobalValid(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ApiVersionDefaultClient.GetPathGlobalValid");
scope.Start();
try
using var message = CreateGetPathGlobalValidRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetPathGlobalValidRequest();
_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);
}
}
@ -245,24 +185,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> GetSwaggerGlobalValidAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ApiVersionDefaultClient.GetSwaggerGlobalValid");
scope.Start();
try
using var message = CreateGetSwaggerGlobalValidRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetSwaggerGlobalValidRequest();
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);
}
}
@ -270,24 +200,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response GetSwaggerGlobalValid(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ApiVersionDefaultClient.GetSwaggerGlobalValid");
scope.Start();
try
using var message = CreateGetSwaggerGlobalValidRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetSwaggerGlobalValidRequest();
_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);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -34,14 +35,34 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> GetMethodLocalValidAsync(CancellationToken cancellationToken = default)
{
return await RestClient.GetMethodLocalValidAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ApiVersionLocalClient.GetMethodLocalValid");
scope.Start();
try
{
return await RestClient.GetMethodLocalValidAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method with api-version modeled in the method. pass in api-version = &apos;2.0&apos; to succeed. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response GetMethodLocalValid(CancellationToken cancellationToken = default)
{
return RestClient.GetMethodLocalValid(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ApiVersionLocalClient.GetMethodLocalValid");
scope.Start();
try
{
return RestClient.GetMethodLocalValid(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method with api-version modeled in the method. pass in api-version = null to succeed. </summary>
@ -49,7 +70,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> GetMethodLocalNullAsync(string apiVersion = null, CancellationToken cancellationToken = default)
{
return await RestClient.GetMethodLocalNullAsync(apiVersion, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ApiVersionLocalClient.GetMethodLocalNull");
scope.Start();
try
{
return await RestClient.GetMethodLocalNullAsync(apiVersion, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method with api-version modeled in the method. pass in api-version = null to succeed. </summary>
@ -57,35 +88,85 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response GetMethodLocalNull(string apiVersion = null, CancellationToken cancellationToken = default)
{
return RestClient.GetMethodLocalNull(apiVersion, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ApiVersionLocalClient.GetMethodLocalNull");
scope.Start();
try
{
return RestClient.GetMethodLocalNull(apiVersion, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method with api-version modeled in the method. pass in api-version = &apos;2.0&apos; to succeed. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> GetPathLocalValidAsync(CancellationToken cancellationToken = default)
{
return await RestClient.GetPathLocalValidAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ApiVersionLocalClient.GetPathLocalValid");
scope.Start();
try
{
return await RestClient.GetPathLocalValidAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method with api-version modeled in the method. pass in api-version = &apos;2.0&apos; to succeed. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response GetPathLocalValid(CancellationToken cancellationToken = default)
{
return RestClient.GetPathLocalValid(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ApiVersionLocalClient.GetPathLocalValid");
scope.Start();
try
{
return RestClient.GetPathLocalValid(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method with api-version modeled in the method. pass in api-version = &apos;2.0&apos; to succeed. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> GetSwaggerLocalValidAsync(CancellationToken cancellationToken = default)
{
return await RestClient.GetSwaggerLocalValidAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("ApiVersionLocalClient.GetSwaggerLocalValid");
scope.Start();
try
{
return await RestClient.GetSwaggerLocalValidAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method with api-version modeled in the method. pass in api-version = &apos;2.0&apos; to succeed. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response GetSwaggerLocalValid(CancellationToken cancellationToken = default)
{
return RestClient.GetSwaggerLocalValid(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("ApiVersionLocalClient.GetSwaggerLocalValid");
scope.Start();
try
{
return RestClient.GetSwaggerLocalValid(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -50,24 +50,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> GetMethodLocalValidAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ApiVersionLocalClient.GetMethodLocalValid");
scope.Start();
try
using var message = CreateGetMethodLocalValidRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetMethodLocalValidRequest();
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);
}
}
@ -75,24 +65,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response GetMethodLocalValid(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ApiVersionLocalClient.GetMethodLocalValid");
scope.Start();
try
using var message = CreateGetMethodLocalValidRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetMethodLocalValidRequest();
_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);
}
}
@ -117,24 +97,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> GetMethodLocalNullAsync(string apiVersion = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ApiVersionLocalClient.GetMethodLocalNull");
scope.Start();
try
using var message = CreateGetMethodLocalNullRequest(apiVersion);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetMethodLocalNullRequest(apiVersion);
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);
}
}
@ -143,24 +113,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response GetMethodLocalNull(string apiVersion = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ApiVersionLocalClient.GetMethodLocalNull");
scope.Start();
try
using var message = CreateGetMethodLocalNullRequest(apiVersion);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetMethodLocalNullRequest(apiVersion);
_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);
}
}
@ -181,24 +141,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> GetPathLocalValidAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ApiVersionLocalClient.GetPathLocalValid");
scope.Start();
try
using var message = CreateGetPathLocalValidRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetPathLocalValidRequest();
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);
}
}
@ -206,24 +156,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response GetPathLocalValid(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ApiVersionLocalClient.GetPathLocalValid");
scope.Start();
try
using var message = CreateGetPathLocalValidRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetPathLocalValidRequest();
_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);
}
}
@ -244,24 +184,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> GetSwaggerLocalValidAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ApiVersionLocalClient.GetSwaggerLocalValid");
scope.Start();
try
using var message = CreateGetSwaggerLocalValidRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetSwaggerLocalValidRequest();
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);
}
}
@ -269,24 +199,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response GetSwaggerLocalValid(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("ApiVersionLocalClient.GetSwaggerLocalValid");
scope.Start();
try
using var message = CreateGetSwaggerLocalValidRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetSwaggerLocalValidRequest();
_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);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -36,7 +37,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> CustomNamedRequestIdAsync(string fooClientRequestId, CancellationToken cancellationToken = default)
{
return (await RestClient.CustomNamedRequestIdAsync(fooClientRequestId, cancellationToken).ConfigureAwait(false)).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("HeaderClient.CustomNamedRequestId");
scope.Start();
try
{
return (await RestClient.CustomNamedRequestIdAsync(fooClientRequestId, cancellationToken).ConfigureAwait(false)).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. </summary>
@ -44,7 +55,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response CustomNamedRequestId(string fooClientRequestId, CancellationToken cancellationToken = default)
{
return RestClient.CustomNamedRequestId(fooClientRequestId, cancellationToken).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("HeaderClient.CustomNamedRequestId");
scope.Start();
try
{
return RestClient.CustomNamedRequestId(fooClientRequestId, cancellationToken).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request, via a parameter group. </summary>
@ -52,7 +73,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> CustomNamedRequestIdParamGroupingAsync(HeaderCustomNamedRequestIdParamGroupingParameters headerCustomNamedRequestIdParamGroupingParameters, CancellationToken cancellationToken = default)
{
return (await RestClient.CustomNamedRequestIdParamGroupingAsync(headerCustomNamedRequestIdParamGroupingParameters, cancellationToken).ConfigureAwait(false)).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("HeaderClient.CustomNamedRequestIdParamGrouping");
scope.Start();
try
{
return (await RestClient.CustomNamedRequestIdParamGroupingAsync(headerCustomNamedRequestIdParamGroupingParameters, cancellationToken).ConfigureAwait(false)).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request, via a parameter group. </summary>
@ -60,7 +91,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response CustomNamedRequestIdParamGrouping(HeaderCustomNamedRequestIdParamGroupingParameters headerCustomNamedRequestIdParamGroupingParameters, CancellationToken cancellationToken = default)
{
return RestClient.CustomNamedRequestIdParamGrouping(headerCustomNamedRequestIdParamGroupingParameters, cancellationToken).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("HeaderClient.CustomNamedRequestIdParamGrouping");
scope.Start();
try
{
return RestClient.CustomNamedRequestIdParamGrouping(headerCustomNamedRequestIdParamGroupingParameters, cancellationToken).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. </summary>
@ -68,7 +109,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> CustomNamedRequestIdHeadAsync(string fooClientRequestId, CancellationToken cancellationToken = default)
{
return (await RestClient.CustomNamedRequestIdHeadAsync(fooClientRequestId, cancellationToken).ConfigureAwait(false)).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("HeaderClient.CustomNamedRequestIdHead");
scope.Start();
try
{
return (await RestClient.CustomNamedRequestIdHeadAsync(fooClientRequestId, cancellationToken).ConfigureAwait(false)).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. </summary>
@ -76,7 +127,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response CustomNamedRequestIdHead(string fooClientRequestId, CancellationToken cancellationToken = default)
{
return RestClient.CustomNamedRequestIdHead(fooClientRequestId, cancellationToken).GetRawResponse();
using var scope = _clientDiagnostics.CreateScope("HeaderClient.CustomNamedRequestIdHead");
scope.Start();
try
{
return RestClient.CustomNamedRequestIdHead(fooClientRequestId, cancellationToken).GetRawResponse();
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -56,25 +56,15 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(fooClientRequestId));
}
using var scope = _clientDiagnostics.CreateScope("HeaderClient.CustomNamedRequestId");
scope.Start();
try
using var message = CreateCustomNamedRequestIdRequest(fooClientRequestId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new HeaderCustomNamedRequestIdHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateCustomNamedRequestIdRequest(fooClientRequestId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new HeaderCustomNamedRequestIdHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 200:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -88,25 +78,15 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(fooClientRequestId));
}
using var scope = _clientDiagnostics.CreateScope("HeaderClient.CustomNamedRequestId");
scope.Start();
try
using var message = CreateCustomNamedRequestIdRequest(fooClientRequestId);
_pipeline.Send(message, cancellationToken);
var headers = new HeaderCustomNamedRequestIdHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateCustomNamedRequestIdRequest(fooClientRequestId);
_pipeline.Send(message, cancellationToken);
var headers = new HeaderCustomNamedRequestIdHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 200:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -133,25 +113,15 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(headerCustomNamedRequestIdParamGroupingParameters));
}
using var scope = _clientDiagnostics.CreateScope("HeaderClient.CustomNamedRequestIdParamGrouping");
scope.Start();
try
using var message = CreateCustomNamedRequestIdParamGroupingRequest(headerCustomNamedRequestIdParamGroupingParameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new HeaderCustomNamedRequestIdParamGroupingHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateCustomNamedRequestIdParamGroupingRequest(headerCustomNamedRequestIdParamGroupingParameters);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new HeaderCustomNamedRequestIdParamGroupingHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 200:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -165,25 +135,15 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(headerCustomNamedRequestIdParamGroupingParameters));
}
using var scope = _clientDiagnostics.CreateScope("HeaderClient.CustomNamedRequestIdParamGrouping");
scope.Start();
try
using var message = CreateCustomNamedRequestIdParamGroupingRequest(headerCustomNamedRequestIdParamGroupingParameters);
_pipeline.Send(message, cancellationToken);
var headers = new HeaderCustomNamedRequestIdParamGroupingHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateCustomNamedRequestIdParamGroupingRequest(headerCustomNamedRequestIdParamGroupingParameters);
_pipeline.Send(message, cancellationToken);
var headers = new HeaderCustomNamedRequestIdParamGroupingHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 200:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
@ -210,26 +170,16 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(fooClientRequestId));
}
using var scope = _clientDiagnostics.CreateScope("HeaderClient.CustomNamedRequestIdHead");
scope.Start();
try
using var message = CreateCustomNamedRequestIdHeadRequest(fooClientRequestId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new HeaderCustomNamedRequestIdHeadHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateCustomNamedRequestIdHeadRequest(fooClientRequestId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
var headers = new HeaderCustomNamedRequestIdHeadHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
case 404:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 200:
case 404:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
@ -243,26 +193,16 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(fooClientRequestId));
}
using var scope = _clientDiagnostics.CreateScope("HeaderClient.CustomNamedRequestIdHead");
scope.Start();
try
using var message = CreateCustomNamedRequestIdHeadRequest(fooClientRequestId);
_pipeline.Send(message, cancellationToken);
var headers = new HeaderCustomNamedRequestIdHeadHeaders(message.Response);
switch (message.Response.Status)
{
using var message = CreateCustomNamedRequestIdHeadRequest(fooClientRequestId);
_pipeline.Send(message, cancellationToken);
var headers = new HeaderCustomNamedRequestIdHeadHeaders(message.Response);
switch (message.Response.Status)
{
case 200:
case 404:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
case 200:
case 404:
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -37,7 +38,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> GetWithFilterAsync(string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default)
{
return await RestClient.GetWithFilterAsync(filter, top, orderby, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("OdataClient.GetWithFilter");
scope.Start();
try
{
return await RestClient.GetWithFilterAsync(filter, top, orderby, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Specify filter parameter with value &apos;$filter=id gt 5 and name eq &apos;foo&apos;&amp;$orderby=id&amp;$top=10&apos;. </summary>
@ -47,7 +58,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response GetWithFilter(string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default)
{
return RestClient.GetWithFilter(filter, top, orderby, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("OdataClient.GetWithFilter");
scope.Start();
try
{
return RestClient.GetWithFilter(filter, top, orderby, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -64,24 +64,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> GetWithFilterAsync(string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("OdataClient.GetWithFilter");
scope.Start();
try
using var message = CreateGetWithFilterRequest(filter, top, orderby);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetWithFilterRequest(filter, top, orderby);
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);
}
}
@ -92,24 +82,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response GetWithFilter(string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("OdataClient.GetWithFilter");
scope.Start();
try
using var message = CreateGetWithFilterRequest(filter, top, orderby);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetWithFilterRequest(filter, top, orderby);
_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);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -35,7 +36,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> GetMethodPathValidAsync(string unencodedPathParam, CancellationToken cancellationToken = default)
{
return await RestClient.GetMethodPathValidAsync(unencodedPathParam, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetMethodPathValid");
scope.Start();
try
{
return await RestClient.GetMethodPathValidAsync(unencodedPathParam, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method with unencoded path parameter with value &apos;path1/path2/path3&apos;. </summary>
@ -43,7 +54,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response GetMethodPathValid(string unencodedPathParam, CancellationToken cancellationToken = default)
{
return RestClient.GetMethodPathValid(unencodedPathParam, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetMethodPathValid");
scope.Start();
try
{
return RestClient.GetMethodPathValid(unencodedPathParam, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method with unencoded path parameter with value &apos;path1/path2/path3&apos;. </summary>
@ -51,7 +72,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> GetPathValidAsync(string unencodedPathParam, CancellationToken cancellationToken = default)
{
return await RestClient.GetPathValidAsync(unencodedPathParam, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetPathValid");
scope.Start();
try
{
return await RestClient.GetPathValidAsync(unencodedPathParam, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method with unencoded path parameter with value &apos;path1/path2/path3&apos;. </summary>
@ -59,21 +90,51 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response GetPathValid(string unencodedPathParam, CancellationToken cancellationToken = default)
{
return RestClient.GetPathValid(unencodedPathParam, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetPathValid");
scope.Start();
try
{
return RestClient.GetPathValid(unencodedPathParam, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method with unencoded path parameter with value &apos;path1/path2/path3&apos;. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> GetSwaggerPathValidAsync(CancellationToken cancellationToken = default)
{
return await RestClient.GetSwaggerPathValidAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetSwaggerPathValid");
scope.Start();
try
{
return await RestClient.GetSwaggerPathValidAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method with unencoded path parameter with value &apos;path1/path2/path3&apos;. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response GetSwaggerPathValid(CancellationToken cancellationToken = default)
{
return RestClient.GetSwaggerPathValid(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetSwaggerPathValid");
scope.Start();
try
{
return RestClient.GetSwaggerPathValid(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method with unencoded query parameter with value &apos;value1&amp;q2=value2&amp;q3=value3&apos;. </summary>
@ -81,7 +142,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> GetMethodQueryValidAsync(string q1, CancellationToken cancellationToken = default)
{
return await RestClient.GetMethodQueryValidAsync(q1, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetMethodQueryValid");
scope.Start();
try
{
return await RestClient.GetMethodQueryValidAsync(q1, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method with unencoded query parameter with value &apos;value1&amp;q2=value2&amp;q3=value3&apos;. </summary>
@ -89,7 +160,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response GetMethodQueryValid(string q1, CancellationToken cancellationToken = default)
{
return RestClient.GetMethodQueryValid(q1, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetMethodQueryValid");
scope.Start();
try
{
return RestClient.GetMethodQueryValid(q1, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method with unencoded query parameter with value null. </summary>
@ -97,7 +178,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> GetMethodQueryNullAsync(string q1 = null, CancellationToken cancellationToken = default)
{
return await RestClient.GetMethodQueryNullAsync(q1, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetMethodQueryNull");
scope.Start();
try
{
return await RestClient.GetMethodQueryNullAsync(q1, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method with unencoded query parameter with value null. </summary>
@ -105,7 +196,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response GetMethodQueryNull(string q1 = null, CancellationToken cancellationToken = default)
{
return RestClient.GetMethodQueryNull(q1, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetMethodQueryNull");
scope.Start();
try
{
return RestClient.GetMethodQueryNull(q1, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method with unencoded query parameter with value &apos;value1&amp;q2=value2&amp;q3=value3&apos;. </summary>
@ -113,7 +214,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> GetPathQueryValidAsync(string q1, CancellationToken cancellationToken = default)
{
return await RestClient.GetPathQueryValidAsync(q1, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetPathQueryValid");
scope.Start();
try
{
return await RestClient.GetPathQueryValidAsync(q1, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method with unencoded query parameter with value &apos;value1&amp;q2=value2&amp;q3=value3&apos;. </summary>
@ -121,21 +232,51 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response GetPathQueryValid(string q1, CancellationToken cancellationToken = default)
{
return RestClient.GetPathQueryValid(q1, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetPathQueryValid");
scope.Start();
try
{
return RestClient.GetPathQueryValid(q1, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method with unencoded query parameter with value &apos;value1&amp;q2=value2&amp;q3=value3&apos;. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> GetSwaggerQueryValidAsync(CancellationToken cancellationToken = default)
{
return await RestClient.GetSwaggerQueryValidAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetSwaggerQueryValid");
scope.Start();
try
{
return await RestClient.GetSwaggerQueryValidAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method with unencoded query parameter with value &apos;value1&amp;q2=value2&amp;q3=value3&apos;. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response GetSwaggerQueryValid(CancellationToken cancellationToken = default)
{
return RestClient.GetSwaggerQueryValid(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetSwaggerQueryValid");
scope.Start();
try
{
return RestClient.GetSwaggerQueryValid(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -56,24 +56,14 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(unencodedPathParam));
}
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetMethodPathValid");
scope.Start();
try
using var message = CreateGetMethodPathValidRequest(unencodedPathParam);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetMethodPathValidRequest(unencodedPathParam);
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);
}
}
@ -87,24 +77,14 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(unencodedPathParam));
}
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetMethodPathValid");
scope.Start();
try
using var message = CreateGetMethodPathValidRequest(unencodedPathParam);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetMethodPathValidRequest(unencodedPathParam);
_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);
}
}
@ -131,24 +111,14 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(unencodedPathParam));
}
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetPathValid");
scope.Start();
try
using var message = CreateGetPathValidRequest(unencodedPathParam);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetPathValidRequest(unencodedPathParam);
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);
}
}
@ -162,24 +132,14 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(unencodedPathParam));
}
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetPathValid");
scope.Start();
try
using var message = CreateGetPathValidRequest(unencodedPathParam);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetPathValidRequest(unencodedPathParam);
_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);
}
}
@ -200,24 +160,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> GetSwaggerPathValidAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetSwaggerPathValid");
scope.Start();
try
using var message = CreateGetSwaggerPathValidRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetSwaggerPathValidRequest();
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);
}
}
@ -225,24 +175,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response GetSwaggerPathValid(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetSwaggerPathValid");
scope.Start();
try
using var message = CreateGetSwaggerPathValidRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetSwaggerPathValidRequest();
_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);
}
}
@ -269,24 +209,14 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(q1));
}
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetMethodQueryValid");
scope.Start();
try
using var message = CreateGetMethodQueryValidRequest(q1);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetMethodQueryValidRequest(q1);
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);
}
}
@ -300,24 +230,14 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(q1));
}
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetMethodQueryValid");
scope.Start();
try
using var message = CreateGetMethodQueryValidRequest(q1);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetMethodQueryValidRequest(q1);
_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);
}
}
@ -342,24 +262,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> GetMethodQueryNullAsync(string q1 = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetMethodQueryNull");
scope.Start();
try
using var message = CreateGetMethodQueryNullRequest(q1);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetMethodQueryNullRequest(q1);
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);
}
}
@ -368,24 +278,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response GetMethodQueryNull(string q1 = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetMethodQueryNull");
scope.Start();
try
using var message = CreateGetMethodQueryNullRequest(q1);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetMethodQueryNullRequest(q1);
_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);
}
}
@ -412,24 +312,14 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(q1));
}
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetPathQueryValid");
scope.Start();
try
using var message = CreateGetPathQueryValidRequest(q1);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetPathQueryValidRequest(q1);
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);
}
}
@ -443,24 +333,14 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(q1));
}
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetPathQueryValid");
scope.Start();
try
using var message = CreateGetPathQueryValidRequest(q1);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetPathQueryValidRequest(q1);
_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);
}
}
@ -481,24 +361,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> GetSwaggerQueryValidAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetSwaggerQueryValid");
scope.Start();
try
using var message = CreateGetSwaggerQueryValidRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetSwaggerQueryValidRequest();
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);
}
}
@ -506,24 +376,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response GetSwaggerQueryValid(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SkipUrlEncodingClient.GetSwaggerQueryValid");
scope.Start();
try
using var message = CreateGetSwaggerQueryValidRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetSwaggerQueryValidRequest();
_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);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -34,70 +35,170 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> PostMethodGlobalValidAsync(CancellationToken cancellationToken = default)
{
return await RestClient.PostMethodGlobalValidAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SubscriptionInCredentialsClient.PostMethodGlobalValid");
scope.Start();
try
{
return await RestClient.PostMethodGlobalValidAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to &apos;1234-5678-9012-3456&apos; to succeed. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response PostMethodGlobalValid(CancellationToken cancellationToken = default)
{
return RestClient.PostMethodGlobalValid(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SubscriptionInCredentialsClient.PostMethodGlobalValid");
scope.Start();
try
{
return RestClient.PostMethodGlobalValid(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to null, and client-side validation should prevent you from making this call. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> PostMethodGlobalNullAsync(CancellationToken cancellationToken = default)
{
return await RestClient.PostMethodGlobalNullAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SubscriptionInCredentialsClient.PostMethodGlobalNull");
scope.Start();
try
{
return await RestClient.PostMethodGlobalNullAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to null, and client-side validation should prevent you from making this call. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response PostMethodGlobalNull(CancellationToken cancellationToken = default)
{
return RestClient.PostMethodGlobalNull(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SubscriptionInCredentialsClient.PostMethodGlobalNull");
scope.Start();
try
{
return RestClient.PostMethodGlobalNull(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to &apos;1234-5678-9012-3456&apos; to succeed. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> PostMethodGlobalNotProvidedValidAsync(CancellationToken cancellationToken = default)
{
return await RestClient.PostMethodGlobalNotProvidedValidAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SubscriptionInCredentialsClient.PostMethodGlobalNotProvidedValid");
scope.Start();
try
{
return await RestClient.PostMethodGlobalNotProvidedValidAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to &apos;1234-5678-9012-3456&apos; to succeed. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response PostMethodGlobalNotProvidedValid(CancellationToken cancellationToken = default)
{
return RestClient.PostMethodGlobalNotProvidedValid(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SubscriptionInCredentialsClient.PostMethodGlobalNotProvidedValid");
scope.Start();
try
{
return RestClient.PostMethodGlobalNotProvidedValid(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to &apos;1234-5678-9012-3456&apos; to succeed. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> PostPathGlobalValidAsync(CancellationToken cancellationToken = default)
{
return await RestClient.PostPathGlobalValidAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SubscriptionInCredentialsClient.PostPathGlobalValid");
scope.Start();
try
{
return await RestClient.PostPathGlobalValidAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to &apos;1234-5678-9012-3456&apos; to succeed. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response PostPathGlobalValid(CancellationToken cancellationToken = default)
{
return RestClient.PostPathGlobalValid(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SubscriptionInCredentialsClient.PostPathGlobalValid");
scope.Start();
try
{
return RestClient.PostPathGlobalValid(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to &apos;1234-5678-9012-3456&apos; to succeed. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> PostSwaggerGlobalValidAsync(CancellationToken cancellationToken = default)
{
return await RestClient.PostSwaggerGlobalValidAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SubscriptionInCredentialsClient.PostSwaggerGlobalValid");
scope.Start();
try
{
return await RestClient.PostSwaggerGlobalValidAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to &apos;1234-5678-9012-3456&apos; to succeed. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response PostSwaggerGlobalValid(CancellationToken cancellationToken = default)
{
return RestClient.PostSwaggerGlobalValid(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SubscriptionInCredentialsClient.PostSwaggerGlobalValid");
scope.Start();
try
{
return RestClient.PostSwaggerGlobalValid(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -62,24 +62,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> PostMethodGlobalValidAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SubscriptionInCredentialsClient.PostMethodGlobalValid");
scope.Start();
try
using var message = CreatePostMethodGlobalValidRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreatePostMethodGlobalValidRequest();
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);
}
}
@ -87,24 +77,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response PostMethodGlobalValid(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SubscriptionInCredentialsClient.PostMethodGlobalValid");
scope.Start();
try
using var message = CreatePostMethodGlobalValidRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreatePostMethodGlobalValidRequest();
_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);
}
}
@ -125,24 +105,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> PostMethodGlobalNullAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SubscriptionInCredentialsClient.PostMethodGlobalNull");
scope.Start();
try
using var message = CreatePostMethodGlobalNullRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreatePostMethodGlobalNullRequest();
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);
}
}
@ -150,24 +120,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response PostMethodGlobalNull(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SubscriptionInCredentialsClient.PostMethodGlobalNull");
scope.Start();
try
using var message = CreatePostMethodGlobalNullRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreatePostMethodGlobalNullRequest();
_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);
}
}
@ -189,24 +149,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> PostMethodGlobalNotProvidedValidAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SubscriptionInCredentialsClient.PostMethodGlobalNotProvidedValid");
scope.Start();
try
using var message = CreatePostMethodGlobalNotProvidedValidRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreatePostMethodGlobalNotProvidedValidRequest();
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);
}
}
@ -214,24 +164,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response PostMethodGlobalNotProvidedValid(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SubscriptionInCredentialsClient.PostMethodGlobalNotProvidedValid");
scope.Start();
try
using var message = CreatePostMethodGlobalNotProvidedValidRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreatePostMethodGlobalNotProvidedValidRequest();
_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);
}
}
@ -252,24 +192,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> PostPathGlobalValidAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SubscriptionInCredentialsClient.PostPathGlobalValid");
scope.Start();
try
using var message = CreatePostPathGlobalValidRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreatePostPathGlobalValidRequest();
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);
}
}
@ -277,24 +207,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response PostPathGlobalValid(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SubscriptionInCredentialsClient.PostPathGlobalValid");
scope.Start();
try
using var message = CreatePostPathGlobalValidRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreatePostPathGlobalValidRequest();
_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);
}
}
@ -315,24 +235,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> PostSwaggerGlobalValidAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SubscriptionInCredentialsClient.PostSwaggerGlobalValid");
scope.Start();
try
using var message = CreatePostSwaggerGlobalValidRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreatePostSwaggerGlobalValidRequest();
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);
}
}
@ -340,24 +250,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response PostSwaggerGlobalValid(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("SubscriptionInCredentialsClient.PostSwaggerGlobalValid");
scope.Start();
try
using var message = CreatePostSwaggerGlobalValidRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreatePostSwaggerGlobalValidRequest();
_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);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -35,7 +36,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> PostMethodLocalValidAsync(string subscriptionId, CancellationToken cancellationToken = default)
{
return await RestClient.PostMethodLocalValidAsync(subscriptionId, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SubscriptionInMethodClient.PostMethodLocalValid");
scope.Start();
try
{
return await RestClient.PostMethodLocalValidAsync(subscriptionId, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> POST method with subscriptionId modeled in the method. pass in subscription id = &apos;1234-5678-9012-3456&apos; to succeed. </summary>
@ -43,7 +54,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response PostMethodLocalValid(string subscriptionId, CancellationToken cancellationToken = default)
{
return RestClient.PostMethodLocalValid(subscriptionId, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SubscriptionInMethodClient.PostMethodLocalValid");
scope.Start();
try
{
return RestClient.PostMethodLocalValid(subscriptionId, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> POST method with subscriptionId modeled in the method. pass in subscription id = null, client-side validation should prevent you from making this call. </summary>
@ -51,7 +72,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> PostMethodLocalNullAsync(string subscriptionId, CancellationToken cancellationToken = default)
{
return await RestClient.PostMethodLocalNullAsync(subscriptionId, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SubscriptionInMethodClient.PostMethodLocalNull");
scope.Start();
try
{
return await RestClient.PostMethodLocalNullAsync(subscriptionId, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> POST method with subscriptionId modeled in the method. pass in subscription id = null, client-side validation should prevent you from making this call. </summary>
@ -59,7 +90,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response PostMethodLocalNull(string subscriptionId, CancellationToken cancellationToken = default)
{
return RestClient.PostMethodLocalNull(subscriptionId, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SubscriptionInMethodClient.PostMethodLocalNull");
scope.Start();
try
{
return RestClient.PostMethodLocalNull(subscriptionId, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> POST method with subscriptionId modeled in the method. pass in subscription id = &apos;1234-5678-9012-3456&apos; to succeed. </summary>
@ -67,7 +108,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> PostPathLocalValidAsync(string subscriptionId, CancellationToken cancellationToken = default)
{
return await RestClient.PostPathLocalValidAsync(subscriptionId, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SubscriptionInMethodClient.PostPathLocalValid");
scope.Start();
try
{
return await RestClient.PostPathLocalValidAsync(subscriptionId, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> POST method with subscriptionId modeled in the method. pass in subscription id = &apos;1234-5678-9012-3456&apos; to succeed. </summary>
@ -75,7 +126,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response PostPathLocalValid(string subscriptionId, CancellationToken cancellationToken = default)
{
return RestClient.PostPathLocalValid(subscriptionId, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SubscriptionInMethodClient.PostPathLocalValid");
scope.Start();
try
{
return RestClient.PostPathLocalValid(subscriptionId, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> POST method with subscriptionId modeled in the method. pass in subscription id = &apos;1234-5678-9012-3456&apos; to succeed. </summary>
@ -83,7 +144,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> PostSwaggerLocalValidAsync(string subscriptionId, CancellationToken cancellationToken = default)
{
return await RestClient.PostSwaggerLocalValidAsync(subscriptionId, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("SubscriptionInMethodClient.PostSwaggerLocalValid");
scope.Start();
try
{
return await RestClient.PostSwaggerLocalValidAsync(subscriptionId, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> POST method with subscriptionId modeled in the method. pass in subscription id = &apos;1234-5678-9012-3456&apos; to succeed. </summary>
@ -91,7 +162,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response PostSwaggerLocalValid(string subscriptionId, CancellationToken cancellationToken = default)
{
return RestClient.PostSwaggerLocalValid(subscriptionId, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("SubscriptionInMethodClient.PostSwaggerLocalValid");
scope.Start();
try
{
return RestClient.PostSwaggerLocalValid(subscriptionId, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -56,24 +56,14 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(subscriptionId));
}
using var scope = _clientDiagnostics.CreateScope("SubscriptionInMethodClient.PostMethodLocalValid");
scope.Start();
try
using var message = CreatePostMethodLocalValidRequest(subscriptionId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreatePostMethodLocalValidRequest(subscriptionId);
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);
}
}
@ -87,24 +77,14 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(subscriptionId));
}
using var scope = _clientDiagnostics.CreateScope("SubscriptionInMethodClient.PostMethodLocalValid");
scope.Start();
try
using var message = CreatePostMethodLocalValidRequest(subscriptionId);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreatePostMethodLocalValidRequest(subscriptionId);
_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);
}
}
@ -131,24 +111,14 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(subscriptionId));
}
using var scope = _clientDiagnostics.CreateScope("SubscriptionInMethodClient.PostMethodLocalNull");
scope.Start();
try
using var message = CreatePostMethodLocalNullRequest(subscriptionId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreatePostMethodLocalNullRequest(subscriptionId);
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);
}
}
@ -162,24 +132,14 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(subscriptionId));
}
using var scope = _clientDiagnostics.CreateScope("SubscriptionInMethodClient.PostMethodLocalNull");
scope.Start();
try
using var message = CreatePostMethodLocalNullRequest(subscriptionId);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreatePostMethodLocalNullRequest(subscriptionId);
_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);
}
}
@ -206,24 +166,14 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(subscriptionId));
}
using var scope = _clientDiagnostics.CreateScope("SubscriptionInMethodClient.PostPathLocalValid");
scope.Start();
try
using var message = CreatePostPathLocalValidRequest(subscriptionId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreatePostPathLocalValidRequest(subscriptionId);
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);
}
}
@ -237,24 +187,14 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(subscriptionId));
}
using var scope = _clientDiagnostics.CreateScope("SubscriptionInMethodClient.PostPathLocalValid");
scope.Start();
try
using var message = CreatePostPathLocalValidRequest(subscriptionId);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreatePostPathLocalValidRequest(subscriptionId);
_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);
}
}
@ -281,24 +221,14 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(subscriptionId));
}
using var scope = _clientDiagnostics.CreateScope("SubscriptionInMethodClient.PostSwaggerLocalValid");
scope.Start();
try
using var message = CreatePostSwaggerLocalValidRequest(subscriptionId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreatePostSwaggerLocalValidRequest(subscriptionId);
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);
}
}
@ -312,24 +242,14 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(subscriptionId));
}
using var scope = _clientDiagnostics.CreateScope("SubscriptionInMethodClient.PostSwaggerLocalValid");
scope.Start();
try
using var message = CreatePostSwaggerLocalValidRequest(subscriptionId);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreatePostSwaggerLocalValidRequest(subscriptionId);
_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);
}
}
}

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

@ -5,6 +5,7 @@
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
@ -34,14 +35,34 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> GetAsync(CancellationToken cancellationToken = default)
{
return await RestClient.GetAsync(cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("XMsClientRequestIdClient.Get");
scope.Start();
try
{
return await RestClient.GetAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response Get(CancellationToken cancellationToken = default)
{
return RestClient.Get(cancellationToken);
using var scope = _clientDiagnostics.CreateScope("XMsClientRequestIdClient.Get");
scope.Start();
try
{
return RestClient.Get(cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. </summary>
@ -49,7 +70,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> ParamGetAsync(string xMsClientRequestId, CancellationToken cancellationToken = default)
{
return await RestClient.ParamGetAsync(xMsClientRequestId, cancellationToken).ConfigureAwait(false);
using var scope = _clientDiagnostics.CreateScope("XMsClientRequestIdClient.ParamGet");
scope.Start();
try
{
return await RestClient.ParamGetAsync(xMsClientRequestId, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. </summary>
@ -57,7 +88,17 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response ParamGet(string xMsClientRequestId, CancellationToken cancellationToken = default)
{
return RestClient.ParamGet(xMsClientRequestId, cancellationToken);
using var scope = _clientDiagnostics.CreateScope("XMsClientRequestIdClient.ParamGet");
scope.Start();
try
{
return RestClient.ParamGet(xMsClientRequestId, cancellationToken);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

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

@ -49,24 +49,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response> GetAsync(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("XMsClientRequestIdClient.Get");
scope.Start();
try
using var message = CreateGetRequest();
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateGetRequest();
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);
}
}
@ -74,24 +64,14 @@ namespace azure_special_properties
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response Get(CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("XMsClientRequestIdClient.Get");
scope.Start();
try
using var message = CreateGetRequest();
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateGetRequest();
_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);
}
}
@ -118,24 +98,14 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(xMsClientRequestId));
}
using var scope = _clientDiagnostics.CreateScope("XMsClientRequestIdClient.ParamGet");
scope.Start();
try
using var message = CreateParamGetRequest(xMsClientRequestId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
using var message = CreateParamGetRequest(xMsClientRequestId);
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);
}
}
@ -149,24 +119,14 @@ namespace azure_special_properties
throw new ArgumentNullException(nameof(xMsClientRequestId));
}
using var scope = _clientDiagnostics.CreateScope("XMsClientRequestIdClient.ParamGet");
scope.Start();
try
using var message = CreateParamGetRequest(xMsClientRequestId);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
using var message = CreateParamGetRequest(xMsClientRequestId);
_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);
}
}
}

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

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

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше