Rename REST clients along with the public ones (#694)
This commit is contained in:
Родитель
bb898ec8eb
Коммит
9c520415f8
|
@ -1,22 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
// <auto-generated/>
|
||||
|
||||
#nullable disable
|
||||
|
||||
using Azure;
|
||||
using Azure.Core;
|
||||
|
||||
namespace Azure.Storage.Tables
|
||||
{
|
||||
internal class TableInsertEntityHeaders
|
||||
{
|
||||
private readonly Response _response;
|
||||
public TableInsertEntityHeaders(Response response)
|
||||
{
|
||||
_response = response;
|
||||
}
|
||||
public string XMsVersion => _response.Headers.TryGetValue("x-ms-version", out string value) ? value : null;
|
||||
}
|
||||
}
|
|
@ -14,12 +14,12 @@ using Azure.Storage.Tables.Models;
|
|||
|
||||
namespace Azure.Storage.Tables
|
||||
{
|
||||
/// <summary> The Table service client. </summary>
|
||||
/// <summary> The TableInternal service client. </summary>
|
||||
internal partial class TableInternalClient
|
||||
{
|
||||
private readonly ClientDiagnostics _clientDiagnostics;
|
||||
private readonly HttpPipeline _pipeline;
|
||||
internal TableRestClient RestClient { get; }
|
||||
internal TableInternalRestClient RestClient { get; }
|
||||
/// <summary> Initializes a new instance of TableInternalClient for mocking. </summary>
|
||||
protected TableInternalClient()
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ namespace Azure.Storage.Tables
|
|||
/// <summary> Initializes a new instance of TableInternalClient. </summary>
|
||||
internal TableInternalClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string url, string version = "2018-10-10")
|
||||
{
|
||||
RestClient = new TableRestClient(clientDiagnostics, pipeline, url, version);
|
||||
RestClient = new TableInternalRestClient(clientDiagnostics, pipeline, url, version);
|
||||
_clientDiagnostics = clientDiagnostics;
|
||||
_pipeline = pipeline;
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@ using Azure.Core;
|
|||
|
||||
namespace Azure.Storage.Tables
|
||||
{
|
||||
internal class TableCreateHeaders
|
||||
internal class TableInternalCreateHeaders
|
||||
{
|
||||
private readonly Response _response;
|
||||
public TableCreateHeaders(Response response)
|
||||
public TableInternalCreateHeaders(Response response)
|
||||
{
|
||||
_response = response;
|
||||
}
|
|
@ -10,10 +10,10 @@ using Azure.Core;
|
|||
|
||||
namespace Azure.Storage.Tables
|
||||
{
|
||||
internal class TableDeleteHeaders
|
||||
internal class TableInternalDeleteEntityHeaders
|
||||
{
|
||||
private readonly Response _response;
|
||||
public TableDeleteHeaders(Response response)
|
||||
public TableInternalDeleteEntityHeaders(Response response)
|
||||
{
|
||||
_response = response;
|
||||
}
|
|
@ -10,10 +10,10 @@ using Azure.Core;
|
|||
|
||||
namespace Azure.Storage.Tables
|
||||
{
|
||||
internal class TableDeleteEntityHeaders
|
||||
internal class TableInternalDeleteHeaders
|
||||
{
|
||||
private readonly Response _response;
|
||||
public TableDeleteEntityHeaders(Response response)
|
||||
public TableInternalDeleteHeaders(Response response)
|
||||
{
|
||||
_response = response;
|
||||
}
|
22
samples/Azure.Storage.Tables/Azure.Storage.Tables/Generated/Operations/TableInternalGetAccessPolicyHeaders.cs
сгенерированный
Normal file
22
samples/Azure.Storage.Tables/Azure.Storage.Tables/Generated/Operations/TableInternalGetAccessPolicyHeaders.cs
сгенерированный
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
// <auto-generated/>
|
||||
|
||||
#nullable disable
|
||||
|
||||
using Azure;
|
||||
using Azure.Core;
|
||||
|
||||
namespace Azure.Storage.Tables
|
||||
{
|
||||
internal class TableInternalGetAccessPolicyHeaders
|
||||
{
|
||||
private readonly Response _response;
|
||||
public TableInternalGetAccessPolicyHeaders(Response response)
|
||||
{
|
||||
_response = response;
|
||||
}
|
||||
public string XMsVersion => _response.Headers.TryGetValue("x-ms-version", out string value) ? value : null;
|
||||
}
|
||||
}
|
|
@ -10,10 +10,10 @@ using Azure.Core;
|
|||
|
||||
namespace Azure.Storage.Tables
|
||||
{
|
||||
internal class TableGetAccessPolicyHeaders
|
||||
internal class TableInternalInsertEntityHeaders
|
||||
{
|
||||
private readonly Response _response;
|
||||
public TableGetAccessPolicyHeaders(Response response)
|
||||
public TableInternalInsertEntityHeaders(Response response)
|
||||
{
|
||||
_response = response;
|
||||
}
|
|
@ -10,10 +10,10 @@ using Azure.Core;
|
|||
|
||||
namespace Azure.Storage.Tables
|
||||
{
|
||||
internal class TableQueryHeaders
|
||||
internal class TableInternalQueryEntitiesHeaders
|
||||
{
|
||||
private readonly Response _response;
|
||||
public TableQueryHeaders(Response response)
|
||||
public TableInternalQueryEntitiesHeaders(Response response)
|
||||
{
|
||||
_response = response;
|
||||
}
|
|
@ -10,10 +10,10 @@ using Azure.Core;
|
|||
|
||||
namespace Azure.Storage.Tables
|
||||
{
|
||||
internal class TableQueryEntitiesWithPartitionAndRowKeyHeaders
|
||||
internal class TableInternalQueryEntitiesWithPartitionAndRowKeyHeaders
|
||||
{
|
||||
private readonly Response _response;
|
||||
public TableQueryEntitiesWithPartitionAndRowKeyHeaders(Response response)
|
||||
public TableInternalQueryEntitiesWithPartitionAndRowKeyHeaders(Response response)
|
||||
{
|
||||
_response = response;
|
||||
}
|
|
@ -10,10 +10,10 @@ using Azure.Core;
|
|||
|
||||
namespace Azure.Storage.Tables
|
||||
{
|
||||
internal class TableQueryEntitiesHeaders
|
||||
internal class TableInternalQueryHeaders
|
||||
{
|
||||
private readonly Response _response;
|
||||
public TableQueryEntitiesHeaders(Response response)
|
||||
public TableInternalQueryHeaders(Response response)
|
||||
{
|
||||
_response = response;
|
||||
}
|
|
@ -17,15 +17,15 @@ using Azure.Storage.Tables.Models;
|
|||
|
||||
namespace Azure.Storage.Tables
|
||||
{
|
||||
internal partial class TableRestClient
|
||||
internal partial class TableInternalRestClient
|
||||
{
|
||||
private string url;
|
||||
private string version;
|
||||
private ClientDiagnostics _clientDiagnostics;
|
||||
private HttpPipeline _pipeline;
|
||||
|
||||
/// <summary> Initializes a new instance of TableRestClient. </summary>
|
||||
public TableRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string url, string version = "2018-10-10")
|
||||
/// <summary> Initializes a new instance of TableInternalRestClient. </summary>
|
||||
public TableInternalRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string url, string version = "2018-10-10")
|
||||
{
|
||||
if (url == null)
|
||||
{
|
||||
|
@ -80,15 +80,15 @@ namespace Azure.Storage.Tables
|
|||
/// <param name="requestId"> Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. </param>
|
||||
/// <param name="queryOptions"> Parameter group. </param>
|
||||
/// <param name="cancellationToken"> The cancellation token to use. </param>
|
||||
public async ValueTask<ResponseWithHeaders<TableQueryResponse, TableQueryHeaders>> QueryAsync(string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
public async ValueTask<ResponseWithHeaders<TableQueryResponse, TableInternalQueryHeaders>> QueryAsync(string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
using var scope = _clientDiagnostics.CreateScope("TableClient.Query");
|
||||
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 TableQueryHeaders(message.Response);
|
||||
var headers = new TableInternalQueryHeaders(message.Response);
|
||||
switch (message.Response.Status)
|
||||
{
|
||||
case 200:
|
||||
|
@ -120,15 +120,15 @@ namespace Azure.Storage.Tables
|
|||
/// <param name="requestId"> Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. </param>
|
||||
/// <param name="queryOptions"> Parameter group. </param>
|
||||
/// <param name="cancellationToken"> The cancellation token to use. </param>
|
||||
public ResponseWithHeaders<TableQueryResponse, TableQueryHeaders> Query(string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
public ResponseWithHeaders<TableQueryResponse, TableInternalQueryHeaders> Query(string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
using var scope = _clientDiagnostics.CreateScope("TableClient.Query");
|
||||
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.Query");
|
||||
scope.Start();
|
||||
try
|
||||
{
|
||||
using var message = CreateQueryRequest(requestId, queryOptions);
|
||||
_pipeline.Send(message, cancellationToken);
|
||||
var headers = new TableQueryHeaders(message.Response);
|
||||
var headers = new TableInternalQueryHeaders(message.Response);
|
||||
switch (message.Response.Status)
|
||||
{
|
||||
case 200:
|
||||
|
@ -187,20 +187,20 @@ namespace Azure.Storage.Tables
|
|||
/// <param name="requestId"> Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. </param>
|
||||
/// <param name="queryOptions"> Parameter group. </param>
|
||||
/// <param name="cancellationToken"> The cancellation token to use. </param>
|
||||
public async ValueTask<ResponseWithHeaders<TableResponse, TableCreateHeaders>> CreateAsync(TableProperties tableProperties, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
public async ValueTask<ResponseWithHeaders<TableResponse, TableInternalCreateHeaders>> CreateAsync(TableProperties tableProperties, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (tableProperties == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(tableProperties));
|
||||
}
|
||||
|
||||
using var scope = _clientDiagnostics.CreateScope("TableClient.Create");
|
||||
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 TableCreateHeaders(message.Response);
|
||||
var headers = new TableInternalCreateHeaders(message.Response);
|
||||
switch (message.Response.Status)
|
||||
{
|
||||
case 201:
|
||||
|
@ -218,7 +218,7 @@ namespace Azure.Storage.Tables
|
|||
return ResponseWithHeaders.FromValue(value, headers, message.Response);
|
||||
}
|
||||
case 204:
|
||||
return ResponseWithHeaders.FromValue<TableResponse, TableCreateHeaders>(null, headers, message.Response);
|
||||
return ResponseWithHeaders.FromValue<TableResponse, TableInternalCreateHeaders>(null, headers, message.Response);
|
||||
default:
|
||||
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
|
||||
}
|
||||
|
@ -235,20 +235,20 @@ namespace Azure.Storage.Tables
|
|||
/// <param name="requestId"> Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. </param>
|
||||
/// <param name="queryOptions"> Parameter group. </param>
|
||||
/// <param name="cancellationToken"> The cancellation token to use. </param>
|
||||
public ResponseWithHeaders<TableResponse, TableCreateHeaders> Create(TableProperties tableProperties, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
public ResponseWithHeaders<TableResponse, TableInternalCreateHeaders> Create(TableProperties tableProperties, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (tableProperties == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(tableProperties));
|
||||
}
|
||||
|
||||
using var scope = _clientDiagnostics.CreateScope("TableClient.Create");
|
||||
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.Create");
|
||||
scope.Start();
|
||||
try
|
||||
{
|
||||
using var message = CreateCreateRequest(tableProperties, requestId, queryOptions);
|
||||
_pipeline.Send(message, cancellationToken);
|
||||
var headers = new TableCreateHeaders(message.Response);
|
||||
var headers = new TableInternalCreateHeaders(message.Response);
|
||||
switch (message.Response.Status)
|
||||
{
|
||||
case 201:
|
||||
|
@ -266,7 +266,7 @@ namespace Azure.Storage.Tables
|
|||
return ResponseWithHeaders.FromValue(value, headers, message.Response);
|
||||
}
|
||||
case 204:
|
||||
return ResponseWithHeaders.FromValue<TableResponse, TableCreateHeaders>(null, headers, message.Response);
|
||||
return ResponseWithHeaders.FromValue<TableResponse, TableInternalCreateHeaders>(null, headers, message.Response);
|
||||
default:
|
||||
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
|
||||
}
|
||||
|
@ -301,20 +301,20 @@ namespace Azure.Storage.Tables
|
|||
/// <param name="table"> The name of the table. </param>
|
||||
/// <param name="requestId"> Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. </param>
|
||||
/// <param name="cancellationToken"> The cancellation token to use. </param>
|
||||
public async ValueTask<ResponseWithHeaders<TableDeleteHeaders>> DeleteAsync(string table, string requestId = null, CancellationToken cancellationToken = default)
|
||||
public async ValueTask<ResponseWithHeaders<TableInternalDeleteHeaders>> DeleteAsync(string table, string requestId = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (table == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(table));
|
||||
}
|
||||
|
||||
using var scope = _clientDiagnostics.CreateScope("TableClient.Delete");
|
||||
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 TableDeleteHeaders(message.Response);
|
||||
var headers = new TableInternalDeleteHeaders(message.Response);
|
||||
switch (message.Response.Status)
|
||||
{
|
||||
case 204:
|
||||
|
@ -334,20 +334,20 @@ namespace Azure.Storage.Tables
|
|||
/// <param name="table"> The name of the table. </param>
|
||||
/// <param name="requestId"> Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. </param>
|
||||
/// <param name="cancellationToken"> The cancellation token to use. </param>
|
||||
public ResponseWithHeaders<TableDeleteHeaders> Delete(string table, string requestId = null, CancellationToken cancellationToken = default)
|
||||
public ResponseWithHeaders<TableInternalDeleteHeaders> Delete(string table, string requestId = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (table == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(table));
|
||||
}
|
||||
|
||||
using var scope = _clientDiagnostics.CreateScope("TableClient.Delete");
|
||||
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.Delete");
|
||||
scope.Start();
|
||||
try
|
||||
{
|
||||
using var message = CreateDeleteRequest(table, requestId);
|
||||
_pipeline.Send(message, cancellationToken);
|
||||
var headers = new TableDeleteHeaders(message.Response);
|
||||
var headers = new TableInternalDeleteHeaders(message.Response);
|
||||
switch (message.Response.Status)
|
||||
{
|
||||
case 204:
|
||||
|
@ -409,20 +409,20 @@ namespace Azure.Storage.Tables
|
|||
/// <param name="requestId"> Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. </param>
|
||||
/// <param name="queryOptions"> Parameter group. </param>
|
||||
/// <param name="cancellationToken"> The cancellation token to use. </param>
|
||||
public async ValueTask<ResponseWithHeaders<TableEntityQueryResponse, TableQueryEntitiesHeaders>> QueryEntitiesAsync(string table, int? timeout = null, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
public async ValueTask<ResponseWithHeaders<TableEntityQueryResponse, TableInternalQueryEntitiesHeaders>> QueryEntitiesAsync(string table, int? timeout = null, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (table == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(table));
|
||||
}
|
||||
|
||||
using var scope = _clientDiagnostics.CreateScope("TableClient.QueryEntities");
|
||||
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 TableQueryEntitiesHeaders(message.Response);
|
||||
var headers = new TableInternalQueryEntitiesHeaders(message.Response);
|
||||
switch (message.Response.Status)
|
||||
{
|
||||
case 200:
|
||||
|
@ -456,20 +456,20 @@ namespace Azure.Storage.Tables
|
|||
/// <param name="requestId"> Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. </param>
|
||||
/// <param name="queryOptions"> Parameter group. </param>
|
||||
/// <param name="cancellationToken"> The cancellation token to use. </param>
|
||||
public ResponseWithHeaders<TableEntityQueryResponse, TableQueryEntitiesHeaders> QueryEntities(string table, int? timeout = null, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
public ResponseWithHeaders<TableEntityQueryResponse, TableInternalQueryEntitiesHeaders> QueryEntities(string table, int? timeout = null, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (table == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(table));
|
||||
}
|
||||
|
||||
using var scope = _clientDiagnostics.CreateScope("TableClient.QueryEntities");
|
||||
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 TableQueryEntitiesHeaders(message.Response);
|
||||
var headers = new TableInternalQueryEntitiesHeaders(message.Response);
|
||||
switch (message.Response.Status)
|
||||
{
|
||||
case 200:
|
||||
|
@ -545,7 +545,7 @@ namespace Azure.Storage.Tables
|
|||
/// <param name="requestId"> Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. </param>
|
||||
/// <param name="queryOptions"> Parameter group. </param>
|
||||
/// <param name="cancellationToken"> The cancellation token to use. </param>
|
||||
public async ValueTask<ResponseWithHeaders<TableEntityQueryResponse, TableQueryEntitiesWithPartitionAndRowKeyHeaders>> QueryEntitiesWithPartitionAndRowKeyAsync(string table, string partitionKey, string rowKey, int? timeout = null, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
public async ValueTask<ResponseWithHeaders<TableEntityQueryResponse, TableInternalQueryEntitiesWithPartitionAndRowKeyHeaders>> QueryEntitiesWithPartitionAndRowKeyAsync(string table, string partitionKey, string rowKey, int? timeout = null, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (table == null)
|
||||
{
|
||||
|
@ -560,13 +560,13 @@ namespace Azure.Storage.Tables
|
|||
throw new ArgumentNullException(nameof(rowKey));
|
||||
}
|
||||
|
||||
using var scope = _clientDiagnostics.CreateScope("TableClient.QueryEntitiesWithPartitionAndRowKey");
|
||||
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 TableQueryEntitiesWithPartitionAndRowKeyHeaders(message.Response);
|
||||
var headers = new TableInternalQueryEntitiesWithPartitionAndRowKeyHeaders(message.Response);
|
||||
switch (message.Response.Status)
|
||||
{
|
||||
case 200:
|
||||
|
@ -602,7 +602,7 @@ namespace Azure.Storage.Tables
|
|||
/// <param name="requestId"> Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. </param>
|
||||
/// <param name="queryOptions"> Parameter group. </param>
|
||||
/// <param name="cancellationToken"> The cancellation token to use. </param>
|
||||
public ResponseWithHeaders<TableEntityQueryResponse, TableQueryEntitiesWithPartitionAndRowKeyHeaders> QueryEntitiesWithPartitionAndRowKey(string table, string partitionKey, string rowKey, int? timeout = null, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
public ResponseWithHeaders<TableEntityQueryResponse, TableInternalQueryEntitiesWithPartitionAndRowKeyHeaders> QueryEntitiesWithPartitionAndRowKey(string table, string partitionKey, string rowKey, int? timeout = null, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (table == null)
|
||||
{
|
||||
|
@ -617,13 +617,13 @@ namespace Azure.Storage.Tables
|
|||
throw new ArgumentNullException(nameof(rowKey));
|
||||
}
|
||||
|
||||
using var scope = _clientDiagnostics.CreateScope("TableClient.QueryEntitiesWithPartitionAndRowKey");
|
||||
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 TableQueryEntitiesWithPartitionAndRowKeyHeaders(message.Response);
|
||||
var headers = new TableInternalQueryEntitiesWithPartitionAndRowKeyHeaders(message.Response);
|
||||
switch (message.Response.Status)
|
||||
{
|
||||
case 200:
|
||||
|
@ -705,7 +705,7 @@ namespace Azure.Storage.Tables
|
|||
/// <param name="tableEntityProperties"> The properties for the table entity. </param>
|
||||
/// <param name="queryOptions"> Parameter group. </param>
|
||||
/// <param name="cancellationToken"> The cancellation token to use. </param>
|
||||
public async ValueTask<ResponseWithHeaders<TableUpdateEntityHeaders>> UpdateEntityAsync(string table, string partitionKey, string rowKey, int? timeout = null, string requestId = null, IDictionary<string, object> tableEntityProperties = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
public async ValueTask<ResponseWithHeaders<TableInternalUpdateEntityHeaders>> UpdateEntityAsync(string table, string partitionKey, string rowKey, int? timeout = null, string requestId = null, IDictionary<string, object> tableEntityProperties = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (table == null)
|
||||
{
|
||||
|
@ -720,13 +720,13 @@ namespace Azure.Storage.Tables
|
|||
throw new ArgumentNullException(nameof(rowKey));
|
||||
}
|
||||
|
||||
using var scope = _clientDiagnostics.CreateScope("TableClient.UpdateEntity");
|
||||
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 TableUpdateEntityHeaders(message.Response);
|
||||
var headers = new TableInternalUpdateEntityHeaders(message.Response);
|
||||
switch (message.Response.Status)
|
||||
{
|
||||
case 200:
|
||||
|
@ -751,7 +751,7 @@ namespace Azure.Storage.Tables
|
|||
/// <param name="tableEntityProperties"> The properties for the table entity. </param>
|
||||
/// <param name="queryOptions"> Parameter group. </param>
|
||||
/// <param name="cancellationToken"> The cancellation token to use. </param>
|
||||
public ResponseWithHeaders<TableUpdateEntityHeaders> UpdateEntity(string table, string partitionKey, string rowKey, int? timeout = null, string requestId = null, IDictionary<string, object> tableEntityProperties = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
public ResponseWithHeaders<TableInternalUpdateEntityHeaders> UpdateEntity(string table, string partitionKey, string rowKey, int? timeout = null, string requestId = null, IDictionary<string, object> tableEntityProperties = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (table == null)
|
||||
{
|
||||
|
@ -766,13 +766,13 @@ namespace Azure.Storage.Tables
|
|||
throw new ArgumentNullException(nameof(rowKey));
|
||||
}
|
||||
|
||||
using var scope = _clientDiagnostics.CreateScope("TableClient.UpdateEntity");
|
||||
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 TableUpdateEntityHeaders(message.Response);
|
||||
var headers = new TableInternalUpdateEntityHeaders(message.Response);
|
||||
switch (message.Response.Status)
|
||||
{
|
||||
case 200:
|
||||
|
@ -828,7 +828,7 @@ namespace Azure.Storage.Tables
|
|||
/// <param name="requestId"> Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. </param>
|
||||
/// <param name="queryOptions"> Parameter group. </param>
|
||||
/// <param name="cancellationToken"> The cancellation token to use. </param>
|
||||
public async ValueTask<ResponseWithHeaders<TableDeleteEntityHeaders>> DeleteEntityAsync(string table, string partitionKey, string rowKey, int? timeout = null, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
public async ValueTask<ResponseWithHeaders<TableInternalDeleteEntityHeaders>> DeleteEntityAsync(string table, string partitionKey, string rowKey, int? timeout = null, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (table == null)
|
||||
{
|
||||
|
@ -843,13 +843,13 @@ namespace Azure.Storage.Tables
|
|||
throw new ArgumentNullException(nameof(rowKey));
|
||||
}
|
||||
|
||||
using var scope = _clientDiagnostics.CreateScope("TableClient.DeleteEntity");
|
||||
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 TableDeleteEntityHeaders(message.Response);
|
||||
var headers = new TableInternalDeleteEntityHeaders(message.Response);
|
||||
switch (message.Response.Status)
|
||||
{
|
||||
case 204:
|
||||
|
@ -873,7 +873,7 @@ namespace Azure.Storage.Tables
|
|||
/// <param name="requestId"> Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. </param>
|
||||
/// <param name="queryOptions"> Parameter group. </param>
|
||||
/// <param name="cancellationToken"> The cancellation token to use. </param>
|
||||
public ResponseWithHeaders<TableDeleteEntityHeaders> DeleteEntity(string table, string partitionKey, string rowKey, int? timeout = null, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
public ResponseWithHeaders<TableInternalDeleteEntityHeaders> DeleteEntity(string table, string partitionKey, string rowKey, int? timeout = null, string requestId = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (table == null)
|
||||
{
|
||||
|
@ -888,13 +888,13 @@ namespace Azure.Storage.Tables
|
|||
throw new ArgumentNullException(nameof(rowKey));
|
||||
}
|
||||
|
||||
using var scope = _clientDiagnostics.CreateScope("TableClient.DeleteEntity");
|
||||
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 TableDeleteEntityHeaders(message.Response);
|
||||
var headers = new TableInternalDeleteEntityHeaders(message.Response);
|
||||
switch (message.Response.Status)
|
||||
{
|
||||
case 204:
|
||||
|
@ -957,20 +957,20 @@ namespace Azure.Storage.Tables
|
|||
/// <param name="tableEntityProperties"> The properties for the table entity. </param>
|
||||
/// <param name="queryOptions"> Parameter group. </param>
|
||||
/// <param name="cancellationToken"> The cancellation token to use. </param>
|
||||
public async ValueTask<ResponseWithHeaders<IReadOnlyDictionary<string, object>, TableInsertEntityHeaders>> InsertEntityAsync(string table, int? timeout = null, string requestId = null, IDictionary<string, object> tableEntityProperties = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
public async ValueTask<ResponseWithHeaders<IReadOnlyDictionary<string, object>, TableInternalInsertEntityHeaders>> InsertEntityAsync(string table, int? timeout = null, string requestId = null, IDictionary<string, object> tableEntityProperties = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (table == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(table));
|
||||
}
|
||||
|
||||
using var scope = _clientDiagnostics.CreateScope("TableClient.InsertEntity");
|
||||
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 TableInsertEntityHeaders(message.Response);
|
||||
var headers = new TableInternalInsertEntityHeaders(message.Response);
|
||||
switch (message.Response.Status)
|
||||
{
|
||||
case 201:
|
||||
|
@ -1017,20 +1017,20 @@ namespace Azure.Storage.Tables
|
|||
/// <param name="tableEntityProperties"> The properties for the table entity. </param>
|
||||
/// <param name="queryOptions"> Parameter group. </param>
|
||||
/// <param name="cancellationToken"> The cancellation token to use. </param>
|
||||
public ResponseWithHeaders<IReadOnlyDictionary<string, object>, TableInsertEntityHeaders> InsertEntity(string table, int? timeout = null, string requestId = null, IDictionary<string, object> tableEntityProperties = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
public ResponseWithHeaders<IReadOnlyDictionary<string, object>, TableInternalInsertEntityHeaders> InsertEntity(string table, int? timeout = null, string requestId = null, IDictionary<string, object> tableEntityProperties = null, QueryOptions queryOptions = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (table == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(table));
|
||||
}
|
||||
|
||||
using var scope = _clientDiagnostics.CreateScope("TableClient.InsertEntity");
|
||||
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 TableInsertEntityHeaders(message.Response);
|
||||
var headers = new TableInternalInsertEntityHeaders(message.Response);
|
||||
switch (message.Response.Status)
|
||||
{
|
||||
case 201:
|
||||
|
@ -1098,20 +1098,20 @@ namespace Azure.Storage.Tables
|
|||
/// <param name="timeout"> The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. </param>
|
||||
/// <param name="requestId"> Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. </param>
|
||||
/// <param name="cancellationToken"> The cancellation token to use. </param>
|
||||
public async ValueTask<ResponseWithHeaders<IReadOnlyList<SignedIdentifier>, TableGetAccessPolicyHeaders>> GetAccessPolicyAsync(string table, int? timeout = null, string requestId = null, CancellationToken cancellationToken = default)
|
||||
public async ValueTask<ResponseWithHeaders<IReadOnlyList<SignedIdentifier>, TableInternalGetAccessPolicyHeaders>> GetAccessPolicyAsync(string table, int? timeout = null, string requestId = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (table == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(table));
|
||||
}
|
||||
|
||||
using var scope = _clientDiagnostics.CreateScope("TableClient.GetAccessPolicy");
|
||||
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 TableGetAccessPolicyHeaders(message.Response);
|
||||
var headers = new TableInternalGetAccessPolicyHeaders(message.Response);
|
||||
switch (message.Response.Status)
|
||||
{
|
||||
case 200:
|
||||
|
@ -1145,20 +1145,20 @@ namespace Azure.Storage.Tables
|
|||
/// <param name="timeout"> The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. </param>
|
||||
/// <param name="requestId"> Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. </param>
|
||||
/// <param name="cancellationToken"> The cancellation token to use. </param>
|
||||
public ResponseWithHeaders<IReadOnlyList<SignedIdentifier>, TableGetAccessPolicyHeaders> GetAccessPolicy(string table, int? timeout = null, string requestId = null, CancellationToken cancellationToken = default)
|
||||
public ResponseWithHeaders<IReadOnlyList<SignedIdentifier>, TableInternalGetAccessPolicyHeaders> GetAccessPolicy(string table, int? timeout = null, string requestId = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (table == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(table));
|
||||
}
|
||||
|
||||
using var scope = _clientDiagnostics.CreateScope("TableClient.GetAccessPolicy");
|
||||
using var scope = _clientDiagnostics.CreateScope("TableInternalClient.GetAccessPolicy");
|
||||
scope.Start();
|
||||
try
|
||||
{
|
||||
using var message = CreateGetAccessPolicyRequest(table, timeout, requestId);
|
||||
_pipeline.Send(message, cancellationToken);
|
||||
var headers = new TableGetAccessPolicyHeaders(message.Response);
|
||||
var headers = new TableInternalGetAccessPolicyHeaders(message.Response);
|
||||
switch (message.Response.Status)
|
||||
{
|
||||
case 200:
|
||||
|
@ -1228,20 +1228,20 @@ namespace Azure.Storage.Tables
|
|||
/// <param name="requestId"> Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. </param>
|
||||
/// <param name="tableAcl"> the acls for the table. </param>
|
||||
/// <param name="cancellationToken"> The cancellation token to use. </param>
|
||||
public async ValueTask<ResponseWithHeaders<TableSetAccessPolicyHeaders>> SetAccessPolicyAsync(string table, int? timeout = null, string requestId = null, IEnumerable<SignedIdentifier> tableAcl = null, CancellationToken cancellationToken = default)
|
||||
public async ValueTask<ResponseWithHeaders<TableInternalSetAccessPolicyHeaders>> SetAccessPolicyAsync(string table, int? timeout = null, string requestId = null, IEnumerable<SignedIdentifier> tableAcl = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (table == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(table));
|
||||
}
|
||||
|
||||
using var scope = _clientDiagnostics.CreateScope("TableClient.SetAccessPolicy");
|
||||
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 TableSetAccessPolicyHeaders(message.Response);
|
||||
var headers = new TableInternalSetAccessPolicyHeaders(message.Response);
|
||||
switch (message.Response.Status)
|
||||
{
|
||||
case 204:
|
||||
|
@ -1263,20 +1263,20 @@ namespace Azure.Storage.Tables
|
|||
/// <param name="requestId"> Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. </param>
|
||||
/// <param name="tableAcl"> the acls for the table. </param>
|
||||
/// <param name="cancellationToken"> The cancellation token to use. </param>
|
||||
public ResponseWithHeaders<TableSetAccessPolicyHeaders> SetAccessPolicy(string table, int? timeout = null, string requestId = null, IEnumerable<SignedIdentifier> tableAcl = null, CancellationToken cancellationToken = default)
|
||||
public ResponseWithHeaders<TableInternalSetAccessPolicyHeaders> SetAccessPolicy(string table, int? timeout = null, string requestId = null, IEnumerable<SignedIdentifier> tableAcl = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (table == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(table));
|
||||
}
|
||||
|
||||
using var scope = _clientDiagnostics.CreateScope("TableClient.SetAccessPolicy");
|
||||
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 TableSetAccessPolicyHeaders(message.Response);
|
||||
var headers = new TableInternalSetAccessPolicyHeaders(message.Response);
|
||||
switch (message.Response.Status)
|
||||
{
|
||||
case 204:
|
22
samples/Azure.Storage.Tables/Azure.Storage.Tables/Generated/Operations/TableInternalSetAccessPolicyHeaders.cs
сгенерированный
Normal file
22
samples/Azure.Storage.Tables/Azure.Storage.Tables/Generated/Operations/TableInternalSetAccessPolicyHeaders.cs
сгенерированный
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
// <auto-generated/>
|
||||
|
||||
#nullable disable
|
||||
|
||||
using Azure;
|
||||
using Azure.Core;
|
||||
|
||||
namespace Azure.Storage.Tables
|
||||
{
|
||||
internal class TableInternalSetAccessPolicyHeaders
|
||||
{
|
||||
private readonly Response _response;
|
||||
public TableInternalSetAccessPolicyHeaders(Response response)
|
||||
{
|
||||
_response = response;
|
||||
}
|
||||
public string XMsVersion => _response.Headers.TryGetValue("x-ms-version", out string value) ? value : null;
|
||||
}
|
||||
}
|
22
samples/Azure.Storage.Tables/Azure.Storage.Tables/Generated/Operations/TableInternalUpdateEntityHeaders.cs
сгенерированный
Normal file
22
samples/Azure.Storage.Tables/Azure.Storage.Tables/Generated/Operations/TableInternalUpdateEntityHeaders.cs
сгенерированный
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
// <auto-generated/>
|
||||
|
||||
#nullable disable
|
||||
|
||||
using Azure;
|
||||
using Azure.Core;
|
||||
|
||||
namespace Azure.Storage.Tables
|
||||
{
|
||||
internal class TableInternalUpdateEntityHeaders
|
||||
{
|
||||
private readonly Response _response;
|
||||
public TableInternalUpdateEntityHeaders(Response response)
|
||||
{
|
||||
_response = response;
|
||||
}
|
||||
public string XMsVersion => _response.Headers.TryGetValue("x-ms-version", out string value) ? value : null;
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
// <auto-generated/>
|
||||
|
||||
#nullable disable
|
||||
|
||||
using Azure;
|
||||
using Azure.Core;
|
||||
|
||||
namespace Azure.Storage.Tables
|
||||
{
|
||||
internal class TableSetAccessPolicyHeaders
|
||||
{
|
||||
private readonly Response _response;
|
||||
public TableSetAccessPolicyHeaders(Response response)
|
||||
{
|
||||
_response = response;
|
||||
}
|
||||
public string XMsVersion => _response.Headers.TryGetValue("x-ms-version", out string value) ? value : null;
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
// <auto-generated/>
|
||||
|
||||
#nullable disable
|
||||
|
||||
using Azure;
|
||||
using Azure.Core;
|
||||
|
||||
namespace Azure.Storage.Tables
|
||||
{
|
||||
internal class TableUpdateEntityHeaders
|
||||
{
|
||||
private readonly Response _response;
|
||||
public TableUpdateEntityHeaders(Response response)
|
||||
{
|
||||
_response = response;
|
||||
}
|
||||
public string XMsVersion => _response.Headers.TryGetValue("x-ms-version", out string value) ? value : null;
|
||||
}
|
||||
}
|
|
@ -23,6 +23,7 @@ namespace AutoRest.CSharp.V3.Output.Builders
|
|||
{
|
||||
internal class ClientBuilder
|
||||
{
|
||||
private const string _clientSuffix = "Client";
|
||||
private static string[] _knownResponseHeaders = new[]
|
||||
{
|
||||
"Date",
|
||||
|
@ -44,8 +45,13 @@ namespace AutoRest.CSharp.V3.Output.Builders
|
|||
|
||||
public (Client Client, RestClient RestClient) BuildClient(OperationGroup operationGroup)
|
||||
{
|
||||
var clientPrefix = GetClientName(operationGroup);
|
||||
var clientName = clientPrefix + "Client";
|
||||
var clientPrefix = GetClientPrefix(operationGroup.Language.Default.Name);
|
||||
var clientName = clientPrefix + _clientSuffix;
|
||||
var existingClient = _context.SourceInputModel.FindForClient(_context.DefaultNamespace, clientName);
|
||||
|
||||
// Update the client name and prefix based on the existing type is available
|
||||
clientName = existingClient?.ExistingType.Name ?? clientName;
|
||||
clientPrefix = GetClientPrefix(clientName);
|
||||
|
||||
var clientParameters = operationGroup.Operations
|
||||
.SelectMany(op => op.Parameters.Concat(op.Requests.SelectMany(r => r.Parameters)))
|
||||
|
@ -139,7 +145,6 @@ namespace AutoRest.CSharp.V3.Output.Builders
|
|||
OrderParameters(clientParameters.Values),
|
||||
methods);
|
||||
|
||||
var existingClient = _context.SourceInputModel.FindForClient(_context.DefaultNamespace, clientName);
|
||||
var client = new Client(
|
||||
BuilderHelpers.CreateTypeAttributes(clientName, _context.DefaultNamespace, "public", existingClient?.ExistingType),
|
||||
BuilderHelpers.EscapeXmlDescription(CreateDescription(operationGroup, clientPrefix)),
|
||||
|
@ -151,9 +156,8 @@ namespace AutoRest.CSharp.V3.Output.Builders
|
|||
return (client, restClient);
|
||||
}
|
||||
|
||||
private string GetClientName(OperationGroup operationGroup)
|
||||
private string GetClientPrefix(string name)
|
||||
{
|
||||
var name = operationGroup.Language.Default.Name;
|
||||
name = string.IsNullOrEmpty(name) ? "Service" : name.ToCleanName();
|
||||
|
||||
var operationsSuffix = "Operations";
|
||||
|
@ -162,6 +166,12 @@ namespace AutoRest.CSharp.V3.Output.Builders
|
|||
name = name.Substring(0, name.Length - operationsSuffix.Length);
|
||||
}
|
||||
|
||||
var clientSuffix = _clientSuffix;
|
||||
if (name.EndsWith(clientSuffix) && name.Length > clientSuffix.Length)
|
||||
{
|
||||
name = name.Substring(0, name.Length - clientSuffix.Length);
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.Reflection;
|
|||
using NamespaceForEnums;
|
||||
using CustomNamespace;
|
||||
using NUnit.Framework;
|
||||
using TypeSchemaMapping;
|
||||
using TypeSchemaMapping.Models;
|
||||
|
||||
namespace AutoRest.TestServer.Tests
|
||||
|
@ -79,5 +80,12 @@ namespace AutoRest.TestServer.Tests
|
|||
|
||||
Assert.That(modelType.GetConstructors().Where(c => c.GetParameters().Length == 2), Is.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ClientsAreMappedToTypes()
|
||||
{
|
||||
Assert.AreEqual("MainClient", typeof(MainClient).Name);
|
||||
Assert.AreEqual("MainRestClient", typeof(MainRestClient).Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,12 +14,12 @@ using TypeSchemaMapping.Models;
|
|||
|
||||
namespace CustomNamespace
|
||||
{
|
||||
/// <summary> The Service service client. </summary>
|
||||
/// <summary> The Main service client. </summary>
|
||||
internal partial class MainClient
|
||||
{
|
||||
private readonly ClientDiagnostics _clientDiagnostics;
|
||||
private readonly HttpPipeline _pipeline;
|
||||
internal ServiceRestClient RestClient { get; }
|
||||
internal MainRestClient RestClient { get; }
|
||||
/// <summary> Initializes a new instance of MainClient for mocking. </summary>
|
||||
protected MainClient()
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ namespace CustomNamespace
|
|||
/// <summary> Initializes a new instance of MainClient. </summary>
|
||||
internal MainClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string host = "http://localhost:3000")
|
||||
{
|
||||
RestClient = new ServiceRestClient(clientDiagnostics, pipeline, host);
|
||||
RestClient = new MainRestClient(clientDiagnostics, pipeline, host);
|
||||
_clientDiagnostics = clientDiagnostics;
|
||||
_pipeline = pipeline;
|
||||
}
|
||||
|
|
|
@ -17,14 +17,14 @@ using TypeSchemaMapping.Models;
|
|||
|
||||
namespace TypeSchemaMapping
|
||||
{
|
||||
internal partial class ServiceRestClient
|
||||
internal partial class MainRestClient
|
||||
{
|
||||
private string host;
|
||||
private ClientDiagnostics _clientDiagnostics;
|
||||
private HttpPipeline _pipeline;
|
||||
|
||||
/// <summary> Initializes a new instance of ServiceRestClient. </summary>
|
||||
public ServiceRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string host = "http://localhost:3000")
|
||||
/// <summary> Initializes a new instance of MainRestClient. </summary>
|
||||
public MainRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string host = "http://localhost:3000")
|
||||
{
|
||||
if (host == null)
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ 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("ServiceClient.Operation");
|
||||
using var scope = _clientDiagnostics.CreateScope("MainClient.Operation");
|
||||
scope.Start();
|
||||
try
|
||||
{
|
||||
|
@ -96,7 +96,7 @@ 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("ServiceClient.Operation");
|
||||
using var scope = _clientDiagnostics.CreateScope("MainClient.Operation");
|
||||
scope.Start();
|
||||
try
|
||||
{
|
||||
|
@ -152,7 +152,7 @@ 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("ServiceClient.OperationStruct");
|
||||
using var scope = _clientDiagnostics.CreateScope("MainClient.OperationStruct");
|
||||
scope.Start();
|
||||
try
|
||||
{
|
||||
|
@ -182,7 +182,7 @@ 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("ServiceClient.OperationStruct");
|
||||
using var scope = _clientDiagnostics.CreateScope("MainClient.OperationStruct");
|
||||
scope.Start();
|
||||
try
|
||||
{
|
||||
|
@ -231,7 +231,7 @@ 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("ServiceClient.OperationSecondModel");
|
||||
using var scope = _clientDiagnostics.CreateScope("MainClient.OperationSecondModel");
|
||||
scope.Start();
|
||||
try
|
||||
{
|
||||
|
@ -268,7 +268,7 @@ 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("ServiceClient.OperationSecondModel");
|
||||
using var scope = _clientDiagnostics.CreateScope("MainClient.OperationSecondModel");
|
||||
scope.Start();
|
||||
try
|
||||
{
|
Загрузка…
Ссылка в новой задаче