From 180a860ea4b5c0b11e2c81b184b8556d7c8c3bca Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 30 Jul 2021 06:23:30 +0000 Subject: [PATCH] CodeGen from PR 14749 in Azure/azure-rest-api-specs Merge 6a5f970e9f7e2ed91bf0c11289daa8743f28e131 into 682c9680fd6ac7746d701bcf0c69948a3199671a --- .../DisasterRecoveryConfigsOperations.cs | 18 +- ...sterRecoveryConfigsOperationsExtensions.cs | 14 +- .../IDisasterRecoveryConfigsOperations.cs | 6 +- .../src/Generated/INamespacesOperations.cs | 333 +- .../IPrivateEndpointConnectionsOperations.cs | 190 + .../IPrivateLinkResourcesOperations.cs | 53 + .../src/Generated/IQueuesOperations.cs | 132 +- .../Generated/IServiceBusManagementClient.cs | 43 +- .../src/Generated/ITopicsOperations.cs | 136 +- .../src/Generated/Models/ConnectionState.cs | 62 + .../src/Generated/Models/Encryption.cs | 62 + .../Models/EndPointProvisioningState.cs | 26 + .../Generated/Models/ErrorAdditionalInfo.cs | 59 + .../src/Generated/Models/ErrorResponse.cs | 24 +- .../Generated/Models/ErrorResponseError.cs | 85 + .../src/Generated/Models/Eventhub.cs | 4 +- .../Generated/Models/FailoverProperties.cs | 59 + .../src/Generated/Models/IPAction.cs | 22 + .../src/Generated/Models/Identity.cs | 71 + .../src/Generated/Models/IdentityType.cs | 54 + .../src/Generated/Models/IpFilterRule.cs | 76 + .../src/Generated/Models/KeySource.cs | 54 + .../Generated/Models/KeyVaultProperties.cs | 59 + .../src/Generated/Models/PrivateEndpoint.cs | 51 + .../Models/PrivateEndpointConnection.cs | 80 + .../Models/PrivateLinkConnectionStatus.cs | 24 + .../Generated/Models/PrivateLinkResource.cs | 95 + ...s.cs => PrivateLinkResourcesListResult.cs} | 41 +- .../src/Generated/Models/Rule.cs | 13 + .../src/Generated/Models/SBNamespace.cs | 39 +- .../Models/SBNamespaceUpdateParameters.cs | 39 +- .../src/Generated/Models/SqlFilter.cs | 24 +- .../Generated/Models/VirtualNetworkRule.cs | 59 + .../src/Generated/NamespacesOperations.cs | 3615 ++++++++++++++--- .../NamespacesOperationsExtensions.cs | 560 ++- .../PrivateEndpointConnectionsOperations.cs | 1144 ++++++ ...EndpointConnectionsOperationsExtensions.cs | 297 ++ .../PrivateLinkResourcesOperations.cs | 268 ++ ...rivateLinkResourcesOperationsExtensions.cs | 67 + .../src/Generated/QueuesOperations.cs | 496 +-- .../Generated/QueuesOperationsExtensions.cs | 298 +- .../src/Generated/RulesOperations.cs | 4 + .../SdkInfo_ServiceBusManagementClient.cs | 24 +- .../Generated/ServiceBusManagementClient.cs | 59 +- .../src/Generated/TopicsOperations.cs | 546 +-- .../Generated/TopicsOperationsExtensions.cs | 308 +- 46 files changed, 8122 insertions(+), 1671 deletions(-) create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/IPrivateEndpointConnectionsOperations.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/IPrivateLinkResourcesOperations.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/ConnectionState.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/Encryption.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/EndPointProvisioningState.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/ErrorAdditionalInfo.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/ErrorResponseError.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/FailoverProperties.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/IPAction.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/Identity.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/IdentityType.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/IpFilterRule.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/KeySource.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/KeyVaultProperties.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/PrivateEndpoint.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/PrivateEndpointConnection.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/PrivateLinkConnectionStatus.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/PrivateLinkResource.cs rename sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/{AuthorizationRuleProperties.cs => PrivateLinkResourcesListResult.cs} (50%) create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/VirtualNetworkRule.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/PrivateEndpointConnectionsOperations.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/PrivateLinkResourcesOperations.cs create mode 100644 sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/PrivateLinkResourcesOperationsExtensions.cs diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/DisasterRecoveryConfigsOperations.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/DisasterRecoveryConfigsOperations.cs index 428bc0be3b817..66f13993e44fe 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/DisasterRecoveryConfigsOperations.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/DisasterRecoveryConfigsOperations.cs @@ -1413,6 +1413,9 @@ internal DisasterRecoveryConfigsOperations(ServiceBusManagementClient client) /// /// The Disaster Recovery configuration name /// + /// + /// Parameters required to create an Alias(Disaster Recovery configuration) + /// /// /// Headers that will be added to request. /// @@ -1431,7 +1434,7 @@ internal DisasterRecoveryConfigsOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task FailOverWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string alias, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task FailOverWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string alias, FailoverProperties parameters = default(FailoverProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1496,6 +1499,7 @@ internal DisasterRecoveryConfigsOperations(ServiceBusManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); tracingParameters.Add("alias", alias); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "FailOver", tracingParameters); } @@ -1549,6 +1553,12 @@ internal DisasterRecoveryConfigsOperations(ServiceBusManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -1717,7 +1727,7 @@ internal DisasterRecoveryConfigsOperations(ServiceBusManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{alias}", System.Uri.EscapeDataString(alias)); @@ -1970,7 +1980,7 @@ internal DisasterRecoveryConfigsOperations(ServiceBusManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{alias}", System.Uri.EscapeDataString(alias)); @@ -2224,7 +2234,7 @@ internal DisasterRecoveryConfigsOperations(ServiceBusManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}/listKeys").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{alias}", System.Uri.EscapeDataString(alias)); diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/DisasterRecoveryConfigsOperationsExtensions.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/DisasterRecoveryConfigsOperationsExtensions.cs index c7740f80f9f9e..1c5c147b3800c 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/DisasterRecoveryConfigsOperationsExtensions.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/DisasterRecoveryConfigsOperationsExtensions.cs @@ -311,9 +311,12 @@ public static void BreakPairing(this IDisasterRecoveryConfigsOperations operatio /// /// The Disaster Recovery configuration name /// - public static void FailOver(this IDisasterRecoveryConfigsOperations operations, string resourceGroupName, string namespaceName, string alias) + /// + /// Parameters required to create an Alias(Disaster Recovery configuration) + /// + public static void FailOver(this IDisasterRecoveryConfigsOperations operations, string resourceGroupName, string namespaceName, string alias, FailoverProperties parameters = default(FailoverProperties)) { - operations.FailOverAsync(resourceGroupName, namespaceName, alias).GetAwaiter().GetResult(); + operations.FailOverAsync(resourceGroupName, namespaceName, alias, parameters).GetAwaiter().GetResult(); } /// @@ -332,12 +335,15 @@ public static void FailOver(this IDisasterRecoveryConfigsOperations operations, /// /// The Disaster Recovery configuration name /// + /// + /// Parameters required to create an Alias(Disaster Recovery configuration) + /// /// /// The cancellation token. /// - public static async Task FailOverAsync(this IDisasterRecoveryConfigsOperations operations, string resourceGroupName, string namespaceName, string alias, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task FailOverAsync(this IDisasterRecoveryConfigsOperations operations, string resourceGroupName, string namespaceName, string alias, FailoverProperties parameters = default(FailoverProperties), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.FailOverWithHttpMessagesAsync(resourceGroupName, namespaceName, alias, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.FailOverWithHttpMessagesAsync(resourceGroupName, namespaceName, alias, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/IDisasterRecoveryConfigsOperations.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/IDisasterRecoveryConfigsOperations.cs index a51700fe49ae5..14236bca7280d 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/IDisasterRecoveryConfigsOperations.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/IDisasterRecoveryConfigsOperations.cs @@ -201,6 +201,10 @@ public partial interface IDisasterRecoveryConfigsOperations /// /// The Disaster Recovery configuration name /// + /// + /// Parameters required to create an Alias(Disaster Recovery + /// configuration) + /// /// /// The headers that will be added to request. /// @@ -213,7 +217,7 @@ public partial interface IDisasterRecoveryConfigsOperations /// /// Thrown when a required parameter is null /// - Task FailOverWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string alias, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task FailOverWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string alias, FailoverProperties parameters = default(FailoverProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the authorization rules for a namespace. /// diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/INamespacesOperations.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/INamespacesOperations.cs index 29a4a7d572bc4..f169ca782c5e7 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/INamespacesOperations.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/INamespacesOperations.cs @@ -24,10 +24,44 @@ namespace Microsoft.Azure.Management.ServiceBus public partial interface INamespacesOperations { /// - /// Check the give namespace name availability. + /// Gets a list of IP Filter rules for a Namespace. /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListIpFilterRulesWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates an IpFilterRule for a Namespace. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The IP Filter Rule name. + /// /// - /// Parameters to check availability of the given namespace name + /// The Namespace IpFilterRule. /// /// /// The headers that will be added to request. @@ -44,7 +78,60 @@ public partial interface INamespacesOperations /// /// Thrown when a required parameter is null /// - Task> CheckNameAvailabilityMethodWithHttpMessagesAsync(CheckNameAvailability parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateIpFilterRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string ipFilterRuleName, IpFilterRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an IpFilterRule for a Namespace. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The IP Filter Rule name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteIpFilterRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string ipFilterRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets an IpFilterRule for a Namespace by rule name. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The IP Filter Rule name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetIpFilterRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string ipFilterRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all the available namespaces within the subscription, /// irrespective of the resource groups. @@ -200,6 +287,115 @@ public partial interface INamespacesOperations /// Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, SBNamespaceUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Gets a list of VirtualNetwork rules for a Namespace. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListVirtualNetworkRulesWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates an VirtualNetworkRule for a Namespace. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The Virtual Network Rule name. + /// + /// + /// The Namespace VirtualNetworkRule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateVirtualNetworkRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string virtualNetworkRuleName, VirtualNetworkRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an VirtualNetworkRule for a Namespace. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The Virtual Network Rule name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteVirtualNetworkRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string virtualNetworkRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets an VirtualNetworkRule for a Namespace by rule name. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The Virtual Network Rule name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetVirtualNetworkRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string virtualNetworkRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Gets the authorization rules for a namespace. /// /// @@ -376,16 +572,10 @@ public partial interface INamespacesOperations /// Task> RegenerateKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string authorizationRuleName, RegenerateAccessKeyParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// This operation Migrate the given namespace to provided name type + /// Check the give namespace name availability. /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// The namespace name - /// /// - /// Parameters supplied to migrate namespace type. + /// Parameters to check availability of the given namespace name /// /// /// The headers that will be added to request. @@ -396,10 +586,13 @@ public partial interface INamespacesOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task MigrateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, SBNamespaceMigrate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CheckNameAvailabilityMethodWithHttpMessagesAsync(CheckNameAvailability parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or update NetworkRuleSet for a Namespace. /// @@ -454,6 +647,56 @@ public partial interface INamespacesOperations /// Task> GetNetworkRuleSetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNetworkRuleSetsWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// This operation Migrate the given namespace to provided name type + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// Parameters supplied to migrate namespace type. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task MigrateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, SBNamespaceMigrate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Creates or updates a service namespace. Once created, this /// namespace's resource manifest is immutable. This operation is /// idempotent. @@ -509,6 +752,28 @@ public partial interface INamespacesOperations /// Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Gets a list of IP Filter rules for a Namespace. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListIpFilterRulesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Gets all the available namespaces within the subscription, /// irrespective of the resource groups. /// @@ -556,6 +821,28 @@ public partial interface INamespacesOperations /// Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Gets a list of VirtualNetwork rules for a Namespace. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListVirtualNetworkRulesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Gets the authorization rules for a namespace. /// /// @@ -578,5 +865,27 @@ public partial interface INamespacesOperations /// Thrown when a required parameter is null /// Task>> ListAuthorizationRulesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNetworkRuleSetsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/IPrivateEndpointConnectionsOperations.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/IPrivateEndpointConnectionsOperations.cs new file mode 100644 index 0000000000000..fdd0192812a9b --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/IPrivateEndpointConnectionsOperations.cs @@ -0,0 +1,190 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateEndpointConnectionsOperations operations. + /// + public partial interface IPrivateEndpointConnectionsOperations + { + /// + /// Gets the available PrivateEndpointConnections within a namespace. + /// + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates PrivateEndpointConnections of service namespace. + /// + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The PrivateEndpointConnection name + /// + /// + /// Parameters supplied to update Status of PrivateEndPoint Connection + /// to namespace resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an existing Private Endpoint Connection. + /// + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The PrivateEndpointConnection name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a description for the specified Private Endpoint Connection. + /// + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The PrivateEndpointConnection name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an existing Private Endpoint Connection. + /// + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The PrivateEndpointConnection name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the available PrivateEndpointConnections within a namespace. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/IPrivateLinkResourcesOperations.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/IPrivateLinkResourcesOperations.cs new file mode 100644 index 0000000000000..11d369649a60a --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/IPrivateLinkResourcesOperations.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateLinkResourcesOperations operations. + /// + public partial interface IPrivateLinkResourcesOperations + { + /// + /// Gets lists of resources that supports Privatelinks. + /// + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/IQueuesOperations.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/IQueuesOperations.cs index 656db53f110d2..16bd9448484ac 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/IQueuesOperations.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/IQueuesOperations.cs @@ -24,8 +24,8 @@ namespace Microsoft.Azure.Management.ServiceBus public partial interface IQueuesOperations { /// - /// Gets the queues within a namespace. - /// + /// Gets all authorization rules for a queue. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -33,15 +33,8 @@ public partial interface IQueuesOperations /// /// The namespace name /// - /// - /// Skip is only used if a previous operation returned a partial - /// result. If a previous response contains a nextLink element, the - /// value of the nextLink element will include a skip parameter that - /// specifies a starting point to use for subsequent calls. - /// - /// - /// May be used to limit the number of results to the most recent N - /// usageDetails. + /// + /// The queue name. /// /// /// The headers that will be added to request. @@ -58,11 +51,9 @@ public partial interface IQueuesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByNamespaceWithHttpMessagesAsync(string resourceGroupName, string namespaceName, int? skip = default(int?), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListAuthorizationRulesWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates or updates a Service Bus queue. This operation is - /// idempotent. - /// + /// Creates an authorization rule for a queue. /// /// /// Name of the Resource group within the Azure subscription. @@ -73,8 +64,11 @@ public partial interface IQueuesOperations /// /// The queue name. /// + /// + /// The authorization rule name. + /// /// - /// Parameters supplied to create or update a queue resource. + /// The shared access authorization rule. /// /// /// The headers that will be added to request. @@ -91,10 +85,10 @@ public partial interface IQueuesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, SBQueue parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, SBAuthorizationRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Deletes a queue from the specified namespace in a resource group. - /// + /// Deletes a queue authorization rule. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -105,6 +99,9 @@ public partial interface IQueuesOperations /// /// The queue name. /// + /// + /// The authorization rule name. + /// /// /// The headers that will be added to request. /// @@ -117,10 +114,10 @@ public partial interface IQueuesOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Returns a description for the specified queue. - /// + /// Gets an authorization rule for a queue by rule name. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -131,6 +128,9 @@ public partial interface IQueuesOperations /// /// The queue name. /// + /// + /// The authorization rule name. + /// /// /// The headers that will be added to request. /// @@ -146,10 +146,10 @@ public partial interface IQueuesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets all authorization rules for a queue. - /// + /// Primary and secondary connection strings to the queue. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -160,6 +160,9 @@ public partial interface IQueuesOperations /// /// The queue name. /// + /// + /// The authorization rule name. + /// /// /// The headers that will be added to request. /// @@ -175,9 +178,11 @@ public partial interface IQueuesOperations /// /// Thrown when a required parameter is null /// - Task>> ListAuthorizationRulesWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates an authorization rule for a queue. + /// Regenerates the primary or secondary connection strings to the + /// queue. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -192,7 +197,7 @@ public partial interface IQueuesOperations /// The authorization rule name. /// /// - /// The shared access authorization rule. + /// Parameters supplied to regenerate the authorization rule. /// /// /// The headers that will be added to request. @@ -209,10 +214,10 @@ public partial interface IQueuesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, SBAuthorizationRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> RegenerateKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, RegenerateAccessKeyParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Deletes a queue authorization rule. - /// + /// Gets the queues within a namespace. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -220,11 +225,15 @@ public partial interface IQueuesOperations /// /// The namespace name /// - /// - /// The queue name. + /// + /// Skip is only used if a previous operation returned a partial + /// result. If a previous response contains a nextLink element, the + /// value of the nextLink element will include a skip parameter that + /// specifies a starting point to use for subsequent calls. /// - /// - /// The authorization rule name. + /// + /// May be used to limit the number of results to the most recent N + /// usageDetails. /// /// /// The headers that will be added to request. @@ -235,13 +244,17 @@ public partial interface IQueuesOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task DeleteAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByNamespaceWithHttpMessagesAsync(string resourceGroupName, string namespaceName, int? skip = default(int?), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets an authorization rule for a queue by rule name. - /// + /// Creates or updates a Service Bus queue. This operation is + /// idempotent. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -252,8 +265,8 @@ public partial interface IQueuesOperations /// /// The queue name. /// - /// - /// The authorization rule name. + /// + /// Parameters supplied to create or update a queue resource. /// /// /// The headers that will be added to request. @@ -270,10 +283,10 @@ public partial interface IQueuesOperations /// /// Thrown when a required parameter is null /// - Task> GetAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, SBQueue parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Primary and secondary connection strings to the queue. - /// + /// Deletes a queue from the specified namespace in a resource group. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -284,9 +297,6 @@ public partial interface IQueuesOperations /// /// The queue name. /// - /// - /// The authorization rule name. - /// /// /// The headers that will be added to request. /// @@ -296,17 +306,13 @@ public partial interface IQueuesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task> ListKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Regenerates the primary or secondary connection strings to the - /// queue. - /// + /// Returns a description for the specified queue. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -317,12 +323,6 @@ public partial interface IQueuesOperations /// /// The queue name. /// - /// - /// The authorization rule name. - /// - /// - /// Parameters supplied to regenerate the authorization rule. - /// /// /// The headers that will be added to request. /// @@ -338,10 +338,10 @@ public partial interface IQueuesOperations /// /// Thrown when a required parameter is null /// - Task> RegenerateKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, RegenerateAccessKeyParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets the queues within a namespace. - /// + /// Gets all authorization rules for a queue. + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -361,10 +361,10 @@ public partial interface IQueuesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByNamespaceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListAuthorizationRulesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets all authorization rules for a queue. - /// + /// Gets the queues within a namespace. + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -384,6 +384,6 @@ public partial interface IQueuesOperations /// /// Thrown when a required parameter is null /// - Task>> ListAuthorizationRulesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByNamespaceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/IServiceBusManagementClient.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/IServiceBusManagementClient.cs index 03c3dd9a4c8f0..d893888c5a70c 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/IServiceBusManagementClient.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/IServiceBusManagementClient.cs @@ -16,7 +16,6 @@ namespace Microsoft.Azure.Management.ServiceBus using Newtonsoft.Json; /// - /// Azure Service Bus client /// public partial interface IServiceBusManagementClient : System.IDisposable { @@ -72,24 +71,24 @@ public partial interface IServiceBusManagementClient : System.IDisposable /// - /// Gets the IOperations. + /// Gets the INamespacesOperations. /// - IOperations Operations { get; } + INamespacesOperations Namespaces { get; } /// - /// Gets the INamespacesOperations. + /// Gets the IPrivateEndpointConnectionsOperations. /// - INamespacesOperations Namespaces { get; } + IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } /// - /// Gets the IDisasterRecoveryConfigsOperations. + /// Gets the IPrivateLinkResourcesOperations. /// - IDisasterRecoveryConfigsOperations DisasterRecoveryConfigs { get; } + IPrivateLinkResourcesOperations PrivateLinkResources { get; } /// - /// Gets the IMigrationConfigsOperations. + /// Gets the IDisasterRecoveryConfigsOperations. /// - IMigrationConfigsOperations MigrationConfigs { get; } + IDisasterRecoveryConfigsOperations DisasterRecoveryConfigs { get; } /// /// Gets the IQueuesOperations. @@ -102,14 +101,19 @@ public partial interface IServiceBusManagementClient : System.IDisposable ITopicsOperations Topics { get; } /// - /// Gets the ISubscriptionsOperations. + /// Gets the IEventHubsOperations. /// - ISubscriptionsOperations Subscriptions { get; } + IEventHubsOperations EventHubs { get; } /// - /// Gets the IRulesOperations. + /// Gets the IMigrationConfigsOperations. /// - IRulesOperations Rules { get; } + IMigrationConfigsOperations MigrationConfigs { get; } + + /// + /// Gets the IPremiumMessagingRegionsOperations. + /// + IPremiumMessagingRegionsOperations PremiumMessagingRegions { get; } /// /// Gets the IRegionsOperations. @@ -117,14 +121,19 @@ public partial interface IServiceBusManagementClient : System.IDisposable IRegionsOperations Regions { get; } /// - /// Gets the IPremiumMessagingRegionsOperations. + /// Gets the ISubscriptionsOperations. /// - IPremiumMessagingRegionsOperations PremiumMessagingRegions { get; } + ISubscriptionsOperations Subscriptions { get; } /// - /// Gets the IEventHubsOperations. + /// Gets the IRulesOperations. /// - IEventHubsOperations EventHubs { get; } + IRulesOperations Rules { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } } } diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/ITopicsOperations.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/ITopicsOperations.cs index b30a0a5184fd5..fd5ceea7c7b8e 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/ITopicsOperations.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/ITopicsOperations.cs @@ -24,8 +24,8 @@ namespace Microsoft.Azure.Management.ServiceBus public partial interface ITopicsOperations { /// - /// Gets all the topics in a namespace. - /// + /// Gets authorization rules for a topic. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -33,15 +33,8 @@ public partial interface ITopicsOperations /// /// The namespace name /// - /// - /// Skip is only used if a previous operation returned a partial - /// result. If a previous response contains a nextLink element, the - /// value of the nextLink element will include a skip parameter that - /// specifies a starting point to use for subsequent calls. - /// - /// - /// May be used to limit the number of results to the most recent N - /// usageDetails. + /// + /// The topic name. /// /// /// The headers that will be added to request. @@ -58,10 +51,10 @@ public partial interface ITopicsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByNamespaceWithHttpMessagesAsync(string resourceGroupName, string namespaceName, int? skip = default(int?), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListAuthorizationRulesWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates a topic in the specified namespace. - /// + /// Creates an authorization rule for the specified topic. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -72,8 +65,11 @@ public partial interface ITopicsOperations /// /// The topic name. /// + /// + /// The authorization rule name. + /// /// - /// Parameters supplied to create a topic resource. + /// The shared access authorization rule. /// /// /// The headers that will be added to request. @@ -90,10 +86,10 @@ public partial interface ITopicsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, SBTopic parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, SBAuthorizationRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Deletes a topic from the specified namespace and resource group. - /// + /// Returns the specified authorization rule. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -104,6 +100,9 @@ public partial interface ITopicsOperations /// /// The topic name. /// + /// + /// The authorization rule name. + /// /// /// The headers that will be added to request. /// @@ -113,13 +112,16 @@ public partial interface ITopicsOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Returns a description for the specified topic. - /// + /// Deletes a topic authorization rule. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -130,6 +132,9 @@ public partial interface ITopicsOperations /// /// The topic name. /// + /// + /// The authorization rule name. + /// /// /// The headers that will be added to request. /// @@ -139,16 +144,13 @@ public partial interface ITopicsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets authorization rules for a topic. - /// + /// Gets the primary and secondary connection strings for the topic. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -159,6 +161,9 @@ public partial interface ITopicsOperations /// /// The topic name. /// + /// + /// The authorization rule name. + /// /// /// The headers that will be added to request. /// @@ -174,10 +179,10 @@ public partial interface ITopicsOperations /// /// Thrown when a required parameter is null /// - Task>> ListAuthorizationRulesWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates an authorization rule for the specified topic. - /// + /// Regenerates primary or secondary connection strings for the topic. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -192,7 +197,7 @@ public partial interface ITopicsOperations /// The authorization rule name. /// /// - /// The shared access authorization rule. + /// Parameters supplied to regenerate the authorization rule. /// /// /// The headers that will be added to request. @@ -209,10 +214,10 @@ public partial interface ITopicsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, SBAuthorizationRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> RegenerateKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, RegenerateAccessKeyParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Returns the specified authorization rule. - /// + /// Gets all the topics in a namespace. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -220,11 +225,15 @@ public partial interface ITopicsOperations /// /// The namespace name /// - /// - /// The topic name. + /// + /// Skip is only used if a previous operation returned a partial + /// result. If a previous response contains a nextLink element, the + /// value of the nextLink element will include a skip parameter that + /// specifies a starting point to use for subsequent calls. /// - /// - /// The authorization rule name. + /// + /// May be used to limit the number of results to the most recent N + /// usageDetails. /// /// /// The headers that will be added to request. @@ -241,10 +250,10 @@ public partial interface ITopicsOperations /// /// Thrown when a required parameter is null /// - Task> GetAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByNamespaceWithHttpMessagesAsync(string resourceGroupName, string namespaceName, int? skip = default(int?), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Deletes a topic authorization rule. - /// + /// Creates a topic in the specified namespace. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -255,8 +264,8 @@ public partial interface ITopicsOperations /// /// The topic name. /// - /// - /// The authorization rule name. + /// + /// Parameters supplied to create a topic resource. /// /// /// The headers that will be added to request. @@ -267,13 +276,16 @@ public partial interface ITopicsOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task DeleteAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, SBTopic parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets the primary and secondary connection strings for the topic. - /// + /// Deletes a topic from the specified namespace and resource group. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -284,9 +296,6 @@ public partial interface ITopicsOperations /// /// The topic name. /// - /// - /// The authorization rule name. - /// /// /// The headers that will be added to request. /// @@ -296,16 +305,13 @@ public partial interface ITopicsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task> ListKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Regenerates primary or secondary connection strings for the topic. - /// + /// Returns a description for the specified topic. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -316,12 +322,6 @@ public partial interface ITopicsOperations /// /// The topic name. /// - /// - /// The authorization rule name. - /// - /// - /// Parameters supplied to regenerate the authorization rule. - /// /// /// The headers that will be added to request. /// @@ -337,10 +337,10 @@ public partial interface ITopicsOperations /// /// Thrown when a required parameter is null /// - Task> RegenerateKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, RegenerateAccessKeyParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets all the topics in a namespace. - /// + /// Gets authorization rules for a topic. + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -360,10 +360,10 @@ public partial interface ITopicsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByNamespaceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListAuthorizationRulesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets authorization rules for a topic. - /// + /// Gets all the topics in a namespace. + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -383,6 +383,6 @@ public partial interface ITopicsOperations /// /// Thrown when a required parameter is null /// - Task>> ListAuthorizationRulesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByNamespaceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/ConnectionState.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/ConnectionState.cs new file mode 100644 index 0000000000000..d127f68ed9527 --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/ConnectionState.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// ConnectionState information. + /// + public partial class ConnectionState + { + /// + /// Initializes a new instance of the ConnectionState class. + /// + public ConnectionState() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConnectionState class. + /// + /// Status of the connection. Possible values + /// include: 'Pending', 'Approved', 'Rejected', 'Disconnected' + /// Description of the connection + /// state. + public ConnectionState(string status = default(string), string description = default(string)) + { + Status = status; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets status of the connection. Possible values include: + /// 'Pending', 'Approved', 'Rejected', 'Disconnected' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets description of the connection state. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/Encryption.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/Encryption.cs new file mode 100644 index 0000000000000..29d09cb83e896 --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/Encryption.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties to configure Encryption + /// + public partial class Encryption + { + /// + /// Initializes a new instance of the Encryption class. + /// + public Encryption() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Encryption class. + /// + /// Properties of KeyVault + /// Enumerates the possible value of keySource + /// for Encryption. Possible values include: + /// 'Microsoft.KeyVault' + public Encryption(KeyVaultProperties keyVaultProperties = default(KeyVaultProperties), KeySource? keySource = default(KeySource?)) + { + KeyVaultProperties = keyVaultProperties; + KeySource = keySource; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets properties of KeyVault + /// + [JsonProperty(PropertyName = "keyVaultProperties")] + public KeyVaultProperties KeyVaultProperties { get; set; } + + /// + /// Gets or sets enumerates the possible value of keySource for + /// Encryption. Possible values include: 'Microsoft.KeyVault' + /// + [JsonProperty(PropertyName = "keySource")] + public KeySource? KeySource { get; set; } + + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/EndPointProvisioningState.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/EndPointProvisioningState.cs new file mode 100644 index 0000000000000..cba32e7eb0f09 --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/EndPointProvisioningState.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus.Models +{ + + /// + /// Defines values for EndPointProvisioningState. + /// + public static class EndPointProvisioningState + { + public const string Creating = "Creating"; + public const string Updating = "Updating"; + public const string Deleting = "Deleting"; + public const string Succeeded = "Succeeded"; + public const string Canceled = "Canceled"; + public const string Failed = "Failed"; + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 0000000000000..fd751f17b153a --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/ErrorAdditionalInfo.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource management error additional info. + /// + public partial class ErrorAdditionalInfo + { + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + public ErrorAdditionalInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + /// The additional info type. + /// The additional info. + public ErrorAdditionalInfo(string type = default(string), object info = default(object)) + { + Type = type; + Info = info; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the additional info type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the additional info. + /// + [JsonProperty(PropertyName = "info")] + public object Info { get; private set; } + + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/ErrorResponse.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/ErrorResponse.cs index 406a594906dc7..292bd0bf818d2 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/ErrorResponse.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/ErrorResponse.cs @@ -14,8 +14,7 @@ namespace Microsoft.Azure.Management.ServiceBus.Models using System.Linq; /// - /// Error response indicates ServiceBus service is not able to process the - /// incoming request. The reason is provided in the error message. + /// The resource management error response. /// public partial class ErrorResponse { @@ -30,13 +29,10 @@ public ErrorResponse() /// /// Initializes a new instance of the ErrorResponse class. /// - /// Error code. - /// Error message indicating why the operation - /// failed. - public ErrorResponse(string code = default(string), string message = default(string)) + /// The error object. + public ErrorResponse(ErrorResponseError error = default(ErrorResponseError)) { - Code = code; - Message = message; + Error = error; CustomInit(); } @@ -46,16 +42,10 @@ public ErrorResponse() partial void CustomInit(); /// - /// Gets or sets error code. + /// Gets or sets the error object. /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } - - /// - /// Gets or sets error message indicating why the operation failed. - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } + [JsonProperty(PropertyName = "error")] + public ErrorResponseError Error { get; set; } } } diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/ErrorResponseError.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/ErrorResponseError.cs new file mode 100644 index 0000000000000..841d0af339c0e --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/ErrorResponseError.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The error object. + /// + public partial class ErrorResponseError + { + /// + /// Initializes a new instance of the ErrorResponseError class. + /// + public ErrorResponseError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponseError class. + /// + /// The error code. + /// The error message. + /// The error target. + /// The error details. + /// The error additional info. + public ErrorResponseError(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + AdditionalInfo = additionalInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the error target. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + /// + /// Gets the error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } + + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/Eventhub.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/Eventhub.cs index 64bc02a84e906..b6848ea06c192 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/Eventhub.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/Eventhub.cs @@ -48,7 +48,7 @@ public Eventhub() /// Number of partitions created for the /// Event Hub, allowed values are from 1 to 32 partitions. /// Enumerates the possible values for the status - /// of the Event Hub. Possible values include: 'Active', 'Disabled', + /// of a Event Hub. Possible values include: 'Active', 'Disabled', /// 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', /// 'Deleting', 'Renaming', 'Unknown' /// Properties of capture @@ -104,7 +104,7 @@ public Eventhub() public long? PartitionCount { get; set; } /// - /// Gets or sets enumerates the possible values for the status of the + /// Gets or sets enumerates the possible values for the status of a /// Event Hub. Possible values include: 'Active', 'Disabled', /// 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', /// 'Deleting', 'Renaming', 'Unknown' diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/FailoverProperties.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/FailoverProperties.cs new file mode 100644 index 0000000000000..dece71d080154 --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/FailoverProperties.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Safe failover is to indicate the service should wait for pending + /// replication to finish before switching to the secondary. + /// + [Rest.Serialization.JsonTransformation] + public partial class FailoverProperties + { + /// + /// Initializes a new instance of the FailoverProperties class. + /// + public FailoverProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FailoverProperties class. + /// + /// Safe failover is to indicate the + /// service should wait for pending replication to finish before + /// switching to the secondary. + public FailoverProperties(bool? isSafeFailover = default(bool?)) + { + IsSafeFailover = isSafeFailover; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets safe failover is to indicate the service should wait + /// for pending replication to finish before switching to the + /// secondary. + /// + [JsonProperty(PropertyName = "properties.IsSafeFailover")] + public bool? IsSafeFailover { get; set; } + + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/IPAction.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/IPAction.cs new file mode 100644 index 0000000000000..4c91f25430e8d --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/IPAction.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus.Models +{ + + /// + /// Defines values for IPAction. + /// + public static class IPAction + { + public const string Accept = "Accept"; + public const string Reject = "Reject"; + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/Identity.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/Identity.cs new file mode 100644 index 0000000000000..bf1b5cad13b82 --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/Identity.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties to configure Identity for Bring your Own Keys + /// + public partial class Identity + { + /// + /// Initializes a new instance of the Identity class. + /// + public Identity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Identity class. + /// + /// ObjectId from the KeyVault + /// TenantId from the KeyVault + /// Enumerates the possible value Identity type, + /// which currently supports only 'SystemAssigned'. Possible values + /// include: 'SystemAssigned' + public Identity(string principalId = default(string), string tenantId = default(string), IdentityType? type = default(IdentityType?)) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets objectId from the KeyVault + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; set; } + + /// + /// Gets or sets tenantId from the KeyVault + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets enumerates the possible value Identity type, which + /// currently supports only 'SystemAssigned'. Possible values include: + /// 'SystemAssigned' + /// + [JsonProperty(PropertyName = "type")] + public IdentityType? Type { get; set; } + + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/IdentityType.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/IdentityType.cs new file mode 100644 index 0000000000000..79fa9cd87eeaa --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/IdentityType.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for IdentityType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum IdentityType + { + [EnumMember(Value = "SystemAssigned")] + SystemAssigned + } + internal static class IdentityTypeEnumExtension + { + internal static string ToSerializedValue(this IdentityType? value) + { + return value == null ? null : ((IdentityType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this IdentityType value) + { + switch( value ) + { + case IdentityType.SystemAssigned: + return "SystemAssigned"; + } + return null; + } + + internal static IdentityType? ParseIdentityType(this string value) + { + switch( value ) + { + case "SystemAssigned": + return IdentityType.SystemAssigned; + } + return null; + } + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/IpFilterRule.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/IpFilterRule.cs new file mode 100644 index 0000000000000..c23b32ab53d82 --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/IpFilterRule.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Single item in a List or Get IpFilterRules operation + /// + [Rest.Serialization.JsonTransformation] + public partial class IpFilterRule : Resource + { + /// + /// Initializes a new instance of the IpFilterRule class. + /// + public IpFilterRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IpFilterRule class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// IP Mask + /// The IP Filter Action. Possible values include: + /// 'Accept', 'Reject' + /// IP Filter name + public IpFilterRule(string id = default(string), string name = default(string), string type = default(string), string ipMask = default(string), string action = default(string), string filterName = default(string)) + : base(id, name, type) + { + IpMask = ipMask; + Action = action; + FilterName = filterName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets IP Mask + /// + [JsonProperty(PropertyName = "properties.ipMask")] + public string IpMask { get; set; } + + /// + /// Gets or sets the IP Filter Action. Possible values include: + /// 'Accept', 'Reject' + /// + [JsonProperty(PropertyName = "properties.action")] + public string Action { get; set; } + + /// + /// Gets or sets IP Filter name + /// + [JsonProperty(PropertyName = "properties.filterName")] + public string FilterName { get; set; } + + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/KeySource.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/KeySource.cs new file mode 100644 index 0000000000000..27ec583001a3b --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/KeySource.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for KeySource. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum KeySource + { + [EnumMember(Value = "Microsoft.KeyVault")] + MicrosoftKeyVault + } + internal static class KeySourceEnumExtension + { + internal static string ToSerializedValue(this KeySource? value) + { + return value == null ? null : ((KeySource)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this KeySource value) + { + switch( value ) + { + case KeySource.MicrosoftKeyVault: + return "Microsoft.KeyVault"; + } + return null; + } + + internal static KeySource? ParseKeySource(this string value) + { + switch( value ) + { + case "Microsoft.KeyVault": + return KeySource.MicrosoftKeyVault; + } + return null; + } + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/KeyVaultProperties.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/KeyVaultProperties.cs new file mode 100644 index 0000000000000..3181c2e5fe44a --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/KeyVaultProperties.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties to configure keyVault Properties + /// + public partial class KeyVaultProperties + { + /// + /// Initializes a new instance of the KeyVaultProperties class. + /// + public KeyVaultProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyVaultProperties class. + /// + /// Name of the Key from KeyVault + /// Uri of KeyVault + public KeyVaultProperties(string keyName = default(string), string keyVaultUri = default(string)) + { + KeyName = keyName; + KeyVaultUri = keyVaultUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the Key from KeyVault + /// + [JsonProperty(PropertyName = "keyName")] + public string KeyName { get; set; } + + /// + /// Gets or sets uri of KeyVault + /// + [JsonProperty(PropertyName = "keyVaultUri")] + public string KeyVaultUri { get; set; } + + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/PrivateEndpoint.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/PrivateEndpoint.cs new file mode 100644 index 0000000000000..b65afca3ac38a --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/PrivateEndpoint.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// PrivateEndpoint information. + /// + public partial class PrivateEndpoint + { + /// + /// Initializes a new instance of the PrivateEndpoint class. + /// + public PrivateEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpoint class. + /// + /// The ARM identifier for Private Endpoint. + public PrivateEndpoint(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the ARM identifier for Private Endpoint. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/PrivateEndpointConnection.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/PrivateEndpointConnection.cs new file mode 100644 index 0000000000000..312aa9f8ff469 --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/PrivateEndpointConnection.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of the PrivateEndpointConnection. + /// + [Rest.Serialization.JsonTransformation] + public partial class PrivateEndpointConnection : Resource + { + /// + /// Initializes a new instance of the PrivateEndpointConnection class. + /// + public PrivateEndpointConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpointConnection class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// The Private Endpoint resource for + /// this Connection. + /// Details about the + /// state of the connection. + /// Provisioning state of the Private + /// Endpoint Connection. Possible values include: 'Creating', + /// 'Updating', 'Deleting', 'Succeeded', 'Canceled', 'Failed' + public PrivateEndpointConnection(string id = default(string), string name = default(string), string type = default(string), PrivateEndpoint privateEndpoint = default(PrivateEndpoint), ConnectionState privateLinkServiceConnectionState = default(ConnectionState), string provisioningState = default(string)) + : base(id, name, type) + { + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Private Endpoint resource for this Connection. + /// + [JsonProperty(PropertyName = "properties.privateEndpoint")] + public PrivateEndpoint PrivateEndpoint { get; set; } + + /// + /// Gets or sets details about the state of the connection. + /// + [JsonProperty(PropertyName = "properties.privateLinkServiceConnectionState")] + public ConnectionState PrivateLinkServiceConnectionState { get; set; } + + /// + /// Gets or sets provisioning state of the Private Endpoint Connection. + /// Possible values include: 'Creating', 'Updating', 'Deleting', + /// 'Succeeded', 'Canceled', 'Failed' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/PrivateLinkConnectionStatus.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/PrivateLinkConnectionStatus.cs new file mode 100644 index 0000000000000..f90627d7a43cf --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/PrivateLinkConnectionStatus.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus.Models +{ + + /// + /// Defines values for PrivateLinkConnectionStatus. + /// + public static class PrivateLinkConnectionStatus + { + public const string Pending = "Pending"; + public const string Approved = "Approved"; + public const string Rejected = "Rejected"; + public const string Disconnected = "Disconnected"; + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/PrivateLinkResource.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/PrivateLinkResource.cs new file mode 100644 index 0000000000000..ca1c33cf9a041 --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/PrivateLinkResource.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Information of the private link resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class PrivateLinkResource + { + /// + /// Initializes a new instance of the PrivateLinkResource class. + /// + public PrivateLinkResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResource class. + /// + /// Required Members + /// Required Zone Names + /// Fully qualified identifier of the + /// resource. + /// Name of the resource + /// Type of the resource + public PrivateLinkResource(string groupId = default(string), IList requiredMembers = default(IList), IList requiredZoneNames = default(IList), string id = default(string), string name = default(string), string type = default(string)) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties.groupId")] + public string GroupId { get; set; } + + /// + /// Gets or sets required Members + /// + [JsonProperty(PropertyName = "properties.requiredMembers")] + public IList RequiredMembers { get; set; } + + /// + /// Gets or sets required Zone Names + /// + [JsonProperty(PropertyName = "properties.requiredZoneNames")] + public IList RequiredZoneNames { get; set; } + + /// + /// Gets or sets fully qualified identifier of the resource. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets name of the resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets type of the resource + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/AuthorizationRuleProperties.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/PrivateLinkResourcesListResult.cs similarity index 50% rename from sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/AuthorizationRuleProperties.cs rename to sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/PrivateLinkResourcesListResult.cs index 4d89d1c093da1..8c7c20f477e14 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/AuthorizationRuleProperties.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/PrivateLinkResourcesListResult.cs @@ -10,34 +10,36 @@ namespace Microsoft.Azure.Management.ServiceBus.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; /// - /// AuthorizationRule properties. + /// Result of the List private link resources operation. /// - public partial class AuthorizationRuleProperties + public partial class PrivateLinkResourcesListResult { /// - /// Initializes a new instance of the AuthorizationRuleProperties + /// Initializes a new instance of the PrivateLinkResourcesListResult /// class. /// - public AuthorizationRuleProperties() + public PrivateLinkResourcesListResult() { CustomInit(); } /// - /// Initializes a new instance of the AuthorizationRuleProperties + /// Initializes a new instance of the PrivateLinkResourcesListResult /// class. /// - /// The rights associated with the rule. - public AuthorizationRuleProperties(IList rights) + /// A collection of private link resources + /// A link for the next page of private link + /// resources. + public PrivateLinkResourcesListResult(IList value = default(IList), string nextLink = default(string)) { - Rights = rights; + Value = value; + NextLink = nextLink; CustomInit(); } @@ -47,23 +49,16 @@ public AuthorizationRuleProperties(IList rights) partial void CustomInit(); /// - /// Gets or sets the rights associated with the rule. + /// Gets or sets a collection of private link resources /// - [JsonProperty(PropertyName = "rights")] - public IList Rights { get; set; } + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } /// - /// Validate the object. + /// Gets or sets a link for the next page of private link resources. /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Rights == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Rights"); - } - } + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + } } diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/Rule.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/Rule.cs index bc710c0eae42b..7cfe24bb11328 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/Rule.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/Rule.cs @@ -87,5 +87,18 @@ public Rule() [JsonProperty(PropertyName = "properties.correlationFilter")] public CorrelationFilter CorrelationFilter { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SqlFilter != null) + { + SqlFilter.Validate(); + } + } } } diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/SBNamespace.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/SBNamespace.cs index 3e7ed947e2357..f4769d14ab3a2 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/SBNamespace.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/SBNamespace.cs @@ -40,24 +40,34 @@ public SBNamespace() /// Resource name /// Resource type /// Resource tags - /// Properties of Sku + /// Properties of SKU + /// Properties of BYOK Identity + /// description /// Provisioning state of the /// namespace. - /// The time the namespace was created. + /// The time the namespace was created /// The time the namespace was updated. /// Endpoint you can use to perform /// Service Bus operations. /// Identifier for Azure Insights /// metrics - public SBNamespace(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), SBSku sku = default(SBSku), string provisioningState = default(string), System.DateTime? createdAt = default(System.DateTime?), System.DateTime? updatedAt = default(System.DateTime?), string serviceBusEndpoint = default(string), string metricId = default(string)) + /// Enabling this property creates a + /// Premium Service Bus Namespace in regions supported availability + /// zones. + /// Properties of BYOK Encryption + /// description + public SBNamespace(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), SBSku sku = default(SBSku), Identity identity = default(Identity), string provisioningState = default(string), System.DateTime? createdAt = default(System.DateTime?), System.DateTime? updatedAt = default(System.DateTime?), string serviceBusEndpoint = default(string), string metricId = default(string), bool? zoneRedundant = default(bool?), Encryption encryption = default(Encryption)) : base(location, id, name, type, tags) { Sku = sku; + Identity = identity; ProvisioningState = provisioningState; CreatedAt = createdAt; UpdatedAt = updatedAt; ServiceBusEndpoint = serviceBusEndpoint; MetricId = metricId; + ZoneRedundant = zoneRedundant; + Encryption = encryption; CustomInit(); } @@ -67,11 +77,17 @@ public SBNamespace() partial void CustomInit(); /// - /// Gets or sets properties of Sku + /// Gets or sets properties of SKU /// [JsonProperty(PropertyName = "sku")] public SBSku Sku { get; set; } + /// + /// Gets or sets properties of BYOK Identity description + /// + [JsonProperty(PropertyName = "identity")] + public Identity Identity { get; set; } + /// /// Gets provisioning state of the namespace. /// @@ -79,7 +95,7 @@ public SBNamespace() public string ProvisioningState { get; private set; } /// - /// Gets the time the namespace was created. + /// Gets the time the namespace was created /// [JsonProperty(PropertyName = "properties.createdAt")] public System.DateTime? CreatedAt { get; private set; } @@ -102,6 +118,19 @@ public SBNamespace() [JsonProperty(PropertyName = "properties.metricId")] public string MetricId { get; private set; } + /// + /// Gets or sets enabling this property creates a Premium Service Bus + /// Namespace in regions supported availability zones. + /// + [JsonProperty(PropertyName = "properties.zoneRedundant")] + public bool? ZoneRedundant { get; set; } + + /// + /// Gets or sets properties of BYOK Encryption description + /// + [JsonProperty(PropertyName = "properties.encryption")] + public Encryption Encryption { get; set; } + /// /// Validate the object. /// diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/SBNamespaceUpdateParameters.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/SBNamespaceUpdateParameters.cs index b127de4e01b6d..ea18e3ddd8c6a 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/SBNamespaceUpdateParameters.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/SBNamespaceUpdateParameters.cs @@ -41,16 +41,23 @@ public SBNamespaceUpdateParameters() /// Resource type /// Resource location /// Resource tags - /// Properties of Sku + /// Properties of SKU /// Provisioning state of the /// namespace. - /// The time the namespace was created. + /// The time the namespace was created /// The time the namespace was updated. /// Endpoint you can use to perform /// Service Bus operations. /// Identifier for Azure Insights /// metrics - public SBNamespaceUpdateParameters(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), SBSku sku = default(SBSku), string provisioningState = default(string), System.DateTime? createdAt = default(System.DateTime?), System.DateTime? updatedAt = default(System.DateTime?), string serviceBusEndpoint = default(string), string metricId = default(string)) + /// Enabling this property creates a + /// Premium Service Bus Namespace in regions supported availability + /// zones. + /// Properties of BYOK Encryption + /// description + /// Properties of BYOK Identity + /// description + public SBNamespaceUpdateParameters(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), SBSku sku = default(SBSku), string provisioningState = default(string), System.DateTime? createdAt = default(System.DateTime?), System.DateTime? updatedAt = default(System.DateTime?), string serviceBusEndpoint = default(string), string metricId = default(string), bool? zoneRedundant = default(bool?), Encryption encryption = default(Encryption), Identity identity = default(Identity)) : base(id, name, type, location, tags) { Sku = sku; @@ -59,6 +66,9 @@ public SBNamespaceUpdateParameters() UpdatedAt = updatedAt; ServiceBusEndpoint = serviceBusEndpoint; MetricId = metricId; + ZoneRedundant = zoneRedundant; + Encryption = encryption; + Identity = identity; CustomInit(); } @@ -68,7 +78,7 @@ public SBNamespaceUpdateParameters() partial void CustomInit(); /// - /// Gets or sets properties of Sku + /// Gets or sets properties of SKU /// [JsonProperty(PropertyName = "sku")] public SBSku Sku { get; set; } @@ -80,7 +90,7 @@ public SBNamespaceUpdateParameters() public string ProvisioningState { get; private set; } /// - /// Gets the time the namespace was created. + /// Gets the time the namespace was created /// [JsonProperty(PropertyName = "properties.createdAt")] public System.DateTime? CreatedAt { get; private set; } @@ -103,6 +113,25 @@ public SBNamespaceUpdateParameters() [JsonProperty(PropertyName = "properties.metricId")] public string MetricId { get; private set; } + /// + /// Gets or sets enabling this property creates a Premium Service Bus + /// Namespace in regions supported availability zones. + /// + [JsonProperty(PropertyName = "properties.zoneRedundant")] + public bool? ZoneRedundant { get; set; } + + /// + /// Gets or sets properties of BYOK Encryption description + /// + [JsonProperty(PropertyName = "properties.encryption")] + public Encryption Encryption { get; set; } + + /// + /// Gets or sets properties of BYOK Identity description + /// + [JsonProperty(PropertyName = "identity")] + public Identity Identity { get; set; } + /// /// Validate the object. /// diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/SqlFilter.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/SqlFilter.cs index eb1bbf03609ab..f21026875bad0 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/SqlFilter.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/SqlFilter.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.ServiceBus.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -57,11 +58,11 @@ public SqlFilter() public string SqlExpression { get; set; } /// - /// Gets this property is reserved for future use. An integer value - /// showing the compatibility level, currently hard-coded to 20. + /// Gets or sets this property is reserved for future use. An integer + /// value showing the compatibility level, currently hard-coded to 20. /// [JsonProperty(PropertyName = "compatibilityLevel")] - public int? CompatibilityLevel { get; private set; } + public int? CompatibilityLevel { get; set; } /// /// Gets or sets value that indicates whether the rule action requires @@ -70,5 +71,22 @@ public SqlFilter() [JsonProperty(PropertyName = "requiresPreprocessing")] public bool? RequiresPreprocessing { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CompatibilityLevel > 20) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "CompatibilityLevel", 20); + } + if (CompatibilityLevel < 20) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "CompatibilityLevel", 20); + } + } } } diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/VirtualNetworkRule.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/VirtualNetworkRule.cs new file mode 100644 index 0000000000000..ed72fa0532e84 --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/VirtualNetworkRule.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Single item in a List or Get VirtualNetworkRules operation + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualNetworkRule : Resource + { + /// + /// Initializes a new instance of the VirtualNetworkRule class. + /// + public VirtualNetworkRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualNetworkRule class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// Resource ID of Virtual Network + /// Subnet + public VirtualNetworkRule(string id = default(string), string name = default(string), string type = default(string), string virtualNetworkSubnetId = default(string)) + : base(id, name, type) + { + VirtualNetworkSubnetId = virtualNetworkSubnetId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource ID of Virtual Network Subnet + /// + [JsonProperty(PropertyName = "properties.virtualNetworkSubnetId")] + public string VirtualNetworkSubnetId { get; set; } + + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/NamespacesOperations.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/NamespacesOperations.cs index 3b8e4f25b6f22..4e1b5f1b40f8b 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/NamespacesOperations.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/NamespacesOperations.cs @@ -51,10 +51,13 @@ internal NamespacesOperations(ServiceBusManagementClient client) public ServiceBusManagementClient Client { get; private set; } /// - /// Check the give namespace name availability. + /// Gets a list of IP Filter rules for a Namespace. /// - /// - /// Parameters to check availability of the given namespace name + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name /// /// /// Headers that will be added to request. @@ -77,23 +80,45 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CheckNameAvailabilityMethodWithHttpMessagesAsync(CheckNameAvailability parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListIpFilterRulesWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (Client.SubscriptionId == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } - if (parameters == null) + if (namespaceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); } - if (parameters != null) + if (namespaceName != null) { - parameters.Validate(); + if (namespaceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + } + if (namespaceName.Length < 6) + { + throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -102,13 +127,16 @@ internal NamespacesOperations(ServiceBusManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("parameters", parameters); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailabilityMethod", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListIpFilterRules", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -122,7 +150,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -153,12 +181,6 @@ internal NamespacesOperations(ServiceBusManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -209,7 +231,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -222,7 +244,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -242,10 +264,20 @@ internal NamespacesOperations(ServiceBusManagementClient client) } /// - /// Gets all the available namespaces within the subscription, irrespective of - /// the resource groups. - /// + /// Creates or updates an IpFilterRule for a Namespace. /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The IP Filter Rule name. + /// + /// + /// The Namespace IpFilterRule. + /// /// /// Headers that will be added to request. /// @@ -267,8 +299,53 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateIpFilterRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string ipFilterRuleName, IpFilterRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (namespaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); + } + if (namespaceName != null) + { + if (namespaceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + } + if (namespaceName.Length < 6) + { + throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + } + } + if (ipFilterRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ipFilterRuleName"); + } + if (ipFilterRuleName != null) + { + if (ipFilterRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ipFilterRuleName", 1); + } + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -284,12 +361,19 @@ internal NamespacesOperations(ServiceBusManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("ipFilterRuleName", ipFilterRuleName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateIpFilterRule", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{ipFilterRuleName}", System.Uri.EscapeDataString(ipFilterRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -303,7 +387,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -334,6 +418,12 @@ internal NamespacesOperations(ServiceBusManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -384,7 +474,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -397,7 +487,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -417,12 +507,17 @@ internal NamespacesOperations(ServiceBusManagementClient client) } /// - /// Gets the available namespaces within a resource group. - /// + /// Deletes an IpFilterRule for a Namespace. /// /// /// Name of the Resource group within the Azure subscription. /// + /// + /// The namespace name + /// + /// + /// The IP Filter Rule name. + /// /// /// Headers that will be added to request. /// @@ -432,9 +527,6 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -444,7 +536,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteIpFilterRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string ipFilterRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -461,6 +553,32 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } + if (namespaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); + } + if (namespaceName != null) + { + if (namespaceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + } + if (namespaceName.Length < 6) + { + throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + } + } + if (ipFilterRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ipFilterRuleName"); + } + if (ipFilterRuleName != null) + { + if (ipFilterRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ipFilterRuleName", 1); + } + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -477,13 +595,17 @@ internal NamespacesOperations(ServiceBusManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("ipFilterRuleName", ipFilterRuleName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DeleteIpFilterRule", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{ipFilterRuleName}", System.Uri.EscapeDataString(ipFilterRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -497,7 +619,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -548,7 +670,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 204) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -578,31 +700,13 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -611,36 +715,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) } /// - /// Creates or updates a service namespace. Once created, this namespace's - /// resource manifest is immutable. This operation is idempotent. - /// - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// The namespace name. - /// - /// - /// Parameters supplied to create a namespace resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, SBNamespace parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, namespaceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes an existing namespace. This operation also removes all associated - /// resources under the namespace. - /// + /// Gets an IpFilterRule for a Namespace by rule name. /// /// /// Name of the Resource group within the Azure subscription. @@ -648,28 +723,8 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// The namespace name /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, namespaceName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a description for the specified namespace. - /// - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// The namespace name + /// + /// The IP Filter Rule name. /// /// /// Headers that will be added to request. @@ -692,7 +747,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetIpFilterRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string ipFilterRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -724,6 +779,17 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); } } + if (ipFilterRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ipFilterRuleName"); + } + if (ipFilterRuleName != null) + { + if (ipFilterRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ipFilterRuleName", 1); + } + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -741,14 +807,16 @@ internal NamespacesOperations(ServiceBusManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("ipFilterRuleName", ipFilterRuleName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetIpFilterRule", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{ipFilterRuleName}", System.Uri.EscapeDataString(ipFilterRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -843,7 +911,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -856,7 +924,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -876,18 +944,10 @@ internal NamespacesOperations(ServiceBusManagementClient client) } /// - /// Updates a service namespace. Once created, this namespace's resource - /// manifest is immutable. This operation is idempotent. + /// Gets all the available namespaces within the subscription, irrespective of + /// the resource groups. + /// /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// The namespace name - /// - /// - /// Parameters supplied to update a namespace resource. - /// /// /// Headers that will be added to request. /// @@ -909,41 +969,199 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, SBNamespaceUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (resourceGroupName != null) + if (Client.SubscriptionId == null) { - if (resourceGroupName.Length > 90) + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + _httpRequest.Headers.Remove("accept-language"); } - if (resourceGroupName.Length < 1) + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - if (namespaceName == null) + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } - if (namespaceName != null) + // Send Request + if (_shouldTrace) { - if (namespaceName.Length > 50) + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try { - throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } } - if (namespaceName.Length < 6) + catch (JsonException) { - throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); } + throw ex; } - if (parameters == null) + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the available namespaces within a resource group. + /// + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } if (Client.ApiVersion == null) { @@ -961,16 +1179,13 @@ internal NamespacesOperations(ServiceBusManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("namespaceName", namespaceName); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -984,7 +1199,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1015,12 +1230,6 @@ internal NamespacesOperations(ServiceBusManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -1041,7 +1250,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1071,7 +1280,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1084,7 +1293,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1096,13 +1305,2312 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates a service namespace. Once created, this namespace's + /// resource manifest is immutable. This operation is idempotent. + /// + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name. + /// + /// + /// Parameters supplied to create a namespace resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, SBNamespace parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, namespaceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing namespace. This operation also removes all associated + /// resources under the namespace. + /// + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, namespaceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a description for the specified namespace. + /// + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (namespaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); + } + if (namespaceName != null) + { + if (namespaceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + } + if (namespaceName.Length < 6) + { + throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates a service namespace. Once created, this namespace's resource + /// manifest is immutable. This operation is idempotent. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// Parameters supplied to update a namespace resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, SBNamespaceUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (namespaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); + } + if (namespaceName != null) + { + if (namespaceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + } + if (namespaceName.Length < 6) + { + throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + } + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of VirtualNetwork rules for a Namespace. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListVirtualNetworkRulesWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (namespaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); + } + if (namespaceName != null) + { + if (namespaceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + } + if (namespaceName.Length < 6) + { + throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListVirtualNetworkRules", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates an VirtualNetworkRule for a Namespace. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The Virtual Network Rule name. + /// + /// + /// The Namespace VirtualNetworkRule. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateVirtualNetworkRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string virtualNetworkRuleName, VirtualNetworkRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (namespaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); + } + if (namespaceName != null) + { + if (namespaceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + } + if (namespaceName.Length < 6) + { + throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + } + } + if (virtualNetworkRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualNetworkRuleName"); + } + if (virtualNetworkRuleName != null) + { + if (virtualNetworkRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "virtualNetworkRuleName", 1); + } + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("virtualNetworkRuleName", virtualNetworkRuleName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateVirtualNetworkRule", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{virtualNetworkRuleName}", System.Uri.EscapeDataString(virtualNetworkRuleName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes an VirtualNetworkRule for a Namespace. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The Virtual Network Rule name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteVirtualNetworkRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string virtualNetworkRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (namespaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); + } + if (namespaceName != null) + { + if (namespaceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + } + if (namespaceName.Length < 6) + { + throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + } + } + if (virtualNetworkRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualNetworkRuleName"); + } + if (virtualNetworkRuleName != null) + { + if (virtualNetworkRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "virtualNetworkRuleName", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("virtualNetworkRuleName", virtualNetworkRuleName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteVirtualNetworkRule", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{virtualNetworkRuleName}", System.Uri.EscapeDataString(virtualNetworkRuleName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets an VirtualNetworkRule for a Namespace by rule name. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The Virtual Network Rule name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetVirtualNetworkRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string virtualNetworkRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (namespaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); + } + if (namespaceName != null) + { + if (namespaceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + } + if (namespaceName.Length < 6) + { + throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + } + } + if (virtualNetworkRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualNetworkRuleName"); + } + if (virtualNetworkRuleName != null) + { + if (virtualNetworkRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "virtualNetworkRuleName", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("virtualNetworkRuleName", virtualNetworkRuleName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetVirtualNetworkRule", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{virtualNetworkRuleName}", System.Uri.EscapeDataString(virtualNetworkRuleName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the authorization rules for a namespace. + /// + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListAuthorizationRulesWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (namespaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); + } + if (namespaceName != null) + { + if (namespaceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + } + if (namespaceName.Length < 6) + { + throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAuthorizationRules", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates an authorization rule for a namespace. + /// + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The authorization rule name. + /// + /// + /// The shared access authorization rule. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string authorizationRuleName, SBAuthorizationRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (namespaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); + } + if (namespaceName != null) + { + if (namespaceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + } + if (namespaceName.Length < 6) + { + throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + } + } + if (authorizationRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); + } + if (authorizationRuleName != null) + { + if (authorizationRuleName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); + } + if (authorizationRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); + } + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("authorizationRuleName", authorizationRuleName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateAuthorizationRule", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a namespace authorization rule. + /// + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The authorization rule name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (namespaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); + } + if (namespaceName != null) + { + if (namespaceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + } + if (namespaceName.Length < 6) + { + throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + } + } + if (authorizationRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); + } + if (authorizationRuleName != null) + { + if (authorizationRuleName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); + } + if (authorizationRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("authorizationRuleName", authorizationRuleName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteAuthorizationRule", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets an authorization rule for a namespace by rule name. + /// + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The authorization rule name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (namespaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); + } + if (namespaceName != null) + { + if (namespaceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + } + if (namespaceName.Length < 6) + { + throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + } + } + if (authorizationRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); + } + if (authorizationRuleName != null) + { + if (authorizationRuleName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); + } + if (authorizationRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("authorizationRuleName", authorizationRuleName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetAuthorizationRule", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } // Deserialize Response - if ((int)_statusCode == 201) + if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1122,8 +3630,8 @@ internal NamespacesOperations(ServiceBusManagementClient client) } /// - /// Gets the authorization rules for a namespace. - /// + /// Gets the primary and secondary connection strings for the namespace. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -1131,6 +3639,9 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// The namespace name /// + /// + /// The authorization rule name. + /// /// /// Headers that will be added to request. /// @@ -1152,7 +3663,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListAuthorizationRulesWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1184,6 +3695,21 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); } } + if (authorizationRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); + } + if (authorizationRuleName != null) + { + if (authorizationRuleName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); + } + if (authorizationRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); + } + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -1201,14 +3727,16 @@ internal NamespacesOperations(ServiceBusManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("authorizationRuleName", authorizationRuleName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListAuthorizationRules", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListKeys", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1222,7 +3750,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1303,7 +3831,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1316,7 +3844,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1336,8 +3864,8 @@ internal NamespacesOperations(ServiceBusManagementClient client) } /// - /// Creates or updates an authorization rule for a namespace. - /// + /// Regenerates the primary or secondary connection strings for the namespace. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -1349,7 +3877,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// The authorization rule name. /// /// - /// The shared access authorization rule. + /// Parameters supplied to regenerate the authorization rule. /// /// /// Headers that will be added to request. @@ -1372,7 +3900,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string authorizationRuleName, SBAuthorizationRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> RegenerateKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string authorizationRuleName, RegenerateAccessKeyParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1447,11 +3975,11 @@ internal NamespacesOperations(ServiceBusManagementClient client) tracingParameters.Add("authorizationRuleName", authorizationRuleName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateAuthorizationRule", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "RegenerateKeys", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); @@ -1468,7 +3996,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1555,7 +4083,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1568,7 +4096,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1588,17 +4116,10 @@ internal NamespacesOperations(ServiceBusManagementClient client) } /// - /// Deletes a namespace authorization rule. - /// + /// Check the give namespace name availability. /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// The namespace name - /// - /// - /// The authorization rule name. + /// + /// Parameters to check availability of the given namespace name /// /// /// Headers that will be added to request. @@ -1609,6 +4130,9 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1618,53 +4142,8 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CheckNameAvailabilityMethodWithHttpMessagesAsync(CheckNameAvailability parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - } - if (namespaceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); - } - if (namespaceName != null) - { - if (namespaceName.Length > 50) - { - throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); - } - if (namespaceName.Length < 6) - { - throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); - } - } - if (authorizationRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); - } - if (authorizationRuleName != null) - { - if (authorizationRuleName.Length > 50) - { - throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); - } - if (authorizationRuleName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); - } - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -1673,6 +4152,14 @@ internal NamespacesOperations(ServiceBusManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1680,18 +4167,13 @@ internal NamespacesOperations(ServiceBusManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("namespaceName", namespaceName); - tracingParameters.Add("authorizationRuleName", authorizationRuleName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteAuthorizationRule", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailabilityMethod", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); - _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1705,7 +4187,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1736,6 +4218,12 @@ internal NamespacesOperations(ServiceBusManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -1756,7 +4244,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1786,13 +4274,31 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1801,8 +4307,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) } /// - /// Gets an authorization rule for a namespace by rule name. - /// + /// Create or update NetworkRuleSet for a Namespace. /// /// /// Name of the Resource group within the Azure subscription. @@ -1810,8 +4315,8 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// The namespace name /// - /// - /// The authorization rule name. + /// + /// The Namespace IpFilterRule. /// /// /// Headers that will be added to request. @@ -1834,7 +4339,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateNetworkRuleSetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, NetworkRuleSet parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1866,21 +4371,6 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); } } - if (authorizationRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); - } - if (authorizationRuleName != null) - { - if (authorizationRuleName.Length > 50) - { - throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); - } - if (authorizationRuleName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); - } - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -1889,6 +4379,10 @@ internal NamespacesOperations(ServiceBusManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1898,16 +4392,15 @@ internal NamespacesOperations(ServiceBusManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); - tracingParameters.Add("authorizationRuleName", authorizationRuleName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetAuthorizationRule", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateNetworkRuleSet", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); - _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1921,7 +4414,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1952,6 +4445,12 @@ internal NamespacesOperations(ServiceBusManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -2002,7 +4501,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2015,7 +4514,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2035,8 +4534,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) } /// - /// Gets the primary and secondary connection strings for the namespace. - /// + /// Gets NetworkRuleSet for a Namespace. /// /// /// Name of the Resource group within the Azure subscription. @@ -2044,9 +4542,6 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// The namespace name /// - /// - /// The authorization rule name. - /// /// /// Headers that will be added to request. /// @@ -2068,7 +4563,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetNetworkRuleSetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -2100,21 +4595,6 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); } } - if (authorizationRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); - } - if (authorizationRuleName != null) - { - if (authorizationRuleName.Length > 50) - { - throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); - } - if (authorizationRuleName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); - } - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -2132,16 +4612,14 @@ internal NamespacesOperations(ServiceBusManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); - tracingParameters.Add("authorizationRuleName", authorizationRuleName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListKeys", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetNetworkRuleSet", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); - _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -2155,7 +4633,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2236,7 +4714,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2249,7 +4727,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2269,8 +4747,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) } /// - /// Regenerates the primary or secondary connection strings for the namespace. - /// + /// Gets list of NetworkRuleSet for a Namespace. /// /// /// Name of the Resource group within the Azure subscription. @@ -2278,12 +4755,6 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// The namespace name /// - /// - /// The authorization rule name. - /// - /// - /// Parameters supplied to regenerate the authorization rule. - /// /// /// Headers that will be added to request. /// @@ -2305,7 +4776,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> RegenerateKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string authorizationRuleName, RegenerateAccessKeyParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListNetworkRuleSetsWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -2337,29 +4808,6 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); } } - if (authorizationRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); - } - if (authorizationRuleName != null) - { - if (authorizationRuleName.Length > 50) - { - throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); - } - if (authorizationRuleName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); - } - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -2377,17 +4825,14 @@ internal NamespacesOperations(ServiceBusManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); - tracingParameters.Add("authorizationRuleName", authorizationRuleName); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "RegenerateKeys", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListNetworkRuleSets", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); - _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -2401,7 +4846,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2432,12 +4877,6 @@ internal NamespacesOperations(ServiceBusManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -2488,7 +4927,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2501,7 +4940,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2731,16 +5170,18 @@ internal NamespacesOperations(ServiceBusManagementClient client) } /// - /// Create or update NetworkRuleSet for a Namespace. + /// Creates or updates a service namespace. Once created, this namespace's + /// resource manifest is immutable. This operation is idempotent. + /// /// /// /// Name of the Resource group within the Azure subscription. /// /// - /// The namespace name + /// The namespace name. /// /// - /// The Namespace IpFilterRule. + /// Parameters supplied to create a namespace resource. /// /// /// Headers that will be added to request. @@ -2763,7 +5204,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateNetworkRuleSetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, NetworkRuleSet parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, SBNamespace parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -2784,16 +5225,13 @@ internal NamespacesOperations(ServiceBusManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); } - if (namespaceName != null) + if (parameters == null) { - if (namespaceName.Length > 50) - { - throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); - } - if (namespaceName.Length < 6) - { - throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); - } + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); } if (Client.ApiVersion == null) { @@ -2803,10 +5241,6 @@ internal NamespacesOperations(ServiceBusManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2818,11 +5252,11 @@ internal NamespacesOperations(ServiceBusManagementClient client) tracingParameters.Add("namespaceName", namespaceName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateNetworkRuleSet", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); @@ -2895,7 +5329,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2925,7 +5359,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2938,7 +5372,25 @@ internal NamespacesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2958,7 +5410,9 @@ internal NamespacesOperations(ServiceBusManagementClient client) } /// - /// Gets NetworkRuleSet for a Namespace. + /// Deletes an existing namespace. This operation also removes all associated + /// resources under the namespace. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -2975,9 +5429,6 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -2987,7 +5438,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetNetworkRuleSetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -3025,7 +5476,165 @@ internal NamespacesOperations(ServiceBusManagementClient client) } if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of IP Filter rules for a Namespace. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListIpFilterRulesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -3034,22 +5643,14 @@ internal NamespacesOperations(ServiceBusManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetNetworkRuleSet", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListIpFilterRulesNext", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -3138,7 +5739,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -3151,7 +5752,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -3171,18 +5772,12 @@ internal NamespacesOperations(ServiceBusManagementClient client) } /// - /// Creates or updates a service namespace. Once created, this namespace's - /// resource manifest is immutable. This operation is idempotent. - /// + /// Gets all the available namespaces within the subscription, irrespective of + /// the resource groups. + /// /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// The namespace name. - /// - /// - /// Parameters supplied to create a namespace resource. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// Headers that will be added to request. @@ -3205,42 +5800,11 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, SBNamespace parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - } - if (namespaceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (Client.SubscriptionId == null) + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -3249,23 +5813,14 @@ internal NamespacesOperations(ServiceBusManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("namespaceName", namespaceName); - tracingParameters.Add("parameters", parameters); + tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -3273,7 +5828,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -3304,12 +5859,6 @@ internal NamespacesOperations(ServiceBusManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -3330,7 +5879,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -3360,7 +5909,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -3373,25 +5922,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -3411,15 +5942,11 @@ internal NamespacesOperations(ServiceBusManagementClient client) } /// - /// Deletes an existing namespace. This operation also removes all associated - /// resources under the namespace. - /// + /// Gets the available namespaces within a resource group. + /// /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// The namespace name + /// + /// The NextLink from the previous successful call to List operation. /// /// /// Headers that will be added to request. @@ -3430,6 +5957,9 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -3439,45 +5969,11 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - } - if (namespaceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); - } - if (namespaceName != null) - { - if (namespaceName.Length > 50) - { - throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); - } - if (namespaceName.Length < 6) - { - throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); - } - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (Client.SubscriptionId == null) + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -3486,22 +5982,14 @@ internal NamespacesOperations(ServiceBusManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -3509,7 +5997,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -3560,7 +6048,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -3590,13 +6078,31 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -3605,9 +6111,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) } /// - /// Gets all the available namespaces within the subscription, irrespective of - /// the resource groups. - /// + /// Gets a list of VirtualNetwork rules for a Namespace. /// /// /// The NextLink from the previous successful call to List operation. @@ -3633,7 +6137,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListVirtualNetworkRulesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -3648,7 +6152,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListVirtualNetworkRulesNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -3742,7 +6246,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -3755,7 +6259,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -3775,8 +6279,8 @@ internal NamespacesOperations(ServiceBusManagementClient client) } /// - /// Gets the available namespaces within a resource group. - /// + /// Gets the authorization rules for a namespace. + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -3802,7 +6306,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListAuthorizationRulesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -3817,7 +6321,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListAuthorizationRulesNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -3911,7 +6415,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -3924,7 +6428,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -3944,8 +6448,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) } /// - /// Gets the authorization rules for a namespace. - /// + /// Gets list of NetworkRuleSet for a Namespace. /// /// /// The NextLink from the previous successful call to List operation. @@ -3971,7 +6474,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListAuthorizationRulesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListNetworkRuleSetsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -3986,7 +6489,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListAuthorizationRulesNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListNetworkRuleSetsNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -4080,7 +6583,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -4093,7 +6596,7 @@ internal NamespacesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/NamespacesOperationsExtensions.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/NamespacesOperationsExtensions.cs index be74f0e08a73c..828586942be20 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/NamespacesOperationsExtensions.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/NamespacesOperationsExtensions.cs @@ -22,34 +22,181 @@ namespace Microsoft.Azure.Management.ServiceBus public static partial class NamespacesOperationsExtensions { /// - /// Check the give namespace name availability. + /// Gets a list of IP Filter rules for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + public static IPage ListIpFilterRules(this INamespacesOperations operations, string resourceGroupName, string namespaceName) + { + return operations.ListIpFilterRulesAsync(resourceGroupName, namespaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of IP Filter rules for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The cancellation token. + /// + public static async Task> ListIpFilterRulesAsync(this INamespacesOperations operations, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListIpFilterRulesWithHttpMessagesAsync(resourceGroupName, namespaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates an IpFilterRule for a Namespace. /// /// /// The operations group for this extension method. /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The IP Filter Rule name. + /// /// - /// Parameters to check availability of the given namespace name + /// The Namespace IpFilterRule. /// - public static CheckNameAvailabilityResult CheckNameAvailabilityMethod(this INamespacesOperations operations, CheckNameAvailability parameters) + public static IpFilterRule CreateOrUpdateIpFilterRule(this INamespacesOperations operations, string resourceGroupName, string namespaceName, string ipFilterRuleName, IpFilterRule parameters) { - return operations.CheckNameAvailabilityMethodAsync(parameters).GetAwaiter().GetResult(); + return operations.CreateOrUpdateIpFilterRuleAsync(resourceGroupName, namespaceName, ipFilterRuleName, parameters).GetAwaiter().GetResult(); } /// - /// Check the give namespace name availability. + /// Creates or updates an IpFilterRule for a Namespace. /// /// /// The operations group for this extension method. /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The IP Filter Rule name. + /// /// - /// Parameters to check availability of the given namespace name + /// The Namespace IpFilterRule. /// /// /// The cancellation token. /// - public static async Task CheckNameAvailabilityMethodAsync(this INamespacesOperations operations, CheckNameAvailability parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateIpFilterRuleAsync(this INamespacesOperations operations, string resourceGroupName, string namespaceName, string ipFilterRuleName, IpFilterRule parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CheckNameAvailabilityMethodWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateIpFilterRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, ipFilterRuleName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an IpFilterRule for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The IP Filter Rule name. + /// + public static void DeleteIpFilterRule(this INamespacesOperations operations, string resourceGroupName, string namespaceName, string ipFilterRuleName) + { + operations.DeleteIpFilterRuleAsync(resourceGroupName, namespaceName, ipFilterRuleName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an IpFilterRule for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The IP Filter Rule name. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteIpFilterRuleAsync(this INamespacesOperations operations, string resourceGroupName, string namespaceName, string ipFilterRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteIpFilterRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, ipFilterRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets an IpFilterRule for a Namespace by rule name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The IP Filter Rule name. + /// + public static IpFilterRule GetIpFilterRule(this INamespacesOperations operations, string resourceGroupName, string namespaceName, string ipFilterRuleName) + { + return operations.GetIpFilterRuleAsync(resourceGroupName, namespaceName, ipFilterRuleName).GetAwaiter().GetResult(); + } + + /// + /// Gets an IpFilterRule for a Namespace by rule name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The IP Filter Rule name. + /// + /// + /// The cancellation token. + /// + public static async Task GetIpFilterRuleAsync(this INamespacesOperations operations, string resourceGroupName, string namespaceName, string ipFilterRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetIpFilterRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, ipFilterRuleName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -304,6 +451,187 @@ public static SBNamespace Update(this INamespacesOperations operations, string r } } + /// + /// Gets a list of VirtualNetwork rules for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + public static IPage ListVirtualNetworkRules(this INamespacesOperations operations, string resourceGroupName, string namespaceName) + { + return operations.ListVirtualNetworkRulesAsync(resourceGroupName, namespaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of VirtualNetwork rules for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The cancellation token. + /// + public static async Task> ListVirtualNetworkRulesAsync(this INamespacesOperations operations, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListVirtualNetworkRulesWithHttpMessagesAsync(resourceGroupName, namespaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates an VirtualNetworkRule for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The Virtual Network Rule name. + /// + /// + /// The Namespace VirtualNetworkRule. + /// + public static VirtualNetworkRule CreateOrUpdateVirtualNetworkRule(this INamespacesOperations operations, string resourceGroupName, string namespaceName, string virtualNetworkRuleName, VirtualNetworkRule parameters) + { + return operations.CreateOrUpdateVirtualNetworkRuleAsync(resourceGroupName, namespaceName, virtualNetworkRuleName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an VirtualNetworkRule for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The Virtual Network Rule name. + /// + /// + /// The Namespace VirtualNetworkRule. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateVirtualNetworkRuleAsync(this INamespacesOperations operations, string resourceGroupName, string namespaceName, string virtualNetworkRuleName, VirtualNetworkRule parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateVirtualNetworkRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, virtualNetworkRuleName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an VirtualNetworkRule for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The Virtual Network Rule name. + /// + public static void DeleteVirtualNetworkRule(this INamespacesOperations operations, string resourceGroupName, string namespaceName, string virtualNetworkRuleName) + { + operations.DeleteVirtualNetworkRuleAsync(resourceGroupName, namespaceName, virtualNetworkRuleName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an VirtualNetworkRule for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The Virtual Network Rule name. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteVirtualNetworkRuleAsync(this INamespacesOperations operations, string resourceGroupName, string namespaceName, string virtualNetworkRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteVirtualNetworkRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, virtualNetworkRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets an VirtualNetworkRule for a Namespace by rule name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The Virtual Network Rule name. + /// + public static VirtualNetworkRule GetVirtualNetworkRule(this INamespacesOperations operations, string resourceGroupName, string namespaceName, string virtualNetworkRuleName) + { + return operations.GetVirtualNetworkRuleAsync(resourceGroupName, namespaceName, virtualNetworkRuleName).GetAwaiter().GetResult(); + } + + /// + /// Gets an VirtualNetworkRule for a Namespace by rule name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The Virtual Network Rule name. + /// + /// + /// The cancellation token. + /// + public static async Task GetVirtualNetworkRuleAsync(this INamespacesOperations operations, string resourceGroupName, string namespaceName, string virtualNetworkRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetVirtualNetworkRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, virtualNetworkRuleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Gets the authorization rules for a namespace. /// @@ -596,46 +924,37 @@ public static AccessKeys RegenerateKeys(this INamespacesOperations operations, s } /// - /// This operation Migrate the given namespace to provided name type + /// Check the give namespace name availability. /// /// /// The operations group for this extension method. /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// The namespace name - /// /// - /// Parameters supplied to migrate namespace type. + /// Parameters to check availability of the given namespace name /// - public static void Migrate(this INamespacesOperations operations, string resourceGroupName, string namespaceName, SBNamespaceMigrate parameters) + public static CheckNameAvailabilityResult CheckNameAvailabilityMethod(this INamespacesOperations operations, CheckNameAvailability parameters) { - operations.MigrateAsync(resourceGroupName, namespaceName, parameters).GetAwaiter().GetResult(); + return operations.CheckNameAvailabilityMethodAsync(parameters).GetAwaiter().GetResult(); } /// - /// This operation Migrate the given namespace to provided name type + /// Check the give namespace name availability. /// /// /// The operations group for this extension method. /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// The namespace name - /// /// - /// Parameters supplied to migrate namespace type. + /// Parameters to check availability of the given namespace name /// /// /// The cancellation token. /// - public static async Task MigrateAsync(this INamespacesOperations operations, string resourceGroupName, string namespaceName, SBNamespaceMigrate parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CheckNameAvailabilityMethodAsync(this INamespacesOperations operations, CheckNameAvailability parameters, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.MigrateWithHttpMessagesAsync(resourceGroupName, namespaceName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.CheckNameAvailabilityMethodWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// @@ -724,6 +1043,89 @@ public static NetworkRuleSet GetNetworkRuleSet(this INamespacesOperations operat } } + /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + public static IPage ListNetworkRuleSets(this INamespacesOperations operations, string resourceGroupName, string namespaceName) + { + return operations.ListNetworkRuleSetsAsync(resourceGroupName, namespaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The cancellation token. + /// + public static async Task> ListNetworkRuleSetsAsync(this INamespacesOperations operations, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNetworkRuleSetsWithHttpMessagesAsync(resourceGroupName, namespaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// This operation Migrate the given namespace to provided name type + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// Parameters supplied to migrate namespace type. + /// + public static void Migrate(this INamespacesOperations operations, string resourceGroupName, string namespaceName, SBNamespaceMigrate parameters) + { + operations.MigrateAsync(resourceGroupName, namespaceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// This operation Migrate the given namespace to provided name type + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// Parameters supplied to migrate namespace type. + /// + /// + /// The cancellation token. + /// + public static async Task MigrateAsync(this INamespacesOperations operations, string resourceGroupName, string namespaceName, SBNamespaceMigrate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.MigrateWithHttpMessagesAsync(resourceGroupName, namespaceName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Creates or updates a service namespace. Once created, this namespace's /// resource manifest is immutable. This operation is idempotent. @@ -815,6 +1217,40 @@ public static void BeginDelete(this INamespacesOperations operations, string res (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, namespaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Gets a list of IP Filter rules for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListIpFilterRulesNext(this INamespacesOperations operations, string nextPageLink) + { + return operations.ListIpFilterRulesNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of IP Filter rules for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListIpFilterRulesNextAsync(this INamespacesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListIpFilterRulesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Gets all the available namespaces within the subscription, irrespective of /// the resource groups. @@ -889,6 +1325,40 @@ public static IPage ListByResourceGroupNext(this INamespacesOperati } } + /// + /// Gets a list of VirtualNetwork rules for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListVirtualNetworkRulesNext(this INamespacesOperations operations, string nextPageLink) + { + return operations.ListVirtualNetworkRulesNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of VirtualNetwork rules for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListVirtualNetworkRulesNextAsync(this INamespacesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListVirtualNetworkRulesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Gets the authorization rules for a namespace. /// @@ -925,5 +1395,39 @@ public static IPage ListAuthorizationRulesNext(this INamesp } } + /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNetworkRuleSetsNext(this INamespacesOperations operations, string nextPageLink) + { + return operations.ListNetworkRuleSetsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNetworkRuleSetsNextAsync(this INamespacesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNetworkRuleSetsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/PrivateEndpointConnectionsOperations.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/PrivateEndpointConnectionsOperations.cs new file mode 100644 index 0000000000000..0ccb7a215ea08 --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/PrivateEndpointConnectionsOperations.cs @@ -0,0 +1,1144 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateEndpointConnectionsOperations operations. + /// + internal partial class PrivateEndpointConnectionsOperations : IServiceOperations, IPrivateEndpointConnectionsOperations + { + /// + /// Initializes a new instance of the PrivateEndpointConnectionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PrivateEndpointConnectionsOperations(ServiceBusManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceBusManagementClient + /// + public ServiceBusManagementClient Client { get; private set; } + + /// + /// Gets the available PrivateEndpointConnections within a namespace. + /// + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (namespaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); + } + if (namespaceName != null) + { + if (namespaceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + } + if (namespaceName.Length < 6) + { + throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates PrivateEndpointConnections of service namespace. + /// + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The PrivateEndpointConnection name + /// + /// + /// Parameters supplied to update Status of PrivateEndPoint Connection to + /// namespace resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (namespaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); + } + if (namespaceName != null) + { + if (namespaceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + } + if (namespaceName.Length < 6) + { + throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + } + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes an existing Private Endpoint Connection. + /// + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The PrivateEndpointConnection name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, namespaceName, privateEndpointConnectionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a description for the specified Private Endpoint Connection. + /// + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The PrivateEndpointConnection name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (namespaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); + } + if (namespaceName != null) + { + if (namespaceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + } + if (namespaceName.Length < 6) + { + throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + } + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes an existing Private Endpoint Connection. + /// + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The PrivateEndpointConnection name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (namespaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); + } + if (namespaceName != null) + { + if (namespaceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + } + if (namespaceName.Length < 6) + { + throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the available PrivateEndpointConnections within a namespace. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs new file mode 100644 index 0000000000000..089b3065d89a8 --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs @@ -0,0 +1,297 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PrivateEndpointConnectionsOperations. + /// + public static partial class PrivateEndpointConnectionsOperationsExtensions + { + /// + /// Gets the available PrivateEndpointConnections within a namespace. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + public static IPage List(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string namespaceName) + { + return operations.ListAsync(resourceGroupName, namespaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the available PrivateEndpointConnections within a namespace. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, namespaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates PrivateEndpointConnections of service namespace. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The PrivateEndpointConnection name + /// + /// + /// Parameters supplied to update Status of PrivateEndPoint Connection to + /// namespace resource. + /// + public static PrivateEndpointConnection CreateOrUpdate(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, PrivateEndpointConnection parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, namespaceName, privateEndpointConnectionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates PrivateEndpointConnections of service namespace. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The PrivateEndpointConnection name + /// + /// + /// Parameters supplied to update Status of PrivateEndPoint Connection to + /// namespace resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, namespaceName, privateEndpointConnectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an existing Private Endpoint Connection. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The PrivateEndpointConnection name + /// + public static void Delete(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string namespaceName, string privateEndpointConnectionName) + { + operations.DeleteAsync(resourceGroupName, namespaceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an existing Private Endpoint Connection. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The PrivateEndpointConnection name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, namespaceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a description for the specified Private Endpoint Connection. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The PrivateEndpointConnection name + /// + public static PrivateEndpointConnection Get(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string namespaceName, string privateEndpointConnectionName) + { + return operations.GetAsync(resourceGroupName, namespaceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Gets a description for the specified Private Endpoint Connection. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The PrivateEndpointConnection name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, namespaceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an existing Private Endpoint Connection. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The PrivateEndpointConnection name + /// + public static void BeginDelete(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string namespaceName, string privateEndpointConnectionName) + { + operations.BeginDeleteAsync(resourceGroupName, namespaceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an existing Private Endpoint Connection. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The PrivateEndpointConnection name + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, namespaceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the available PrivateEndpointConnections within a namespace. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IPrivateEndpointConnectionsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the available PrivateEndpointConnections within a namespace. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IPrivateEndpointConnectionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/PrivateLinkResourcesOperations.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/PrivateLinkResourcesOperations.cs new file mode 100644 index 0000000000000..4bc45e29add5f --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/PrivateLinkResourcesOperations.cs @@ -0,0 +1,268 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateLinkResourcesOperations operations. + /// + internal partial class PrivateLinkResourcesOperations : IServiceOperations, IPrivateLinkResourcesOperations + { + /// + /// Initializes a new instance of the PrivateLinkResourcesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PrivateLinkResourcesOperations(ServiceBusManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceBusManagementClient + /// + public ServiceBusManagementClient Client { get; private set; } + + /// + /// Gets lists of resources that supports Privatelinks. + /// + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (namespaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); + } + if (namespaceName != null) + { + if (namespaceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + } + if (namespaceName.Length < 6) + { + throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/PrivateLinkResourcesOperationsExtensions.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/PrivateLinkResourcesOperationsExtensions.cs new file mode 100644 index 0000000000000..d67835cfd4a8e --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/PrivateLinkResourcesOperationsExtensions.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceBus +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PrivateLinkResourcesOperations. + /// + public static partial class PrivateLinkResourcesOperationsExtensions + { + /// + /// Gets lists of resources that supports Privatelinks. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + public static PrivateLinkResourcesListResult Get(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string namespaceName) + { + return operations.GetAsync(resourceGroupName, namespaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets lists of resources that supports Privatelinks. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, namespaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/QueuesOperations.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/QueuesOperations.cs index 6d07ba1fb2837..f9f14ce9f66c5 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/QueuesOperations.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/QueuesOperations.cs @@ -51,8 +51,8 @@ internal QueuesOperations(ServiceBusManagementClient client) public ServiceBusManagementClient Client { get; private set; } /// - /// Gets the queues within a namespace. - /// + /// Gets all authorization rules for a queue. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -60,15 +60,8 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// The namespace name /// - /// - /// Skip is only used if a previous operation returned a partial result. If a - /// previous response contains a nextLink element, the value of the nextLink - /// element will include a skip parameter that specifies a starting point to - /// use for subsequent calls. - /// - /// - /// May be used to limit the number of results to the most recent N - /// usageDetails. + /// + /// The queue name. /// /// /// Headers that will be added to request. @@ -91,7 +84,7 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByNamespaceWithHttpMessagesAsync(string resourceGroupName, string namespaceName, int? skip = default(int?), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListAuthorizationRulesWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -123,29 +116,24 @@ internal QueuesOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); } } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (skip > 1000) + if (queueName == null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "skip", 1000); + throw new ValidationException(ValidationRules.CannotBeNull, "queueName"); } - if (skip < 0) + if (queueName != null) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "skip", 0); + if (queueName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "queueName", 1); + } } - if (top > 1000) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "top", 1000); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (top < 1) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "top", 1); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -156,30 +144,22 @@ internal QueuesOperations(ServiceBusManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); - tracingParameters.Add("skip", skip); - tracingParameters.Add("top", top); + tracingParameters.Add("queueName", queueName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByNamespace", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListAuthorizationRules", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{queueName}", System.Uri.EscapeDataString(queueName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } - if (skip != null) - { - _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); - } - if (top != null) - { - _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -268,7 +248,7 @@ internal QueuesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -281,7 +261,7 @@ internal QueuesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -301,8 +281,7 @@ internal QueuesOperations(ServiceBusManagementClient client) } /// - /// Creates or updates a Service Bus queue. This operation is idempotent. - /// + /// Creates an authorization rule for a queue. /// /// /// Name of the Resource group within the Azure subscription. @@ -313,8 +292,11 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// The queue name. /// + /// + /// The authorization rule name. + /// /// - /// Parameters supplied to create or update a queue resource. + /// The shared access authorization rule. /// /// /// Headers that will be added to request. @@ -337,7 +319,7 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, SBQueue parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, SBAuthorizationRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -380,10 +362,29 @@ internal QueuesOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "queueName", 1); } } + if (authorizationRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); + } + if (authorizationRuleName != null) + { + if (authorizationRuleName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); + } + if (authorizationRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); + } + } if (parameters == null) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (parameters != null) + { + parameters.Validate(); + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -402,16 +403,18 @@ internal QueuesOperations(ServiceBusManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); tracingParameters.Add("queueName", queueName); + tracingParameters.Add("authorizationRuleName", authorizationRuleName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateAuthorizationRule", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{queueName}", System.Uri.EscapeDataString(queueName)); + _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -512,7 +515,7 @@ internal QueuesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -525,7 +528,7 @@ internal QueuesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -545,8 +548,8 @@ internal QueuesOperations(ServiceBusManagementClient client) } /// - /// Deletes a queue from the specified namespace in a resource group. - /// + /// Deletes a queue authorization rule. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -557,6 +560,9 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// The queue name. /// + /// + /// The authorization rule name. + /// /// /// Headers that will be added to request. /// @@ -575,7 +581,7 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -618,6 +624,21 @@ internal QueuesOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "queueName", 1); } } + if (authorizationRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); + } + if (authorizationRuleName != null) + { + if (authorizationRuleName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); + } + if (authorizationRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); + } + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -636,15 +657,17 @@ internal QueuesOperations(ServiceBusManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); tracingParameters.Add("queueName", queueName); + tracingParameters.Add("authorizationRuleName", authorizationRuleName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DeleteAuthorizationRule", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{queueName}", System.Uri.EscapeDataString(queueName)); + _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -754,8 +777,8 @@ internal QueuesOperations(ServiceBusManagementClient client) } /// - /// Returns a description for the specified queue. - /// + /// Gets an authorization rule for a queue by rule name. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -766,6 +789,9 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// The queue name. /// + /// + /// The authorization rule name. + /// /// /// Headers that will be added to request. /// @@ -787,7 +813,7 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -830,6 +856,21 @@ internal QueuesOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "queueName", 1); } } + if (authorizationRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); + } + if (authorizationRuleName != null) + { + if (authorizationRuleName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); + } + if (authorizationRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); + } + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -848,15 +889,17 @@ internal QueuesOperations(ServiceBusManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); tracingParameters.Add("queueName", queueName); + tracingParameters.Add("authorizationRuleName", authorizationRuleName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetAuthorizationRule", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{queueName}", System.Uri.EscapeDataString(queueName)); + _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -951,7 +994,7 @@ internal QueuesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -964,7 +1007,7 @@ internal QueuesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -984,8 +1027,8 @@ internal QueuesOperations(ServiceBusManagementClient client) } /// - /// Gets all authorization rules for a queue. - /// + /// Primary and secondary connection strings to the queue. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -996,6 +1039,9 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// The queue name. /// + /// + /// The authorization rule name. + /// /// /// Headers that will be added to request. /// @@ -1017,7 +1063,7 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListAuthorizationRulesWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1060,6 +1106,21 @@ internal QueuesOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "queueName", 1); } } + if (authorizationRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); + } + if (authorizationRuleName != null) + { + if (authorizationRuleName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); + } + if (authorizationRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); + } + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -1078,15 +1139,17 @@ internal QueuesOperations(ServiceBusManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); tracingParameters.Add("queueName", queueName); + tracingParameters.Add("authorizationRuleName", authorizationRuleName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListAuthorizationRules", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListKeys", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{queueName}", System.Uri.EscapeDataString(queueName)); + _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1100,7 +1163,7 @@ internal QueuesOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1181,7 +1244,7 @@ internal QueuesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1194,7 +1257,7 @@ internal QueuesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1214,7 +1277,8 @@ internal QueuesOperations(ServiceBusManagementClient client) } /// - /// Creates an authorization rule for a queue. + /// Regenerates the primary or secondary connection strings to the queue. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -1229,7 +1293,7 @@ internal QueuesOperations(ServiceBusManagementClient client) /// The authorization rule name. /// /// - /// The shared access authorization rule. + /// Parameters supplied to regenerate the authorization rule. /// /// /// Headers that will be added to request. @@ -1252,7 +1316,7 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, SBAuthorizationRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> RegenerateKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, RegenerateAccessKeyParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1339,11 +1403,11 @@ internal QueuesOperations(ServiceBusManagementClient client) tracingParameters.Add("authorizationRuleName", authorizationRuleName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateAuthorizationRule", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "RegenerateKeys", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{queueName}", System.Uri.EscapeDataString(queueName)); @@ -1361,7 +1425,7 @@ internal QueuesOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1448,7 +1512,7 @@ internal QueuesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1461,7 +1525,7 @@ internal QueuesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1481,8 +1545,8 @@ internal QueuesOperations(ServiceBusManagementClient client) } /// - /// Deletes a queue authorization rule. - /// + /// Gets the queues within a namespace. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -1490,11 +1554,15 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// The namespace name /// - /// - /// The queue name. + /// + /// Skip is only used if a previous operation returned a partial result. If a + /// previous response contains a nextLink element, the value of the nextLink + /// element will include a skip parameter that specifies a starting point to + /// use for subsequent calls. /// - /// - /// The authorization rule name. + /// + /// May be used to limit the number of results to the most recent N + /// usageDetails. /// /// /// Headers that will be added to request. @@ -1505,6 +1573,9 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1514,7 +1585,7 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByNamespaceWithHttpMessagesAsync(string resourceGroupName, string namespaceName, int? skip = default(int?), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1546,39 +1617,29 @@ internal QueuesOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); } } - if (queueName == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "queueName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (queueName != null) + if (Client.SubscriptionId == null) { - if (queueName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "queueName", 1); - } + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (authorizationRuleName == null) + if (skip > 1000) { - throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); + throw new ValidationException(ValidationRules.InclusiveMaximum, "skip", 1000); } - if (authorizationRuleName != null) + if (skip < 0) { - if (authorizationRuleName.Length > 50) - { - throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); - } - if (authorizationRuleName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); - } + throw new ValidationException(ValidationRules.InclusiveMinimum, "skip", 0); } - if (Client.ApiVersion == null) + if (top > 1000) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.InclusiveMaximum, "top", 1000); } - if (Client.SubscriptionId == null) + if (top < 1) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.InclusiveMinimum, "top", 1); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1589,24 +1650,30 @@ internal QueuesOperations(ServiceBusManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); - tracingParameters.Add("queueName", queueName); - tracingParameters.Add("authorizationRuleName", authorizationRuleName); + tracingParameters.Add("skip", skip); + tracingParameters.Add("top", top); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteAuthorizationRule", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByNamespace", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); - _url = _url.Replace("{queueName}", System.Uri.EscapeDataString(queueName)); - _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -1614,7 +1681,7 @@ internal QueuesOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1665,7 +1732,7 @@ internal QueuesOperations(ServiceBusManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1695,13 +1762,31 @@ internal QueuesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1710,8 +1795,8 @@ internal QueuesOperations(ServiceBusManagementClient client) } /// - /// Gets an authorization rule for a queue by rule name. - /// + /// Creates or updates a Service Bus queue. This operation is idempotent. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -1722,8 +1807,8 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// The queue name. /// - /// - /// The authorization rule name. + /// + /// Parameters supplied to create or update a queue resource. /// /// /// Headers that will be added to request. @@ -1746,7 +1831,7 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, SBQueue parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1789,20 +1874,9 @@ internal QueuesOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "queueName", 1); } } - if (authorizationRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); - } - if (authorizationRuleName != null) + if (parameters == null) { - if (authorizationRuleName.Length > 50) - { - throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); - } - if (authorizationRuleName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); - } + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } if (Client.ApiVersion == null) { @@ -1822,17 +1896,16 @@ internal QueuesOperations(ServiceBusManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); tracingParameters.Add("queueName", queueName); - tracingParameters.Add("authorizationRuleName", authorizationRuleName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetAuthorizationRule", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{queueName}", System.Uri.EscapeDataString(queueName)); - _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1846,7 +1919,7 @@ internal QueuesOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1877,6 +1950,12 @@ internal QueuesOperations(ServiceBusManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -1927,7 +2006,7 @@ internal QueuesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1940,7 +2019,7 @@ internal QueuesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1960,8 +2039,8 @@ internal QueuesOperations(ServiceBusManagementClient client) } /// - /// Primary and secondary connection strings to the queue. - /// + /// Deletes a queue from the specified namespace in a resource group. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -1972,9 +2051,6 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// The queue name. /// - /// - /// The authorization rule name. - /// /// /// Headers that will be added to request. /// @@ -1984,9 +2060,6 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -1996,7 +2069,7 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -2039,21 +2112,6 @@ internal QueuesOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "queueName", 1); } } - if (authorizationRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); - } - if (authorizationRuleName != null) - { - if (authorizationRuleName.Length > 50) - { - throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); - } - if (authorizationRuleName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); - } - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -2072,17 +2130,15 @@ internal QueuesOperations(ServiceBusManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); tracingParameters.Add("queueName", queueName); - tracingParameters.Add("authorizationRuleName", authorizationRuleName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListKeys", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{queueName}", System.Uri.EscapeDataString(queueName)); - _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -2096,7 +2152,7 @@ internal QueuesOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2147,7 +2203,7 @@ internal QueuesOperations(ServiceBusManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 204) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2177,31 +2233,13 @@ internal QueuesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -2210,8 +2248,8 @@ internal QueuesOperations(ServiceBusManagementClient client) } /// - /// Regenerates the primary or secondary connection strings to the queue. - /// + /// Returns a description for the specified queue. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -2222,12 +2260,6 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// The queue name. /// - /// - /// The authorization rule name. - /// - /// - /// Parameters supplied to regenerate the authorization rule. - /// /// /// Headers that will be added to request. /// @@ -2249,7 +2281,7 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> RegenerateKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, RegenerateAccessKeyParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string queueName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -2292,29 +2324,6 @@ internal QueuesOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "queueName", 1); } } - if (authorizationRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); - } - if (authorizationRuleName != null) - { - if (authorizationRuleName.Length > 50) - { - throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); - } - if (authorizationRuleName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); - } - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -2333,18 +2342,15 @@ internal QueuesOperations(ServiceBusManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); tracingParameters.Add("queueName", queueName); - tracingParameters.Add("authorizationRuleName", authorizationRuleName); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "RegenerateKeys", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{queueName}", System.Uri.EscapeDataString(queueName)); - _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -2358,7 +2364,7 @@ internal QueuesOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2389,12 +2395,6 @@ internal QueuesOperations(ServiceBusManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -2445,7 +2445,7 @@ internal QueuesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2458,7 +2458,7 @@ internal QueuesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2478,8 +2478,8 @@ internal QueuesOperations(ServiceBusManagementClient client) } /// - /// Gets the queues within a namespace. - /// + /// Gets all authorization rules for a queue. + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -2505,7 +2505,7 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByNamespaceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListAuthorizationRulesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2520,7 +2520,7 @@ internal QueuesOperations(ServiceBusManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByNamespaceNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListAuthorizationRulesNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2614,7 +2614,7 @@ internal QueuesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2627,7 +2627,7 @@ internal QueuesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2647,8 +2647,8 @@ internal QueuesOperations(ServiceBusManagementClient client) } /// - /// Gets all authorization rules for a queue. - /// + /// Gets the queues within a namespace. + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -2674,7 +2674,7 @@ internal QueuesOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListAuthorizationRulesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByNamespaceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2689,7 +2689,7 @@ internal QueuesOperations(ServiceBusManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListAuthorizationRulesNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByNamespaceNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2783,7 +2783,7 @@ internal QueuesOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2796,7 +2796,7 @@ internal QueuesOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/QueuesOperationsExtensions.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/QueuesOperationsExtensions.cs index 3c7e0395cb81e..ef68513e5020d 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/QueuesOperationsExtensions.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/QueuesOperationsExtensions.cs @@ -22,8 +22,8 @@ namespace Microsoft.Azure.Management.ServiceBus public static partial class QueuesOperationsExtensions { /// - /// Gets the queues within a namespace. - /// + /// Gets all authorization rules for a queue. + /// /// /// /// The operations group for this extension method. @@ -34,24 +34,17 @@ public static partial class QueuesOperationsExtensions /// /// The namespace name /// - /// - /// Skip is only used if a previous operation returned a partial result. If a - /// previous response contains a nextLink element, the value of the nextLink - /// element will include a skip parameter that specifies a starting point to - /// use for subsequent calls. - /// - /// - /// May be used to limit the number of results to the most recent N - /// usageDetails. + /// + /// The queue name. /// - public static IPage ListByNamespace(this IQueuesOperations operations, string resourceGroupName, string namespaceName, int? skip = default(int?), int? top = default(int?)) + public static IPage ListAuthorizationRules(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName) { - return operations.ListByNamespaceAsync(resourceGroupName, namespaceName, skip, top).GetAwaiter().GetResult(); + return operations.ListAuthorizationRulesAsync(resourceGroupName, namespaceName, queueName).GetAwaiter().GetResult(); } /// - /// Gets the queues within a namespace. - /// + /// Gets all authorization rules for a queue. + /// /// /// /// The operations group for this extension method. @@ -62,30 +55,22 @@ public static partial class QueuesOperationsExtensions /// /// The namespace name /// - /// - /// Skip is only used if a previous operation returned a partial result. If a - /// previous response contains a nextLink element, the value of the nextLink - /// element will include a skip parameter that specifies a starting point to - /// use for subsequent calls. - /// - /// - /// May be used to limit the number of results to the most recent N - /// usageDetails. + /// + /// The queue name. /// /// /// The cancellation token. /// - public static async Task> ListByNamespaceAsync(this IQueuesOperations operations, string resourceGroupName, string namespaceName, int? skip = default(int?), int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAuthorizationRulesAsync(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByNamespaceWithHttpMessagesAsync(resourceGroupName, namespaceName, skip, top, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListAuthorizationRulesWithHttpMessagesAsync(resourceGroupName, namespaceName, queueName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Creates or updates a Service Bus queue. This operation is idempotent. - /// + /// Creates an authorization rule for a queue. /// /// /// The operations group for this extension method. @@ -99,17 +84,19 @@ public static partial class QueuesOperationsExtensions /// /// The queue name. /// + /// + /// The authorization rule name. + /// /// - /// Parameters supplied to create or update a queue resource. + /// The shared access authorization rule. /// - public static SBQueue CreateOrUpdate(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, SBQueue parameters) + public static SBAuthorizationRule CreateOrUpdateAuthorizationRule(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, SBAuthorizationRule parameters) { - return operations.CreateOrUpdateAsync(resourceGroupName, namespaceName, queueName, parameters).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAuthorizationRuleAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters).GetAwaiter().GetResult(); } /// - /// Creates or updates a Service Bus queue. This operation is idempotent. - /// + /// Creates an authorization rule for a queue. /// /// /// The operations group for this extension method. @@ -123,23 +110,26 @@ public static SBQueue CreateOrUpdate(this IQueuesOperations operations, string r /// /// The queue name. /// + /// + /// The authorization rule name. + /// /// - /// Parameters supplied to create or update a queue resource. + /// The shared access authorization rule. /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, SBQueue parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAuthorizationRuleAsync(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, SBAuthorizationRule parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, namespaceName, queueName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateAuthorizationRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Deletes a queue from the specified namespace in a resource group. - /// + /// Deletes a queue authorization rule. + /// /// /// /// The operations group for this extension method. @@ -153,14 +143,17 @@ public static SBQueue CreateOrUpdate(this IQueuesOperations operations, string r /// /// The queue name. /// - public static void Delete(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName) + /// + /// The authorization rule name. + /// + public static void DeleteAuthorizationRule(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName) { - operations.DeleteAsync(resourceGroupName, namespaceName, queueName).GetAwaiter().GetResult(); + operations.DeleteAuthorizationRuleAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).GetAwaiter().GetResult(); } /// - /// Deletes a queue from the specified namespace in a resource group. - /// + /// Deletes a queue authorization rule. + /// /// /// /// The operations group for this extension method. @@ -174,17 +167,20 @@ public static void Delete(this IQueuesOperations operations, string resourceGrou /// /// The queue name. /// + /// + /// The authorization rule name. + /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAuthorizationRuleAsync(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, namespaceName, queueName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteAuthorizationRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Returns a description for the specified queue. - /// + /// Gets an authorization rule for a queue by rule name. + /// /// /// /// The operations group for this extension method. @@ -198,14 +194,17 @@ public static void Delete(this IQueuesOperations operations, string resourceGrou /// /// The queue name. /// - public static SBQueue Get(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName) + /// + /// The authorization rule name. + /// + public static SBAuthorizationRule GetAuthorizationRule(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName) { - return operations.GetAsync(resourceGroupName, namespaceName, queueName).GetAwaiter().GetResult(); + return operations.GetAuthorizationRuleAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).GetAwaiter().GetResult(); } /// - /// Returns a description for the specified queue. - /// + /// Gets an authorization rule for a queue by rule name. + /// /// /// /// The operations group for this extension method. @@ -219,20 +218,23 @@ public static SBQueue Get(this IQueuesOperations operations, string resourceGrou /// /// The queue name. /// + /// + /// The authorization rule name. + /// /// /// The cancellation token. /// - public static async Task GetAsync(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAuthorizationRuleAsync(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, namespaceName, queueName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetAuthorizationRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets all authorization rules for a queue. - /// + /// Primary and secondary connection strings to the queue. + /// /// /// /// The operations group for this extension method. @@ -246,14 +248,17 @@ public static SBQueue Get(this IQueuesOperations operations, string resourceGrou /// /// The queue name. /// - public static IPage ListAuthorizationRules(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName) + /// + /// The authorization rule name. + /// + public static AccessKeys ListKeys(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName) { - return operations.ListAuthorizationRulesAsync(resourceGroupName, namespaceName, queueName).GetAwaiter().GetResult(); + return operations.ListKeysAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).GetAwaiter().GetResult(); } /// - /// Gets all authorization rules for a queue. - /// + /// Primary and secondary connection strings to the queue. + /// /// /// /// The operations group for this extension method. @@ -267,19 +272,23 @@ public static IPage ListAuthorizationRules(this IQueuesOper /// /// The queue name. /// + /// + /// The authorization rule name. + /// /// /// The cancellation token. /// - public static async Task> ListAuthorizationRulesAsync(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListKeysAsync(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListAuthorizationRulesWithHttpMessagesAsync(resourceGroupName, namespaceName, queueName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListKeysWithHttpMessagesAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Creates an authorization rule for a queue. + /// Regenerates the primary or secondary connection strings to the queue. + /// /// /// /// The operations group for this extension method. @@ -297,15 +306,16 @@ public static IPage ListAuthorizationRules(this IQueuesOper /// The authorization rule name. /// /// - /// The shared access authorization rule. + /// Parameters supplied to regenerate the authorization rule. /// - public static SBAuthorizationRule CreateOrUpdateAuthorizationRule(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, SBAuthorizationRule parameters) + public static AccessKeys RegenerateKeys(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, RegenerateAccessKeyParameters parameters) { - return operations.CreateOrUpdateAuthorizationRuleAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters).GetAwaiter().GetResult(); + return operations.RegenerateKeysAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters).GetAwaiter().GetResult(); } /// - /// Creates an authorization rule for a queue. + /// Regenerates the primary or secondary connection strings to the queue. + /// /// /// /// The operations group for this extension method. @@ -323,22 +333,22 @@ public static SBAuthorizationRule CreateOrUpdateAuthorizationRule(this IQueuesOp /// The authorization rule name. /// /// - /// The shared access authorization rule. + /// Parameters supplied to regenerate the authorization rule. /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAuthorizationRuleAsync(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, SBAuthorizationRule parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task RegenerateKeysAsync(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, RegenerateAccessKeyParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateAuthorizationRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.RegenerateKeysWithHttpMessagesAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Deletes a queue authorization rule. - /// + /// Gets the queues within a namespace. + /// /// /// /// The operations group for this extension method. @@ -349,20 +359,24 @@ public static SBAuthorizationRule CreateOrUpdateAuthorizationRule(this IQueuesOp /// /// The namespace name /// - /// - /// The queue name. + /// + /// Skip is only used if a previous operation returned a partial result. If a + /// previous response contains a nextLink element, the value of the nextLink + /// element will include a skip parameter that specifies a starting point to + /// use for subsequent calls. /// - /// - /// The authorization rule name. + /// + /// May be used to limit the number of results to the most recent N + /// usageDetails. /// - public static void DeleteAuthorizationRule(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName) + public static IPage ListByNamespace(this IQueuesOperations operations, string resourceGroupName, string namespaceName, int? skip = default(int?), int? top = default(int?)) { - operations.DeleteAuthorizationRuleAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).GetAwaiter().GetResult(); + return operations.ListByNamespaceAsync(resourceGroupName, namespaceName, skip, top).GetAwaiter().GetResult(); } /// - /// Deletes a queue authorization rule. - /// + /// Gets the queues within a namespace. + /// /// /// /// The operations group for this extension method. @@ -373,23 +387,30 @@ public static void DeleteAuthorizationRule(this IQueuesOperations operations, st /// /// The namespace name /// - /// - /// The queue name. + /// + /// Skip is only used if a previous operation returned a partial result. If a + /// previous response contains a nextLink element, the value of the nextLink + /// element will include a skip parameter that specifies a starting point to + /// use for subsequent calls. /// - /// - /// The authorization rule name. + /// + /// May be used to limit the number of results to the most recent N + /// usageDetails. /// /// /// The cancellation token. /// - public static async Task DeleteAuthorizationRuleAsync(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByNamespaceAsync(this IQueuesOperations operations, string resourceGroupName, string namespaceName, int? skip = default(int?), int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteAuthorizationRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.ListByNamespaceWithHttpMessagesAsync(resourceGroupName, namespaceName, skip, top, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Gets an authorization rule for a queue by rule name. - /// + /// Creates or updates a Service Bus queue. This operation is idempotent. + /// /// /// /// The operations group for this extension method. @@ -403,17 +424,17 @@ public static void DeleteAuthorizationRule(this IQueuesOperations operations, st /// /// The queue name. /// - /// - /// The authorization rule name. + /// + /// Parameters supplied to create or update a queue resource. /// - public static SBAuthorizationRule GetAuthorizationRule(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName) + public static SBQueue CreateOrUpdate(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, SBQueue parameters) { - return operations.GetAuthorizationRuleAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, namespaceName, queueName, parameters).GetAwaiter().GetResult(); } /// - /// Gets an authorization rule for a queue by rule name. - /// + /// Creates or updates a Service Bus queue. This operation is idempotent. + /// /// /// /// The operations group for this extension method. @@ -427,23 +448,23 @@ public static SBAuthorizationRule GetAuthorizationRule(this IQueuesOperations op /// /// The queue name. /// - /// - /// The authorization rule name. + /// + /// Parameters supplied to create or update a queue resource. /// /// /// The cancellation token. /// - public static async Task GetAuthorizationRuleAsync(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, SBQueue parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetAuthorizationRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, namespaceName, queueName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Primary and secondary connection strings to the queue. - /// + /// Deletes a queue from the specified namespace in a resource group. + /// /// /// /// The operations group for this extension method. @@ -457,17 +478,14 @@ public static SBAuthorizationRule GetAuthorizationRule(this IQueuesOperations op /// /// The queue name. /// - /// - /// The authorization rule name. - /// - public static AccessKeys ListKeys(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName) + public static void Delete(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName) { - return operations.ListKeysAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, namespaceName, queueName).GetAwaiter().GetResult(); } /// - /// Primary and secondary connection strings to the queue. - /// + /// Deletes a queue from the specified namespace in a resource group. + /// /// /// /// The operations group for this extension method. @@ -481,23 +499,17 @@ public static AccessKeys ListKeys(this IQueuesOperations operations, string reso /// /// The queue name. /// - /// - /// The authorization rule name. - /// /// /// The cancellation token. /// - public static async Task ListKeysAsync(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListKeysWithHttpMessagesAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, namespaceName, queueName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Regenerates the primary or secondary connection strings to the queue. - /// + /// Returns a description for the specified queue. + /// /// /// /// The operations group for this extension method. @@ -511,20 +523,14 @@ public static AccessKeys ListKeys(this IQueuesOperations operations, string reso /// /// The queue name. /// - /// - /// The authorization rule name. - /// - /// - /// Parameters supplied to regenerate the authorization rule. - /// - public static AccessKeys RegenerateKeys(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, RegenerateAccessKeyParameters parameters) + public static SBQueue Get(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName) { - return operations.RegenerateKeysAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, namespaceName, queueName).GetAwaiter().GetResult(); } /// - /// Regenerates the primary or secondary connection strings to the queue. - /// + /// Returns a description for the specified queue. + /// /// /// /// The operations group for this extension method. @@ -538,26 +544,20 @@ public static AccessKeys RegenerateKeys(this IQueuesOperations operations, strin /// /// The queue name. /// - /// - /// The authorization rule name. - /// - /// - /// Parameters supplied to regenerate the authorization rule. - /// /// /// The cancellation token. /// - public static async Task RegenerateKeysAsync(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName, RegenerateAccessKeyParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IQueuesOperations operations, string resourceGroupName, string namespaceName, string queueName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.RegenerateKeysWithHttpMessagesAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, namespaceName, queueName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets the queues within a namespace. - /// + /// Gets all authorization rules for a queue. + /// /// /// /// The operations group for this extension method. @@ -565,14 +565,14 @@ public static AccessKeys RegenerateKeys(this IQueuesOperations operations, strin /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByNamespaceNext(this IQueuesOperations operations, string nextPageLink) + public static IPage ListAuthorizationRulesNext(this IQueuesOperations operations, string nextPageLink) { - return operations.ListByNamespaceNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListAuthorizationRulesNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Gets the queues within a namespace. - /// + /// Gets all authorization rules for a queue. + /// /// /// /// The operations group for this extension method. @@ -583,17 +583,17 @@ public static IPage ListByNamespaceNext(this IQueuesOperations operatio /// /// The cancellation token. /// - public static async Task> ListByNamespaceNextAsync(this IQueuesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAuthorizationRulesNextAsync(this IQueuesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByNamespaceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListAuthorizationRulesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets all authorization rules for a queue. - /// + /// Gets the queues within a namespace. + /// /// /// /// The operations group for this extension method. @@ -601,14 +601,14 @@ public static IPage ListByNamespaceNext(this IQueuesOperations operatio /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListAuthorizationRulesNext(this IQueuesOperations operations, string nextPageLink) + public static IPage ListByNamespaceNext(this IQueuesOperations operations, string nextPageLink) { - return operations.ListAuthorizationRulesNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByNamespaceNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Gets all authorization rules for a queue. - /// + /// Gets the queues within a namespace. + /// /// /// /// The operations group for this extension method. @@ -619,9 +619,9 @@ public static IPage ListAuthorizationRulesNext(this IQueues /// /// The cancellation token. /// - public static async Task> ListAuthorizationRulesNextAsync(this IQueuesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByNamespaceNextAsync(this IQueuesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListAuthorizationRulesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByNamespaceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/RulesOperations.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/RulesOperations.cs index f162eb0c40242..05a5b053c266d 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/RulesOperations.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/RulesOperations.cs @@ -454,6 +454,10 @@ internal RulesOperations(ServiceBusManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (parameters != null) + { + parameters.Validate(); + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/SdkInfo_ServiceBusManagementClient.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/SdkInfo_ServiceBusManagementClient.cs index c4b79f7a1e4e7..5ae082cd0d9b6 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/SdkInfo_ServiceBusManagementClient.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/SdkInfo_ServiceBusManagementClient.cs @@ -19,17 +19,19 @@ public static IEnumerable> ApiInfo_ServiceBusManag { return new Tuple[] { - new Tuple("ServiceBus", "DisasterRecoveryConfigs", "2017-04-01"), - new Tuple("ServiceBus", "EventHubs", "2017-04-01"), - new Tuple("ServiceBus", "MigrationConfigs", "2017-04-01"), - new Tuple("ServiceBus", "Namespaces", "2017-04-01"), - new Tuple("ServiceBus", "Operations", "2017-04-01"), - new Tuple("ServiceBus", "PremiumMessagingRegions", "2017-04-01"), - new Tuple("ServiceBus", "Queues", "2017-04-01"), - new Tuple("ServiceBus", "Regions", "2017-04-01"), - new Tuple("ServiceBus", "Rules", "2017-04-01"), - new Tuple("ServiceBus", "Subscriptions", "2017-04-01"), - new Tuple("ServiceBus", "Topics", "2017-04-01"), + new Tuple("ServiceBus", "DisasterRecoveryConfigs", "2018-01-01-preview"), + new Tuple("ServiceBus", "EventHubs", "2018-01-01-preview"), + new Tuple("ServiceBus", "MigrationConfigs", "2018-01-01-preview"), + new Tuple("ServiceBus", "Namespaces", "2018-01-01-preview"), + new Tuple("ServiceBus", "Operations", "2018-01-01-preview"), + new Tuple("ServiceBus", "PremiumMessagingRegions", "2018-01-01-preview"), + new Tuple("ServiceBus", "PrivateEndpointConnections", "2018-01-01-preview"), + new Tuple("ServiceBus", "PrivateLinkResources", "2018-01-01-preview"), + new Tuple("ServiceBus", "Queues", "2018-01-01-preview"), + new Tuple("ServiceBus", "Regions", "2018-01-01-preview"), + new Tuple("ServiceBus", "Rules", "2018-01-01-preview"), + new Tuple("ServiceBus", "Subscriptions", "2018-01-01-preview"), + new Tuple("ServiceBus", "Topics", "2018-01-01-preview"), }.AsEnumerable(); } } diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/ServiceBusManagementClient.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/ServiceBusManagementClient.cs index 7a09870490233..f0fb826668cba 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/ServiceBusManagementClient.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/ServiceBusManagementClient.cs @@ -21,9 +21,6 @@ namespace Microsoft.Azure.Management.ServiceBus using System.Net; using System.Net.Http; - /// - /// Azure Service Bus client - /// public partial class ServiceBusManagementClient : ServiceClient, IServiceBusManagementClient, IAzureClient { /// @@ -77,24 +74,24 @@ public partial class ServiceBusManagementClient : ServiceClient - /// Gets the IOperations. + /// Gets the INamespacesOperations. /// - public virtual IOperations Operations { get; private set; } + public virtual INamespacesOperations Namespaces { get; private set; } /// - /// Gets the INamespacesOperations. + /// Gets the IPrivateEndpointConnectionsOperations. /// - public virtual INamespacesOperations Namespaces { get; private set; } + public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } /// - /// Gets the IDisasterRecoveryConfigsOperations. + /// Gets the IPrivateLinkResourcesOperations. /// - public virtual IDisasterRecoveryConfigsOperations DisasterRecoveryConfigs { get; private set; } + public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } /// - /// Gets the IMigrationConfigsOperations. + /// Gets the IDisasterRecoveryConfigsOperations. /// - public virtual IMigrationConfigsOperations MigrationConfigs { get; private set; } + public virtual IDisasterRecoveryConfigsOperations DisasterRecoveryConfigs { get; private set; } /// /// Gets the IQueuesOperations. @@ -107,14 +104,19 @@ public partial class ServiceBusManagementClient : ServiceClient - /// Gets the ISubscriptionsOperations. + /// Gets the IEventHubsOperations. /// - public virtual ISubscriptionsOperations Subscriptions { get; private set; } + public virtual IEventHubsOperations EventHubs { get; private set; } /// - /// Gets the IRulesOperations. + /// Gets the IMigrationConfigsOperations. /// - public virtual IRulesOperations Rules { get; private set; } + public virtual IMigrationConfigsOperations MigrationConfigs { get; private set; } + + /// + /// Gets the IPremiumMessagingRegionsOperations. + /// + public virtual IPremiumMessagingRegionsOperations PremiumMessagingRegions { get; private set; } /// /// Gets the IRegionsOperations. @@ -122,14 +124,19 @@ public partial class ServiceBusManagementClient : ServiceClient - /// Gets the IPremiumMessagingRegionsOperations. + /// Gets the ISubscriptionsOperations. /// - public virtual IPremiumMessagingRegionsOperations PremiumMessagingRegions { get; private set; } + public virtual ISubscriptionsOperations Subscriptions { get; private set; } /// - /// Gets the IEventHubsOperations. + /// Gets the IRulesOperations. /// - public virtual IEventHubsOperations EventHubs { get; private set; } + public virtual IRulesOperations Rules { get; private set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } /// /// Initializes a new instance of the ServiceBusManagementClient class. @@ -372,19 +379,21 @@ public ServiceBusManagementClient(System.Uri baseUri, ServiceClientCredentials c /// private void Initialize() { - Operations = new Operations(this); Namespaces = new NamespacesOperations(this); + PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); + PrivateLinkResources = new PrivateLinkResourcesOperations(this); DisasterRecoveryConfigs = new DisasterRecoveryConfigsOperations(this); - MigrationConfigs = new MigrationConfigsOperations(this); Queues = new QueuesOperations(this); Topics = new TopicsOperations(this); + EventHubs = new EventHubsOperations(this); + MigrationConfigs = new MigrationConfigsOperations(this); + PremiumMessagingRegions = new PremiumMessagingRegionsOperations(this); + Regions = new RegionsOperations(this); Subscriptions = new SubscriptionsOperations(this); Rules = new RulesOperations(this); - Regions = new RegionsOperations(this); - PremiumMessagingRegions = new PremiumMessagingRegionsOperations(this); - EventHubs = new EventHubsOperations(this); + Operations = new Operations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2017-04-01"; + ApiVersion = "2018-01-01-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/TopicsOperations.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/TopicsOperations.cs index dd4801028c2ae..be7bfd727d4b4 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/TopicsOperations.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/TopicsOperations.cs @@ -51,8 +51,8 @@ internal TopicsOperations(ServiceBusManagementClient client) public ServiceBusManagementClient Client { get; private set; } /// - /// Gets all the topics in a namespace. - /// + /// Gets authorization rules for a topic. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -60,15 +60,8 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// The namespace name /// - /// - /// Skip is only used if a previous operation returned a partial result. If a - /// previous response contains a nextLink element, the value of the nextLink - /// element will include a skip parameter that specifies a starting point to - /// use for subsequent calls. - /// - /// - /// May be used to limit the number of results to the most recent N - /// usageDetails. + /// + /// The topic name. /// /// /// Headers that will be added to request. @@ -91,7 +84,7 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByNamespaceWithHttpMessagesAsync(string resourceGroupName, string namespaceName, int? skip = default(int?), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListAuthorizationRulesWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -123,29 +116,24 @@ internal TopicsOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); } } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (skip > 1000) + if (topicName == null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "skip", 1000); + throw new ValidationException(ValidationRules.CannotBeNull, "topicName"); } - if (skip < 0) + if (topicName != null) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "skip", 0); + if (topicName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "topicName", 1); + } } - if (top > 1000) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "top", 1000); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (top < 1) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "top", 1); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -156,30 +144,22 @@ internal TopicsOperations(ServiceBusManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); - tracingParameters.Add("skip", skip); - tracingParameters.Add("top", top); + tracingParameters.Add("topicName", topicName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByNamespace", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListAuthorizationRules", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{topicName}", System.Uri.EscapeDataString(topicName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } - if (skip != null) - { - _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); - } - if (top != null) - { - _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -268,7 +248,7 @@ internal TopicsOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -281,7 +261,7 @@ internal TopicsOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -301,8 +281,8 @@ internal TopicsOperations(ServiceBusManagementClient client) } /// - /// Creates a topic in the specified namespace. - /// + /// Creates an authorization rule for the specified topic. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -313,8 +293,11 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// The topic name. /// + /// + /// The authorization rule name. + /// /// - /// Parameters supplied to create a topic resource. + /// The shared access authorization rule. /// /// /// Headers that will be added to request. @@ -337,7 +320,7 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, SBTopic parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, SBAuthorizationRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -380,10 +363,29 @@ internal TopicsOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "topicName", 1); } } + if (authorizationRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); + } + if (authorizationRuleName != null) + { + if (authorizationRuleName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); + } + if (authorizationRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); + } + } if (parameters == null) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (parameters != null) + { + parameters.Validate(); + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -402,16 +404,18 @@ internal TopicsOperations(ServiceBusManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); tracingParameters.Add("topicName", topicName); + tracingParameters.Add("authorizationRuleName", authorizationRuleName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateAuthorizationRule", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{topicName}", System.Uri.EscapeDataString(topicName)); + _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -512,7 +516,7 @@ internal TopicsOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -525,7 +529,7 @@ internal TopicsOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -545,8 +549,8 @@ internal TopicsOperations(ServiceBusManagementClient client) } /// - /// Deletes a topic from the specified namespace and resource group. - /// + /// Returns the specified authorization rule. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -557,6 +561,9 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// The topic name. /// + /// + /// The authorization rule name. + /// /// /// Headers that will be added to request. /// @@ -566,6 +573,9 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -575,7 +585,7 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -618,6 +628,21 @@ internal TopicsOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "topicName", 1); } } + if (authorizationRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); + } + if (authorizationRuleName != null) + { + if (authorizationRuleName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); + } + if (authorizationRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); + } + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -636,15 +661,17 @@ internal TopicsOperations(ServiceBusManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); tracingParameters.Add("topicName", topicName); + tracingParameters.Add("authorizationRuleName", authorizationRuleName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetAuthorizationRule", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{topicName}", System.Uri.EscapeDataString(topicName)); + _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -658,7 +685,7 @@ internal TopicsOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -709,7 +736,7 @@ internal TopicsOperations(ServiceBusManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -739,13 +766,31 @@ internal TopicsOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -754,8 +799,8 @@ internal TopicsOperations(ServiceBusManagementClient client) } /// - /// Returns a description for the specified topic. - /// + /// Deletes a topic authorization rule. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -766,6 +811,9 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// The topic name. /// + /// + /// The authorization rule name. + /// /// /// Headers that will be added to request. /// @@ -775,9 +823,6 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -787,7 +832,7 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -830,6 +875,21 @@ internal TopicsOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "topicName", 1); } } + if (authorizationRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); + } + if (authorizationRuleName != null) + { + if (authorizationRuleName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); + } + if (authorizationRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); + } + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -848,15 +908,17 @@ internal TopicsOperations(ServiceBusManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); tracingParameters.Add("topicName", topicName); + tracingParameters.Add("authorizationRuleName", authorizationRuleName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DeleteAuthorizationRule", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{topicName}", System.Uri.EscapeDataString(topicName)); + _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -870,7 +932,7 @@ internal TopicsOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -921,7 +983,7 @@ internal TopicsOperations(ServiceBusManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 204) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -951,31 +1013,13 @@ internal TopicsOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -984,8 +1028,8 @@ internal TopicsOperations(ServiceBusManagementClient client) } /// - /// Gets authorization rules for a topic. - /// + /// Gets the primary and secondary connection strings for the topic. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -996,6 +1040,9 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// The topic name. /// + /// + /// The authorization rule name. + /// /// /// Headers that will be added to request. /// @@ -1017,7 +1064,7 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListAuthorizationRulesWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1060,6 +1107,21 @@ internal TopicsOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "topicName", 1); } } + if (authorizationRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); + } + if (authorizationRuleName != null) + { + if (authorizationRuleName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); + } + if (authorizationRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); + } + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -1078,15 +1140,17 @@ internal TopicsOperations(ServiceBusManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); tracingParameters.Add("topicName", topicName); + tracingParameters.Add("authorizationRuleName", authorizationRuleName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListAuthorizationRules", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListKeys", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{topicName}", System.Uri.EscapeDataString(topicName)); + _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1100,7 +1164,7 @@ internal TopicsOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1181,7 +1245,7 @@ internal TopicsOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1194,7 +1258,7 @@ internal TopicsOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1214,8 +1278,8 @@ internal TopicsOperations(ServiceBusManagementClient client) } /// - /// Creates an authorization rule for the specified topic. - /// + /// Regenerates primary or secondary connection strings for the topic. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -1230,7 +1294,7 @@ internal TopicsOperations(ServiceBusManagementClient client) /// The authorization rule name. /// /// - /// The shared access authorization rule. + /// Parameters supplied to regenerate the authorization rule. /// /// /// Headers that will be added to request. @@ -1253,7 +1317,7 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, SBAuthorizationRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> RegenerateKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, RegenerateAccessKeyParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1340,11 +1404,11 @@ internal TopicsOperations(ServiceBusManagementClient client) tracingParameters.Add("authorizationRuleName", authorizationRuleName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateAuthorizationRule", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "RegenerateKeys", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{topicName}", System.Uri.EscapeDataString(topicName)); @@ -1362,7 +1426,7 @@ internal TopicsOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1449,7 +1513,7 @@ internal TopicsOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1462,7 +1526,7 @@ internal TopicsOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1482,8 +1546,8 @@ internal TopicsOperations(ServiceBusManagementClient client) } /// - /// Returns the specified authorization rule. - /// + /// Gets all the topics in a namespace. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -1491,11 +1555,15 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// The namespace name /// - /// - /// The topic name. + /// + /// Skip is only used if a previous operation returned a partial result. If a + /// previous response contains a nextLink element, the value of the nextLink + /// element will include a skip parameter that specifies a starting point to + /// use for subsequent calls. /// - /// - /// The authorization rule name. + /// + /// May be used to limit the number of results to the most recent N + /// usageDetails. /// /// /// Headers that will be added to request. @@ -1518,7 +1586,7 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByNamespaceWithHttpMessagesAsync(string resourceGroupName, string namespaceName, int? skip = default(int?), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1550,39 +1618,29 @@ internal TopicsOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); } } - if (topicName == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "topicName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (topicName != null) + if (Client.SubscriptionId == null) { - if (topicName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "topicName", 1); - } + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (authorizationRuleName == null) + if (skip > 1000) { - throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); + throw new ValidationException(ValidationRules.InclusiveMaximum, "skip", 1000); } - if (authorizationRuleName != null) + if (skip < 0) { - if (authorizationRuleName.Length > 50) - { - throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); - } - if (authorizationRuleName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); - } + throw new ValidationException(ValidationRules.InclusiveMinimum, "skip", 0); } - if (Client.ApiVersion == null) + if (top > 1000) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.InclusiveMaximum, "top", 1000); } - if (Client.SubscriptionId == null) + if (top < 1) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.InclusiveMinimum, "top", 1); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1593,24 +1651,30 @@ internal TopicsOperations(ServiceBusManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); - tracingParameters.Add("topicName", topicName); - tracingParameters.Add("authorizationRuleName", authorizationRuleName); + tracingParameters.Add("skip", skip); + tracingParameters.Add("top", top); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetAuthorizationRule", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByNamespace", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); - _url = _url.Replace("{topicName}", System.Uri.EscapeDataString(topicName)); - _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -1699,7 +1763,7 @@ internal TopicsOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1712,7 +1776,7 @@ internal TopicsOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1732,8 +1796,8 @@ internal TopicsOperations(ServiceBusManagementClient client) } /// - /// Deletes a topic authorization rule. - /// + /// Creates a topic in the specified namespace. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -1744,8 +1808,8 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// The topic name. /// - /// - /// The authorization rule name. + /// + /// Parameters supplied to create a topic resource. /// /// /// Headers that will be added to request. @@ -1756,6 +1820,9 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1765,7 +1832,7 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, SBTopic parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1808,20 +1875,9 @@ internal TopicsOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "topicName", 1); } } - if (authorizationRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); - } - if (authorizationRuleName != null) + if (parameters == null) { - if (authorizationRuleName.Length > 50) - { - throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); - } - if (authorizationRuleName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); - } + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } if (Client.ApiVersion == null) { @@ -1841,17 +1897,16 @@ internal TopicsOperations(ServiceBusManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); tracingParameters.Add("topicName", topicName); - tracingParameters.Add("authorizationRuleName", authorizationRuleName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteAuthorizationRule", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{topicName}", System.Uri.EscapeDataString(topicName)); - _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1865,7 +1920,7 @@ internal TopicsOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1896,6 +1951,12 @@ internal TopicsOperations(ServiceBusManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -1916,7 +1977,7 @@ internal TopicsOperations(ServiceBusManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1946,13 +2007,31 @@ internal TopicsOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1961,8 +2040,8 @@ internal TopicsOperations(ServiceBusManagementClient client) } /// - /// Gets the primary and secondary connection strings for the topic. - /// + /// Deletes a topic from the specified namespace and resource group. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -1973,9 +2052,6 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// The topic name. /// - /// - /// The authorization rule name. - /// /// /// Headers that will be added to request. /// @@ -1985,9 +2061,6 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -1997,7 +2070,7 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -2040,21 +2113,6 @@ internal TopicsOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "topicName", 1); } } - if (authorizationRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); - } - if (authorizationRuleName != null) - { - if (authorizationRuleName.Length > 50) - { - throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); - } - if (authorizationRuleName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); - } - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -2073,17 +2131,15 @@ internal TopicsOperations(ServiceBusManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); tracingParameters.Add("topicName", topicName); - tracingParameters.Add("authorizationRuleName", authorizationRuleName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListKeys", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{topicName}", System.Uri.EscapeDataString(topicName)); - _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -2097,7 +2153,7 @@ internal TopicsOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2148,7 +2204,7 @@ internal TopicsOperations(ServiceBusManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 204) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2178,31 +2234,13 @@ internal TopicsOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -2211,8 +2249,8 @@ internal TopicsOperations(ServiceBusManagementClient client) } /// - /// Regenerates primary or secondary connection strings for the topic. - /// + /// Returns a description for the specified topic. + /// /// /// /// Name of the Resource group within the Azure subscription. @@ -2223,12 +2261,6 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// The topic name. /// - /// - /// The authorization rule name. - /// - /// - /// Parameters supplied to regenerate the authorization rule. - /// /// /// Headers that will be added to request. /// @@ -2250,7 +2282,7 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> RegenerateKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, RegenerateAccessKeyParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string topicName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -2293,29 +2325,6 @@ internal TopicsOperations(ServiceBusManagementClient client) throw new ValidationException(ValidationRules.MinLength, "topicName", 1); } } - if (authorizationRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName"); - } - if (authorizationRuleName != null) - { - if (authorizationRuleName.Length > 50) - { - throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50); - } - if (authorizationRuleName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1); - } - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -2334,18 +2343,15 @@ internal TopicsOperations(ServiceBusManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("namespaceName", namespaceName); tracingParameters.Add("topicName", topicName); - tracingParameters.Add("authorizationRuleName", authorizationRuleName); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "RegenerateKeys", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); _url = _url.Replace("{topicName}", System.Uri.EscapeDataString(topicName)); - _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -2359,7 +2365,7 @@ internal TopicsOperations(ServiceBusManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2390,12 +2396,6 @@ internal TopicsOperations(ServiceBusManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -2446,7 +2446,7 @@ internal TopicsOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2459,7 +2459,7 @@ internal TopicsOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2479,8 +2479,8 @@ internal TopicsOperations(ServiceBusManagementClient client) } /// - /// Gets all the topics in a namespace. - /// + /// Gets authorization rules for a topic. + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -2506,7 +2506,7 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByNamespaceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListAuthorizationRulesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2521,7 +2521,7 @@ internal TopicsOperations(ServiceBusManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByNamespaceNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListAuthorizationRulesNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2615,7 +2615,7 @@ internal TopicsOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2628,7 +2628,7 @@ internal TopicsOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2648,8 +2648,8 @@ internal TopicsOperations(ServiceBusManagementClient client) } /// - /// Gets authorization rules for a topic. - /// + /// Gets all the topics in a namespace. + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -2675,7 +2675,7 @@ internal TopicsOperations(ServiceBusManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListAuthorizationRulesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByNamespaceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2690,7 +2690,7 @@ internal TopicsOperations(ServiceBusManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListAuthorizationRulesNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByNamespaceNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2784,7 +2784,7 @@ internal TopicsOperations(ServiceBusManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2797,7 +2797,7 @@ internal TopicsOperations(ServiceBusManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/TopicsOperationsExtensions.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/TopicsOperationsExtensions.cs index d03ec60ab673b..14047a70ea81f 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/TopicsOperationsExtensions.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/TopicsOperationsExtensions.cs @@ -22,8 +22,8 @@ namespace Microsoft.Azure.Management.ServiceBus public static partial class TopicsOperationsExtensions { /// - /// Gets all the topics in a namespace. - /// + /// Gets authorization rules for a topic. + /// /// /// /// The operations group for this extension method. @@ -34,24 +34,17 @@ public static partial class TopicsOperationsExtensions /// /// The namespace name /// - /// - /// Skip is only used if a previous operation returned a partial result. If a - /// previous response contains a nextLink element, the value of the nextLink - /// element will include a skip parameter that specifies a starting point to - /// use for subsequent calls. - /// - /// - /// May be used to limit the number of results to the most recent N - /// usageDetails. + /// + /// The topic name. /// - public static IPage ListByNamespace(this ITopicsOperations operations, string resourceGroupName, string namespaceName, int? skip = default(int?), int? top = default(int?)) + public static IPage ListAuthorizationRules(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName) { - return operations.ListByNamespaceAsync(resourceGroupName, namespaceName, skip, top).GetAwaiter().GetResult(); + return operations.ListAuthorizationRulesAsync(resourceGroupName, namespaceName, topicName).GetAwaiter().GetResult(); } /// - /// Gets all the topics in a namespace. - /// + /// Gets authorization rules for a topic. + /// /// /// /// The operations group for this extension method. @@ -62,30 +55,23 @@ public static partial class TopicsOperationsExtensions /// /// The namespace name /// - /// - /// Skip is only used if a previous operation returned a partial result. If a - /// previous response contains a nextLink element, the value of the nextLink - /// element will include a skip parameter that specifies a starting point to - /// use for subsequent calls. - /// - /// - /// May be used to limit the number of results to the most recent N - /// usageDetails. + /// + /// The topic name. /// /// /// The cancellation token. /// - public static async Task> ListByNamespaceAsync(this ITopicsOperations operations, string resourceGroupName, string namespaceName, int? skip = default(int?), int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAuthorizationRulesAsync(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByNamespaceWithHttpMessagesAsync(resourceGroupName, namespaceName, skip, top, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListAuthorizationRulesWithHttpMessagesAsync(resourceGroupName, namespaceName, topicName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Creates a topic in the specified namespace. - /// + /// Creates an authorization rule for the specified topic. + /// /// /// /// The operations group for this extension method. @@ -99,17 +85,20 @@ public static partial class TopicsOperationsExtensions /// /// The topic name. /// + /// + /// The authorization rule name. + /// /// - /// Parameters supplied to create a topic resource. + /// The shared access authorization rule. /// - public static SBTopic CreateOrUpdate(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, SBTopic parameters) + public static SBAuthorizationRule CreateOrUpdateAuthorizationRule(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, SBAuthorizationRule parameters) { - return operations.CreateOrUpdateAsync(resourceGroupName, namespaceName, topicName, parameters).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAuthorizationRuleAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters).GetAwaiter().GetResult(); } /// - /// Creates a topic in the specified namespace. - /// + /// Creates an authorization rule for the specified topic. + /// /// /// /// The operations group for this extension method. @@ -123,23 +112,26 @@ public static SBTopic CreateOrUpdate(this ITopicsOperations operations, string r /// /// The topic name. /// + /// + /// The authorization rule name. + /// /// - /// Parameters supplied to create a topic resource. + /// The shared access authorization rule. /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, SBTopic parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAuthorizationRuleAsync(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, SBAuthorizationRule parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, namespaceName, topicName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateAuthorizationRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Deletes a topic from the specified namespace and resource group. - /// + /// Returns the specified authorization rule. + /// /// /// /// The operations group for this extension method. @@ -153,14 +145,17 @@ public static SBTopic CreateOrUpdate(this ITopicsOperations operations, string r /// /// The topic name. /// - public static void Delete(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName) + /// + /// The authorization rule name. + /// + public static SBAuthorizationRule GetAuthorizationRule(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName) { - operations.DeleteAsync(resourceGroupName, namespaceName, topicName).GetAwaiter().GetResult(); + return operations.GetAuthorizationRuleAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).GetAwaiter().GetResult(); } /// - /// Deletes a topic from the specified namespace and resource group. - /// + /// Returns the specified authorization rule. + /// /// /// /// The operations group for this extension method. @@ -174,17 +169,23 @@ public static void Delete(this ITopicsOperations operations, string resourceGrou /// /// The topic name. /// + /// + /// The authorization rule name. + /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAuthorizationRuleAsync(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, namespaceName, topicName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.GetAuthorizationRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Returns a description for the specified topic. - /// + /// Deletes a topic authorization rule. + /// /// /// /// The operations group for this extension method. @@ -198,14 +199,17 @@ public static void Delete(this ITopicsOperations operations, string resourceGrou /// /// The topic name. /// - public static SBTopic Get(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName) + /// + /// The authorization rule name. + /// + public static void DeleteAuthorizationRule(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName) { - return operations.GetAsync(resourceGroupName, namespaceName, topicName).GetAwaiter().GetResult(); + operations.DeleteAuthorizationRuleAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).GetAwaiter().GetResult(); } /// - /// Returns a description for the specified topic. - /// + /// Deletes a topic authorization rule. + /// /// /// /// The operations group for this extension method. @@ -219,20 +223,20 @@ public static SBTopic Get(this ITopicsOperations operations, string resourceGrou /// /// The topic name. /// + /// + /// The authorization rule name. + /// /// /// The cancellation token. /// - public static async Task GetAsync(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAuthorizationRuleAsync(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, namespaceName, topicName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.DeleteAuthorizationRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Gets authorization rules for a topic. - /// + /// Gets the primary and secondary connection strings for the topic. + /// /// /// /// The operations group for this extension method. @@ -246,14 +250,17 @@ public static SBTopic Get(this ITopicsOperations operations, string resourceGrou /// /// The topic name. /// - public static IPage ListAuthorizationRules(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName) + /// + /// The authorization rule name. + /// + public static AccessKeys ListKeys(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName) { - return operations.ListAuthorizationRulesAsync(resourceGroupName, namespaceName, topicName).GetAwaiter().GetResult(); + return operations.ListKeysAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).GetAwaiter().GetResult(); } /// - /// Gets authorization rules for a topic. - /// + /// Gets the primary and secondary connection strings for the topic. + /// /// /// /// The operations group for this extension method. @@ -267,20 +274,23 @@ public static IPage ListAuthorizationRules(this ITopicsOper /// /// The topic name. /// + /// + /// The authorization rule name. + /// /// /// The cancellation token. /// - public static async Task> ListAuthorizationRulesAsync(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListKeysAsync(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListAuthorizationRulesWithHttpMessagesAsync(resourceGroupName, namespaceName, topicName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListKeysWithHttpMessagesAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Creates an authorization rule for the specified topic. - /// + /// Regenerates primary or secondary connection strings for the topic. + /// /// /// /// The operations group for this extension method. @@ -298,16 +308,16 @@ public static IPage ListAuthorizationRules(this ITopicsOper /// The authorization rule name. /// /// - /// The shared access authorization rule. + /// Parameters supplied to regenerate the authorization rule. /// - public static SBAuthorizationRule CreateOrUpdateAuthorizationRule(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, SBAuthorizationRule parameters) + public static AccessKeys RegenerateKeys(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, RegenerateAccessKeyParameters parameters) { - return operations.CreateOrUpdateAuthorizationRuleAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters).GetAwaiter().GetResult(); + return operations.RegenerateKeysAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters).GetAwaiter().GetResult(); } /// - /// Creates an authorization rule for the specified topic. - /// + /// Regenerates primary or secondary connection strings for the topic. + /// /// /// /// The operations group for this extension method. @@ -325,22 +335,22 @@ public static SBAuthorizationRule CreateOrUpdateAuthorizationRule(this ITopicsOp /// The authorization rule name. /// /// - /// The shared access authorization rule. + /// Parameters supplied to regenerate the authorization rule. /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAuthorizationRuleAsync(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, SBAuthorizationRule parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task RegenerateKeysAsync(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, RegenerateAccessKeyParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateAuthorizationRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.RegenerateKeysWithHttpMessagesAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Returns the specified authorization rule. - /// + /// Gets all the topics in a namespace. + /// /// /// /// The operations group for this extension method. @@ -351,20 +361,24 @@ public static SBAuthorizationRule CreateOrUpdateAuthorizationRule(this ITopicsOp /// /// The namespace name /// - /// - /// The topic name. + /// + /// Skip is only used if a previous operation returned a partial result. If a + /// previous response contains a nextLink element, the value of the nextLink + /// element will include a skip parameter that specifies a starting point to + /// use for subsequent calls. /// - /// - /// The authorization rule name. + /// + /// May be used to limit the number of results to the most recent N + /// usageDetails. /// - public static SBAuthorizationRule GetAuthorizationRule(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName) + public static IPage ListByNamespace(this ITopicsOperations operations, string resourceGroupName, string namespaceName, int? skip = default(int?), int? top = default(int?)) { - return operations.GetAuthorizationRuleAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).GetAwaiter().GetResult(); + return operations.ListByNamespaceAsync(resourceGroupName, namespaceName, skip, top).GetAwaiter().GetResult(); } /// - /// Returns the specified authorization rule. - /// + /// Gets all the topics in a namespace. + /// /// /// /// The operations group for this extension method. @@ -375,26 +389,30 @@ public static SBAuthorizationRule GetAuthorizationRule(this ITopicsOperations op /// /// The namespace name /// - /// - /// The topic name. + /// + /// Skip is only used if a previous operation returned a partial result. If a + /// previous response contains a nextLink element, the value of the nextLink + /// element will include a skip parameter that specifies a starting point to + /// use for subsequent calls. /// - /// - /// The authorization rule name. + /// + /// May be used to limit the number of results to the most recent N + /// usageDetails. /// /// /// The cancellation token. /// - public static async Task GetAuthorizationRuleAsync(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByNamespaceAsync(this ITopicsOperations operations, string resourceGroupName, string namespaceName, int? skip = default(int?), int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetAuthorizationRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByNamespaceWithHttpMessagesAsync(resourceGroupName, namespaceName, skip, top, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Deletes a topic authorization rule. - /// + /// Creates a topic in the specified namespace. + /// /// /// /// The operations group for this extension method. @@ -408,17 +426,17 @@ public static SBAuthorizationRule GetAuthorizationRule(this ITopicsOperations op /// /// The topic name. /// - /// - /// The authorization rule name. + /// + /// Parameters supplied to create a topic resource. /// - public static void DeleteAuthorizationRule(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName) + public static SBTopic CreateOrUpdate(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, SBTopic parameters) { - operations.DeleteAuthorizationRuleAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, namespaceName, topicName, parameters).GetAwaiter().GetResult(); } /// - /// Deletes a topic authorization rule. - /// + /// Creates a topic in the specified namespace. + /// /// /// /// The operations group for this extension method. @@ -432,20 +450,23 @@ public static void DeleteAuthorizationRule(this ITopicsOperations operations, st /// /// The topic name. /// - /// - /// The authorization rule name. + /// + /// Parameters supplied to create a topic resource. /// /// /// The cancellation token. /// - public static async Task DeleteAuthorizationRuleAsync(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, SBTopic parameters, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteAuthorizationRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, namespaceName, topicName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Gets the primary and secondary connection strings for the topic. - /// + /// Deletes a topic from the specified namespace and resource group. + /// /// /// /// The operations group for this extension method. @@ -459,17 +480,14 @@ public static void DeleteAuthorizationRule(this ITopicsOperations operations, st /// /// The topic name. /// - /// - /// The authorization rule name. - /// - public static AccessKeys ListKeys(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName) + public static void Delete(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName) { - return operations.ListKeysAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, namespaceName, topicName).GetAwaiter().GetResult(); } /// - /// Gets the primary and secondary connection strings for the topic. - /// + /// Deletes a topic from the specified namespace and resource group. + /// /// /// /// The operations group for this extension method. @@ -483,23 +501,17 @@ public static AccessKeys ListKeys(this ITopicsOperations operations, string reso /// /// The topic name. /// - /// - /// The authorization rule name. - /// /// /// The cancellation token. /// - public static async Task ListKeysAsync(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListKeysWithHttpMessagesAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, namespaceName, topicName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Regenerates primary or secondary connection strings for the topic. - /// + /// Returns a description for the specified topic. + /// /// /// /// The operations group for this extension method. @@ -513,20 +525,14 @@ public static AccessKeys ListKeys(this ITopicsOperations operations, string reso /// /// The topic name. /// - /// - /// The authorization rule name. - /// - /// - /// Parameters supplied to regenerate the authorization rule. - /// - public static AccessKeys RegenerateKeys(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, RegenerateAccessKeyParameters parameters) + public static SBTopic Get(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName) { - return operations.RegenerateKeysAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, namespaceName, topicName).GetAwaiter().GetResult(); } /// - /// Regenerates primary or secondary connection strings for the topic. - /// + /// Returns a description for the specified topic. + /// /// /// /// The operations group for this extension method. @@ -540,26 +546,20 @@ public static AccessKeys RegenerateKeys(this ITopicsOperations operations, strin /// /// The topic name. /// - /// - /// The authorization rule name. - /// - /// - /// Parameters supplied to regenerate the authorization rule. - /// /// /// The cancellation token. /// - public static async Task RegenerateKeysAsync(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName, RegenerateAccessKeyParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this ITopicsOperations operations, string resourceGroupName, string namespaceName, string topicName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.RegenerateKeysWithHttpMessagesAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, namespaceName, topicName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets all the topics in a namespace. - /// + /// Gets authorization rules for a topic. + /// /// /// /// The operations group for this extension method. @@ -567,14 +567,14 @@ public static AccessKeys RegenerateKeys(this ITopicsOperations operations, strin /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByNamespaceNext(this ITopicsOperations operations, string nextPageLink) + public static IPage ListAuthorizationRulesNext(this ITopicsOperations operations, string nextPageLink) { - return operations.ListByNamespaceNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListAuthorizationRulesNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Gets all the topics in a namespace. - /// + /// Gets authorization rules for a topic. + /// /// /// /// The operations group for this extension method. @@ -585,17 +585,17 @@ public static IPage ListByNamespaceNext(this ITopicsOperations operatio /// /// The cancellation token. /// - public static async Task> ListByNamespaceNextAsync(this ITopicsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAuthorizationRulesNextAsync(this ITopicsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByNamespaceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListAuthorizationRulesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets authorization rules for a topic. - /// + /// Gets all the topics in a namespace. + /// /// /// /// The operations group for this extension method. @@ -603,14 +603,14 @@ public static IPage ListByNamespaceNext(this ITopicsOperations operatio /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListAuthorizationRulesNext(this ITopicsOperations operations, string nextPageLink) + public static IPage ListByNamespaceNext(this ITopicsOperations operations, string nextPageLink) { - return operations.ListAuthorizationRulesNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByNamespaceNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Gets authorization rules for a topic. - /// + /// Gets all the topics in a namespace. + /// /// /// /// The operations group for this extension method. @@ -621,9 +621,9 @@ public static IPage ListAuthorizationRulesNext(this ITopics /// /// The cancellation token. /// - public static async Task> ListAuthorizationRulesNextAsync(this ITopicsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByNamespaceNextAsync(this ITopicsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListAuthorizationRulesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByNamespaceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; }