From 8c6489186c7d74dcc10b7eea0f27996049e180f2 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 7 May 2025 09:09:02 +0000 Subject: [PATCH] CodeGen from PR 34320 in Azure/azure-rest-api-specs Merge 39b7d8aba3b58294ebcae9890e816ef39c34bdc1 into 532b1b8f4efdb960efce95c6694164303d79a3fc --- ...Sample_NotificationHubNamespaceResource.cs | 22 +- .../ArmNotificationHubsModelFactory.cs | 466 ++++++------- .../MockableNotificationHubsArmClient.cs | 48 +- ...bleNotificationHubsSubscriptionResource.cs | 4 +- .../Extensions/NotificationHubsExtensions.cs | 52 +- ...NotificationHubListResult.Serialization.cs | 20 +- .../Models/NotificationHubListResult.cs | 25 +- ...ionHubNamespaceListResult.Serialization.cs | 20 +- .../NotificationHubNamespaceListResult.cs | 25 +- ...ateLinkResourceListResult.Serialization.cs | 20 +- ...cationHubsPrivateLinkResourceListResult.cs | 25 +- ...nectionResourceListResult.Serialization.cs | 20 +- ...ateEndpointConnectionResourceListResult.cs | 25 +- ...thorizationRuleListResult.Serialization.cs | 20 +- ...SharedAccessAuthorizationRuleListResult.cs | 25 +- ...ificationHubAuthorizationRuleCollection.cs | 16 +- ...HubNamespaceAuthorizationRuleCollection.cs | 16 +- .../NotificationHubNamespaceResource.cs | 168 ++--- ...nHubPrivateEndpointConnectionCollection.cs | 6 +- .../src/Generated/NotificationHubResource.cs | 4 +- ...cationHubsPrivateLinkResourceCollection.cs | 6 +- .../NamespacesRestOperations.cs | 612 +++++++++--------- .../NotificationHubsRestOperations.cs | 512 +++++++-------- ...rivateEndpointConnectionsRestOperations.cs | 390 ++++++++--- .../src/autorest.md | 2 +- sdk/storage/ci.yml | 2 + 26 files changed, 1386 insertions(+), 1165 deletions(-) diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceResource.cs index 6c5c5f2092d3..32297bbfaecd 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceResource.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceResource.cs @@ -122,10 +122,10 @@ public async Task Update_NamespacesUpdate() [Test] [Ignore("Only validating compilation of examples")] - public async Task CheckNotificationHubAvailability_NotificationHubsCheckNotificationHubAvailability() + public async Task GetPnsCredentials_NamespacesGetPnsCredentials() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/NotificationHubs/CheckAvailability.json - // this example is just showing the usage of "NotificationHubs_CheckNotificationHubAvailability" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/PnsCredentialsGet.json + // this example is just showing the usage of "Namespaces_GetPnsCredentials" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -136,23 +136,22 @@ public async Task CheckNotificationHubAvailability_NotificationHubsCheckNotifica // for more information of creating NotificationHubNamespaceResource, please refer to the document of NotificationHubNamespaceResource string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; string resourceGroupName = "5ktrial"; - string namespaceName = "locp-newns"; + string namespaceName = "nh-sdk-ns"; ResourceIdentifier notificationHubNamespaceResourceId = NotificationHubNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); // invoke the operation - NotificationHubAvailabilityContent content = new NotificationHubAvailabilityContent(new AzureLocation("West Europe")); - NotificationHubAvailabilityResult result = await notificationHubNamespace.CheckNotificationHubAvailabilityAsync(content); + NotificationHubPnsCredentials result = await notificationHubNamespace.GetPnsCredentialsAsync(); Console.WriteLine($"Succeeded: {result}"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task GetPnsCredentials_NamespacesGetPnsCredentials() + public async Task CheckNotificationHubAvailability_NotificationHubsCheckNotificationHubAvailability() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/PnsCredentialsGet.json - // this example is just showing the usage of "Namespaces_GetPnsCredentials" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/NotificationHubs/CheckAvailability.json + // this example is just showing the usage of "NotificationHubs_CheckNotificationHubAvailability" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -163,12 +162,13 @@ public async Task GetPnsCredentials_NamespacesGetPnsCredentials() // for more information of creating NotificationHubNamespaceResource, please refer to the document of NotificationHubNamespaceResource string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; string resourceGroupName = "5ktrial"; - string namespaceName = "nh-sdk-ns"; + string namespaceName = "locp-newns"; ResourceIdentifier notificationHubNamespaceResourceId = NotificationHubNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); // invoke the operation - NotificationHubPnsCredentials result = await notificationHubNamespace.GetPnsCredentialsAsync(); + NotificationHubAvailabilityContent content = new NotificationHubAvailabilityContent(new AzureLocation("West Europe")); + NotificationHubAvailabilityResult result = await notificationHubNamespace.CheckNotificationHubAvailabilityAsync(content); Console.WriteLine($"Succeeded: {result}"); } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/ArmNotificationHubsModelFactory.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/ArmNotificationHubsModelFactory.cs index 0a8d18b12440..3a5da2cb7e6b 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/ArmNotificationHubsModelFactory.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/ArmNotificationHubsModelFactory.cs @@ -72,239 +72,6 @@ public static NotificationHubAvailabilityResult NotificationHubAvailabilityResul serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The Sku description for a namespace. - /// Gets or sets the NotificationHub name. - /// Gets or sets the RegistrationTtl of the created NotificationHub. - /// Gets or sets the AuthorizationRules of the created NotificationHub. - /// Description of a NotificationHub ApnsCredential. - /// Description of a NotificationHub WnsCredential. - /// Description of a NotificationHub GcmCredential. - /// Description of a NotificationHub MpnsCredential. - /// Description of a NotificationHub AdmCredential. - /// Description of a NotificationHub BaiduCredential. - /// Description of a NotificationHub BrowserCredential. - /// Description of a NotificationHub XiaomiCredential. - /// Description of a NotificationHub FcmV1Credential. - /// - /// A new instance for mocking. - public static NotificationHubData NotificationHubData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NotificationHubSku sku = null, string notificationHubName = null, TimeSpan? registrationTtl = null, IEnumerable authorizationRules = null, NotificationHubApnsCredential apnsCredential = null, NotificationHubWnsCredential wnsCredential = null, NotificationHubGcmCredential gcmCredential = null, NotificationHubMpnsCredential mpnsCredential = null, NotificationHubAdmCredential admCredential = null, NotificationHubBaiduCredential baiduCredential = null, BrowserCredential browserCredential = null, XiaomiCredential xiaomiCredential = null, FcmV1Credential fcmV1Credential = null, long? dailyMaxActiveDevices = null) - { - tags ??= new Dictionary(); - authorizationRules ??= new List(); - - return new NotificationHubData( - id, - name, - resourceType, - systemData, - tags, - location, - sku, - notificationHubName, - registrationTtl, - authorizationRules?.ToList(), - apnsCredential, - wnsCredential, - gcmCredential, - mpnsCredential, - admCredential, - baiduCredential, - browserCredential, - xiaomiCredential, - fcmV1Credential, - dailyMaxActiveDevices, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Gets or sets the rights associated with the rule. - /// - /// Gets a base64-encoded 256-bit primary key for signing and - /// validating the SAS token. - /// - /// - /// Gets a base64-encoded 256-bit primary key for signing and - /// validating the SAS token. - /// - /// Gets a string that describes the authorization rule. - /// Gets the last modified time for this rule. - /// Gets the created time for this rule. - /// Gets a string that describes the claim type. - /// Gets a string that describes the claim value. - /// Gets the revision number for the rule. - /// A new instance for mocking. - public static SharedAccessAuthorizationRuleProperties SharedAccessAuthorizationRuleProperties(IEnumerable accessRights = null, string primaryKey = null, string secondaryKey = null, string keyName = null, DateTimeOffset? modifiedOn = null, DateTimeOffset? createdOn = null, string claimType = null, string claimValue = null, int? revision = null) - { - accessRights ??= new List(); - - return new SharedAccessAuthorizationRuleProperties( - accessRights?.ToList(), - primaryKey, - secondaryKey, - keyName, - modifiedOn, - createdOn, - claimType, - claimValue, - revision, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// Gets or sets successful send. - /// Gets or sets send failure. - /// Gets or sets actual failure description. - /// A new instance for mocking. - public static NotificationHubTestSendResult NotificationHubTestSendResult(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, int? success = null, int? failure = null, IEnumerable failureDescription = null) - { - tags ??= new Dictionary(); - failureDescription ??= new List(); - - return new NotificationHubTestSendResult( - id, - name, - resourceType, - systemData, - tags, - location, - success, - failure, - failureDescription?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// PNS type. - /// PNS handle. - /// Registration id. - /// Notification outcome. - /// A new instance for mocking. - public static NotificationHubPubRegistrationResult NotificationHubPubRegistrationResult(string applicationPlatform = null, string pnsHandle = null, string registrationId = null, string outcome = null) - { - return new NotificationHubPubRegistrationResult(applicationPlatform, pnsHandle, registrationId, outcome, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// Gets or sets the rights associated with the rule. - /// - /// Gets a base64-encoded 256-bit primary key for signing and - /// validating the SAS token. - /// - /// - /// Gets a base64-encoded 256-bit primary key for signing and - /// validating the SAS token. - /// - /// Gets a string that describes the authorization rule. - /// Gets the last modified time for this rule. - /// Gets the created time for this rule. - /// Gets a string that describes the claim type. - /// Gets a string that describes the claim value. - /// Gets the revision number for the rule. - /// A new instance for mocking. - public static NotificationHubAuthorizationRuleData NotificationHubAuthorizationRuleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, IEnumerable accessRights = null, string primaryKey = null, string secondaryKey = null, string keyName = null, DateTimeOffset? modifiedOn = null, DateTimeOffset? createdOn = null, string claimType = null, string claimValue = null, int? revision = null) - { - tags ??= new Dictionary(); - accessRights ??= new List(); - - return new NotificationHubAuthorizationRuleData( - id, - name, - resourceType, - systemData, - tags, - location, - accessRights?.ToList(), - primaryKey, - secondaryKey, - keyName, - modifiedOn, - createdOn, - claimType, - claimValue, - revision, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Gets or sets primaryConnectionString of the AuthorizationRule. - /// - /// Gets or sets secondaryConnectionString of the created - /// AuthorizationRule - /// - /// Gets or sets primaryKey of the created AuthorizationRule. - /// Gets or sets secondaryKey of the created AuthorizationRule. - /// Gets or sets keyName of the created AuthorizationRule. - /// A new instance for mocking. - public static NotificationHubResourceKeys NotificationHubResourceKeys(string primaryConnectionString = null, string secondaryConnectionString = null, string primaryKey = null, string secondaryKey = null, string keyName = null) - { - return new NotificationHubResourceKeys( - primaryConnectionString, - secondaryConnectionString, - primaryKey, - secondaryKey, - keyName, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// Description of a NotificationHub AdmCredential. - /// Description of a NotificationHub ApnsCredential. - /// Description of a NotificationHub BaiduCredential. - /// Description of a NotificationHub BrowserCredential. - /// Description of a NotificationHub GcmCredential. - /// Description of a NotificationHub MpnsCredential. - /// Description of a NotificationHub WnsCredential. - /// Description of a NotificationHub XiaomiCredential. - /// Description of a NotificationHub FcmV1Credential. - /// A new instance for mocking. - public static NotificationHubPnsCredentials NotificationHubPnsCredentials(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NotificationHubAdmCredential admCredential = null, NotificationHubApnsCredential apnsCredential = null, NotificationHubBaiduCredential baiduCredential = null, BrowserCredential browserCredential = null, NotificationHubGcmCredential gcmCredential = null, NotificationHubMpnsCredential mpnsCredential = null, NotificationHubWnsCredential wnsCredential = null, XiaomiCredential xiaomiCredential = null, FcmV1Credential fcmV1Credential = null) - { - tags ??= new Dictionary(); - - return new NotificationHubPnsCredentials( - id, - name, - resourceType, - systemData, - tags, - location, - admCredential, - apnsCredential, - baiduCredential, - browserCredential, - gcmCredential, - mpnsCredential, - wnsCredential, - xiaomiCredential, - fcmV1Credential, - serializedAdditionalRawData: null); - } - /// Initializes a new instance of . /// The id. /// The name. @@ -479,6 +246,239 @@ public static RemotePrivateLinkServiceConnectionState RemotePrivateLinkServiceCo return new RemotePrivateLinkServiceConnectionState(status, description, actionsRequired, serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Gets or sets the rights associated with the rule. + /// + /// Gets a base64-encoded 256-bit primary key for signing and + /// validating the SAS token. + /// + /// + /// Gets a base64-encoded 256-bit primary key for signing and + /// validating the SAS token. + /// + /// Gets a string that describes the authorization rule. + /// Gets the last modified time for this rule. + /// Gets the created time for this rule. + /// Gets a string that describes the claim type. + /// Gets a string that describes the claim value. + /// Gets the revision number for the rule. + /// A new instance for mocking. + public static NotificationHubAuthorizationRuleData NotificationHubAuthorizationRuleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, IEnumerable accessRights = null, string primaryKey = null, string secondaryKey = null, string keyName = null, DateTimeOffset? modifiedOn = null, DateTimeOffset? createdOn = null, string claimType = null, string claimValue = null, int? revision = null) + { + tags ??= new Dictionary(); + accessRights ??= new List(); + + return new NotificationHubAuthorizationRuleData( + id, + name, + resourceType, + systemData, + tags, + location, + accessRights?.ToList(), + primaryKey, + secondaryKey, + keyName, + modifiedOn, + createdOn, + claimType, + claimValue, + revision, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Gets or sets the rights associated with the rule. + /// + /// Gets a base64-encoded 256-bit primary key for signing and + /// validating the SAS token. + /// + /// + /// Gets a base64-encoded 256-bit primary key for signing and + /// validating the SAS token. + /// + /// Gets a string that describes the authorization rule. + /// Gets the last modified time for this rule. + /// Gets the created time for this rule. + /// Gets a string that describes the claim type. + /// Gets a string that describes the claim value. + /// Gets the revision number for the rule. + /// A new instance for mocking. + public static SharedAccessAuthorizationRuleProperties SharedAccessAuthorizationRuleProperties(IEnumerable accessRights = null, string primaryKey = null, string secondaryKey = null, string keyName = null, DateTimeOffset? modifiedOn = null, DateTimeOffset? createdOn = null, string claimType = null, string claimValue = null, int? revision = null) + { + accessRights ??= new List(); + + return new SharedAccessAuthorizationRuleProperties( + accessRights?.ToList(), + primaryKey, + secondaryKey, + keyName, + modifiedOn, + createdOn, + claimType, + claimValue, + revision, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Gets or sets primaryConnectionString of the AuthorizationRule. + /// + /// Gets or sets secondaryConnectionString of the created + /// AuthorizationRule + /// + /// Gets or sets primaryKey of the created AuthorizationRule. + /// Gets or sets secondaryKey of the created AuthorizationRule. + /// Gets or sets keyName of the created AuthorizationRule. + /// A new instance for mocking. + public static NotificationHubResourceKeys NotificationHubResourceKeys(string primaryConnectionString = null, string secondaryConnectionString = null, string primaryKey = null, string secondaryKey = null, string keyName = null) + { + return new NotificationHubResourceKeys( + primaryConnectionString, + secondaryConnectionString, + primaryKey, + secondaryKey, + keyName, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The Sku description for a namespace. + /// Gets or sets the NotificationHub name. + /// Gets or sets the RegistrationTtl of the created NotificationHub. + /// Gets or sets the AuthorizationRules of the created NotificationHub. + /// Description of a NotificationHub ApnsCredential. + /// Description of a NotificationHub WnsCredential. + /// Description of a NotificationHub GcmCredential. + /// Description of a NotificationHub MpnsCredential. + /// Description of a NotificationHub AdmCredential. + /// Description of a NotificationHub BaiduCredential. + /// Description of a NotificationHub BrowserCredential. + /// Description of a NotificationHub XiaomiCredential. + /// Description of a NotificationHub FcmV1Credential. + /// + /// A new instance for mocking. + public static NotificationHubData NotificationHubData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NotificationHubSku sku = null, string notificationHubName = null, TimeSpan? registrationTtl = null, IEnumerable authorizationRules = null, NotificationHubApnsCredential apnsCredential = null, NotificationHubWnsCredential wnsCredential = null, NotificationHubGcmCredential gcmCredential = null, NotificationHubMpnsCredential mpnsCredential = null, NotificationHubAdmCredential admCredential = null, NotificationHubBaiduCredential baiduCredential = null, BrowserCredential browserCredential = null, XiaomiCredential xiaomiCredential = null, FcmV1Credential fcmV1Credential = null, long? dailyMaxActiveDevices = null) + { + tags ??= new Dictionary(); + authorizationRules ??= new List(); + + return new NotificationHubData( + id, + name, + resourceType, + systemData, + tags, + location, + sku, + notificationHubName, + registrationTtl, + authorizationRules?.ToList(), + apnsCredential, + wnsCredential, + gcmCredential, + mpnsCredential, + admCredential, + baiduCredential, + browserCredential, + xiaomiCredential, + fcmV1Credential, + dailyMaxActiveDevices, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Gets or sets successful send. + /// Gets or sets send failure. + /// Gets or sets actual failure description. + /// A new instance for mocking. + public static NotificationHubTestSendResult NotificationHubTestSendResult(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, int? success = null, int? failure = null, IEnumerable failureDescription = null) + { + tags ??= new Dictionary(); + failureDescription ??= new List(); + + return new NotificationHubTestSendResult( + id, + name, + resourceType, + systemData, + tags, + location, + success, + failure, + failureDescription?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// PNS type. + /// PNS handle. + /// Registration id. + /// Notification outcome. + /// A new instance for mocking. + public static NotificationHubPubRegistrationResult NotificationHubPubRegistrationResult(string applicationPlatform = null, string pnsHandle = null, string registrationId = null, string outcome = null) + { + return new NotificationHubPubRegistrationResult(applicationPlatform, pnsHandle, registrationId, outcome, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Description of a NotificationHub AdmCredential. + /// Description of a NotificationHub ApnsCredential. + /// Description of a NotificationHub BaiduCredential. + /// Description of a NotificationHub BrowserCredential. + /// Description of a NotificationHub GcmCredential. + /// Description of a NotificationHub MpnsCredential. + /// Description of a NotificationHub WnsCredential. + /// Description of a NotificationHub XiaomiCredential. + /// Description of a NotificationHub FcmV1Credential. + /// A new instance for mocking. + public static NotificationHubPnsCredentials NotificationHubPnsCredentials(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NotificationHubAdmCredential admCredential = null, NotificationHubApnsCredential apnsCredential = null, NotificationHubBaiduCredential baiduCredential = null, BrowserCredential browserCredential = null, NotificationHubGcmCredential gcmCredential = null, NotificationHubMpnsCredential mpnsCredential = null, NotificationHubWnsCredential wnsCredential = null, XiaomiCredential xiaomiCredential = null, FcmV1Credential fcmV1Credential = null) + { + tags ??= new Dictionary(); + + return new NotificationHubPnsCredentials( + id, + name, + resourceType, + systemData, + tags, + location, + admCredential, + apnsCredential, + baiduCredential, + browserCredential, + gcmCredential, + mpnsCredential, + wnsCredential, + xiaomiCredential, + fcmV1Credential, + serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsArmClient.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsArmClient.cs index 170c27aa805f..e0d53e332d8a 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsArmClient.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsArmClient.cs @@ -35,27 +35,15 @@ private string GetApiVersionOrNull(ResourceType resourceType) } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The resource ID of the resource to get. - /// Returns a object. - public virtual NotificationHubResource GetNotificationHubResource(ResourceIdentifier id) - { - NotificationHubResource.ValidateResourceId(id); - return new NotificationHubResource(Client, id); - } - - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual NotificationHubAuthorizationRuleResource GetNotificationHubAuthorizationRuleResource(ResourceIdentifier id) + /// Returns a object. + public virtual NotificationHubNamespaceResource GetNotificationHubNamespaceResource(ResourceIdentifier id) { - NotificationHubAuthorizationRuleResource.ValidateResourceId(id); - return new NotificationHubAuthorizationRuleResource(Client, id); + NotificationHubNamespaceResource.ValidateResourceId(id); + return new NotificationHubNamespaceResource(Client, id); } /// @@ -71,15 +59,27 @@ public virtual NotificationHubNamespaceAuthorizationRuleResource GetNotification } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual NotificationHubNamespaceResource GetNotificationHubNamespaceResource(ResourceIdentifier id) + /// Returns a object. + public virtual NotificationHubAuthorizationRuleResource GetNotificationHubAuthorizationRuleResource(ResourceIdentifier id) { - NotificationHubNamespaceResource.ValidateResourceId(id); - return new NotificationHubNamespaceResource(Client, id); + NotificationHubAuthorizationRuleResource.ValidateResourceId(id); + return new NotificationHubAuthorizationRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NotificationHubResource GetNotificationHubResource(ResourceIdentifier id) + { + NotificationHubResource.ValidateResourceId(id); + return new NotificationHubResource(Client, id); } /// diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsSubscriptionResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsSubscriptionResource.cs index 94b9dac0abb6..ef7cf13d503f 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsSubscriptionResource.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsSubscriptionResource.cs @@ -63,7 +63,7 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// /// /// - /// Request content. + /// The request body. /// The cancellation token to use. /// is null. public virtual async Task> CheckNotificationHubNamespaceAvailabilityAsync(NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) @@ -105,7 +105,7 @@ public virtual async Task> CheckNoti /// /// /// - /// Request content. + /// The request body. /// The cancellation token to use. /// is null. public virtual Response CheckNotificationHubNamespaceAvailability(NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/NotificationHubsExtensions.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/NotificationHubsExtensions.cs index 52f32b9568df..bf8bf5475871 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/NotificationHubsExtensions.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/NotificationHubsExtensions.cs @@ -34,79 +34,79 @@ private static MockableNotificationHubsSubscriptionResource GetMockableNotificat } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static NotificationHubResource GetNotificationHubResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static NotificationHubNamespaceResource GetNotificationHubNamespaceResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableNotificationHubsArmClient(client).GetNotificationHubResource(id); + return GetMockableNotificationHubsArmClient(client).GetNotificationHubNamespaceResource(id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static NotificationHubAuthorizationRuleResource GetNotificationHubAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static NotificationHubNamespaceAuthorizationRuleResource GetNotificationHubNamespaceAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableNotificationHubsArmClient(client).GetNotificationHubAuthorizationRuleResource(id); + return GetMockableNotificationHubsArmClient(client).GetNotificationHubNamespaceAuthorizationRuleResource(id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static NotificationHubNamespaceAuthorizationRuleResource GetNotificationHubNamespaceAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static NotificationHubAuthorizationRuleResource GetNotificationHubAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableNotificationHubsArmClient(client).GetNotificationHubNamespaceAuthorizationRuleResource(id); + return GetMockableNotificationHubsArmClient(client).GetNotificationHubAuthorizationRuleResource(id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static NotificationHubNamespaceResource GetNotificationHubNamespaceResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static NotificationHubResource GetNotificationHubResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableNotificationHubsArmClient(client).GetNotificationHubNamespaceResource(id); + return GetMockableNotificationHubsArmClient(client).GetNotificationHubResource(id); } /// @@ -266,7 +266,7 @@ public static Response GetNotificationHubNames /// /// /// The instance the method will execute against. - /// Request content. + /// The request body. /// The cancellation token to use. /// or is null. public static async Task> CheckNotificationHubNamespaceAvailabilityAsync(this SubscriptionResource subscriptionResource, NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) @@ -302,7 +302,7 @@ public static async Task> CheckNotif /// /// /// The instance the method will execute against. - /// Request content. + /// The request body. /// The cancellation token to use. /// or is null. public static Response CheckNotificationHubNamespaceAvailability(this SubscriptionResource subscriptionResource, NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubListResult.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubListResult.Serialization.cs index 86e25e050850..523143b87c45 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubListResult.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubListResult.Serialization.cs @@ -34,7 +34,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(NotificationHubListResult)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + if (options.Format != "W") { writer.WritePropertyName("value"u8); writer.WriteStartArray(); @@ -44,10 +44,10 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -87,17 +87,13 @@ internal static NotificationHubListResult DeserializeNotificationHubListResult(J return null; } IReadOnlyList value = default; - string nextLink = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); foreach (var item in property.Value.EnumerateArray()) { @@ -108,7 +104,11 @@ internal static NotificationHubListResult DeserializeNotificationHubListResult(J } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -117,7 +117,7 @@ internal static NotificationHubListResult DeserializeNotificationHubListResult(J } } serializedAdditionalRawData = rawDataDictionary; - return new NotificationHubListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new NotificationHubListResult(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubListResult.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubListResult.cs index b28253eda1fe..5addfcd8d453 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubListResult.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubListResult.cs @@ -7,10 +7,11 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.NotificationHubs.Models { - /// The response of the List NotificationHub operation. + /// Paged collection of NotificationHubResource items. internal partial class NotificationHubListResult { /// @@ -46,25 +47,31 @@ internal partial class NotificationHubListResult private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal NotificationHubListResult() + /// The NotificationHubResource items on this page. + internal NotificationHubListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Gets or sets result of the List AuthorizationRules operation. - /// Gets or sets link to the next set of results. + /// The NotificationHubResource items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal NotificationHubListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal NotificationHubListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Gets or sets result of the List AuthorizationRules operation. + /// Initializes a new instance of for deserialization. + internal NotificationHubListResult() + { + } + + /// The NotificationHubResource items on this page. public IReadOnlyList Value { get; } - /// Gets or sets link to the next set of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceListResult.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceListResult.Serialization.cs index 106f9ce0f354..172b3ddabcfe 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceListResult.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceListResult.Serialization.cs @@ -34,7 +34,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(NotificationHubNamespaceListResult)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + if (options.Format != "W") { writer.WritePropertyName("value"u8); writer.WriteStartArray(); @@ -44,10 +44,10 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -87,17 +87,13 @@ internal static NotificationHubNamespaceListResult DeserializeNotificationHubNam return null; } IReadOnlyList value = default; - string nextLink = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); foreach (var item in property.Value.EnumerateArray()) { @@ -108,7 +104,11 @@ internal static NotificationHubNamespaceListResult DeserializeNotificationHubNam } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -117,7 +117,7 @@ internal static NotificationHubNamespaceListResult DeserializeNotificationHubNam } } serializedAdditionalRawData = rawDataDictionary; - return new NotificationHubNamespaceListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new NotificationHubNamespaceListResult(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceListResult.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceListResult.cs index 5b0e92165eee..810bd4559b2d 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceListResult.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceListResult.cs @@ -7,10 +7,11 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.NotificationHubs.Models { - /// The response of the List Namespace operation. + /// Paged collection of NamespaceResource items. internal partial class NotificationHubNamespaceListResult { /// @@ -46,25 +47,31 @@ internal partial class NotificationHubNamespaceListResult private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal NotificationHubNamespaceListResult() + /// The NamespaceResource items on this page. + internal NotificationHubNamespaceListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Gets or sets result of the List AuthorizationRules operation. - /// Gets or sets link to the next set of results. + /// The NamespaceResource items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal NotificationHubNamespaceListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal NotificationHubNamespaceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Gets or sets result of the List AuthorizationRules operation. + /// Initializes a new instance of for deserialization. + internal NotificationHubNamespaceListResult() + { + } + + /// The NamespaceResource items on this page. public IReadOnlyList Value { get; } - /// Gets or sets link to the next set of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceListResult.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceListResult.Serialization.cs index b817714614e2..3abf320f02d6 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceListResult.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceListResult.Serialization.cs @@ -34,7 +34,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(NotificationHubsPrivateLinkResourceListResult)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + if (options.Format != "W") { writer.WritePropertyName("value"u8); writer.WriteStartArray(); @@ -44,10 +44,10 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -87,17 +87,13 @@ internal static NotificationHubsPrivateLinkResourceListResult DeserializeNotific return null; } IReadOnlyList value = default; - string nextLink = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); foreach (var item in property.Value.EnumerateArray()) { @@ -108,7 +104,11 @@ internal static NotificationHubsPrivateLinkResourceListResult DeserializeNotific } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -117,7 +117,7 @@ internal static NotificationHubsPrivateLinkResourceListResult DeserializeNotific } } serializedAdditionalRawData = rawDataDictionary; - return new NotificationHubsPrivateLinkResourceListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new NotificationHubsPrivateLinkResourceListResult(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceListResult.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceListResult.cs index 8646b52b54c6..0bdd4055cc45 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceListResult.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceListResult.cs @@ -7,10 +7,11 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.NotificationHubs.Models { - /// The response of the List Private Link Resources operation. + /// The response of a PrivateLinkResource list operation. internal partial class NotificationHubsPrivateLinkResourceListResult { /// @@ -46,25 +47,31 @@ internal partial class NotificationHubsPrivateLinkResourceListResult private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal NotificationHubsPrivateLinkResourceListResult() + /// The PrivateLinkResource items on this page. + internal NotificationHubsPrivateLinkResourceListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Gets or sets result of the List AuthorizationRules operation. - /// Gets or sets link to the next set of results. + /// The PrivateLinkResource items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal NotificationHubsPrivateLinkResourceListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal NotificationHubsPrivateLinkResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Gets or sets result of the List AuthorizationRules operation. + /// Initializes a new instance of for deserialization. + internal NotificationHubsPrivateLinkResourceListResult() + { + } + + /// The PrivateLinkResource items on this page. public IReadOnlyList Value { get; } - /// Gets or sets link to the next set of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceListResult.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceListResult.Serialization.cs index 265c86c8fdd1..d747bc2f6c30 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceListResult.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceListResult.Serialization.cs @@ -34,7 +34,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(PrivateEndpointConnectionResourceListResult)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + if (options.Format != "W") { writer.WritePropertyName("value"u8); writer.WriteStartArray(); @@ -44,10 +44,10 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -87,17 +87,13 @@ internal static PrivateEndpointConnectionResourceListResult DeserializePrivateEn return null; } IReadOnlyList value = default; - string nextLink = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); foreach (var item in property.Value.EnumerateArray()) { @@ -108,7 +104,11 @@ internal static PrivateEndpointConnectionResourceListResult DeserializePrivateEn } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -117,7 +117,7 @@ internal static PrivateEndpointConnectionResourceListResult DeserializePrivateEn } } serializedAdditionalRawData = rawDataDictionary; - return new PrivateEndpointConnectionResourceListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new PrivateEndpointConnectionResourceListResult(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceListResult.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceListResult.cs index e4736684c9a5..bbe056c73955 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceListResult.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceListResult.cs @@ -7,10 +7,11 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.NotificationHubs.Models { - /// The response of the List Private Endpoint Connections operation. + /// The response of a PrivateEndpointConnectionResource list operation. internal partial class PrivateEndpointConnectionResourceListResult { /// @@ -46,25 +47,31 @@ internal partial class PrivateEndpointConnectionResourceListResult private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal PrivateEndpointConnectionResourceListResult() + /// The PrivateEndpointConnectionResource items on this page. + internal PrivateEndpointConnectionResourceListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Gets or sets result of the List AuthorizationRules operation. - /// Gets or sets link to the next set of results. + /// The PrivateEndpointConnectionResource items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal PrivateEndpointConnectionResourceListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal PrivateEndpointConnectionResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Gets or sets result of the List AuthorizationRules operation. + /// Initializes a new instance of for deserialization. + internal PrivateEndpointConnectionResourceListResult() + { + } + + /// The PrivateEndpointConnectionResource items on this page. public IReadOnlyList Value { get; } - /// Gets or sets link to the next set of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleListResult.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleListResult.Serialization.cs index 8a139195b7ee..c0f7e4ecbdc1 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleListResult.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleListResult.Serialization.cs @@ -34,7 +34,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(SharedAccessAuthorizationRuleListResult)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + if (options.Format != "W") { writer.WritePropertyName("value"u8); writer.WriteStartArray(); @@ -44,10 +44,10 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -87,17 +87,13 @@ internal static SharedAccessAuthorizationRuleListResult DeserializeSharedAccessA return null; } IReadOnlyList value = default; - string nextLink = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); foreach (var item in property.Value.EnumerateArray()) { @@ -108,7 +104,11 @@ internal static SharedAccessAuthorizationRuleListResult DeserializeSharedAccessA } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -117,7 +117,7 @@ internal static SharedAccessAuthorizationRuleListResult DeserializeSharedAccessA } } serializedAdditionalRawData = rawDataDictionary; - return new SharedAccessAuthorizationRuleListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new SharedAccessAuthorizationRuleListResult(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleListResult.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleListResult.cs index d5ceba8840db..6dcf018e7278 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleListResult.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleListResult.cs @@ -7,10 +7,11 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.NotificationHubs.Models { - /// The response of the List Namespace operation. + /// Paged collection of SharedAccessAuthorizationRuleResource items. internal partial class SharedAccessAuthorizationRuleListResult { /// @@ -46,25 +47,31 @@ internal partial class SharedAccessAuthorizationRuleListResult private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal SharedAccessAuthorizationRuleListResult() + /// The SharedAccessAuthorizationRuleResource items on this page. + internal SharedAccessAuthorizationRuleListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Gets or sets result of the List AuthorizationRules operation. - /// Gets or sets link to the next set of results. + /// The SharedAccessAuthorizationRuleResource items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal SharedAccessAuthorizationRuleListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal SharedAccessAuthorizationRuleListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Gets or sets result of the List AuthorizationRules operation. + /// Initializes a new instance of for deserialization. + internal SharedAccessAuthorizationRuleListResult() + { + } + + /// The SharedAccessAuthorizationRuleResource items on this page. public IReadOnlyList Value { get; } - /// Gets or sets link to the next set of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleCollection.cs index ed55302dffb5..e6dba798686a 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleCollection.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleCollection.cs @@ -73,7 +73,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Authorization Rule Name. + /// The name of the SharedAccessAuthorizationRuleResource. /// Request content. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. @@ -124,7 +124,7 @@ public virtual async Task /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Authorization Rule Name. + /// The name of the SharedAccessAuthorizationRuleResource. /// Request content. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. @@ -174,7 +174,7 @@ public virtual ArmOperation CreateOrUp /// /// /// - /// Authorization Rule Name. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -219,7 +219,7 @@ public virtual async Task> Ge /// /// /// - /// Authorization Rule Name. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -324,7 +324,7 @@ public virtual Pageable GetAll(Cancell /// /// /// - /// Authorization Rule Name. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -367,7 +367,7 @@ public virtual async Task> ExistsAsync(string authorizationRuleNa /// /// /// - /// Authorization Rule Name. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -410,7 +410,7 @@ public virtual Response Exists(string authorizationRuleName, CancellationT /// /// /// - /// Authorization Rule Name. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -455,7 +455,7 @@ public virtual async Task /// /// - /// Authorization Rule Name. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleCollection.cs index e8d7ba7cba05..7feb4d57028e 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleCollection.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleCollection.cs @@ -73,7 +73,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Authorization Rule Name. + /// The name of the SharedAccessAuthorizationRuleResource. /// Request content. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. @@ -124,7 +124,7 @@ public virtual async Task /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Authorization Rule Name. + /// The name of the SharedAccessAuthorizationRuleResource. /// Request content. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. @@ -174,7 +174,7 @@ public virtual ArmOperation C /// /// /// - /// Authorization Rule Name. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -219,7 +219,7 @@ public virtual async Task /// /// - /// Authorization Rule Name. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -324,7 +324,7 @@ public virtual Pageable GetAl /// /// /// - /// Authorization Rule Name. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -367,7 +367,7 @@ public virtual async Task> ExistsAsync(string authorizationRuleNa /// /// /// - /// Authorization Rule Name. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -410,7 +410,7 @@ public virtual Response Exists(string authorizationRuleName, CancellationT /// /// /// - /// Authorization Rule Name. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -455,7 +455,7 @@ public virtual async Task /// /// - /// Authorization Rule Name. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceResource.cs index ceed23c37b86..b04466af0475 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceResource.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceResource.cs @@ -94,23 +94,23 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } - /// Gets a collection of NotificationHubResources in the NotificationHubNamespace. - /// An object representing collection of NotificationHubResources and their operations over a NotificationHubResource. - public virtual NotificationHubCollection GetNotificationHubs() + /// Gets a collection of NotificationHubNamespaceAuthorizationRuleResources in the NotificationHubNamespace. + /// An object representing collection of NotificationHubNamespaceAuthorizationRuleResources and their operations over a NotificationHubNamespaceAuthorizationRuleResource. + public virtual NotificationHubNamespaceAuthorizationRuleCollection GetNotificationHubNamespaceAuthorizationRules() { - return GetCachedClient(client => new NotificationHubCollection(client, Id)); + return GetCachedClient(client => new NotificationHubNamespaceAuthorizationRuleCollection(client, Id)); } /// - /// Gets the notification hub. + /// Gets an authorization rule for a namespace by name. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id - /// NotificationHubs_Get + /// Namespaces_GetAuthorizationRule /// /// /// Default Api Version @@ -118,30 +118,30 @@ public virtual NotificationHubCollection GetNotificationHubs() /// /// /// Resource - /// + /// /// /// /// - /// Notification Hub name. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetNotificationHubAsync(string notificationHubName, CancellationToken cancellationToken = default) + public virtual async Task> GetNotificationHubNamespaceAuthorizationRuleAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { - return await GetNotificationHubs().GetAsync(notificationHubName, cancellationToken).ConfigureAwait(false); + return await GetNotificationHubNamespaceAuthorizationRules().GetAsync(authorizationRuleName, cancellationToken).ConfigureAwait(false); } /// - /// Gets the notification hub. + /// Gets an authorization rule for a namespace by name. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id - /// NotificationHubs_Get + /// Namespaces_GetAuthorizationRule /// /// /// Default Api Version @@ -149,37 +149,37 @@ public virtual async Task> GetNotificationHubA /// /// /// Resource - /// + /// /// /// /// - /// Notification Hub name. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetNotificationHub(string notificationHubName, CancellationToken cancellationToken = default) + public virtual Response GetNotificationHubNamespaceAuthorizationRule(string authorizationRuleName, CancellationToken cancellationToken = default) { - return GetNotificationHubs().Get(notificationHubName, cancellationToken); + return GetNotificationHubNamespaceAuthorizationRules().Get(authorizationRuleName, cancellationToken); } - /// Gets a collection of NotificationHubNamespaceAuthorizationRuleResources in the NotificationHubNamespace. - /// An object representing collection of NotificationHubNamespaceAuthorizationRuleResources and their operations over a NotificationHubNamespaceAuthorizationRuleResource. - public virtual NotificationHubNamespaceAuthorizationRuleCollection GetNotificationHubNamespaceAuthorizationRules() + /// Gets a collection of NotificationHubResources in the NotificationHubNamespace. + /// An object representing collection of NotificationHubResources and their operations over a NotificationHubResource. + public virtual NotificationHubCollection GetNotificationHubs() { - return GetCachedClient(client => new NotificationHubNamespaceAuthorizationRuleCollection(client, Id)); + return GetCachedClient(client => new NotificationHubCollection(client, Id)); } /// - /// Gets an authorization rule for a namespace by name. + /// Gets the notification hub. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName} /// /// /// Operation Id - /// Namespaces_GetAuthorizationRule + /// NotificationHubs_Get /// /// /// Default Api Version @@ -187,30 +187,30 @@ public virtual NotificationHubNamespaceAuthorizationRuleCollection GetNotificati /// /// /// Resource - /// + /// /// /// /// - /// Authorization Rule Name. + /// Notification Hub name. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetNotificationHubNamespaceAuthorizationRuleAsync(string authorizationRuleName, CancellationToken cancellationToken = default) + public virtual async Task> GetNotificationHubAsync(string notificationHubName, CancellationToken cancellationToken = default) { - return await GetNotificationHubNamespaceAuthorizationRules().GetAsync(authorizationRuleName, cancellationToken).ConfigureAwait(false); + return await GetNotificationHubs().GetAsync(notificationHubName, cancellationToken).ConfigureAwait(false); } /// - /// Gets an authorization rule for a namespace by name. + /// Gets the notification hub. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName} /// /// /// Operation Id - /// Namespaces_GetAuthorizationRule + /// NotificationHubs_Get /// /// /// Default Api Version @@ -218,18 +218,18 @@ public virtual async Task /// /// Resource - /// + /// /// /// /// - /// Authorization Rule Name. + /// Notification Hub name. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetNotificationHubNamespaceAuthorizationRule(string authorizationRuleName, CancellationToken cancellationToken = default) + public virtual Response GetNotificationHub(string notificationHubName, CancellationToken cancellationToken = default) { - return GetNotificationHubNamespaceAuthorizationRules().Get(authorizationRuleName, cancellationToken); + return GetNotificationHubs().Get(notificationHubName, cancellationToken); } /// Gets a collection of NotificationHubPrivateEndpointConnectionResources in the NotificationHubNamespace. @@ -627,34 +627,34 @@ public virtual Response Update(NotificationHub } /// - /// Checks the availability of the given notificationHub in a namespace. + /// Lists the PNS credentials associated with a namespace. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/checkNotificationHubAvailability + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/pnsCredentials /// /// /// Operation Id - /// NotificationHubs_CheckNotificationHubAvailability + /// Namespaces_GetPnsCredentials /// /// /// Default Api Version /// 2023-10-01-preview /// + /// + /// Resource + /// + /// /// /// - /// Request content. /// The cancellation token to use. - /// is null. - public virtual async Task> CheckNotificationHubAvailabilityAsync(NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) + public virtual async Task> GetPnsCredentialsAsync(CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _notificationHubsClientDiagnostics.CreateScope("NotificationHubNamespaceResource.CheckNotificationHubAvailability"); + using var scope = _notificationHubNamespaceNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceResource.GetPnsCredentials"); scope.Start(); try { - var response = await _notificationHubsRestClient.CheckNotificationHubAvailabilityAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var response = await _notificationHubNamespaceNamespacesRestClient.GetPnsCredentialsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -665,34 +665,34 @@ public virtual async Task> CheckNoti } /// - /// Checks the availability of the given notificationHub in a namespace. + /// Lists the PNS credentials associated with a namespace. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/checkNotificationHubAvailability + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/pnsCredentials /// /// /// Operation Id - /// NotificationHubs_CheckNotificationHubAvailability + /// Namespaces_GetPnsCredentials /// /// /// Default Api Version /// 2023-10-01-preview /// + /// + /// Resource + /// + /// /// /// - /// Request content. /// The cancellation token to use. - /// is null. - public virtual Response CheckNotificationHubAvailability(NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) + public virtual Response GetPnsCredentials(CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _notificationHubsClientDiagnostics.CreateScope("NotificationHubNamespaceResource.CheckNotificationHubAvailability"); + using var scope = _notificationHubNamespaceNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceResource.GetPnsCredentials"); scope.Start(); try { - var response = _notificationHubsRestClient.CheckNotificationHubAvailability(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var response = _notificationHubNamespaceNamespacesRestClient.GetPnsCredentials(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return response; } catch (Exception e) @@ -703,34 +703,34 @@ public virtual Response CheckNotificationHubA } /// - /// Lists the PNS credentials associated with a namespace. + /// Checks the availability of the given notificationHub in a namespace. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/pnsCredentials + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/checkNotificationHubAvailability /// /// /// Operation Id - /// Namespaces_GetPnsCredentials + /// NotificationHubs_CheckNotificationHubAvailability /// /// /// Default Api Version /// 2023-10-01-preview /// - /// - /// Resource - /// - /// /// /// + /// Request content. /// The cancellation token to use. - public virtual async Task> GetPnsCredentialsAsync(CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> CheckNotificationHubAvailabilityAsync(NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) { - using var scope = _notificationHubNamespaceNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceResource.GetPnsCredentials"); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _notificationHubsClientDiagnostics.CreateScope("NotificationHubNamespaceResource.CheckNotificationHubAvailability"); scope.Start(); try { - var response = await _notificationHubNamespaceNamespacesRestClient.GetPnsCredentialsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _notificationHubsRestClient.CheckNotificationHubAvailabilityAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -741,34 +741,34 @@ public virtual async Task> GetPnsCredent } /// - /// Lists the PNS credentials associated with a namespace. + /// Checks the availability of the given notificationHub in a namespace. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/pnsCredentials + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/checkNotificationHubAvailability /// /// /// Operation Id - /// Namespaces_GetPnsCredentials + /// NotificationHubs_CheckNotificationHubAvailability /// /// /// Default Api Version /// 2023-10-01-preview /// - /// - /// Resource - /// - /// /// /// + /// Request content. /// The cancellation token to use. - public virtual Response GetPnsCredentials(CancellationToken cancellationToken = default) + /// is null. + public virtual Response CheckNotificationHubAvailability(NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) { - using var scope = _notificationHubNamespaceNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceResource.GetPnsCredentials"); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _notificationHubsClientDiagnostics.CreateScope("NotificationHubNamespaceResource.CheckNotificationHubAvailability"); scope.Start(); try { - var response = _notificationHubNamespaceNamespacesRestClient.GetPnsCredentials(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var response = _notificationHubsRestClient.CheckNotificationHubAvailability(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubPrivateEndpointConnectionCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubPrivateEndpointConnectionCollection.cs index 98b4a1c3dd0d..db00a07e6bdd 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubPrivateEndpointConnectionCollection.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubPrivateEndpointConnectionCollection.cs @@ -270,7 +270,8 @@ public virtual Response Get(st public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationHubPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new NotificationHubPrivateEndpointConnectionResource(Client, NotificationHubPrivateEndpointConnectionData.DeserializeNotificationHubPrivateEndpointConnectionData(e)), _notificationHubPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "NotificationHubPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _notificationHubPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NotificationHubPrivateEndpointConnectionResource(Client, NotificationHubPrivateEndpointConnectionData.DeserializeNotificationHubPrivateEndpointConnectionData(e)), _notificationHubPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "NotificationHubPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -300,7 +301,8 @@ public virtual AsyncPageable G public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationHubPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new NotificationHubPrivateEndpointConnectionResource(Client, NotificationHubPrivateEndpointConnectionData.DeserializeNotificationHubPrivateEndpointConnectionData(e)), _notificationHubPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "NotificationHubPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _notificationHubPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NotificationHubPrivateEndpointConnectionResource(Client, NotificationHubPrivateEndpointConnectionData.DeserializeNotificationHubPrivateEndpointConnectionData(e)), _notificationHubPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "NotificationHubPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubResource.cs index 98ee1ea20c8b..3aba1b2108ec 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubResource.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubResource.cs @@ -118,7 +118,7 @@ public virtual NotificationHubAuthorizationRuleCollection GetNotificationHubAuth /// /// /// - /// Authorization Rule Name. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -149,7 +149,7 @@ public virtual async Task> Ge /// /// /// - /// Authorization Rule Name. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResourceCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResourceCollection.cs index f51ded7084e2..f3173a8cec66 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResourceCollection.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResourceCollection.cs @@ -170,7 +170,8 @@ public virtual Response Get(string subResou public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsRestClient.CreateListGroupIdsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new NotificationHubsPrivateLinkResource(Client, NotificationHubsPrivateLinkResourceData.DeserializeNotificationHubsPrivateLinkResourceData(e)), _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsClientDiagnostics, Pipeline, "NotificationHubsPrivateLinkResourceCollection.GetAll", "value", null, cancellationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsRestClient.CreateListGroupIdsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NotificationHubsPrivateLinkResource(Client, NotificationHubsPrivateLinkResourceData.DeserializeNotificationHubsPrivateLinkResourceData(e)), _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsClientDiagnostics, Pipeline, "NotificationHubsPrivateLinkResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -200,7 +201,8 @@ public virtual AsyncPageable GetAllAsync(Ca public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsRestClient.CreateListGroupIdsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new NotificationHubsPrivateLinkResource(Client, NotificationHubsPrivateLinkResourceData.DeserializeNotificationHubsPrivateLinkResourceData(e)), _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsClientDiagnostics, Pipeline, "NotificationHubsPrivateLinkResourceCollection.GetAll", "value", null, cancellationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsRestClient.CreateListGroupIdsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NotificationHubsPrivateLinkResource(Client, NotificationHubsPrivateLinkResourceData.DeserializeNotificationHubsPrivateLinkResourceData(e)), _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsClientDiagnostics, Pipeline, "NotificationHubsPrivateLinkResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/RestOperations/NamespacesRestOperations.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/RestOperations/NamespacesRestOperations.cs index 6bee2f056133..480612fb7a32 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/RestOperations/NamespacesRestOperations.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/RestOperations/NamespacesRestOperations.cs @@ -70,7 +70,7 @@ internal HttpMessage CreateCheckAvailabilityRequest(string subscriptionId, Notif /// Checks the availability of the given service namespace across all Azure subscriptions. This is useful because the domain name is created based on the service namespace name. /// The ID of the target subscription. The value must be an UUID. - /// Request content. + /// The request body. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. @@ -97,7 +97,7 @@ public async Task> CheckAvailability /// Checks the availability of the given service namespace across all Azure subscriptions. This is useful because the domain name is created based on the service namespace name. /// The ID of the target subscription. The value must be an UUID. - /// Request content. + /// The request body. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. @@ -122,21 +122,26 @@ public Response CheckAvailability(string subs } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string namespaceName) + internal RequestUriBuilder CreateListAllRequestUri(string subscriptionId, string skipToken, int? top) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); - uri.AppendPath(namespaceName, true); + uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces", false); uri.AppendQuery("api-version", _apiVersion, true); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string namespaceName) + internal HttpMessage CreateListAllRequest(string subscriptionId, string skipToken, int? top) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -145,80 +150,77 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); - uri.AppendPath(namespaceName, true); + uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces", false); uri.AppendQuery("api-version", _apiVersion, true); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Returns the given namespace. + /// Lists all the available namespaces within the subscription. /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Namespace name. + /// Skip token for subsequent requests. + /// Maximum number of results to return. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListAllAsync(string subscriptionId, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName); + using var message = CreateListAllRequest(subscriptionId, skipToken, top); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - NotificationHubNamespaceData value = default; + NotificationHubNamespaceListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NotificationHubNamespaceData.DeserializeNotificationHubNamespaceData(document.RootElement); + value = NotificationHubNamespaceListResult.DeserializeNotificationHubNamespaceListResult(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((NotificationHubNamespaceData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Returns the given namespace. + /// Lists all the available namespaces within the subscription. /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Namespace name. + /// Skip token for subsequent requests. + /// Maximum number of results to return. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListAll(string subscriptionId, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName); + using var message = CreateListAllRequest(subscriptionId, skipToken, top); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - NotificationHubNamespaceData value = default; + NotificationHubNamespaceListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NotificationHubNamespaceData.DeserializeNotificationHubNamespaceData(document.RootElement); + value = NotificationHubNamespaceListResult.DeserializeNotificationHubNamespaceListResult(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((NotificationHubNamespaceData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespaceData data) + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string skipToken, int? top) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -226,91 +228,105 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); - uri.AppendPath(namespaceName, true); + uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces", false); uri.AppendQuery("api-version", _apiVersion, true); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespaceData data) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string skipToken, int? top) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); - uri.AppendPath(namespaceName, true); + uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces", false); uri.AppendQuery("api-version", _apiVersion, true); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; _userAgent.Apply(message); return message; } - /// Creates / Updates a Notification Hub namespace. This operation is idempotent. + /// Lists the available namespaces within a resource group. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Request content. + /// Skip token for subsequent requests. + /// Maximum number of results to return. /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespaceData data, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, data); + using var message = CreateListRequest(subscriptionId, resourceGroupName, skipToken, top); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: - return message.Response; + { + NotificationHubNamespaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = NotificationHubNamespaceListResult.DeserializeNotificationHubNamespaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Creates / Updates a Notification Hub namespace. This operation is idempotent. + /// Lists the available namespaces within a resource group. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Request content. + /// Skip token for subsequent requests. + /// Maximum number of results to return. /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespaceData data, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, data); + using var message = CreateListRequest(subscriptionId, resourceGroupName, skipToken, top); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: - return message.Response; + { + NotificationHubNamespaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = NotificationHubNamespaceListResult.DeserializeNotificationHubNamespaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespacePatch patch) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string namespaceName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -324,11 +340,11 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespacePatch patch) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string namespaceName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Patch; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -340,30 +356,24 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; _userAgent.Apply(message); return message; } - /// Patches the existing namespace. + /// Returns the given namespace. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Namespace name. - /// Request content. /// The cancellation token to use. - /// , , or is null. + /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespacePatch patch, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); - Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, namespaceName, patch); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -374,27 +384,27 @@ public async Task> UpdateAsync(string sub value = NotificationHubNamespaceData.DeserializeNotificationHubNamespaceData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((NotificationHubNamespaceData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Patches the existing namespace. + /// Returns the given namespace. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Namespace name. - /// Request content. /// The cancellation token to use. - /// , , or is null. + /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespacePatch patch, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); - Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, namespaceName, patch); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -405,12 +415,14 @@ public Response Update(string subscriptionId, stri value = NotificationHubNamespaceData.DeserializeNotificationHubNamespaceData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((NotificationHubNamespaceData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string namespaceName) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespaceData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -424,11 +436,11 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string namespaceName) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespaceData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -440,124 +452,130 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; _userAgent.Apply(message); return message; } - /// Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. + /// Creates / Updates a Notification Hub namespace. This operation is idempotent. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Namespace name. + /// Request content. /// The cancellation token to use. - /// , or is null. + /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespaceData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 204: + case 201: return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. + /// Creates / Updates a Notification Hub namespace. This operation is idempotent. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Namespace name. + /// Request content. /// The cancellation token to use. - /// , or is null. + /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespaceData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 204: + case 201: return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListAllRequestUri(string subscriptionId, string skipToken, int? top) + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespacePatch patch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces", false); - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); + uri.AppendPath(namespaceName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListAllRequest(string subscriptionId, string skipToken, int? top) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespacePatch patch) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Patch; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces", false); - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); + uri.AppendPath(namespaceName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; _userAgent.Apply(message); return message; } - /// Lists all the available namespaces within the subscription. + /// Patches the existing namespace. /// The ID of the target subscription. The value must be an UUID. - /// Skip token for subsequent requests. - /// Maximum number of results to return. + /// The name of the resource group. The name is case insensitive. + /// Namespace name. + /// Request content. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListAllAsync(string subscriptionId, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespacePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateListAllRequest(subscriptionId, skipToken, top); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, namespaceName, patch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - NotificationHubNamespaceListResult value = default; + NotificationHubNamespaceData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NotificationHubNamespaceListResult.DeserializeNotificationHubNamespaceListResult(document.RootElement); + value = NotificationHubNamespaceData.DeserializeNotificationHubNamespaceData(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -565,26 +583,30 @@ public async Task> ListAllAsync(str } } - /// Lists all the available namespaces within the subscription. + /// Patches the existing namespace. /// The ID of the target subscription. The value must be an UUID. - /// Skip token for subsequent requests. - /// Maximum number of results to return. + /// The name of the resource group. The name is case insensitive. + /// Namespace name. + /// Request content. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListAll(string subscriptionId, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespacePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateListAllRequest(subscriptionId, skipToken, top); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, namespaceName, patch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - NotificationHubNamespaceListResult value = default; + NotificationHubNamespaceData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NotificationHubNamespaceListResult.DeserializeNotificationHubNamespaceListResult(document.RootElement); + value = NotificationHubNamespaceData.DeserializeNotificationHubNamespaceData(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -592,47 +614,33 @@ public Response ListAll(string subscriptionI } } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string skipToken, int? top) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string namespaceName) { var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces", false); - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); + uri.AppendPath(namespaceName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string skipToken, int? top) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string namespaceName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces", false); - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } + uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); + uri.AppendPath(namespaceName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -640,65 +648,57 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro return message; } - /// Lists the available namespaces within a resource group. + /// Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Skip token for subsequent requests. - /// Maximum number of results to return. + /// Namespace name. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, skipToken, top); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - NotificationHubNamespaceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NotificationHubNamespaceListResult.DeserializeNotificationHubNamespaceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Lists the available namespaces within a resource group. + /// Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Skip token for subsequent requests. - /// Maximum number of results to return. + /// Namespace name. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, skipToken, top); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - NotificationHubNamespaceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NotificationHubNamespaceListResult.DeserializeNotificationHubNamespaceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateAuthorizationRuleRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, NotificationHubAuthorizationRuleData data) + internal RequestUriBuilder CreateListAuthorizationRulesRequestUri(string subscriptionId, string resourceGroupName, string namespaceName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -708,17 +708,16 @@ internal RequestUriBuilder CreateCreateOrUpdateAuthorizationRuleRequestUri(strin uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); uri.AppendPath(namespaceName, true); - uri.AppendPath("/authorizationRules/", false); - uri.AppendPath(authorizationRuleName, true); + uri.AppendPath("/authorizationRules", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateCreateOrUpdateAuthorizationRuleRequest(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, NotificationHubAuthorizationRuleData data) + internal HttpMessage CreateListAuthorizationRulesRequest(string subscriptionId, string resourceGroupName, string namespaceName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -727,46 +726,36 @@ internal HttpMessage CreateCreateOrUpdateAuthorizationRuleRequest(string subscri uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); uri.AppendPath(namespaceName, true); - uri.AppendPath("/authorizationRules/", false); - uri.AppendPath(authorizationRuleName, true); + uri.AppendPath("/authorizationRules", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; _userAgent.Apply(message); return message; } - /// Creates an authorization rule for a namespace. + /// Gets the authorization rules for a namespace. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Authorization Rule Name. - /// Request content. + /// The name of the NamespaceResource. /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAuthorizationRuleAsync(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, NotificationHubAuthorizationRuleData data, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAuthorizationRulesAsync(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); - Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName, data); + using var message = CreateListAuthorizationRulesRequest(subscriptionId, resourceGroupName, namespaceName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: { - NotificationHubAuthorizationRuleData value = default; + SharedAccessAuthorizationRuleListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NotificationHubAuthorizationRuleData.DeserializeNotificationHubAuthorizationRuleData(document.RootElement); + value = SharedAccessAuthorizationRuleListResult.DeserializeSharedAccessAuthorizationRuleListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -774,33 +763,28 @@ public async Task> CreateOrUpdate } } - /// Creates an authorization rule for a namespace. + /// Gets the authorization rules for a namespace. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Authorization Rule Name. - /// Request content. + /// The name of the NamespaceResource. /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdateAuthorizationRule(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, NotificationHubAuthorizationRuleData data, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListAuthorizationRules(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); - Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName, data); + using var message = CreateListAuthorizationRulesRequest(subscriptionId, resourceGroupName, namespaceName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: { - NotificationHubAuthorizationRuleData value = default; + SharedAccessAuthorizationRuleListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NotificationHubAuthorizationRuleData.DeserializeNotificationHubAuthorizationRuleData(document.RootElement); + value = SharedAccessAuthorizationRuleListResult.DeserializeSharedAccessAuthorizationRuleListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -808,7 +792,7 @@ public Response CreateOrUpdateAuthorizatio } } - internal RequestUriBuilder CreateDeleteAuthorizationRuleRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName) + internal RequestUriBuilder CreateGetAuthorizationRuleRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -824,11 +808,11 @@ internal RequestUriBuilder CreateDeleteAuthorizationRuleRequestUri(string subscr return uri; } - internal HttpMessage CreateDeleteAuthorizationRuleRequest(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName) + internal HttpMessage CreateGetAuthorizationRuleRequest(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -846,61 +830,73 @@ internal HttpMessage CreateDeleteAuthorizationRuleRequest(string subscriptionId, return message; } - /// Deletes a namespace authorization rule. + /// Gets an authorization rule for a namespace by name. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Authorization Rule Name. + /// The name of the NamespaceResource. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAuthorizationRuleAsync(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, CancellationToken cancellationToken = default) + public async Task> GetAuthorizationRuleAsync(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - using var message = CreateDeleteAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); + using var message = CreateGetAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + NotificationHubAuthorizationRuleData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = NotificationHubAuthorizationRuleData.DeserializeNotificationHubAuthorizationRuleData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NotificationHubAuthorizationRuleData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Deletes a namespace authorization rule. + /// Gets an authorization rule for a namespace by name. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Authorization Rule Name. + /// The name of the NamespaceResource. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response DeleteAuthorizationRule(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, CancellationToken cancellationToken = default) + public Response GetAuthorizationRule(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - using var message = CreateDeleteAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); + using var message = CreateGetAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + NotificationHubAuthorizationRuleData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = NotificationHubAuthorizationRuleData.DeserializeNotificationHubAuthorizationRuleData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NotificationHubAuthorizationRuleData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateGetAuthorizationRuleRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName) + internal RequestUriBuilder CreateCreateOrUpdateAuthorizationRuleRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, NotificationHubAuthorizationRuleData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -916,11 +912,11 @@ internal RequestUriBuilder CreateGetAuthorizationRuleRequestUri(string subscript return uri; } - internal HttpMessage CreateGetAuthorizationRuleRequest(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName) + internal HttpMessage CreateCreateOrUpdateAuthorizationRuleRequest(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, NotificationHubAuthorizationRuleData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -934,77 +930,83 @@ internal HttpMessage CreateGetAuthorizationRuleRequest(string subscriptionId, st uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; _userAgent.Apply(message); return message; } - /// Gets an authorization rule for a namespace by name. + /// Creates an authorization rule for a namespace. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Authorization Rule Name. + /// The name of the NamespaceResource. + /// The name of the SharedAccessAuthorizationRuleResource. + /// Request content. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAuthorizationRuleAsync(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAuthorizationRuleAsync(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, NotificationHubAuthorizationRuleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateGetAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); + using var message = CreateCreateOrUpdateAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: + case 201: { NotificationHubAuthorizationRuleData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); value = NotificationHubAuthorizationRuleData.DeserializeNotificationHubAuthorizationRuleData(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((NotificationHubAuthorizationRuleData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Gets an authorization rule for a namespace by name. + /// Creates an authorization rule for a namespace. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Authorization Rule Name. + /// The name of the NamespaceResource. + /// The name of the SharedAccessAuthorizationRuleResource. + /// Request content. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response GetAuthorizationRule(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, CancellationToken cancellationToken = default) + public Response CreateOrUpdateAuthorizationRule(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, NotificationHubAuthorizationRuleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateGetAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); + using var message = CreateCreateOrUpdateAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: + case 201: { NotificationHubAuthorizationRuleData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); value = NotificationHubAuthorizationRuleData.DeserializeNotificationHubAuthorizationRuleData(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((NotificationHubAuthorizationRuleData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListAuthorizationRulesRequestUri(string subscriptionId, string resourceGroupName, string namespaceName) + internal RequestUriBuilder CreateDeleteAuthorizationRuleRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -1014,16 +1016,17 @@ internal RequestUriBuilder CreateListAuthorizationRulesRequestUri(string subscri uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); uri.AppendPath(namespaceName, true); - uri.AppendPath("/authorizationRules", false); + uri.AppendPath("/authorizationRules/", false); + uri.AppendPath(authorizationRuleName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListAuthorizationRulesRequest(string subscriptionId, string resourceGroupName, string namespaceName) + internal HttpMessage CreateDeleteAuthorizationRuleRequest(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -1032,7 +1035,8 @@ internal HttpMessage CreateListAuthorizationRulesRequest(string subscriptionId, uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); uri.AppendPath(namespaceName, true); - uri.AppendPath("/authorizationRules", false); + uri.AppendPath("/authorizationRules/", false); + uri.AppendPath(authorizationRuleName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -1040,59 +1044,55 @@ internal HttpMessage CreateListAuthorizationRulesRequest(string subscriptionId, return message; } - /// Gets the authorization rules for a namespace. + /// Deletes a namespace authorization rule. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. + /// The name of the NamespaceResource. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAuthorizationRulesAsync(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAuthorizationRuleAsync(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - using var message = CreateListAuthorizationRulesRequest(subscriptionId, resourceGroupName, namespaceName); + using var message = CreateDeleteAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - SharedAccessAuthorizationRuleListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = SharedAccessAuthorizationRuleListResult.DeserializeSharedAccessAuthorizationRuleListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Gets the authorization rules for a namespace. + /// Deletes a namespace authorization rule. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. + /// The name of the NamespaceResource. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListAuthorizationRules(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response DeleteAuthorizationRule(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - using var message = CreateListAuthorizationRulesRequest(subscriptionId, resourceGroupName, namespaceName); + using var message = CreateDeleteAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - SharedAccessAuthorizationRuleListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = SharedAccessAuthorizationRuleListResult.DeserializeSharedAccessAuthorizationRuleListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } @@ -1141,8 +1141,8 @@ internal HttpMessage CreateListKeysRequest(string subscriptionId, string resourc /// Gets the Primary and Secondary ConnectionStrings to the namespace. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Authorization Rule Name. + /// The name of the NamespaceResource. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -1172,8 +1172,8 @@ public async Task> ListKeysAsync(string su /// Gets the Primary and Secondary ConnectionStrings to the namespace. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Authorization Rule Name. + /// The name of the NamespaceResource. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -1247,8 +1247,8 @@ internal HttpMessage CreateRegenerateKeysRequest(string subscriptionId, string r /// Regenerates the Primary/Secondary Keys to the Namespace Authorization Rule. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Authorization Rule Name. + /// The name of the NamespaceResource. + /// The name of the SharedAccessAuthorizationRuleResource. /// Request content. /// The cancellation token to use. /// , , , or is null. @@ -1280,8 +1280,8 @@ public async Task> RegenerateKeysAsync(str /// Regenerates the Primary/Secondary Keys to the Namespace Authorization Rule. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Authorization Rule Name. + /// The name of the NamespaceResource. + /// The name of the SharedAccessAuthorizationRuleResource. /// Request content. /// The cancellation token to use. /// , , , or is null. @@ -1594,7 +1594,7 @@ internal HttpMessage CreateListAuthorizationRulesNextPageRequest(string nextLink /// The URL to the next page of results. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. + /// The name of the NamespaceResource. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -1625,7 +1625,7 @@ public async Task> ListAuthori /// The URL to the next page of results. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. + /// The name of the NamespaceResource. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/RestOperations/NotificationHubsRestOperations.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/RestOperations/NotificationHubsRestOperations.cs index 6b545b708221..b02c11e2ecde 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/RestOperations/NotificationHubsRestOperations.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/RestOperations/NotificationHubsRestOperations.cs @@ -138,6 +138,120 @@ public Response CheckNotificationHubAvailabil } } + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string skipToken, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/notificationHubs", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string namespaceName, string skipToken, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/notificationHubs", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the notification hubs associated with a namespace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Namespace name. + /// Continuation token. + /// Page size. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string namespaceName, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, namespaceName, skipToken, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NotificationHubListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = NotificationHubListResult.DeserializeNotificationHubListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the notification hubs associated with a namespace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Namespace name. + /// Continuation token. + /// Page size. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string namespaceName, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, namespaceName, skipToken, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NotificationHubListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = NotificationHubListResult.DeserializeNotificationHubListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName) { var uri = new RawRequestUriBuilder(); @@ -460,7 +574,7 @@ public Response Delete(string subscriptionId, string resourceGroupName, string n } } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string skipToken, int? top) + internal RequestUriBuilder CreateListAuthorizationRulesRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -470,20 +584,14 @@ internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string re uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); uri.AppendPath(namespaceName, true); - uri.AppendPath("/notificationHubs", false); - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } + uri.AppendPath("/notificationHubs/", false); + uri.AppendPath(notificationHubName, true); + uri.AppendPath("/authorizationRules", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string namespaceName, string skipToken, int? top) + internal HttpMessage CreateListAuthorizationRulesRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -496,15 +604,9 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); uri.AppendPath(namespaceName, true); - uri.AppendPath("/notificationHubs", false); - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } + uri.AppendPath("/notificationHubs/", false); + uri.AppendPath(notificationHubName, true); + uri.AppendPath("/authorizationRules", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -512,30 +614,30 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro return message; } - /// Lists the notification hubs associated with a namespace. + /// Gets the authorization rules for a NotificationHub. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Continuation token. - /// Page size. + /// The name of the NamespaceResource. + /// The name of the NotificationHubResource. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string namespaceName, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListAuthorizationRulesAsync(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, namespaceName, skipToken, top); + using var message = CreateListAuthorizationRulesRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - NotificationHubListResult value = default; + SharedAccessAuthorizationRuleListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NotificationHubListResult.DeserializeNotificationHubListResult(document.RootElement); + value = SharedAccessAuthorizationRuleListResult.DeserializeSharedAccessAuthorizationRuleListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -543,30 +645,30 @@ public async Task> ListAsync(string subscrip } } - /// Lists the notification hubs associated with a namespace. + /// Gets the authorization rules for a NotificationHub. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Continuation token. - /// Page size. + /// The name of the NamespaceResource. + /// The name of the NotificationHubResource. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string namespaceName, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListAuthorizationRules(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, namespaceName, skipToken, top); + using var message = CreateListAuthorizationRulesRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - NotificationHubListResult value = default; + SharedAccessAuthorizationRuleListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NotificationHubListResult.DeserializeNotificationHubListResult(document.RootElement); + value = SharedAccessAuthorizationRuleListResult.DeserializeSharedAccessAuthorizationRuleListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -574,7 +676,7 @@ public Response List(string subscriptionId, string re } } - internal RequestUriBuilder CreateDebugSendRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName) + internal RequestUriBuilder CreateGetAuthorizationRuleRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -586,16 +688,17 @@ internal RequestUriBuilder CreateDebugSendRequestUri(string subscriptionId, stri uri.AppendPath(namespaceName, true); uri.AppendPath("/notificationHubs/", false); uri.AppendPath(notificationHubName, true); - uri.AppendPath("/debugsend", false); + uri.AppendPath("/authorizationRules/", false); + uri.AppendPath(authorizationRuleName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateDebugSendRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName) + internal HttpMessage CreateGetAuthorizationRuleRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -606,7 +709,8 @@ internal HttpMessage CreateDebugSendRequest(string subscriptionId, string resour uri.AppendPath(namespaceName, true); uri.AppendPath("/notificationHubs/", false); uri.AppendPath(notificationHubName, true); - uri.AppendPath("/debugsend", false); + uri.AppendPath("/authorizationRules/", false); + uri.AppendPath(authorizationRuleName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -614,63 +718,71 @@ internal HttpMessage CreateDebugSendRequest(string subscriptionId, string resour return message; } - /// Test send a push notification. + /// Gets an authorization rule for a NotificationHub by name. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Notification Hub name. + /// The name of the NamespaceResource. + /// The name of the NotificationHubResource. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> DebugSendAsync(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAuthorizationRuleAsync(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - using var message = CreateDebugSendRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName); + using var message = CreateGetAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - NotificationHubTestSendResult value = default; + NotificationHubAuthorizationRuleData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NotificationHubTestSendResult.DeserializeNotificationHubTestSendResult(document.RootElement); + value = NotificationHubAuthorizationRuleData.DeserializeNotificationHubAuthorizationRuleData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((NotificationHubAuthorizationRuleData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Test send a push notification. + /// Gets an authorization rule for a NotificationHub by name. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Notification Hub name. + /// The name of the NamespaceResource. + /// The name of the NotificationHubResource. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response DebugSend(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetAuthorizationRule(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - using var message = CreateDebugSendRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName); + using var message = CreateGetAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - NotificationHubTestSendResult value = default; + NotificationHubAuthorizationRuleData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NotificationHubTestSendResult.DeserializeNotificationHubTestSendResult(document.RootElement); + value = NotificationHubAuthorizationRuleData.DeserializeNotificationHubAuthorizationRuleData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((NotificationHubAuthorizationRuleData)null, message.Response); default: throw new RequestFailedException(message.Response); } @@ -725,9 +837,9 @@ internal HttpMessage CreateCreateOrUpdateAuthorizationRuleRequest(string subscri /// Creates/Updates an authorization rule for a NotificationHub. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Notification Hub name. - /// Authorization Rule Name. + /// The name of the NamespaceResource. + /// The name of the NotificationHubResource. + /// The name of the SharedAccessAuthorizationRuleResource. /// Request content. /// The cancellation token to use. /// , , , , or is null. @@ -761,9 +873,9 @@ public async Task> CreateOrUpdate /// Creates/Updates an authorization rule for a NotificationHub. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Notification Hub name. - /// Authorization Rule Name. + /// The name of the NamespaceResource. + /// The name of the NotificationHubResource. + /// The name of the SharedAccessAuthorizationRuleResource. /// Request content. /// The cancellation token to use. /// , , , , or is null. @@ -839,9 +951,9 @@ internal HttpMessage CreateDeleteAuthorizationRuleRequest(string subscriptionId, /// Deletes a notificationHub authorization rule. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Notification Hub name. - /// Authorization Rule Name. + /// The name of the NamespaceResource. + /// The name of the NotificationHubResource. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. @@ -868,9 +980,9 @@ public async Task DeleteAuthorizationRuleAsync(string subscriptionId, /// Deletes a notificationHub authorization rule. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Notification Hub name. - /// Authorization Rule Name. + /// The name of the NamespaceResource. + /// The name of the NotificationHubResource. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. @@ -894,7 +1006,7 @@ public Response DeleteAuthorizationRule(string subscriptionId, string resourceGr } } - internal RequestUriBuilder CreateGetAuthorizationRuleRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName) + internal RequestUriBuilder CreateListKeysRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -908,15 +1020,16 @@ internal RequestUriBuilder CreateGetAuthorizationRuleRequestUri(string subscript uri.AppendPath(notificationHubName, true); uri.AppendPath("/authorizationRules/", false); uri.AppendPath(authorizationRuleName, true); + uri.AppendPath("/listKeys", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetAuthorizationRuleRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName) + internal HttpMessage CreateListKeysRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -929,6 +1042,7 @@ internal HttpMessage CreateGetAuthorizationRuleRequest(string subscriptionId, st uri.AppendPath(notificationHubName, true); uri.AppendPath("/authorizationRules/", false); uri.AppendPath(authorizationRuleName, true); + uri.AppendPath("/listKeys", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -936,16 +1050,16 @@ internal HttpMessage CreateGetAuthorizationRuleRequest(string subscriptionId, st return message; } - /// Gets an authorization rule for a NotificationHub by name. + /// Gets the Primary and Secondary ConnectionStrings to the NotificationHub. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Notification Hub name. - /// Authorization Rule Name. + /// The name of the NamespaceResource. + /// The name of the NotificationHubResource. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task> GetAuthorizationRuleAsync(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, CancellationToken cancellationToken = default) + public async Task> ListKeysAsync(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -953,34 +1067,32 @@ public async Task> GetAuthorizati Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - using var message = CreateGetAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); + using var message = CreateListKeysRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - NotificationHubAuthorizationRuleData value = default; + NotificationHubResourceKeys value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NotificationHubAuthorizationRuleData.DeserializeNotificationHubAuthorizationRuleData(document.RootElement); + value = NotificationHubResourceKeys.DeserializeNotificationHubResourceKeys(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((NotificationHubAuthorizationRuleData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Gets an authorization rule for a NotificationHub by name. + /// Gets the Primary and Secondary ConnectionStrings to the NotificationHub. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Notification Hub name. - /// Authorization Rule Name. + /// The name of the NamespaceResource. + /// The name of the NotificationHubResource. + /// The name of the SharedAccessAuthorizationRuleResource. /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response GetAuthorizationRule(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, CancellationToken cancellationToken = default) + public Response ListKeys(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -988,119 +1100,15 @@ public Response GetAuthorizationRule(strin Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - using var message = CreateGetAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NotificationHubAuthorizationRuleData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NotificationHubAuthorizationRuleData.DeserializeNotificationHubAuthorizationRuleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NotificationHubAuthorizationRuleData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListAuthorizationRulesRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); - uri.AppendPath(namespaceName, true); - uri.AppendPath("/notificationHubs/", false); - uri.AppendPath(notificationHubName, true); - uri.AppendPath("/authorizationRules", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListAuthorizationRulesRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); - uri.AppendPath(namespaceName, true); - uri.AppendPath("/notificationHubs/", false); - uri.AppendPath(notificationHubName, true); - uri.AppendPath("/authorizationRules", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets the authorization rules for a NotificationHub. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Notification Hub name. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListAuthorizationRulesAsync(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); - Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); - - using var message = CreateListAuthorizationRulesRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - SharedAccessAuthorizationRuleListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = SharedAccessAuthorizationRuleListResult.DeserializeSharedAccessAuthorizationRuleListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets the authorization rules for a NotificationHub. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Notification Hub name. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListAuthorizationRules(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); - Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); - - using var message = CreateListAuthorizationRulesRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName); + using var message = CreateListKeysRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - SharedAccessAuthorizationRuleListResult value = default; + NotificationHubResourceKeys value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = SharedAccessAuthorizationRuleListResult.DeserializeSharedAccessAuthorizationRuleListResult(document.RootElement); + value = NotificationHubResourceKeys.DeserializeNotificationHubResourceKeys(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -1108,7 +1116,7 @@ public Response ListAuthorizationRules( } } - internal RequestUriBuilder CreateListKeysRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName) + internal RequestUriBuilder CreateRegenerateKeysRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, NotificationHubPolicyKey notificationHubPolicyKey) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -1122,12 +1130,12 @@ internal RequestUriBuilder CreateListKeysRequestUri(string subscriptionId, strin uri.AppendPath(notificationHubName, true); uri.AppendPath("/authorizationRules/", false); uri.AppendPath(authorizationRuleName, true); - uri.AppendPath("/listKeys", false); + uri.AppendPath("/regenerateKeys", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListKeysRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName) + internal HttpMessage CreateRegenerateKeysRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, NotificationHubPolicyKey notificationHubPolicyKey) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1144,32 +1152,38 @@ internal HttpMessage CreateListKeysRequest(string subscriptionId, string resourc uri.AppendPath(notificationHubName, true); uri.AppendPath("/authorizationRules/", false); uri.AppendPath(authorizationRuleName, true); - uri.AppendPath("/listKeys", false); + uri.AppendPath("/regenerateKeys", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(notificationHubPolicyKey, ModelSerializationExtensions.WireOptions); + request.Content = content; _userAgent.Apply(message); return message; } - /// Gets the Primary and Secondary ConnectionStrings to the NotificationHub. + /// Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Notification Hub name. - /// Authorization Rule Name. + /// The name of the NamespaceResource. + /// The name of the NotificationHubResource. + /// The name of the SharedAccessAuthorizationRuleResource. + /// Request content. /// The cancellation token to use. - /// , , , or is null. + /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task> ListKeysAsync(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, CancellationToken cancellationToken = default) + public async Task> RegenerateKeysAsync(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, NotificationHubPolicyKey notificationHubPolicyKey, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + Argument.AssertNotNull(notificationHubPolicyKey, nameof(notificationHubPolicyKey)); - using var message = CreateListKeysRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); + using var message = CreateRegenerateKeysRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, notificationHubPolicyKey); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1185,24 +1199,26 @@ public async Task> ListKeysAsync(string su } } - /// Gets the Primary and Secondary ConnectionStrings to the NotificationHub. + /// Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Notification Hub name. - /// Authorization Rule Name. + /// The name of the NamespaceResource. + /// The name of the NotificationHubResource. + /// The name of the SharedAccessAuthorizationRuleResource. + /// Request content. /// The cancellation token to use. - /// , , , or is null. + /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response ListKeys(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, CancellationToken cancellationToken = default) + public Response RegenerateKeys(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, NotificationHubPolicyKey notificationHubPolicyKey, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + Argument.AssertNotNull(notificationHubPolicyKey, nameof(notificationHubPolicyKey)); - using var message = CreateListKeysRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); + using var message = CreateRegenerateKeysRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, notificationHubPolicyKey); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1218,7 +1234,7 @@ public Response ListKeys(string subscriptionId, str } } - internal RequestUriBuilder CreateRegenerateKeysRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, NotificationHubPolicyKey notificationHubPolicyKey) + internal RequestUriBuilder CreateDebugSendRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -1230,14 +1246,12 @@ internal RequestUriBuilder CreateRegenerateKeysRequestUri(string subscriptionId, uri.AppendPath(namespaceName, true); uri.AppendPath("/notificationHubs/", false); uri.AppendPath(notificationHubName, true); - uri.AppendPath("/authorizationRules/", false); - uri.AppendPath(authorizationRuleName, true); - uri.AppendPath("/regenerateKeys", false); + uri.AppendPath("/debugsend", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateRegenerateKeysRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, NotificationHubPolicyKey notificationHubPolicyKey) + internal HttpMessage CreateDebugSendRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1252,48 +1266,38 @@ internal HttpMessage CreateRegenerateKeysRequest(string subscriptionId, string r uri.AppendPath(namespaceName, true); uri.AppendPath("/notificationHubs/", false); uri.AppendPath(notificationHubName, true); - uri.AppendPath("/authorizationRules/", false); - uri.AppendPath(authorizationRuleName, true); - uri.AppendPath("/regenerateKeys", false); + uri.AppendPath("/debugsend", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(notificationHubPolicyKey, ModelSerializationExtensions.WireOptions); - request.Content = content; _userAgent.Apply(message); return message; } - /// Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. + /// Test send a push notification. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Namespace name. /// Notification Hub name. - /// Authorization Rule Name. - /// Request content. /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task> RegenerateKeysAsync(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, NotificationHubPolicyKey notificationHubPolicyKey, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> DebugSendAsync(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); - Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - Argument.AssertNotNull(notificationHubPolicyKey, nameof(notificationHubPolicyKey)); - using var message = CreateRegenerateKeysRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, notificationHubPolicyKey); + using var message = CreateDebugSendRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - NotificationHubResourceKeys value = default; + NotificationHubTestSendResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NotificationHubResourceKeys.DeserializeNotificationHubResourceKeys(document.RootElement); + value = NotificationHubTestSendResult.DeserializeNotificationHubTestSendResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -1301,34 +1305,30 @@ public async Task> RegenerateKeysAsync(str } } - /// Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. + /// Test send a push notification. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Namespace name. /// Notification Hub name. - /// Authorization Rule Name. - /// Request content. /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response RegenerateKeys(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, NotificationHubPolicyKey notificationHubPolicyKey, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response DebugSend(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); - Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - Argument.AssertNotNull(notificationHubPolicyKey, nameof(notificationHubPolicyKey)); - using var message = CreateRegenerateKeysRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, notificationHubPolicyKey); + using var message = CreateDebugSendRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - NotificationHubResourceKeys value = default; + NotificationHubTestSendResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NotificationHubResourceKeys.DeserializeNotificationHubResourceKeys(document.RootElement); + value = NotificationHubTestSendResult.DeserializeNotificationHubTestSendResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -1552,8 +1552,8 @@ internal HttpMessage CreateListAuthorizationRulesNextPageRequest(string nextLink /// The URL to the next page of results. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Notification Hub name. + /// The name of the NamespaceResource. + /// The name of the NotificationHubResource. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -1585,8 +1585,8 @@ public async Task> ListAuthori /// The URL to the next page of results. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Namespace name. - /// Notification Hub name. + /// The name of the NamespaceResource. + /// The name of the NotificationHubResource. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index 751d32a1ee9e..a9cc0877d4a4 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -36,7 +36,107 @@ public PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string ap _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, NotificationHubPrivateEndpointConnectionData data) + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string namespaceName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/privateEndpointConnections", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string namespaceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/privateEndpointConnections", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// + /// Returns all Private Endpoint Connections that belong to the given Notification Hubs namespace. + /// This is a public API that can be called directly by Notification Hubs users. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Namespace name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, namespaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PrivateEndpointConnectionResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = PrivateEndpointConnectionResourceListResult.DeserializePrivateEndpointConnectionResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// + /// Returns all Private Endpoint Connections that belong to the given Notification Hubs namespace. + /// This is a public API that can be called directly by Notification Hubs users. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Namespace name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, namespaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PrivateEndpointConnectionResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = PrivateEndpointConnectionResourceListResult.DeserializePrivateEndpointConnectionResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -52,11 +152,11 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, NotificationHubPrivateEndpointConnectionData data) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -70,79 +170,83 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; _userAgent.Apply(message); return message; } /// - /// Approves or rejects Private Endpoint Connection. + /// Returns a Private Endpoint Connection with a given name. /// This is a public API that can be called directly by Notification Hubs users. /// /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Namespace name. /// Private Endpoint Connection Name. - /// Description of the Private Endpoint Connection resource. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, NotificationHubPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, namespaceName, privateEndpointConnectionName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, privateEndpointConnectionName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: - return message.Response; + { + NotificationHubPrivateEndpointConnectionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = NotificationHubPrivateEndpointConnectionData.DeserializeNotificationHubPrivateEndpointConnectionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NotificationHubPrivateEndpointConnectionData)null, message.Response); default: throw new RequestFailedException(message.Response); } } /// - /// Approves or rejects Private Endpoint Connection. + /// Returns a Private Endpoint Connection with a given name. /// This is a public API that can be called directly by Notification Hubs users. /// /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Namespace name. /// Private Endpoint Connection Name. - /// Description of the Private Endpoint Connection resource. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, NotificationHubPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, namespaceName, privateEndpointConnectionName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, privateEndpointConnectionName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: - return message.Response; + { + NotificationHubPrivateEndpointConnectionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = NotificationHubPrivateEndpointConnectionData.DeserializeNotificationHubPrivateEndpointConnectionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NotificationHubPrivateEndpointConnectionData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName) + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, NotificationHubPrivateEndpointConnectionData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -158,11 +262,11 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, NotificationHubPrivateEndpointConnectionData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -176,34 +280,40 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; _userAgent.Apply(message); return message; } /// - /// Deletes the Private Endpoint Connection. + /// Approves or rejects Private Endpoint Connection. /// This is a public API that can be called directly by Notification Hubs users. /// /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Namespace name. /// Private Endpoint Connection Name. + /// Description of the Private Endpoint Connection resource. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, NotificationHubPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName, privateEndpointConnectionName); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, namespaceName, privateEndpointConnectionName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { - case 202: - case 204: + case 200: + case 201: return message.Response; default: throw new RequestFailedException(message.Response); @@ -211,36 +321,38 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// - /// Deletes the Private Endpoint Connection. + /// Approves or rejects Private Endpoint Connection. /// This is a public API that can be called directly by Notification Hubs users. /// /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Namespace name. /// Private Endpoint Connection Name. + /// Description of the Private Endpoint Connection resource. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, NotificationHubPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName, privateEndpointConnectionName); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, namespaceName, privateEndpointConnectionName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { - case 202: - case 204: + case 200: + case 201: return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -256,11 +368,11 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -279,7 +391,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// - /// Returns a Private Endpoint Connection with a given name. + /// Deletes the Private Endpoint Connection. /// This is a public API that can be called directly by Notification Hubs users. /// /// The ID of the target subscription. The value must be an UUID. @@ -289,33 +401,27 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, privateEndpointConnectionName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName, privateEndpointConnectionName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { - case 200: - { - NotificationHubPrivateEndpointConnectionData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NotificationHubPrivateEndpointConnectionData.DeserializeNotificationHubPrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NotificationHubPrivateEndpointConnectionData)null, message.Response); + case 202: + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } /// - /// Returns a Private Endpoint Connection with a given name. + /// Deletes the Private Endpoint Connection. /// This is a public API that can be called directly by Notification Hubs users. /// /// The ID of the target subscription. The value must be an UUID. @@ -325,32 +431,26 @@ public async Task> GetAsy /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + public Response Delete(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, privateEndpointConnectionName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName, privateEndpointConnectionName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { - case 200: - { - NotificationHubPrivateEndpointConnectionData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NotificationHubPrivateEndpointConnectionData.DeserializeNotificationHubPrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NotificationHubPrivateEndpointConnectionData)null, message.Response); + case 202: + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string namespaceName) + internal RequestUriBuilder CreateListGroupIdsRequestUri(string subscriptionId, string resourceGroupName, string namespaceName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -360,12 +460,12 @@ internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string re uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); uri.AppendPath(namespaceName, true); - uri.AppendPath("/privateEndpointConnections", false); + uri.AppendPath("/privateLinkResources", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string namespaceName) + internal HttpMessage CreateListGroupIdsRequest(string subscriptionId, string resourceGroupName, string namespaceName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -378,7 +478,7 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); uri.AppendPath(namespaceName, true); - uri.AppendPath("/privateEndpointConnections", false); + uri.AppendPath("/privateLinkResources", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -387,8 +487,8 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// - /// Returns all Private Endpoint Connections that belong to the given Notification Hubs namespace. - /// This is a public API that can be called directly by Notification Hubs users. + /// Even though this namespace requires subscription id, resource group and namespace name, it returns a constant payload (for a given namespacE) every time it's called. + /// That's why we don't send it to the sibling RP, but process it directly in the scale unit that received the request. /// /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. @@ -396,21 +496,21 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) + public async Task> ListGroupIdsAsync(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, namespaceName); + using var message = CreateListGroupIdsRequest(subscriptionId, resourceGroupName, namespaceName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - PrivateEndpointConnectionResourceListResult value = default; + NotificationHubsPrivateLinkResourceListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = PrivateEndpointConnectionResourceListResult.DeserializePrivateEndpointConnectionResourceListResult(document.RootElement); + value = NotificationHubsPrivateLinkResourceListResult.DeserializeNotificationHubsPrivateLinkResourceListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -419,8 +519,8 @@ public async Task> ListAsy } /// - /// Returns all Private Endpoint Connections that belong to the given Notification Hubs namespace. - /// This is a public API that can be called directly by Notification Hubs users. + /// Even though this namespace requires subscription id, resource group and namespace name, it returns a constant payload (for a given namespacE) every time it's called. + /// That's why we don't send it to the sibling RP, but process it directly in the scale unit that received the request. /// /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. @@ -428,21 +528,21 @@ public async Task> ListAsy /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) + public Response ListGroupIds(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, namespaceName); + using var message = CreateListGroupIdsRequest(subscriptionId, resourceGroupName, namespaceName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - PrivateEndpointConnectionResourceListResult value = default; + NotificationHubsPrivateLinkResourceListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = PrivateEndpointConnectionResourceListResult.DeserializePrivateEndpointConnectionResourceListResult(document.RootElement); + value = NotificationHubsPrivateLinkResourceListResult.DeserializeNotificationHubsPrivateLinkResourceListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -560,36 +660,112 @@ public Response GetGroupId(string subsc } } - internal RequestUriBuilder CreateListGroupIdsRequestUri(string subscriptionId, string resourceGroupName, string namespaceName) + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); - uri.AppendPath(namespaceName, true); - uri.AppendPath("/privateLinkResources", false); - uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendRawNextLink(nextLink, false); return uri; } - internal HttpMessage CreateListGroupIdsRequest(string subscriptionId, string resourceGroupName, string namespaceName) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); - uri.AppendPath(namespaceName, true); - uri.AppendPath("/privateLinkResources", false); - uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// + /// Returns all Private Endpoint Connections that belong to the given Notification Hubs namespace. + /// This is a public API that can be called directly by Notification Hubs users. + /// + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Namespace name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, namespaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PrivateEndpointConnectionResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = PrivateEndpointConnectionResourceListResult.DeserializePrivateEndpointConnectionResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// + /// Returns all Private Endpoint Connections that belong to the given Notification Hubs namespace. + /// This is a public API that can be called directly by Notification Hubs users. + /// + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Namespace name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, namespaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PrivateEndpointConnectionResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = PrivateEndpointConnectionResourceListResult.DeserializePrivateEndpointConnectionResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListGroupIdsNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListGroupIdsNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); @@ -600,19 +776,21 @@ internal HttpMessage CreateListGroupIdsRequest(string subscriptionId, string res /// Even though this namespace requires subscription id, resource group and namespace name, it returns a constant payload (for a given namespacE) every time it's called. /// That's why we don't send it to the sibling RP, but process it directly in the scale unit that received the request. /// + /// The URL to the next page of results. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Namespace name. /// The cancellation token to use. - /// , or is null. + /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> ListGroupIdsAsync(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) + public async Task> ListGroupIdsNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); - using var message = CreateListGroupIdsRequest(subscriptionId, resourceGroupName, namespaceName); + using var message = CreateListGroupIdsNextPageRequest(nextLink, subscriptionId, resourceGroupName, namespaceName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -632,19 +810,21 @@ public async Task> ListG /// Even though this namespace requires subscription id, resource group and namespace name, it returns a constant payload (for a given namespacE) every time it's called. /// That's why we don't send it to the sibling RP, but process it directly in the scale unit that received the request. /// + /// The URL to the next page of results. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Namespace name. /// The cancellation token to use. - /// , or is null. + /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response ListGroupIds(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) + public Response ListGroupIdsNextPage(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); - using var message = CreateListGroupIdsRequest(subscriptionId, resourceGroupName, namespaceName); + using var message = CreateListGroupIdsNextPageRequest(nextLink, subscriptionId, resourceGroupName, namespaceName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/autorest.md b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/autorest.md index a5f316c03c67..43cc9c4f2bb4 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/autorest.md +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/autorest.md @@ -8,7 +8,7 @@ azure-arm: true csharp: true library-name: NotificationHubs namespace: Azure.ResourceManager.NotificationHubs -require: https://github.com/Azure/azure-rest-api-specs/blob/87643ba491d34656ed9d08ddce7544d033c349eb/specification/notificationhubs/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/notificationhubs/resource-manager/readme.md #package-preview-2023-10 output-folder: $(this-folder)/Generated clear-output-folder: true diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 2ca0501b60bd..4e749e6b85b1 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -12,6 +12,8 @@ trigger: - sdk/storage/Azure.Storage.DataMovement/ - sdk/storage/Azure.Storage.DataMovement.Blobs/ - sdk/storage/Azure.Storage.DataMovement.Files/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement.Blobs.Files.Shares/ exclude: - sdk/storage/Azure.ResourceManager.Storage/