diff --git a/sdk/websites/Azure.ResourceManager.AppService/CHANGELOG.md b/sdk/websites/Azure.ResourceManager.AppService/CHANGELOG.md index 5ea2616cb109a..e952468949010 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/CHANGELOG.md +++ b/sdk/websites/Azure.ResourceManager.AppService/CHANGELOG.md @@ -5,6 +5,7 @@ ### Features Added ### Breaking Changes +- Fix null Id deserialization problem for 'WebSiteResource.GetAllHybridConnectionDataAsync()' and 'WebSiteSlotResource.GetAllHybridConnectionSlotDataAsync()', to use 'WebSiteResource.GetHybridConnectionsAsync()' and 'WebSiteSlotResource.GetHybridConnectionsSlotAsync()' instead. ### Bugs Fixed @@ -27,8 +28,7 @@ ### Features Added - Enable mocking for extension methods, refer this [document](https://aka.ms/azsdk/net/mocking) for more details. - -### Other Changes +### Other ChangesGetHybridConnectionsAsync - Upgraded dependent `Azure.ResourceManager` to 1.9.0. 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 7712dfafee999..bc0d5f96607ba 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 @@ -4354,7 +4354,11 @@ protected WebSiteResource() { } public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetAllConfigurationData(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetAllConfigurationDataAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release, please use `GetHybridConnectionsAsync` instead", false)] public virtual Azure.Response GetAllHybridConnectionData(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release, please use `GetHybridConnectionsAsync` instead", false)] public virtual System.Threading.Tasks.Task> GetAllHybridConnectionDataAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetAllPremierAddOnData(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAllPremierAddOnDataAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -4383,6 +4387,8 @@ protected WebSiteResource() { } public virtual Azure.AsyncPageable GetHistoryForWebAppRecommendationsAsync(bool? expiredOnly = default(bool?), string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetHostKeys(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetHostKeysAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetHybridConnections(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetHybridConnectionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.AppService.LogsSiteConfigResource GetLogsSiteConfig() { throw null; } public virtual Azure.Response GetMetadata(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetMetadataAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -4919,7 +4925,11 @@ protected WebSiteSlotResource() { } public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetAllConfigurationSlotData(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetAllConfigurationSlotDataAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release, please use `GetHybridConnectionsSlot` instead", false)] public virtual Azure.Response GetAllHybridConnectionSlotData(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release, please use `GetHybridConnectionsSlotAsync` instead", false)] public virtual System.Threading.Tasks.Task> GetAllHybridConnectionSlotDataAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetAllPremierAddOnSlotData(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAllPremierAddOnSlotDataAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -4946,6 +4956,8 @@ protected WebSiteSlotResource() { } public virtual System.Threading.Tasks.Task> GetFunctionsAdminTokenSlotAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetHostKeysSlot(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetHostKeysSlotAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetHybridConnectionsSlot(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetHybridConnectionsSlotAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.AppService.LogsSiteSlotConfigResource GetLogsSiteSlotConfig() { throw null; } public virtual Azure.Response GetMetadataSlot(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetMetadataSlotAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } diff --git a/sdk/websites/Azure.ResourceManager.AppService/assets.json b/sdk/websites/Azure.ResourceManager.AppService/assets.json index 436139cad36a7..236be26a781b1 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/assets.json +++ b/sdk/websites/Azure.ResourceManager.AppService/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/websites/Azure.ResourceManager.AppService", - "Tag": "net/websites/Azure.ResourceManager.AppService_438b9596a0" + "Tag": "net/websites/Azure.ResourceManager.AppService_9137631a43" } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Customization/WebSiteResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Customization/WebSiteResource.cs index 7f0bc0f8f8e03..5780a9bae44df 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Customization/WebSiteResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Customization/WebSiteResource.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Globalization; using System.IO; using System.Threading; @@ -140,20 +141,12 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) /// /// /// The cancellation token to use. - public virtual async Task> GetAllHybridConnectionDataAsync(CancellationToken cancellationToken = default) + /// due to this isssue https://github.com/Azure/azure-sdk-for-net/issues/43813, and this method doesn't work,so just throw Exception. + [Obsolete("This method is obsolete and will be removed in a future release, please use `GetHybridConnectionsAsync` instead", false)] + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Task> GetAllHybridConnectionDataAsync(CancellationToken cancellationToken = default) { - using var scope = _webSiteWebAppsClientDiagnostics.CreateScope("WebSiteResource.GetAllHybridConnectionData"); - scope.Start(); - try - { - var response = await _webSiteWebAppsRestClient.ListHybridConnectionsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + throw new Exception("Obsolete method, Use GetHybridConnectionsAsync instead."); } /// @@ -166,24 +159,17 @@ public virtual async Task> GetAllHybridConnection /// /// Operation Id /// WebApps_ListHybridConnections + /// WebApps_ListHybridConnections /// /// /// /// The cancellation token to use. + ///due to this isssue https://github.com/Azure/azure-sdk-for-net/issues/43813, and this method doesn't work,so just throw Exception. + [Obsolete("This method is obsolete and will be removed in a future release, please use `GetHybridConnectionsAsync` instead", false)] + [EditorBrowsable(EditorBrowsableState.Never)] public virtual Response GetAllHybridConnectionData(CancellationToken cancellationToken = default) { - using var scope = _webSiteWebAppsClientDiagnostics.CreateScope("WebSiteResource.GetAllHybridConnectionData"); - scope.Start(); - try - { - var response = _webSiteWebAppsRestClient.ListHybridConnections(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + throw new Exception("Obsolete method, Use GetHybridConnectionsAsync instead."); } /// diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Customization/WebSiteSlotResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Customization/WebSiteSlotResource.cs index 3e32c59f01c54..0da91a7f2cf46 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Customization/WebSiteSlotResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Customization/WebSiteSlotResource.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Globalization; using System.IO; using System.Threading; @@ -139,20 +140,12 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) /// /// /// The cancellation token to use. - public virtual async Task> GetAllHybridConnectionSlotDataAsync(CancellationToken cancellationToken = default) + ///due to this isssue https://github.com/Azure/azure-sdk-for-net/issues/43813, and this method doesn't work,so just throw Exception. + [Obsolete("This method is obsolete and will be removed in a future release, please use `GetHybridConnectionsSlotAsync` instead", false)] + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Task> GetAllHybridConnectionSlotDataAsync(CancellationToken cancellationToken = default) { - using var scope = _webSiteSlotWebAppsClientDiagnostics.CreateScope("WebSiteSlotResource.GetAllHybridConnectionSlotData"); - scope.Start(); - try - { - var response = await _webSiteSlotWebAppsRestClient.ListHybridConnectionsSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + throw new Exception("Obsolete method, Use GetHybridConnectionsSlotAsync instead."); } /// @@ -169,20 +162,12 @@ public virtual async Task> GetAllHybridConnection /// /// /// The cancellation token to use. + /// due to this isssue https://github.com/Azure/azure-sdk-for-net/issues/43813, and this method doesn't work,so just throw Exception. + [Obsolete("This method is obsolete and will be removed in a future release, please use `GetHybridConnectionsSlot` instead", false)] + [EditorBrowsable(EditorBrowsableState.Never)] public virtual Response GetAllHybridConnectionSlotData(CancellationToken cancellationToken = default) { - using var scope = _webSiteSlotWebAppsClientDiagnostics.CreateScope("WebSiteSlotResource.GetAllHybridConnectionSlotData"); - scope.Start(); - try - { - var response = _webSiteSlotWebAppsRestClient.ListHybridConnectionsSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + throw new Exception("Obsolete method, Use GetHybridConnectionsSlot instead."); } /// diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/HybridConnectionListResult.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/HybridConnectionListResult.cs index 57fb405758989..166cf09ecb965 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/HybridConnectionListResult.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/HybridConnectionListResult.cs @@ -73,8 +73,10 @@ internal HybridConnectionListResult() } /// Collection of resources. + [WirePath("value")] public IReadOnlyList Value { get; } /// Link to next page of resources. + [WirePath("nextLink")] public string NextLink { get; } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/RestOperations/WebAppsRestOperations.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/RestOperations/WebAppsRestOperations.cs index 1678e84299a7b..ab4f5df2008c8 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/RestOperations/WebAppsRestOperations.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/RestOperations/WebAppsRestOperations.cs @@ -9369,7 +9369,7 @@ internal HttpMessage CreateListHybridConnectionsRequest(string subscriptionId, s /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> ListHybridConnectionsAsync(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) + public async Task> ListHybridConnectionsAsync(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -9381,9 +9381,9 @@ public async Task> ListHybridConnectionsAsync(str { case 200: { - HybridConnectionData value = default; + HybridConnectionListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = HybridConnectionData.DeserializeHybridConnectionData(document.RootElement); + value = HybridConnectionListResult.DeserializeHybridConnectionListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -9398,7 +9398,7 @@ public async Task> ListHybridConnectionsAsync(str /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response ListHybridConnections(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) + public Response ListHybridConnections(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -9410,9 +9410,9 @@ public Response ListHybridConnections(string subscriptionI { case 200: { - HybridConnectionData value = default; + HybridConnectionListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = HybridConnectionData.DeserializeHybridConnectionData(document.RootElement); + value = HybridConnectionListResult.DeserializeHybridConnectionListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -26324,7 +26324,7 @@ internal HttpMessage CreateListHybridConnectionsSlotRequest(string subscriptionI /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListHybridConnectionsSlotAsync(string subscriptionId, string resourceGroupName, string name, string slot, CancellationToken cancellationToken = default) + public async Task> ListHybridConnectionsSlotAsync(string subscriptionId, string resourceGroupName, string name, string slot, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -26337,9 +26337,9 @@ public async Task> ListHybridConnectionsSlotAsync { case 200: { - HybridConnectionData value = default; + HybridConnectionListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = HybridConnectionData.DeserializeHybridConnectionData(document.RootElement); + value = HybridConnectionListResult.DeserializeHybridConnectionListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -26355,7 +26355,7 @@ public async Task> ListHybridConnectionsSlotAsync /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response ListHybridConnectionsSlot(string subscriptionId, string resourceGroupName, string name, string slot, CancellationToken cancellationToken = default) + public Response ListHybridConnectionsSlot(string subscriptionId, string resourceGroupName, string name, string slot, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -26368,9 +26368,9 @@ public Response ListHybridConnectionsSlot(string subscript { case 200: { - HybridConnectionData value = default; + HybridConnectionListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = HybridConnectionData.DeserializeHybridConnectionData(document.RootElement); + value = HybridConnectionListResult.DeserializeHybridConnectionListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteResource.cs index 549fff15c2735..9deca7c3d854d 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteResource.cs @@ -4564,6 +4564,64 @@ public virtual Response DeleteHostSecret(string keyType, string keyName, Cancell } } + /// + /// Description for Retrieves all Service Bus Hybrid Connections used by this Web App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionRelays + /// + /// + /// Operation Id + /// WebApps_ListHybridConnections + /// + /// + /// Default Api Version + /// 2021-02-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetHybridConnectionsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _webSiteWebAppsRestClient.CreateListHybridConnectionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => HybridConnectionData.DeserializeHybridConnectionData(e), _webSiteWebAppsClientDiagnostics, Pipeline, "WebSiteResource.GetHybridConnections", "value", null, cancellationToken); + } + + /// + /// Description for Retrieves all Service Bus Hybrid Connections used by this Web App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionRelays + /// + /// + /// Operation Id + /// WebApps_ListHybridConnections + /// + /// + /// Default Api Version + /// 2021-02-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetHybridConnections(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _webSiteWebAppsRestClient.CreateListHybridConnectionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => HybridConnectionData.DeserializeHybridConnectionData(e), _webSiteWebAppsClientDiagnostics, Pipeline, "WebSiteResource.GetHybridConnections", "value", null, cancellationToken); + } + /// /// Description for Shows whether an app can be cloned to another resource group or subscription. /// diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotResource.cs index 46bc822c36fa6..e3da142f6e663 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotResource.cs @@ -4226,6 +4226,64 @@ public virtual Response DeleteHostSecretSlot(string keyType, string keyName, Can } } + /// + /// Description for Retrieves all Service Bus Hybrid Connections used by this Web App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionRelays + /// + /// + /// Operation Id + /// WebApps_ListHybridConnectionsSlot + /// + /// + /// Default Api Version + /// 2021-02-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetHybridConnectionsSlotAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _webSiteSlotWebAppsRestClient.CreateListHybridConnectionsSlotRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => HybridConnectionData.DeserializeHybridConnectionData(e), _webSiteSlotWebAppsClientDiagnostics, Pipeline, "WebSiteSlotResource.GetHybridConnectionsSlot", "value", null, cancellationToken); + } + + /// + /// Description for Retrieves all Service Bus Hybrid Connections used by this Web App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionRelays + /// + /// + /// Operation Id + /// WebApps_ListHybridConnectionsSlot + /// + /// + /// Default Api Version + /// 2021-02-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetHybridConnectionsSlot(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _webSiteSlotWebAppsRestClient.CreateListHybridConnectionsSlotRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => HybridConnectionData.DeserializeHybridConnectionData(e), _webSiteSlotWebAppsClientDiagnostics, Pipeline, "WebSiteSlotResource.GetHybridConnectionsSlot", "value", null, cancellationToken); + } + /// /// Description for Shows whether an app can be cloned to another resource group or subscription. /// diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/autorest.md b/sdk/websites/Azure.ResourceManager.AppService/src/autorest.md index bbb6b83ae95f4..18fe5253d7f06 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/autorest.md +++ b/sdk/websites/Azure.ResourceManager.AppService/src/autorest.md @@ -119,12 +119,12 @@ override-operation-name: ResourceHealthMetadata_ListByResourceGroup: GetAllResourceHealthMetadataData ListSiteIdentifiersAssignedToHostName: GetAllSiteIdentifierData WebApps_ListConfigurations: GetAllConfigurationData - WebApps_ListHybridConnections: GetAllHybridConnectionData + WebApps_ListHybridConnections: GetHybridConnections WebApps_ListPremierAddOns: GetAllPremierAddOnData WebApps_ListRelayServiceConnections: GetAllRelayServiceConnectionData WebApps_ListSiteBackups: GetAllSiteBackupData WebApps_ListConfigurationsSlot: GetAllConfigurationSlotData - WebApps_ListHybridConnectionsSlot: GetAllHybridConnectionSlotData + WebApps_ListHybridConnectionsSlot: GetHybridConnectionsSlot WebApps_ListPremierAddOnsSlot: GetAllPremierAddOnSlotData WebApps_ListRelayServiceConnectionsSlot: GetAllRelayServiceConnectionSlotData WebApps_ListSiteBackupsSlot: GetAllSiteBackupSlotData @@ -849,4 +849,12 @@ directive: "Aborted", "Running" ] + - from: WebApps.json + where: $.paths['/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionRelays'].get + transform: > + $['responses']['200']['schema']['$ref'] = "./AppServicePlans.json#/definitions/HybridConnectionCollection"; + - from: WebApps.json + where: $.paths['/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionRelays'].get + transform: > + $['responses']['200']['schema']['$ref'] = "./AppServicePlans.json#/definitions/HybridConnectionCollection"; ``` diff --git a/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/SiteOperationsTests.cs b/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/SiteOperationsTests.cs index ffc8e1d44ad8d..a8b82f1efe99c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/SiteOperationsTests.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/tests/TestsCase/SiteOperationsTests.cs @@ -3,7 +3,10 @@ using System.Threading.Tasks; using Azure.Core.TestFramework; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; using Azure.ResourceManager.AppService.Tests.Helpers; +using Azure.ResourceManager.Resources; using NUnit.Framework; namespace Azure.ResourceManager.AppService.Tests.TestsCase @@ -42,5 +45,38 @@ public async Task Get() ResourceDataHelper.AssertSite(site1.Data, site2.Data); } + + //Manual operation needed to create website/hybridconnection resource, get it from existing one. + [TestCase] + [RecordedTest] + public async Task GetHybridConnections() + { + ResourceGroupCollection rgCollection = DefaultSubscription.GetResourceGroups(); + ResourceGroupResource rg = await rgCollection.GetAsync("Rg_Lwm"); + WebSiteCollection webSiteCollection = rg.GetWebSites(); + WebSiteResource webSiteResource = await webSiteCollection.GetAsync("sitelwm01"); + var hybridConnectionDataCollection = webSiteResource.GetHybridConnectionsAsync(); + int count = 0; + await foreach (HybridConnectionData item in hybridConnectionDataCollection) + { + count++; + } + Assert.AreEqual(2, count); + } + //Manual operation needed to create website/hybridconnection resource, get it from existing one. + [TestCase] + [RecordedTest] + public async Task GetHybridConnectionsSlot() + { + var wbSiteSlotID = WebSiteSlotResource.CreateResourceIdentifier(DefaultSubscription.Data.SubscriptionId, "Rg_Lwm", "sitelwm01", "slotsitelwm01"); + WebSiteSlotResource wsSlotResource = Client.GetWebSiteSlotResource(wbSiteSlotID); + var hybridConnectionDataCollection = wsSlotResource.GetHybridConnectionsSlotAsync(); + int count = 0; + await foreach (HybridConnectionData item in hybridConnectionDataCollection) + { + count++; + } + Assert.AreEqual(2, count); + } } }