From e02f379cdf1f8f98e8b48feac313156370a410b5 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 5 Aug 2022 09:04:26 +0000 Subject: [PATCH] CodeGen from PR 20092 in Azure/azure-rest-api-specs migrate to .net track 2 batch 2 (#20092) --- ...re.ResourceManager.MySql.netstandard2.0.cs | 12 +- .../Extensions/FlexibleServersExtensions.cs | 52 ++++++-- .../SubscriptionResourceExtensionClient.cs | 62 +++++++++- ...rNameAvailabilityRequest.Serialization.cs} | 2 +- ...lFlexibleServerNameAvailabilityRequest.cs} | 6 +- ...lNetworkSubnetUsageResult.Serialization.cs | 19 ++- ...leServerVirtualNetworkSubnetUsageResult.cs | 10 +- .../CheckNameAvailabilityRestOperations.cs | 28 ++--- ...ailabilityWithoutLocationRestOperations.cs | 115 ++++++++++++++++++ .../src/autorest.md | 4 +- 10 files changed, 268 insertions(+), 42 deletions(-) rename sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/{MySqlFlexibleServerNameAvailabilityContent.Serialization.cs => MySqlFlexibleServerNameAvailabilityRequest.Serialization.cs} (88%) rename sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/{MySqlFlexibleServerNameAvailabilityContent.cs => MySqlFlexibleServerNameAvailabilityRequest.cs} (84%) create mode 100644 sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/CheckNameAvailabilityWithoutLocationRestOperations.cs diff --git a/sdk/mysql/Azure.ResourceManager.MySql/api/Azure.ResourceManager.MySql.netstandard2.0.cs b/sdk/mysql/Azure.ResourceManager.MySql/api/Azure.ResourceManager.MySql.netstandard2.0.cs index 504d764f9b18f..53718415e88ba 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/api/Azure.ResourceManager.MySql.netstandard2.0.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/api/Azure.ResourceManager.MySql.netstandard2.0.cs @@ -610,8 +610,10 @@ namespace Azure.ResourceManager.MySql.FlexibleServers { public static partial class FlexibleServersExtensions { - public static Azure.Response CheckMySqlFlexibleServerNameAvailability(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation locationName, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task> CheckMySqlFlexibleServerNameAvailabilityAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation locationName, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response CheckMySqlFlexibleServerNameAvailability(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation locationName, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerNameAvailabilityRequest nameAvailabilityRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> CheckMySqlFlexibleServerNameAvailabilityAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation locationName, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerNameAvailabilityRequest nameAvailabilityRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response ExecuteCheckNameAvailabilityWithoutLocation(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerNameAvailabilityRequest nameAvailabilityRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> ExecuteCheckNameAvailabilityWithoutLocationAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerNameAvailabilityRequest nameAvailabilityRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Response ExecuteCheckVirtualNetworkSubnetUsage(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation locationName, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerVirtualNetworkSubnetUsageParameter mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task> ExecuteCheckVirtualNetworkSubnetUsageAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation locationName, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerVirtualNetworkSubnetUsageParameter mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Response ExecuteGetPrivateDnsZoneSuffix(this Azure.ResourceManager.Resources.TenantResource tenantResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -1077,9 +1079,9 @@ public MySqlFlexibleServerMaintenanceWindow() { } public int? StartHour { get { throw null; } set { } } public int? StartMinute { get { throw null; } set { } } } - public partial class MySqlFlexibleServerNameAvailabilityContent + public partial class MySqlFlexibleServerNameAvailabilityRequest { - public MySqlFlexibleServerNameAvailabilityContent(string name) { } + public MySqlFlexibleServerNameAvailabilityRequest(string name) { } public string Name { get { throw null; } } public Azure.Core.ResourceType? ResourceType { get { throw null; } set { } } } @@ -1247,6 +1249,8 @@ public partial class MySqlFlexibleServerVirtualNetworkSubnetUsageResult { internal MySqlFlexibleServerVirtualNetworkSubnetUsageResult() { } public System.Collections.Generic.IReadOnlyList DelegatedSubnetsUsage { get { throw null; } } + public Azure.Core.AzureLocation? Location { get { throw null; } } + public string SubscriptionId { get { throw null; } } } } namespace Azure.ResourceManager.MySql.Models diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/FlexibleServersExtensions.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/FlexibleServersExtensions.cs index ed0baf20cf8a1..49234603cc414 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/FlexibleServersExtensions.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/FlexibleServersExtensions.cs @@ -156,14 +156,14 @@ public static Response Execu /// /// The instance the method will execute against. /// The name of the location. - /// The required parameters for checking if server name is available. + /// The required parameters for checking if server name is available. /// The cancellation token to use. - /// is null. - public static async Task> CheckMySqlFlexibleServerNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, MySqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) + /// is null. + public static async Task> CheckMySqlFlexibleServerNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, MySqlFlexibleServerNameAvailabilityRequest nameAvailabilityRequest, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(nameAvailabilityRequest, nameof(nameAvailabilityRequest)); - return await GetExtensionClient(subscriptionResource).CheckMySqlFlexibleServerNameAvailabilityAsync(locationName, content, cancellationToken).ConfigureAwait(false); + return await GetExtensionClient(subscriptionResource).CheckMySqlFlexibleServerNameAvailabilityAsync(locationName, nameAvailabilityRequest, cancellationToken).ConfigureAwait(false); } /// @@ -173,14 +173,46 @@ public static async Task> Ch /// /// The instance the method will execute against. /// The name of the location. - /// The required parameters for checking if server name is available. + /// The required parameters for checking if server name is available. /// The cancellation token to use. - /// is null. - public static Response CheckMySqlFlexibleServerNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation locationName, MySqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) + /// is null. + public static Response CheckMySqlFlexibleServerNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation locationName, MySqlFlexibleServerNameAvailabilityRequest nameAvailabilityRequest, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(nameAvailabilityRequest, nameof(nameAvailabilityRequest)); - return GetExtensionClient(subscriptionResource).CheckMySqlFlexibleServerNameAvailability(locationName, content, cancellationToken); + return GetExtensionClient(subscriptionResource).CheckMySqlFlexibleServerNameAvailability(locationName, nameAvailabilityRequest, cancellationToken); + } + + /// + /// Check the availability of name for server + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/checkNameAvailability + /// Operation Id: CheckNameAvailabilityWithoutLocation_Execute + /// + /// The instance the method will execute against. + /// The required parameters for checking if server name is available. + /// The cancellation token to use. + /// is null. + public static async Task> ExecuteCheckNameAvailabilityWithoutLocationAsync(this SubscriptionResource subscriptionResource, MySqlFlexibleServerNameAvailabilityRequest nameAvailabilityRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nameAvailabilityRequest, nameof(nameAvailabilityRequest)); + + return await GetExtensionClient(subscriptionResource).ExecuteCheckNameAvailabilityWithoutLocationAsync(nameAvailabilityRequest, cancellationToken).ConfigureAwait(false); + } + + /// + /// Check the availability of name for server + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/checkNameAvailability + /// Operation Id: CheckNameAvailabilityWithoutLocation_Execute + /// + /// The instance the method will execute against. + /// The required parameters for checking if server name is available. + /// The cancellation token to use. + /// is null. + public static Response ExecuteCheckNameAvailabilityWithoutLocation(this SubscriptionResource subscriptionResource, MySqlFlexibleServerNameAvailabilityRequest nameAvailabilityRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nameAvailabilityRequest, nameof(nameAvailabilityRequest)); + + return GetExtensionClient(subscriptionResource).ExecuteCheckNameAvailabilityWithoutLocation(nameAvailabilityRequest, cancellationToken); } private static ResourceGroupResourceExtensionClient GetExtensionClient(ResourceGroupResource resourceGroupResource) diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 8c4227e28b7aa..2c7693fc099c5 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -28,6 +28,8 @@ internal partial class SubscriptionResourceExtensionClient : ArmResource private CheckVirtualNetworkSubnetUsageRestOperations _checkVirtualNetworkSubnetUsageRestClient; private ClientDiagnostics _checkNameAvailabilityClientDiagnostics; private CheckNameAvailabilityRestOperations _checkNameAvailabilityRestClient; + private ClientDiagnostics _checkNameAvailabilityWithoutLocationClientDiagnostics; + private CheckNameAvailabilityWithoutLocationRestOperations _checkNameAvailabilityWithoutLocationRestClient; /// Initializes a new instance of the class for mocking. protected SubscriptionResourceExtensionClient() @@ -49,6 +51,8 @@ internal SubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifie private CheckVirtualNetworkSubnetUsageRestOperations CheckVirtualNetworkSubnetUsageRestClient => _checkVirtualNetworkSubnetUsageRestClient ??= new CheckVirtualNetworkSubnetUsageRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics CheckNameAvailabilityClientDiagnostics => _checkNameAvailabilityClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); private CheckNameAvailabilityRestOperations CheckNameAvailabilityRestClient => _checkNameAvailabilityRestClient ??= new CheckNameAvailabilityRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics CheckNameAvailabilityWithoutLocationClientDiagnostics => _checkNameAvailabilityWithoutLocationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private CheckNameAvailabilityWithoutLocationRestOperations CheckNameAvailabilityWithoutLocationRestClient => _checkNameAvailabilityWithoutLocationRestClient ??= new CheckNameAvailabilityWithoutLocationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -280,15 +284,15 @@ public virtual Response Exec /// Operation Id: CheckNameAvailability_Execute /// /// The name of the location. - /// The required parameters for checking if server name is available. + /// The required parameters for checking if server name is available. /// The cancellation token to use. - public virtual async Task> CheckMySqlFlexibleServerNameAvailabilityAsync(AzureLocation locationName, MySqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) + public virtual async Task> CheckMySqlFlexibleServerNameAvailabilityAsync(AzureLocation locationName, MySqlFlexibleServerNameAvailabilityRequest nameAvailabilityRequest, CancellationToken cancellationToken = default) { using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckMySqlFlexibleServerNameAvailability"); scope.Start(); try { - var response = await CheckNameAvailabilityRestClient.ExecuteAsync(Id.SubscriptionId, locationName, content, cancellationToken).ConfigureAwait(false); + var response = await CheckNameAvailabilityRestClient.ExecuteAsync(Id.SubscriptionId, locationName, nameAvailabilityRequest, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -304,15 +308,61 @@ public virtual async Task> C /// Operation Id: CheckNameAvailability_Execute /// /// The name of the location. - /// The required parameters for checking if server name is available. + /// The required parameters for checking if server name is available. /// The cancellation token to use. - public virtual Response CheckMySqlFlexibleServerNameAvailability(AzureLocation locationName, MySqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) + public virtual Response CheckMySqlFlexibleServerNameAvailability(AzureLocation locationName, MySqlFlexibleServerNameAvailabilityRequest nameAvailabilityRequest, CancellationToken cancellationToken = default) { using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckMySqlFlexibleServerNameAvailability"); scope.Start(); try { - var response = CheckNameAvailabilityRestClient.Execute(Id.SubscriptionId, locationName, content, cancellationToken); + var response = CheckNameAvailabilityRestClient.Execute(Id.SubscriptionId, locationName, nameAvailabilityRequest, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of name for server + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/checkNameAvailability + /// Operation Id: CheckNameAvailabilityWithoutLocation_Execute + /// + /// The required parameters for checking if server name is available. + /// The cancellation token to use. + public virtual async Task> ExecuteCheckNameAvailabilityWithoutLocationAsync(MySqlFlexibleServerNameAvailabilityRequest nameAvailabilityRequest, CancellationToken cancellationToken = default) + { + using var scope = CheckNameAvailabilityWithoutLocationClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ExecuteCheckNameAvailabilityWithoutLocation"); + scope.Start(); + try + { + var response = await CheckNameAvailabilityWithoutLocationRestClient.ExecuteAsync(Id.SubscriptionId, nameAvailabilityRequest, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of name for server + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/checkNameAvailability + /// Operation Id: CheckNameAvailabilityWithoutLocation_Execute + /// + /// The required parameters for checking if server name is available. + /// The cancellation token to use. + public virtual Response ExecuteCheckNameAvailabilityWithoutLocation(MySqlFlexibleServerNameAvailabilityRequest nameAvailabilityRequest, CancellationToken cancellationToken = default) + { + using var scope = CheckNameAvailabilityWithoutLocationClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ExecuteCheckNameAvailabilityWithoutLocation"); + scope.Start(); + try + { + var response = CheckNameAvailabilityWithoutLocationRestClient.Execute(Id.SubscriptionId, nameAvailabilityRequest, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerNameAvailabilityContent.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerNameAvailabilityRequest.Serialization.cs similarity index 88% rename from sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerNameAvailabilityContent.Serialization.cs rename to sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerNameAvailabilityRequest.Serialization.cs index 81cade1614bd4..a005595077929 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerNameAvailabilityContent.Serialization.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerNameAvailabilityRequest.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.MySql.FlexibleServers.Models { - public partial class MySqlFlexibleServerNameAvailabilityContent : IUtf8JsonSerializable + public partial class MySqlFlexibleServerNameAvailabilityRequest : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerNameAvailabilityContent.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerNameAvailabilityRequest.cs similarity index 84% rename from sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerNameAvailabilityContent.cs rename to sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerNameAvailabilityRequest.cs index 7f0195089804b..4261e83127ceb 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerNameAvailabilityContent.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerNameAvailabilityRequest.cs @@ -11,12 +11,12 @@ namespace Azure.ResourceManager.MySql.FlexibleServers.Models { /// Request from client to check resource name availability. - public partial class MySqlFlexibleServerNameAvailabilityContent + public partial class MySqlFlexibleServerNameAvailabilityRequest { - /// Initializes a new instance of MySqlFlexibleServerNameAvailabilityContent. + /// Initializes a new instance of MySqlFlexibleServerNameAvailabilityRequest. /// Resource name to verify. /// is null. - public MySqlFlexibleServerNameAvailabilityContent(string name) + public MySqlFlexibleServerNameAvailabilityRequest(string name) { if (name == null) { diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerVirtualNetworkSubnetUsageResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerVirtualNetworkSubnetUsageResult.Serialization.cs index 85f4d6a4f00c5..b82f66ec80f46 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerVirtualNetworkSubnetUsageResult.Serialization.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerVirtualNetworkSubnetUsageResult.Serialization.cs @@ -15,9 +15,26 @@ public partial class MySqlFlexibleServerVirtualNetworkSubnetUsageResult { internal static MySqlFlexibleServerVirtualNetworkSubnetUsageResult DeserializeMySqlFlexibleServerVirtualNetworkSubnetUsageResult(JsonElement element) { + Optional location = default; + Optional subscriptionId = default; Optional> delegatedSubnetsUsage = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("location")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("subscriptionId")) + { + subscriptionId = property.Value.GetString(); + continue; + } if (property.NameEquals("delegatedSubnetsUsage")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -34,7 +51,7 @@ internal static MySqlFlexibleServerVirtualNetworkSubnetUsageResult DeserializeMy continue; } } - return new MySqlFlexibleServerVirtualNetworkSubnetUsageResult(Optional.ToList(delegatedSubnetsUsage)); + return new MySqlFlexibleServerVirtualNetworkSubnetUsageResult(Optional.ToNullable(location), subscriptionId.Value, Optional.ToList(delegatedSubnetsUsage)); } } } diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerVirtualNetworkSubnetUsageResult.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerVirtualNetworkSubnetUsageResult.cs index cd5916bb52ef8..252cf36639edf 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerVirtualNetworkSubnetUsageResult.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerVirtualNetworkSubnetUsageResult.cs @@ -20,12 +20,20 @@ internal MySqlFlexibleServerVirtualNetworkSubnetUsageResult() } /// Initializes a new instance of MySqlFlexibleServerVirtualNetworkSubnetUsageResult. + /// The location name. + /// The subscription id. /// A list of delegated subnet usage. - internal MySqlFlexibleServerVirtualNetworkSubnetUsageResult(IReadOnlyList delegatedSubnetsUsage) + internal MySqlFlexibleServerVirtualNetworkSubnetUsageResult(AzureLocation? location, string subscriptionId, IReadOnlyList delegatedSubnetsUsage) { + Location = location; + SubscriptionId = subscriptionId; DelegatedSubnetsUsage = delegatedSubnetsUsage; } + /// The location name. + public AzureLocation? Location { get; } + /// The subscription id. + public string SubscriptionId { get; } /// A list of delegated subnet usage. public IReadOnlyList DelegatedSubnetsUsage { get; } } diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/CheckNameAvailabilityRestOperations.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/CheckNameAvailabilityRestOperations.cs index a51e5ec388c7c..07155c0be23b8 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/CheckNameAvailabilityRestOperations.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/CheckNameAvailabilityRestOperations.cs @@ -37,7 +37,7 @@ public CheckNameAvailabilityRestOperations(HttpPipeline pipeline, string applica _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal HttpMessage CreateExecuteRequest(string subscriptionId, AzureLocation locationName, MySqlFlexibleServerNameAvailabilityContent content) + internal HttpMessage CreateExecuteRequest(string subscriptionId, AzureLocation locationName, MySqlFlexibleServerNameAvailabilityRequest nameAvailabilityRequest) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -53,9 +53,9 @@ internal HttpMessage CreateExecuteRequest(string subscriptionId, AzureLocation l request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(nameAvailabilityRequest); + request.Content = content; _userAgent.Apply(message); return message; } @@ -63,16 +63,16 @@ internal HttpMessage CreateExecuteRequest(string subscriptionId, AzureLocation l /// Check the availability of name for server. /// The ID of the target subscription. /// The name of the location. - /// The required parameters for checking if server name is available. + /// The required parameters for checking if server name is available. /// The cancellation token to use. - /// or is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public async Task> ExecuteAsync(string subscriptionId, AzureLocation locationName, MySqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) + public async Task> ExecuteAsync(string subscriptionId, AzureLocation locationName, MySqlFlexibleServerNameAvailabilityRequest nameAvailabilityRequest, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(nameAvailabilityRequest, nameof(nameAvailabilityRequest)); - using var message = CreateExecuteRequest(subscriptionId, locationName, content); + using var message = CreateExecuteRequest(subscriptionId, locationName, nameAvailabilityRequest); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -91,16 +91,16 @@ public async Task> ExecuteAs /// Check the availability of name for server. /// The ID of the target subscription. /// The name of the location. - /// The required parameters for checking if server name is available. + /// The required parameters for checking if server name is available. /// The cancellation token to use. - /// or is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public Response Execute(string subscriptionId, AzureLocation locationName, MySqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) + public Response Execute(string subscriptionId, AzureLocation locationName, MySqlFlexibleServerNameAvailabilityRequest nameAvailabilityRequest, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(nameAvailabilityRequest, nameof(nameAvailabilityRequest)); - using var message = CreateExecuteRequest(subscriptionId, locationName, content); + using var message = CreateExecuteRequest(subscriptionId, locationName, nameAvailabilityRequest); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/CheckNameAvailabilityWithoutLocationRestOperations.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/CheckNameAvailabilityWithoutLocationRestOperations.cs new file mode 100644 index 0000000000000..cbd3b8e644d44 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/CheckNameAvailabilityWithoutLocationRestOperations.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.MySql.FlexibleServers.Models; + +namespace Azure.ResourceManager.MySql.FlexibleServers +{ + internal partial class CheckNameAvailabilityWithoutLocationRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of CheckNameAvailabilityWithoutLocationRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public CheckNameAvailabilityWithoutLocationRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2021-05-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateExecuteRequest(string subscriptionId, MySqlFlexibleServerNameAvailabilityRequest nameAvailabilityRequest) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DBforMySQL/checkNameAvailability", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(nameAvailabilityRequest); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Check the availability of name for server. + /// The ID of the target subscription. + /// The required parameters for checking if server name is available. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ExecuteAsync(string subscriptionId, MySqlFlexibleServerNameAvailabilityRequest nameAvailabilityRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(nameAvailabilityRequest, nameof(nameAvailabilityRequest)); + + using var message = CreateExecuteRequest(subscriptionId, nameAvailabilityRequest); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MySqlFlexibleServerNameAvailabilityResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MySqlFlexibleServerNameAvailabilityResult.DeserializeMySqlFlexibleServerNameAvailabilityResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Check the availability of name for server. + /// The ID of the target subscription. + /// The required parameters for checking if server name is available. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response Execute(string subscriptionId, MySqlFlexibleServerNameAvailabilityRequest nameAvailabilityRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(nameAvailabilityRequest, nameof(nameAvailabilityRequest)); + + using var message = CreateExecuteRequest(subscriptionId, nameAvailabilityRequest); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MySqlFlexibleServerNameAvailabilityResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MySqlFlexibleServerNameAvailabilityResult.DeserializeMySqlFlexibleServerNameAvailabilityResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/autorest.md b/sdk/mysql/Azure.ResourceManager.MySql/src/autorest.md index be8d9d429b0f6..af31e6e172f2d 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/autorest.md +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/autorest.md @@ -16,7 +16,7 @@ batch: ``` yaml $(tag) == 'package-2020-01-01' namespace: Azure.ResourceManager.MySql -require: https://github.com/Azure/azure-rest-api-specs/blob/9d85adf7eb1bf9877be1e7a7991b7f1e2252a0e2/specification/mysql/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/mysql/resource-manager/readme.md output-folder: $(this-folder)/MySql/Generated modelerfour: flatten-payloads: false @@ -180,7 +180,7 @@ directive: ``` yaml $(tag) == 'package-flexibleserver-2021-05-01' namespace: Azure.ResourceManager.MySql.FlexibleServers -require: https://github.com/Azure/azure-rest-api-specs/blob/9d85adf7eb1bf9877be1e7a7991b7f1e2252a0e2/specification/mysql/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/mysql/resource-manager/readme.md output-folder: $(this-folder)/MySqlFlexibleServers/Generated modelerfour: flatten-payloads: false