Temporary disable client version generation (#712)
This commit is contained in:
Родитель
ee2ea0e63d
Коммит
66317f57ef
|
@ -33,7 +33,7 @@ namespace Azure.Management.Storage
|
|||
options ??= new StorageManagementClientOptions();
|
||||
_clientDiagnostics = new ClientDiagnostics(options);
|
||||
_pipeline = ManagementPipelineBuilder.Build(tokenCredential, options);
|
||||
RestClient = new BlobContainersRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId, apiVersion: options.Version);
|
||||
RestClient = new BlobContainersRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId);
|
||||
}
|
||||
|
||||
/// <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>
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Azure.Management.Storage
|
|||
options ??= new StorageManagementClientOptions();
|
||||
_clientDiagnostics = new ClientDiagnostics(options);
|
||||
_pipeline = ManagementPipelineBuilder.Build(tokenCredential, options);
|
||||
RestClient = new BlobServicesRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId, apiVersion: options.Version);
|
||||
RestClient = new BlobServicesRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId);
|
||||
}
|
||||
|
||||
/// <summary> Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. </summary>
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Azure.Management.Storage
|
|||
options ??= new StorageManagementClientOptions();
|
||||
_clientDiagnostics = new ClientDiagnostics(options);
|
||||
_pipeline = ManagementPipelineBuilder.Build(tokenCredential, options);
|
||||
RestClient = new EncryptionScopesRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId, apiVersion: options.Version);
|
||||
RestClient = new EncryptionScopesRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId);
|
||||
}
|
||||
|
||||
/// <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>
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace Azure.Management.Storage
|
|||
options ??= new StorageManagementClientOptions();
|
||||
_clientDiagnostics = new ClientDiagnostics(options);
|
||||
_pipeline = ManagementPipelineBuilder.Build(tokenCredential, options);
|
||||
RestClient = new FileServicesRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId, apiVersion: options.Version);
|
||||
RestClient = new FileServicesRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId);
|
||||
}
|
||||
|
||||
/// <summary> List all file services in storage accounts. </summary>
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace Azure.Management.Storage
|
|||
options ??= new StorageManagementClientOptions();
|
||||
_clientDiagnostics = new ClientDiagnostics(options);
|
||||
_pipeline = ManagementPipelineBuilder.Build(tokenCredential, options);
|
||||
RestClient = new FileSharesRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId, apiVersion: options.Version);
|
||||
RestClient = new FileSharesRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId);
|
||||
}
|
||||
|
||||
/// <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>
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace Azure.Management.Storage
|
|||
options ??= new StorageManagementClientOptions();
|
||||
_clientDiagnostics = new ClientDiagnostics(options);
|
||||
_pipeline = ManagementPipelineBuilder.Build(tokenCredential, options);
|
||||
RestClient = new ManagementPoliciesRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId, apiVersion: options.Version);
|
||||
RestClient = new ManagementPoliciesRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId);
|
||||
}
|
||||
|
||||
/// <summary> Gets the managementpolicy associated with the specified storage account. </summary>
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace Azure.Management.Storage
|
|||
options ??= new StorageManagementClientOptions();
|
||||
_clientDiagnostics = new ClientDiagnostics(options);
|
||||
_pipeline = ManagementPipelineBuilder.Build(tokenCredential, options);
|
||||
RestClient = new OperationsRestClient(_clientDiagnostics, _pipeline, apiVersion: options.Version);
|
||||
RestClient = new OperationsRestClient(_clientDiagnostics, _pipeline);
|
||||
}
|
||||
|
||||
/// <summary> Lists all of the available Storage Rest API operations. </summary>
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace Azure.Management.Storage
|
|||
options ??= new StorageManagementClientOptions();
|
||||
_clientDiagnostics = new ClientDiagnostics(options);
|
||||
_pipeline = ManagementPipelineBuilder.Build(tokenCredential, options);
|
||||
RestClient = new PrivateEndpointConnectionsRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId, apiVersion: options.Version);
|
||||
RestClient = new PrivateEndpointConnectionsRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId);
|
||||
}
|
||||
|
||||
/// <summary> Gets the specified private endpoint connection associated with the storage account. </summary>
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace Azure.Management.Storage
|
|||
options ??= new StorageManagementClientOptions();
|
||||
_clientDiagnostics = new ClientDiagnostics(options);
|
||||
_pipeline = ManagementPipelineBuilder.Build(tokenCredential, options);
|
||||
RestClient = new PrivateLinkResourcesRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId, apiVersion: options.Version);
|
||||
RestClient = new PrivateLinkResourcesRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId);
|
||||
}
|
||||
|
||||
/// <summary> Gets the private link resources that need to be created for a storage account. </summary>
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace Azure.Management.Storage
|
|||
options ??= new StorageManagementClientOptions();
|
||||
_clientDiagnostics = new ClientDiagnostics(options);
|
||||
_pipeline = ManagementPipelineBuilder.Build(tokenCredential, options);
|
||||
RestClient = new SkusRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId, apiVersion: options.Version);
|
||||
RestClient = new SkusRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId);
|
||||
}
|
||||
|
||||
/// <summary> Lists the available SKUs supported by Microsoft.Storage for given subscription. </summary>
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace Azure.Management.Storage
|
|||
options ??= new StorageManagementClientOptions();
|
||||
_clientDiagnostics = new ClientDiagnostics(options);
|
||||
_pipeline = ManagementPipelineBuilder.Build(tokenCredential, options);
|
||||
RestClient = new StorageAccountsRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId, apiVersion: options.Version);
|
||||
RestClient = new StorageAccountsRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId);
|
||||
}
|
||||
|
||||
/// <summary> Checks that the storage account name is valid and is not already in use. </summary>
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using Azure.Core;
|
||||
|
||||
namespace Azure.Management.Storage
|
||||
|
@ -13,22 +12,5 @@ namespace Azure.Management.Storage
|
|||
/// <summary> Client options for Storage. </summary>
|
||||
public class StorageManagementClientOptions : ClientOptions
|
||||
{
|
||||
private const ServiceVersion LatestVersion = ServiceVersion.V2019_06_01;
|
||||
/// <summary> The version of the service to use. </summary>
|
||||
public enum ServiceVersion
|
||||
{
|
||||
/// <summary> Service version "2019-06-01". </summary>
|
||||
V2019_06_01 = 1,
|
||||
}
|
||||
internal string Version { get; }
|
||||
/// <summary> Initializes new instance of StorageManagementClientOptions. </summary>
|
||||
public StorageManagementClientOptions(ServiceVersion version = LatestVersion)
|
||||
{
|
||||
Version = version switch
|
||||
{
|
||||
ServiceVersion.V2019_06_01 => "2019-06-01",
|
||||
_ => throw new NotSupportedException()
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Azure.Management.Storage
|
|||
options ??= new StorageManagementClientOptions();
|
||||
_clientDiagnostics = new ClientDiagnostics(options);
|
||||
_pipeline = ManagementPipelineBuilder.Build(tokenCredential, options);
|
||||
RestClient = new UsagesRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId, apiVersion: options.Version);
|
||||
RestClient = new UsagesRestClient(_clientDiagnostics, _pipeline, subscriptionId: subscriptionId);
|
||||
}
|
||||
|
||||
/// <summary> Gets the current usage count and the limit for the resources of the location under the subscription. </summary>
|
||||
|
|
|
@ -100,49 +100,12 @@ namespace AutoRest.CSharp.V3.AutoRest.Plugins
|
|||
public static void WriteClientOptions(CodeWriter writer, BuildContext context)
|
||||
{
|
||||
var title = context.Configuration.LibraryName;
|
||||
var apiVersions = context.CodeModel.OperationGroups
|
||||
.SelectMany(g => g.Operations.SelectMany(o => o.ApiVersions))
|
||||
.Select(v => v.Version)
|
||||
.Distinct()
|
||||
.OrderBy(v => v)
|
||||
.Select(v=> (Version: v, Name: ToVersionProperty(v)))
|
||||
.ToArray();
|
||||
|
||||
using (writer.Scope($"namespace {context.Configuration.Namespace}"))
|
||||
{
|
||||
writer.WriteXmlDocumentationSummary($"Client options for {title}.");
|
||||
using (writer.Scope($"public class {title}ManagementClientOptions: {typeof(ClientOptions)}"))
|
||||
{
|
||||
writer.Line($"private const ServiceVersion LatestVersion = ServiceVersion.{apiVersions.Last().Name};");
|
||||
|
||||
writer.WriteXmlDocumentationSummary("The version of the service to use.");
|
||||
using (writer.Scope($"public enum ServiceVersion"))
|
||||
{
|
||||
int i = 1;
|
||||
foreach (var apiVersion in apiVersions)
|
||||
{
|
||||
writer.WriteXmlDocumentationSummary($"Service version \"{apiVersion.Version}\"");
|
||||
writer.Line($"{apiVersion.Name} = {i:L},");
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
writer.Line($"internal string Version {{ get; }}");
|
||||
|
||||
writer.WriteXmlDocumentationSummary($"Initializes new instance of {title}ManagementClientOptions.");
|
||||
using (writer.Scope($"public {title}ManagementClientOptions(ServiceVersion version = LatestVersion)"))
|
||||
{
|
||||
writer.Append($"Version = version ");
|
||||
using (writer.Scope($"switch", end: "};"))
|
||||
{
|
||||
foreach (var apiVersion in apiVersions)
|
||||
{
|
||||
writer.Line($"ServiceVersion.{apiVersion.Name} => {apiVersion.Version:L},");
|
||||
}
|
||||
|
||||
writer.Line($"_ => throw new {typeof(NotSupportedException)}()");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,17 +110,13 @@ namespace AutoRest.CSharp.V3.Generation.Writers
|
|||
|
||||
foreach (Parameter parameter in client.RestClient.Parameters)
|
||||
{
|
||||
if (ManagementClientWriterHelpers.IsHostParameter(parameter))
|
||||
// Skip host and API Version parameters that would be set later
|
||||
if (ManagementClientWriterHelpers.IsHostParameter(parameter) ||
|
||||
ManagementClientWriterHelpers.IsApiVersionParameter(parameter))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ManagementClientWriterHelpers.IsApiVersionParameter(parameter))
|
||||
{
|
||||
writer.Append($"{parameter.Name}: options.Version, ");
|
||||
continue;
|
||||
}
|
||||
|
||||
writer.Append($"{parameter.Name}: {parameter.Name:I}, ");
|
||||
}
|
||||
writer.RemoveTrailingComma();
|
||||
|
|
Загрузка…
Ссылка в новой задаче