From 8c96c15b35ed1804d6424aebb3382e2a86ed6f86 Mon Sep 17 00:00:00 2001 From: mcgallan <1186003288@qq.com> Date: Mon, 9 Dec 2024 11:03:26 +0800 Subject: [PATCH 1/7] Update AppServicePlanOperationsTests.cs --- .../AppServicePlanOperationsTests.cs | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs b/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs index 63a5a69538c54..52af58141310d 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs @@ -1,8 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.Collections.Generic; +using System.IO; using System.Threading.Tasks; +using Azure.Core; using Azure.Core.TestFramework; using Azure.ResourceManager.AppService.Tests.Helpers; using NUnit.Framework; @@ -12,14 +15,14 @@ namespace Azure.ResourceManager.AppService.Tests.TestsCase public class AppServicePlanOperationsTests : AppServiceTestBase { public AppServicePlanOperationsTests(bool isAsync) - : base(isAsync)//, RecordedTestMode.Record) + : base(isAsync, RecordedTestMode.Record) { } private async Task CreateAppServicePlanAsync(string appServicePlanName) { var container = (await CreateResourceGroupAsync()).GetAppServicePlans(); - var input = ResourceDataHelper.GetBasicAppServicePlanData(DefaultLocation); + var input = ResourceDataHelper.GetBasicAppServicePlanData(AzureLocation.EastUS2); var lro = await container.CreateOrUpdateAsync(WaitUntil.Completed, appServicePlanName, input); return lro.Value; } @@ -52,5 +55,37 @@ public async Task GetServerFarmSkus() var skus = await plan.GetServerFarmSkusAsync(); var dict = skus.Value.ToObjectFromJson() as Dictionary; } + + [TestCase] + public async Task GetWebApps() + { + var planName = Recording.GenerateAssetName("testDisk-"); + var plan1 = await CreateAppServicePlanAsync(planName); + AppServicePlanResource plan2 = await plan1.GetAsync(); + var relays = plan2.GetHybridConnectionRelaysAsync(); + await foreach (var relayOverview in relays) + { + var relay = await plan2.GetAppServicePlanHybridConnectionNamespaceRelayAsync(relayOverview.ServiceBusNamespace, + relayOverview.Name); + var listOfAppServicesWhichAreUsingHybridConnection = relay.Value.GetWebAppsByHybridConnectionAsync(); + } + } + + [RecordedTest] + public async Task ExistingGetWebApps() + { + AppServicePlanResource plan = Client.GetAppServicePlanResource(new ResourceIdentifier("/subscriptions/4d042dc6-fe17-4698-a23f-ec6a8d1e98f4/resourceGroups/deleteme1205/providers/Microsoft.Web/serverFarms/HybirdConnectionTest")); + var relays = plan.GetHybridConnectionRelaysAsync(); + int num = 0; + await foreach (var relayOverview in relays) + { + num++; + Console.WriteLine(num); + Console.WriteLine(relayOverview.ServiceBusNamespace); + Console.WriteLine(relayOverview.Name); + var relay = await plan.GetAppServicePlanHybridConnectionNamespaceRelayAsync(relayOverview.ServiceBusNamespace, relayOverview.Name); + var listOfAppServicesWhichAreUsingHybridConnection = relay.Value.GetWebAppsByHybridConnectionAsync(); + } + } } } From fda153aedf2c9adc18200cb38d2a04486774c12e Mon Sep 17 00:00:00 2001 From: mcgallan <1186003288@qq.com> Date: Thu, 12 Dec 2024 14:38:44 +0800 Subject: [PATCH 2/7] update --- ...nHybridConnectionNamespaceRelayResource.cs | 12 +- ...icePlanResourceListResult.Serialization.cs | 225 ------------------ .../AppServicePlanResourceListResult.cs | 80 ------- .../AppServicePlansRestOperations.cs | 24 +- .../src/autorest.md | 10 +- .../AppServicePlanOperationsTests.cs | 6 +- 6 files changed, 31 insertions(+), 326 deletions(-) delete mode 100644 sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServicePlanResourceListResult.Serialization.cs delete mode 100644 sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServicePlanResourceListResult.cs diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayResource.cs index bd4d796e9843f..ab639f1edcbb8 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayResource.cs @@ -357,12 +357,12 @@ public virtual Response GetHybridConnectionKeys(Cancellatio /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetWebAppsByHybridConnectionAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWebAppsByHybridConnectionAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _appServicePlanHybridConnectionNamespaceRelayAppServicePlansRestClient.CreateListWebAppsByHybridConnectionRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appServicePlanHybridConnectionNamespaceRelayAppServicePlansRestClient.CreateListWebAppsByHybridConnectionNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => e.GetString(), _appServicePlanHybridConnectionNamespaceRelayAppServicePlansClientDiagnostics, Pipeline, "AppServicePlanHybridConnectionNamespaceRelayResource.GetWebAppsByHybridConnection", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => WebSiteData.DeserializeWebSiteData(e), _appServicePlanHybridConnectionNamespaceRelayAppServicePlansClientDiagnostics, Pipeline, "AppServicePlanHybridConnectionNamespaceRelayResource.GetWebAppsByHybridConnection", "value", "nextLink", cancellationToken); } /// @@ -387,12 +387,12 @@ public virtual AsyncPageable GetWebAppsByHybridConnectionAsync(Cancellat /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetWebAppsByHybridConnection(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWebAppsByHybridConnection(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _appServicePlanHybridConnectionNamespaceRelayAppServicePlansRestClient.CreateListWebAppsByHybridConnectionRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appServicePlanHybridConnectionNamespaceRelayAppServicePlansRestClient.CreateListWebAppsByHybridConnectionNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => e.GetString(), _appServicePlanHybridConnectionNamespaceRelayAppServicePlansClientDiagnostics, Pipeline, "AppServicePlanHybridConnectionNamespaceRelayResource.GetWebAppsByHybridConnection", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => WebSiteData.DeserializeWebSiteData(e), _appServicePlanHybridConnectionNamespaceRelayAppServicePlansClientDiagnostics, Pipeline, "AppServicePlanHybridConnectionNamespaceRelayResource.GetWebAppsByHybridConnection", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServicePlanResourceListResult.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServicePlanResourceListResult.Serialization.cs deleted file mode 100644 index ca97a9c574c83..0000000000000 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServicePlanResourceListResult.Serialization.cs +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.AppService.Models -{ - internal partial class AppServicePlanResourceListResult : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(AppServicePlanResourceListResult)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - if (options.Format != "W" && Optional.IsDefined(NextLink)) - { - writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - AppServicePlanResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(AppServicePlanResourceListResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAppServicePlanResourceListResult(document.RootElement, options); - } - - internal static AppServicePlanResourceListResult DeserializeAppServicePlanResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - nextLink = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AppServicePlanResourceListResult(value, nextLink, serializedAdditionalRawData); - } - - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - if (item == null) - { - builder.Append("null"); - continue; - } - if (item.Contains(Environment.NewLine)) - { - builder.AppendLine(" '''"); - builder.AppendLine($"{item}'''"); - } - else - { - builder.AppendLine($" '{item}'"); - } - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nextLink: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NextLink)) - { - builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - case "bicep": - return SerializeBicep(options); - default: - throw new FormatException($"The model {nameof(AppServicePlanResourceListResult)} does not support writing '{options.Format}' format."); - } - } - - AppServicePlanResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeAppServicePlanResourceListResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AppServicePlanResourceListResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServicePlanResourceListResult.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServicePlanResourceListResult.cs deleted file mode 100644 index f38450010cf7f..0000000000000 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServicePlanResourceListResult.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.ResourceManager.AppService.Models -{ - /// Collection of resources. - internal partial class AppServicePlanResourceListResult - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// Collection of resources. - /// is null. - internal AppServicePlanResourceListResult(IEnumerable value) - { - Argument.AssertNotNull(value, nameof(value)); - - Value = value.ToList(); - } - - /// Initializes a new instance of . - /// Collection of resources. - /// Link to next page of resources. - /// Keeps track of any properties unknown to the library. - internal AppServicePlanResourceListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) - { - Value = value; - NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AppServicePlanResourceListResult() - { - } - - /// Collection of resources. - public IReadOnlyList Value { get; } - /// Link to next page of resources. - public string NextLink { get; } - } -} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/RestOperations/AppServicePlansRestOperations.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/RestOperations/AppServicePlansRestOperations.cs index 12b000e14e076..ad162112bbe50 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/RestOperations/AppServicePlansRestOperations.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/RestOperations/AppServicePlansRestOperations.cs @@ -1070,7 +1070,7 @@ internal HttpMessage CreateListWebAppsByHybridConnectionRequest(string subscript /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task> ListWebAppsByHybridConnectionAsync(string subscriptionId, string resourceGroupName, string name, string namespaceName, string relayName, CancellationToken cancellationToken = default) + public async Task> ListWebAppsByHybridConnectionAsync(string subscriptionId, string resourceGroupName, string name, string namespaceName, string relayName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -1084,9 +1084,9 @@ public async Task> ListWebAppsByHybri { case 200: { - AppServicePlanResourceListResult value = default; + WebAppListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AppServicePlanResourceListResult.DeserializeAppServicePlanResourceListResult(document.RootElement); + value = WebAppListResult.DeserializeWebAppListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -1103,7 +1103,7 @@ public async Task> ListWebAppsByHybri /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response ListWebAppsByHybridConnection(string subscriptionId, string resourceGroupName, string name, string namespaceName, string relayName, CancellationToken cancellationToken = default) + public Response ListWebAppsByHybridConnection(string subscriptionId, string resourceGroupName, string name, string namespaceName, string relayName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -1117,9 +1117,9 @@ public Response ListWebAppsByHybridConnection( { case 200: { - AppServicePlanResourceListResult value = default; + WebAppListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AppServicePlanResourceListResult.DeserializeAppServicePlanResourceListResult(document.RootElement); + value = WebAppListResult.DeserializeWebAppListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -2899,7 +2899,7 @@ internal HttpMessage CreateListWebAppsByHybridConnectionNextPageRequest(string n /// The cancellation token to use. /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task> ListWebAppsByHybridConnectionNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string name, string namespaceName, string relayName, CancellationToken cancellationToken = default) + public async Task> ListWebAppsByHybridConnectionNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string name, string namespaceName, string relayName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); @@ -2914,9 +2914,9 @@ public async Task> ListWebAppsByHybri { case 200: { - AppServicePlanResourceListResult value = default; + WebAppListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AppServicePlanResourceListResult.DeserializeAppServicePlanResourceListResult(document.RootElement); + value = WebAppListResult.DeserializeWebAppListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -2934,7 +2934,7 @@ public async Task> ListWebAppsByHybri /// The cancellation token to use. /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response ListWebAppsByHybridConnectionNextPage(string nextLink, string subscriptionId, string resourceGroupName, string name, string namespaceName, string relayName, CancellationToken cancellationToken = default) + public Response ListWebAppsByHybridConnectionNextPage(string nextLink, string subscriptionId, string resourceGroupName, string name, string namespaceName, string relayName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); @@ -2949,9 +2949,9 @@ public Response ListWebAppsByHybridConnectionN { case 200: { - AppServicePlanResourceListResult value = default; + WebAppListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AppServicePlanResourceListResult.DeserializeAppServicePlanResourceListResult(document.RootElement); + value = WebAppListResult.DeserializeWebAppListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/autorest.md b/sdk/websites/Azure.ResourceManager.AppService/src/autorest.md index fccebe53abfc2..55dae9658dd0a 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/autorest.md +++ b/sdk/websites/Azure.ResourceManager.AppService/src/autorest.md @@ -24,7 +24,7 @@ deserialize-null-collection-as-null-value: true use-model-reader-writer: true enable-bicep-serialization: true -#mgmt-debug: +#mgmt-debug: # show-serialized-names: true list-exception: @@ -107,6 +107,7 @@ override-operation-name: StaticSites_UpdateStaticSiteUser: UpdateUser CheckNameAvailability: CheckAppServiceNameAvailability AppServicePlans_ListHybridConnections: GetHybridConnectionRelays + AppServicePlans_ListWebAppsByHybridConnection: GetAllWebAppByHybridConnection StaticSites_CreateOrUpdateStaticSiteBuildAppSettings: CreateOrUpdateAppSettings StaticSites_CreateOrUpdateStaticSiteBuildFunctionAppSettings: CreateOrUpdateFunctionAppSettings StaticSites_ListStaticSiteBuildFunctions: GetFunctions @@ -981,6 +982,11 @@ directive: where: $.paths['/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionRelays'].get transform: > $['responses']['200']['schema']['$ref'] = "./AppServicePlans.json#/definitions/HybridConnectionCollection"; + # Fix https://github.com/Azure/azure-sdk-for-net/issues/47267, fix the issue of data type mismatch in the AsyncPageable return values. + - from: AppServicePlans.json + where: $.paths['/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/sites'].get + transform: > + $['responses']['200']['schema']['$ref'] = "./CommonDefinitions.json#/definitions/WebAppCollection"; # The Enum name "StorageType" is shared by artifactsStorageType, cause the apicompat error - from: CommonDefinitions.json where: $.definitions.FunctionsDeployment.properties.storage.properties.type @@ -1012,7 +1018,7 @@ directive: "$ref": "#/definitions/DayOfWeek", "description": "The days of the week." }; - # Fix https://github.com/Azure/azure-sdk-for-net/issues/39126, fix the `ProcessThreadInfo` definition based on the return result + # Fix https://github.com/Azure/azure-sdk-for-net/issues/39126, fix the `ProcessThreadInfo` definition based on the return result - from: WebApps.json where: $.definitions transform: > diff --git a/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs b/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs index 52af58141310d..55690e1934530 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs @@ -74,7 +74,7 @@ public async Task GetWebApps() [RecordedTest] public async Task ExistingGetWebApps() { - AppServicePlanResource plan = Client.GetAppServicePlanResource(new ResourceIdentifier("/subscriptions/4d042dc6-fe17-4698-a23f-ec6a8d1e98f4/resourceGroups/deleteme1205/providers/Microsoft.Web/serverFarms/HybirdConnectionTest")); + AppServicePlanResource plan = Client.GetAppServicePlanResource(new ResourceIdentifier("/subscriptions/4d042dc6-fe17-4698-a23f-ec6a8d1e98f4/resourceGroups/v-zihewang1211/providers/Microsoft.Web/serverFarms/hybirdtest")); var relays = plan.GetHybridConnectionRelaysAsync(); int num = 0; await foreach (var relayOverview in relays) @@ -85,6 +85,10 @@ public async Task ExistingGetWebApps() Console.WriteLine(relayOverview.Name); var relay = await plan.GetAppServicePlanHybridConnectionNamespaceRelayAsync(relayOverview.ServiceBusNamespace, relayOverview.Name); var listOfAppServicesWhichAreUsingHybridConnection = relay.Value.GetWebAppsByHybridConnectionAsync(); + await foreach (var webApp in listOfAppServicesWhichAreUsingHybridConnection) + { + Console.WriteLine(webApp.Name); + } } } } From 6e410a16304284d90f866bae7750bd505fbca389 Mon Sep 17 00:00:00 2001 From: mcgallan <1186003288@qq.com> Date: Thu, 12 Dec 2024 16:36:25 +0800 Subject: [PATCH 3/7] update --- ...Azure.ResourceManager.AppService.net8.0.cs | 4 + ...sourceManager.AppService.netstandard2.0.cs | 4 + ...nHybridConnectionNamespaceRelayResource.cs | 86 +++++++++++++++++++ ...nHybridConnectionNamespaceRelayResource.cs | 8 +- .../src/autorest.md | 2 +- .../AppServicePlanOperationsTests.cs | 15 +++- 6 files changed, 112 insertions(+), 7 deletions(-) create mode 100644 sdk/websites/Azure.ResourceManager.AppService/src/Customization/AppServicePlanHybridConnectionNamespaceRelayResource.cs diff --git a/sdk/websites/Azure.ResourceManager.AppService/api/Azure.ResourceManager.AppService.net8.0.cs b/sdk/websites/Azure.ResourceManager.AppService/api/Azure.ResourceManager.AppService.net8.0.cs index cc2a00c4e5fe9..3937356b7eb0d 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/api/Azure.ResourceManager.AppService.net8.0.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/api/Azure.ResourceManager.AppService.net8.0.cs @@ -773,10 +773,14 @@ protected AppServicePlanHybridConnectionNamespaceRelayResource() { } public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAllWebAppsByHybridConnection(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllWebAppsByHybridConnectionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetHybridConnectionKeys(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetHybridConnectionKeysAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public virtual Azure.Pageable GetWebAppsByHybridConnection(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public virtual Azure.AsyncPageable GetWebAppsByHybridConnectionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } Azure.ResourceManager.AppService.HybridConnectionData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } diff --git a/sdk/websites/Azure.ResourceManager.AppService/api/Azure.ResourceManager.AppService.netstandard2.0.cs b/sdk/websites/Azure.ResourceManager.AppService/api/Azure.ResourceManager.AppService.netstandard2.0.cs index cc2a00c4e5fe9..3937356b7eb0d 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/api/Azure.ResourceManager.AppService.netstandard2.0.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/api/Azure.ResourceManager.AppService.netstandard2.0.cs @@ -773,10 +773,14 @@ protected AppServicePlanHybridConnectionNamespaceRelayResource() { } public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAllWebAppsByHybridConnection(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllWebAppsByHybridConnectionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetHybridConnectionKeys(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetHybridConnectionKeysAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public virtual Azure.Pageable GetWebAppsByHybridConnection(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public virtual Azure.AsyncPageable GetWebAppsByHybridConnectionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } Azure.ResourceManager.AppService.HybridConnectionData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Customization/AppServicePlanHybridConnectionNamespaceRelayResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Customization/AppServicePlanHybridConnectionNamespaceRelayResource.cs new file mode 100644 index 0000000000000..9ece7347f4662 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Customization/AppServicePlanHybridConnectionNamespaceRelayResource.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using System.Threading; +using Autorest.CSharp.Core; +using Azure.Core; + +namespace Azure.ResourceManager.AppService +{ + /// + /// A Class representing an AppServicePlanHybridConnectionNamespaceRelay along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetAppServicePlanHybridConnectionNamespaceRelayResource method. + /// Otherwise you can get one from its parent resource using the GetAppServicePlanHybridConnectionNamespaceRelay method. + /// + public partial class AppServicePlanHybridConnectionNamespaceRelayResource + { + /// + /// Description for Get all apps that use a Hybrid Connection in an App Service Plan. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/sites + /// + /// + /// Operation Id + /// AppServicePlans_ListWebAppsByHybridConnection + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual AsyncPageable GetWebAppsByHybridConnectionAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _appServicePlanHybridConnectionNamespaceRelayAppServicePlansRestClient.CreateListWebAppsByHybridConnectionRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appServicePlanHybridConnectionNamespaceRelayAppServicePlansRestClient.CreateListWebAppsByHybridConnectionNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => WebSiteData.DeserializeWebSiteData(e).ToString(), _appServicePlanHybridConnectionNamespaceRelayAppServicePlansClientDiagnostics, Pipeline, "AppServicePlanHybridConnectionNamespaceRelayResource.GetAllWebAppsByHybridConnection", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get all apps that use a Hybrid Connection in an App Service Plan. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/sites + /// + /// + /// Operation Id + /// AppServicePlans_ListWebAppsByHybridConnection + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Pageable GetWebAppsByHybridConnection(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _appServicePlanHybridConnectionNamespaceRelayAppServicePlansRestClient.CreateListWebAppsByHybridConnectionRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appServicePlanHybridConnectionNamespaceRelayAppServicePlansRestClient.CreateListWebAppsByHybridConnectionNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => WebSiteData.DeserializeWebSiteData(e).ToString(), _appServicePlanHybridConnectionNamespaceRelayAppServicePlansClientDiagnostics, Pipeline, "AppServicePlanHybridConnectionNamespaceRelayResource.GetAllWebAppsByHybridConnection", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayResource.cs index ab639f1edcbb8..f83e5c6710ca9 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayResource.cs @@ -358,11 +358,11 @@ public virtual Response GetHybridConnectionKeys(Cancellatio /// /// The cancellation token to use. /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetWebAppsByHybridConnectionAsync(CancellationToken cancellationToken = default) + public virtual AsyncPageable GetAllWebAppsByHybridConnectionAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _appServicePlanHybridConnectionNamespaceRelayAppServicePlansRestClient.CreateListWebAppsByHybridConnectionRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appServicePlanHybridConnectionNamespaceRelayAppServicePlansRestClient.CreateListWebAppsByHybridConnectionNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => WebSiteData.DeserializeWebSiteData(e), _appServicePlanHybridConnectionNamespaceRelayAppServicePlansClientDiagnostics, Pipeline, "AppServicePlanHybridConnectionNamespaceRelayResource.GetWebAppsByHybridConnection", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => WebSiteData.DeserializeWebSiteData(e), _appServicePlanHybridConnectionNamespaceRelayAppServicePlansClientDiagnostics, Pipeline, "AppServicePlanHybridConnectionNamespaceRelayResource.GetAllWebAppsByHybridConnection", "value", "nextLink", cancellationToken); } /// @@ -388,11 +388,11 @@ public virtual AsyncPageable GetWebAppsByHybridConnectionAsync(Canc /// /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetWebAppsByHybridConnection(CancellationToken cancellationToken = default) + public virtual Pageable GetAllWebAppsByHybridConnection(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _appServicePlanHybridConnectionNamespaceRelayAppServicePlansRestClient.CreateListWebAppsByHybridConnectionRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appServicePlanHybridConnectionNamespaceRelayAppServicePlansRestClient.CreateListWebAppsByHybridConnectionNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => WebSiteData.DeserializeWebSiteData(e), _appServicePlanHybridConnectionNamespaceRelayAppServicePlansClientDiagnostics, Pipeline, "AppServicePlanHybridConnectionNamespaceRelayResource.GetWebAppsByHybridConnection", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => WebSiteData.DeserializeWebSiteData(e), _appServicePlanHybridConnectionNamespaceRelayAppServicePlansClientDiagnostics, Pipeline, "AppServicePlanHybridConnectionNamespaceRelayResource.GetAllWebAppsByHybridConnection", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/autorest.md b/sdk/websites/Azure.ResourceManager.AppService/src/autorest.md index 55dae9658dd0a..2b565f0efe4c1 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/autorest.md +++ b/sdk/websites/Azure.ResourceManager.AppService/src/autorest.md @@ -107,7 +107,7 @@ override-operation-name: StaticSites_UpdateStaticSiteUser: UpdateUser CheckNameAvailability: CheckAppServiceNameAvailability AppServicePlans_ListHybridConnections: GetHybridConnectionRelays - AppServicePlans_ListWebAppsByHybridConnection: GetAllWebAppByHybridConnection + AppServicePlans_ListWebAppsByHybridConnection: GetAllWebAppsByHybridConnection StaticSites_CreateOrUpdateStaticSiteBuildAppSettings: CreateOrUpdateAppSettings StaticSites_CreateOrUpdateStaticSiteBuildFunctionAppSettings: CreateOrUpdateFunctionAppSettings StaticSites_ListStaticSiteBuildFunctions: GetFunctions diff --git a/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs b/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs index 55690e1934530..f4319d2ec4646 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.IO; using System.Threading.Tasks; using Azure.Core; @@ -60,14 +61,24 @@ public async Task GetServerFarmSkus() public async Task GetWebApps() { var planName = Recording.GenerateAssetName("testDisk-"); + var siteName = Recording.GenerateAssetName("testSite"); var plan1 = await CreateAppServicePlanAsync(planName); AppServicePlanResource plan2 = await plan1.GetAsync(); + var resourcegroupName = plan2.Data.ResourceGroup; + var resourcegroup = Client.GetResourceGroupResource(new ResourceIdentifier($"/subscriptions/{DefaultSubscription.Data.SubscriptionId}/resourceGroups/{resourcegroupName}")); + var siteCollection = resourcegroup.GetWebSites(); + var siteInput = new WebSiteData(AzureLocation.EastUS2) + { + AppServicePlanId = plan2.Id, + }; + var lro = await siteCollection.CreateOrUpdateAsync(WaitUntil.Completed, siteName, siteInput); + var site = lro.Value; var relays = plan2.GetHybridConnectionRelaysAsync(); await foreach (var relayOverview in relays) { var relay = await plan2.GetAppServicePlanHybridConnectionNamespaceRelayAsync(relayOverview.ServiceBusNamespace, relayOverview.Name); - var listOfAppServicesWhichAreUsingHybridConnection = relay.Value.GetWebAppsByHybridConnectionAsync(); + var listOfAppServicesWhichAreUsingHybridConnection = relay.Value.GetAllWebAppsByHybridConnectionAsync(); } } @@ -84,7 +95,7 @@ public async Task ExistingGetWebApps() Console.WriteLine(relayOverview.ServiceBusNamespace); Console.WriteLine(relayOverview.Name); var relay = await plan.GetAppServicePlanHybridConnectionNamespaceRelayAsync(relayOverview.ServiceBusNamespace, relayOverview.Name); - var listOfAppServicesWhichAreUsingHybridConnection = relay.Value.GetWebAppsByHybridConnectionAsync(); + var listOfAppServicesWhichAreUsingHybridConnection = relay.Value.GetAllWebAppsByHybridConnectionAsync(); await foreach (var webApp in listOfAppServicesWhichAreUsingHybridConnection) { Console.WriteLine(webApp.Name); From 7256eac40c7083890d41cff65c369a02db972854 Mon Sep 17 00:00:00 2001 From: mcgallan <1186003288@qq.com> Date: Thu, 12 Dec 2024 16:39:36 +0800 Subject: [PATCH 4/7] Update AppServicePlanOperationsTests.cs --- .../AppServicePlanOperationsTests.cs | 46 ------------------- 1 file changed, 46 deletions(-) diff --git a/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs b/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs index f4319d2ec4646..7f9d38a838e50 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs @@ -56,51 +56,5 @@ public async Task GetServerFarmSkus() var skus = await plan.GetServerFarmSkusAsync(); var dict = skus.Value.ToObjectFromJson() as Dictionary; } - - [TestCase] - public async Task GetWebApps() - { - var planName = Recording.GenerateAssetName("testDisk-"); - var siteName = Recording.GenerateAssetName("testSite"); - var plan1 = await CreateAppServicePlanAsync(planName); - AppServicePlanResource plan2 = await plan1.GetAsync(); - var resourcegroupName = plan2.Data.ResourceGroup; - var resourcegroup = Client.GetResourceGroupResource(new ResourceIdentifier($"/subscriptions/{DefaultSubscription.Data.SubscriptionId}/resourceGroups/{resourcegroupName}")); - var siteCollection = resourcegroup.GetWebSites(); - var siteInput = new WebSiteData(AzureLocation.EastUS2) - { - AppServicePlanId = plan2.Id, - }; - var lro = await siteCollection.CreateOrUpdateAsync(WaitUntil.Completed, siteName, siteInput); - var site = lro.Value; - var relays = plan2.GetHybridConnectionRelaysAsync(); - await foreach (var relayOverview in relays) - { - var relay = await plan2.GetAppServicePlanHybridConnectionNamespaceRelayAsync(relayOverview.ServiceBusNamespace, - relayOverview.Name); - var listOfAppServicesWhichAreUsingHybridConnection = relay.Value.GetAllWebAppsByHybridConnectionAsync(); - } - } - - [RecordedTest] - public async Task ExistingGetWebApps() - { - AppServicePlanResource plan = Client.GetAppServicePlanResource(new ResourceIdentifier("/subscriptions/4d042dc6-fe17-4698-a23f-ec6a8d1e98f4/resourceGroups/v-zihewang1211/providers/Microsoft.Web/serverFarms/hybirdtest")); - var relays = plan.GetHybridConnectionRelaysAsync(); - int num = 0; - await foreach (var relayOverview in relays) - { - num++; - Console.WriteLine(num); - Console.WriteLine(relayOverview.ServiceBusNamespace); - Console.WriteLine(relayOverview.Name); - var relay = await plan.GetAppServicePlanHybridConnectionNamespaceRelayAsync(relayOverview.ServiceBusNamespace, relayOverview.Name); - var listOfAppServicesWhichAreUsingHybridConnection = relay.Value.GetAllWebAppsByHybridConnectionAsync(); - await foreach (var webApp in listOfAppServicesWhichAreUsingHybridConnection) - { - Console.WriteLine(webApp.Name); - } - } - } } } From 477fe9f910a149101533e24add033842fbc2a8fc Mon Sep 17 00:00:00 2001 From: mcgallan <1186003288@qq.com> Date: Thu, 12 Dec 2024 17:33:50 +0800 Subject: [PATCH 5/7] Update AppServicePlanOperationsTests.cs --- .../tests/TestsCase/AppServicePlanOperationsTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs b/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs index 7f9d38a838e50..17fa99ccec83b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.AppService.Tests.TestsCase public class AppServicePlanOperationsTests : AppServiceTestBase { public AppServicePlanOperationsTests(bool isAsync) - : base(isAsync, RecordedTestMode.Record) + : base(isAsync)//, RecordedTestMode.Record) { } private async Task CreateAppServicePlanAsync(string appServicePlanName) { var container = (await CreateResourceGroupAsync()).GetAppServicePlans(); - var input = ResourceDataHelper.GetBasicAppServicePlanData(AzureLocation.EastUS2); + var input = ResourceDataHelper.GetBasicAppServicePlanData(DefaultLocation); var lro = await container.CreateOrUpdateAsync(WaitUntil.Completed, appServicePlanName, input); return lro.Value; } From eb49f05484ff4988eec97a3dcdb3689b5dd37d5b Mon Sep 17 00:00:00 2001 From: mcgallan <1186003288@qq.com> Date: Thu, 12 Dec 2024 17:34:32 +0800 Subject: [PATCH 6/7] Update AppServicePlanOperationsTests.cs --- .../tests/TestsCase/AppServicePlanOperationsTests.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs b/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs index 17fa99ccec83b..63a5a69538c54 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/AppServicePlanOperationsTests.cs @@ -1,12 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System; using System.Collections.Generic; -using System.ComponentModel; -using System.IO; using System.Threading.Tasks; -using Azure.Core; using Azure.Core.TestFramework; using Azure.ResourceManager.AppService.Tests.Helpers; using NUnit.Framework; From 870720aaf098d5262206e38d058bb751b8ed3ea3 Mon Sep 17 00:00:00 2001 From: mcgallan <1186003288@qq.com> Date: Tue, 17 Dec 2024 14:45:13 +0800 Subject: [PATCH 7/7] Update CHANGELOG.md --- sdk/websites/Azure.ResourceManager.AppService/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/websites/Azure.ResourceManager.AppService/CHANGELOG.md b/sdk/websites/Azure.ResourceManager.AppService/CHANGELOG.md index fc4bfe0ea0f06..93427928c1146 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/CHANGELOG.md +++ b/sdk/websites/Azure.ResourceManager.AppService/CHANGELOG.md @@ -8,6 +8,8 @@ ### Bugs Fixed +- fix the issue of data type mismatch in the AsyncPageable return values. Issue at 'https://github.com/Azure/azure-sdk-for-net/issues/47267 + ### Other Changes ## 1.3.0 (2024-11-19)