From 7c4aab6704aa7bd3d3c7d8c15b7be4621720a492 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Sat, 28 Oct 2023 00:17:08 +0000 Subject: [PATCH] CodeGen from PR 26443 in Azure/azure-rest-api-specs Merge 8a1deb534e31ac60d5e60abb214ecea0de3fac30 into 58e92dd03733bc175e6a9540f4bc53703b57fcc9 --- ...e_NamespaceAuthorizationRuleCollection.cs} | 74 +- ...ple_NamespaceAuthorizationRuleResource.cs} | 99 ++- ...ficationHubAuthorizationRuleCollection.cs} | 76 +- ...tificationHubAuthorizationRuleResource.cs} | 101 ++- .../Sample_NotificationHubCollection.cs | 87 +- ...mple_NotificationHubNamespaceCollection.cs | 121 +-- ...Sample_NotificationHubNamespaceResource.cs | 125 +-- .../Samples/Sample_NotificationHubResource.cs | 84 +- ...ple_NotificationHubsPrivateLinkResource.cs | 51 ++ ...cationHubsPrivateLinkResourceCollection.cs | 166 ++++ ...ample_PrivateEndpointConnectionResource.cs | 124 +++ ...ateEndpointConnectionResourceCollection.cs | 213 +++++ .../ArmNotificationHubsModelFactory.cs | 330 ++++---- .../Extensions/NotificationHubsExtensions.cs | 122 ++- .../SubscriptionResourceExtensionClient.cs | 24 +- ...NotificationHubNamespaceOperationSource.cs | 40 + ...dpointConnectionResourceOperationSource.cs | 40 + .../AdmCredentialProperties.Serialization.cs | 58 ++ .../Models/AdmCredentialProperties.cs | 39 + .../ApnsCredentialProperties.Serialization.cs | 118 +++ .../Models/ApnsCredentialProperties.cs | 82 ++ ...horizationRuleAccessRight.Serialization.cs | 30 - .../Models/AuthorizationRuleAccessRight.cs | 44 +- ...BaiduCredentialProperties.Serialization.cs | 57 ++ .../Models/BaiduCredentialProperties.cs | 39 + .../Models/BrowserCredential.Serialization.cs | 41 + .../src/Generated/Models/BrowserCredential.cs | 29 + ...owserCredentialProperties.Serialization.cs | 57 ++ .../Models/BrowserCredentialProperties.cs | 39 + .../Models/DebugSendResult.Serialization.cs | 69 ++ .../src/Generated/Models/DebugSendResult.cs | 40 + .../Models/FcmV1Credential.Serialization.cs | 41 + .../src/Generated/Models/FcmV1Credential.cs | 29 + ...FcmV1CredentialProperties.Serialization.cs | 57 ++ .../Models/FcmV1CredentialProperties.cs | 39 + .../GcmCredentialProperties.Serialization.cs | 52 ++ .../Models/GcmCredentialProperties.cs | 40 + .../Generated/Models/IPRule.Serialization.cs | 60 ++ .../src/Generated/Models/IPRule.cs | 45 ++ .../MpnsCredentialProperties.Serialization.cs | 57 ++ .../Models/MpnsCredentialProperties.cs | 39 + .../NamespaceProperties.Serialization.cs | 263 +++++++ .../Generated/Models/NamespaceProperties.cs | 128 +++ .../src/Generated/Models/NamespaceStatus.cs | 57 ++ .../Models/NetworkAcls.Serialization.cs | 74 ++ .../src/Generated/Models/NetworkAcls.cs | 42 + ...ificationHubAdmCredential.Serialization.cs | 55 +- .../Models/NotificationHubAdmCredential.cs | 27 +- ...ficationHubApnsCredential.Serialization.cs | 108 +-- .../Models/NotificationHubApnsCredential.cs | 45 +- ...nHubAuthorizationRuleData.Serialization.cs | 115 +-- ...ionHubAvailabilityContent.Serialization.cs | 10 +- .../NotificationHubAvailabilityContent.cs | 11 +- .../NotificationHubAvailabilityResult.cs | 14 +- ...icationHubBaiduCredential.Serialization.cs | 55 +- .../Models/NotificationHubBaiduCredential.cs | 27 +- ...nHubCreateOrUpdateContent.Serialization.cs | 269 ------- .../NotificationHubCreateOrUpdateContent.cs | 77 -- .../NotificationHubData.Serialization.cs | 174 +--- ...ificationHubGcmCredential.Serialization.cs | 44 +- .../Models/NotificationHubGcmCredential.cs | 23 +- .../Models/NotificationHubListResult.cs | 8 +- ...ficationHubMpnsCredential.Serialization.cs | 48 +- .../Models/NotificationHubMpnsCredential.cs | 27 +- ...paceCreateOrUpdateContent.Serialization.cs | 301 ------- ...cationHubNamespaceCreateOrUpdateContent.cs | 96 --- ...ificationHubNamespaceData.Serialization.cs | 209 +---- .../NotificationHubNamespaceListResult.cs | 8 +- ...ficationHubNamespacePatch.Serialization.cs | 15 +- .../Models/NotificationHubNamespacePatch.cs | 10 +- ...ificationHubNamespaceType.Serialization.cs | 28 - .../Models/NotificationHubNamespaceType.cs | 41 +- .../NotificationHubPatch.Serialization.cs | 237 +----- .../Generated/Models/NotificationHubPatch.cs | 66 +- ...ficationHubPnsCredentials.Serialization.cs | 119 +-- .../Models/NotificationHubPnsCredentials.cs | 39 +- .../NotificationHubPolicyKey.Serialization.cs | 26 - .../Models/NotificationHubPolicyKey.cs | 21 - ...NotificationHubProperties.Serialization.cs | 216 +++++ .../Models/NotificationHubProperties.cs | 143 ++++ .../Models/NotificationHubResourceKeys.cs | 28 +- .../Generated/Models/NotificationHubSku.cs | 22 +- .../Models/NotificationHubSkuName.cs | 2 +- ...ficationHubTestSendResult.Serialization.cs | 82 +- .../Models/NotificationHubTestSendResult.cs | 52 +- ...ificationHubWnsCredential.Serialization.cs | 55 +- .../Models/NotificationHubWnsCredential.cs | 27 +- ...vateEndpointConnectionProvisioningState.cs | 69 ++ ...bsPrivateLinkResourceData.Serialization.cs | 78 ++ ...ateLinkResourceListResult.Serialization.cs | 50 ++ ...cationHubsPrivateLinkResourceListResult.cs | 37 + ...ateLinkResourceProperties.Serialization.cs | 70 ++ ...cationHubsPrivateLinkResourceProperties.cs | 41 + .../Models/OperationProvisioningState.cs | 66 ++ .../Models/PnsCredentials.Serialization.cs | 168 ++++ .../src/Generated/Models/PnsCredentials.cs | 122 +++ ....cs => PolicyKeyResource.Serialization.cs} | 6 +- .../src/Generated/Models/PolicyKeyResource.cs | 23 + .../src/Generated/Models/PolicyKeyType.cs | 51 ++ ...pointConnectionProperties.Serialization.cs | 95 +++ .../PrivateEndpointConnectionProperties.cs | 51 ++ ...intConnectionResourceData.Serialization.cs | 78 ++ ...nectionResourceListResult.Serialization.cs | 50 ++ ...ateEndpointConnectionResourceListResult.cs | 37 + .../Models/PrivateLinkConnectionStatus.cs | 57 ++ ...InternetAuthorizationRule.Serialization.cs | 52 ++ .../Models/PublicInternetAuthorizationRule.cs | 38 + .../Generated/Models/PublicNetworkAccess.cs | 51 ++ .../RegistrationResult.Serialization.cs | 51 ++ .../Generated/Models/RegistrationResult.cs | 40 + ...inkServiceConnectionState.Serialization.cs | 60 ++ ...RemotePrivateLinkServiceConnectionState.cs | 36 + .../src/Generated/Models/ReplicationRegion.cs | 69 ++ ...sAuthorizationRuleCreateOrUpdateContent.cs | 29 - ...SharedAccessAuthorizationRuleListResult.cs | 8 +- ...thorizationRuleProperties.Serialization.cs | 57 +- ...SharedAccessAuthorizationRuleProperties.cs | 71 +- .../WnsCredentialProperties.Serialization.cs | 88 +++ .../Models/WnsCredentialProperties.cs | 44 ++ .../Models/XiaomiCredential.Serialization.cs | 41 + .../src/Generated/Models/XiaomiCredential.cs | 29 + ...iaomiCredentialProperties.Serialization.cs | 55 ++ .../Models/XiaomiCredentialProperties.cs | 32 + .../Models/ZoneRedundancyPreference.cs | 51 ++ ...> NamespaceAuthorizationRuleCollection.cs} | 155 ++-- .../NamespaceAuthorizationRuleResource.cs | 715 +++++++++++++++++ ...ficationHubAuthorizationRuleCollection.cs} | 155 ++-- ...otificationHubAuthorizationRuleResource.cs | 715 +++++++++++++++++ .../NotificationHubAuthorizationRuleData.cs | 50 +- ...otificationHubAuthorizationRuleResource.cs | 426 ---------- .../Generated/NotificationHubCollection.cs | 57 +- .../src/Generated/NotificationHubData.cs | 50 +- ...onHubNamespaceAuthorizationRuleResource.cs | 426 ---------- .../NotificationHubNamespaceCollection.cs | 69 +- .../Generated/NotificationHubNamespaceData.cs | 75 +- .../NotificationHubNamespaceResource.cs | 262 +++++-- .../src/Generated/NotificationHubResource.cs | 70 +- .../NotificationHubsPrivateLinkResource.cs | 155 ++++ ...cationHubsPrivateLinkResourceCollection.cs | 335 ++++++++ ...NotificationHubsPrivateLinkResourceData.cs | 39 + .../PrivateEndpointConnectionResource.cs | 303 +++++++ ...ateEndpointConnectionResourceCollection.cs | 419 ++++++++++ .../PrivateEndpointConnectionResourceData.cs | 39 + .../NamespacesRestOperations.cs | 741 ++++++++++-------- .../NotificationHubsRestOperations.cs | 626 +++++++-------- ...rivateEndpointConnectionsRestOperations.cs | 570 ++++++++++++++ .../src/autorest.md | 2 +- 147 files changed, 10169 insertions(+), 4958 deletions(-) rename sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/{Sample_NotificationHubNamespaceAuthorizationRuleCollection.cs => Sample_NamespaceAuthorizationRuleCollection.cs} (74%) rename sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/{Sample_NotificationHubNamespaceAuthorizationRuleResource.cs => Sample_NamespaceAuthorizationRuleResource.cs} (50%) rename sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/{Sample_NotificationHubAuthorizationRuleCollection.cs => Sample_NamespaceNotificationHubAuthorizationRuleCollection.cs} (73%) rename sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/{Sample_NotificationHubAuthorizationRuleResource.cs => Sample_NamespaceNotificationHubAuthorizationRuleResource.cs} (51%) create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubsPrivateLinkResource.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubsPrivateLinkResourceCollection.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_PrivateEndpointConnectionResource.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_PrivateEndpointConnectionResourceCollection.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/LongRunningOperation/NotificationHubNamespaceOperationSource.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/LongRunningOperation/PrivateEndpointConnectionResourceOperationSource.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/AdmCredentialProperties.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/AdmCredentialProperties.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/ApnsCredentialProperties.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/ApnsCredentialProperties.cs delete mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/AuthorizationRuleAccessRight.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BaiduCredentialProperties.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BaiduCredentialProperties.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredential.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredential.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredentialProperties.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredentialProperties.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/DebugSendResult.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/DebugSendResult.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1Credential.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1Credential.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1CredentialProperties.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1CredentialProperties.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/GcmCredentialProperties.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/GcmCredentialProperties.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/IPRule.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/IPRule.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/MpnsCredentialProperties.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/MpnsCredentialProperties.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NamespaceProperties.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NamespaceProperties.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NamespaceStatus.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NetworkAcls.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NetworkAcls.cs delete mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubCreateOrUpdateContent.Serialization.cs delete mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubCreateOrUpdateContent.cs delete mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceCreateOrUpdateContent.Serialization.cs delete mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceCreateOrUpdateContent.cs delete mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceType.Serialization.cs delete mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPolicyKey.Serialization.cs delete mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPolicyKey.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubProperties.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubProperties.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateEndpointConnectionProvisioningState.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceData.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceListResult.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceListResult.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceProperties.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceProperties.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/OperationProvisioningState.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PnsCredentials.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PnsCredentials.cs rename sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/{SharedAccessAuthorizationRuleCreateOrUpdateContent.Serialization.cs => PolicyKeyResource.Serialization.cs} (67%) create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PolicyKeyResource.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PolicyKeyType.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionProperties.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceData.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceListResult.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceListResult.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateLinkConnectionStatus.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PublicInternetAuthorizationRule.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PublicInternetAuthorizationRule.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PublicNetworkAccess.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/RegistrationResult.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/RegistrationResult.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/RemotePrivateLinkServiceConnectionState.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/RemotePrivateLinkServiceConnectionState.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/ReplicationRegion.cs delete mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleCreateOrUpdateContent.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/WnsCredentialProperties.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/WnsCredentialProperties.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/XiaomiCredential.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/XiaomiCredential.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/XiaomiCredentialProperties.Serialization.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/XiaomiCredentialProperties.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/ZoneRedundancyPreference.cs rename sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/{NotificationHubNamespaceAuthorizationRuleCollection.cs => NamespaceAuthorizationRuleCollection.cs} (56%) create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NamespaceAuthorizationRuleResource.cs rename sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/{NotificationHubAuthorizationRuleCollection.cs => NamespaceNotificationHubAuthorizationRuleCollection.cs} (56%) create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NamespaceNotificationHubAuthorizationRuleResource.cs delete mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleResource.cs delete mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleResource.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResource.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResourceCollection.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResourceData.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/PrivateEndpointConnectionResource.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/PrivateEndpointConnectionResourceCollection.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/PrivateEndpointConnectionResourceData.cs create mode 100644 sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceAuthorizationRuleCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NamespaceAuthorizationRuleCollection.cs similarity index 74% rename from sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceAuthorizationRuleCollection.cs rename to sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NamespaceAuthorizationRuleCollection.cs index 156a6cedbbd2..2fc74dfb123d 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceAuthorizationRuleCollection.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NamespaceAuthorizationRuleCollection.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.NotificationHubs.Samples { - public partial class Sample_NotificationHubNamespaceAuthorizationRuleCollection + public partial class Sample_NamespaceAuthorizationRuleCollection { - // NameSpaceAuthorizationRuleCreate + // Namespaces_CreateOrUpdateAuthorizationRule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task CreateOrUpdate_NameSpaceAuthorizationRuleCreate() + public async Task CreateOrUpdate_NamespacesCreateOrUpdateAuthorizationRule() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceAuthorizationRuleCreate.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/AuthorizationRuleCreateOrUpdate.json // this example is just showing the usage of "Namespaces_CreateOrUpdateAuthorizationRule" 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 @@ -39,20 +39,20 @@ public async Task CreateOrUpdate_NameSpaceAuthorizationRuleCreate() ResourceIdentifier notificationHubNamespaceResourceId = NotificationHubNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); - // get the collection of this NotificationHubNamespaceAuthorizationRuleResource - NotificationHubNamespaceAuthorizationRuleCollection collection = notificationHubNamespace.GetNotificationHubNamespaceAuthorizationRules(); + // get the collection of this NamespaceAuthorizationRuleResource + NamespaceAuthorizationRuleCollection collection = notificationHubNamespace.GetNamespaceAuthorizationRules(); // invoke the operation string authorizationRuleName = "sdk-AuthRules-1788"; - SharedAccessAuthorizationRuleCreateOrUpdateContent content = new SharedAccessAuthorizationRuleCreateOrUpdateContent(new SharedAccessAuthorizationRuleProperties() + NotificationHubAuthorizationRuleData data = new NotificationHubAuthorizationRuleData(new AzureLocation("placeholder")) + { + Properties = new SharedAccessAuthorizationRuleProperties(new AuthorizationRuleAccessRight[] { - Rights = -{ AuthorizationRuleAccessRight.Listen,AuthorizationRuleAccessRight.Send -}, - }); - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, authorizationRuleName, content); - NotificationHubNamespaceAuthorizationRuleResource result = lro.Value; + }), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, authorizationRuleName, data); + NamespaceAuthorizationRuleResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -61,12 +61,12 @@ public async Task CreateOrUpdate_NameSpaceAuthorizationRuleCreate() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // NameSpaceAuthorizationRuleGet + // Namespaces_GetAuthorizationRule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_NameSpaceAuthorizationRuleGet() + public async Task Get_NamespacesGetAuthorizationRule() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceAuthorizationRuleGet.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/AuthorizationRuleGet.json // this example is just showing the usage of "Namespaces_GetAuthorizationRule" 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 @@ -82,12 +82,12 @@ public async Task Get_NameSpaceAuthorizationRuleGet() ResourceIdentifier notificationHubNamespaceResourceId = NotificationHubNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); - // get the collection of this NotificationHubNamespaceAuthorizationRuleResource - NotificationHubNamespaceAuthorizationRuleCollection collection = notificationHubNamespace.GetNotificationHubNamespaceAuthorizationRules(); + // get the collection of this NamespaceAuthorizationRuleResource + NamespaceAuthorizationRuleCollection collection = notificationHubNamespace.GetNamespaceAuthorizationRules(); // invoke the operation string authorizationRuleName = "RootManageSharedAccessKey"; - NotificationHubNamespaceAuthorizationRuleResource result = await collection.GetAsync(authorizationRuleName); + NamespaceAuthorizationRuleResource result = await collection.GetAsync(authorizationRuleName); // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -96,12 +96,12 @@ public async Task Get_NameSpaceAuthorizationRuleGet() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // NameSpaceAuthorizationRuleGet + // Namespaces_GetAuthorizationRule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Exists_NameSpaceAuthorizationRuleGet() + public async Task Exists_NamespacesGetAuthorizationRule() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceAuthorizationRuleGet.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/AuthorizationRuleGet.json // this example is just showing the usage of "Namespaces_GetAuthorizationRule" 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 @@ -117,8 +117,8 @@ public async Task Exists_NameSpaceAuthorizationRuleGet() ResourceIdentifier notificationHubNamespaceResourceId = NotificationHubNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); - // get the collection of this NotificationHubNamespaceAuthorizationRuleResource - NotificationHubNamespaceAuthorizationRuleCollection collection = notificationHubNamespace.GetNotificationHubNamespaceAuthorizationRules(); + // get the collection of this NamespaceAuthorizationRuleResource + NamespaceAuthorizationRuleCollection collection = notificationHubNamespace.GetNamespaceAuthorizationRules(); // invoke the operation string authorizationRuleName = "RootManageSharedAccessKey"; @@ -127,12 +127,12 @@ public async Task Exists_NameSpaceAuthorizationRuleGet() Console.WriteLine($"Succeeded: {result}"); } - // NameSpaceAuthorizationRuleGet + // Namespaces_GetAuthorizationRule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetIfExists_NameSpaceAuthorizationRuleGet() + public async Task GetIfExists_NamespacesGetAuthorizationRule() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceAuthorizationRuleGet.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/AuthorizationRuleGet.json // this example is just showing the usage of "Namespaces_GetAuthorizationRule" 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 @@ -148,13 +148,13 @@ public async Task GetIfExists_NameSpaceAuthorizationRuleGet() ResourceIdentifier notificationHubNamespaceResourceId = NotificationHubNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); - // get the collection of this NotificationHubNamespaceAuthorizationRuleResource - NotificationHubNamespaceAuthorizationRuleCollection collection = notificationHubNamespace.GetNotificationHubNamespaceAuthorizationRules(); + // get the collection of this NamespaceAuthorizationRuleResource + NamespaceAuthorizationRuleCollection collection = notificationHubNamespace.GetNamespaceAuthorizationRules(); // invoke the operation string authorizationRuleName = "RootManageSharedAccessKey"; - NullableResponse response = await collection.GetIfExistsAsync(authorizationRuleName); - NotificationHubNamespaceAuthorizationRuleResource result = response.HasValue ? response.Value : null; + NullableResponse response = await collection.GetIfExistsAsync(authorizationRuleName); + NamespaceAuthorizationRuleResource result = response.HasValue ? response.Value : null; if (result == null) { @@ -170,12 +170,12 @@ public async Task GetIfExists_NameSpaceAuthorizationRuleGet() } } - // NameSpaceAuthorizationRuleListAll + // Namespaces_ListAuthorizationRules [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAll_NameSpaceAuthorizationRuleListAll() + public async Task GetAll_NamespacesListAuthorizationRules() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceAuthorizationRuleListAll.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/AuthorizationRuleList.json // this example is just showing the usage of "Namespaces_ListAuthorizationRules" 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 @@ -191,11 +191,11 @@ public async Task GetAll_NameSpaceAuthorizationRuleListAll() ResourceIdentifier notificationHubNamespaceResourceId = NotificationHubNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); - // get the collection of this NotificationHubNamespaceAuthorizationRuleResource - NotificationHubNamespaceAuthorizationRuleCollection collection = notificationHubNamespace.GetNotificationHubNamespaceAuthorizationRules(); + // get the collection of this NamespaceAuthorizationRuleResource + NamespaceAuthorizationRuleCollection collection = notificationHubNamespace.GetNamespaceAuthorizationRules(); // invoke the operation and iterate over the result - await foreach (NotificationHubNamespaceAuthorizationRuleResource item in collection.GetAllAsync()) + await foreach (NamespaceAuthorizationRuleResource item in collection.GetAllAsync()) { // the variable item is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceAuthorizationRuleResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NamespaceAuthorizationRuleResource.cs similarity index 50% rename from sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceAuthorizationRuleResource.cs rename to sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NamespaceAuthorizationRuleResource.cs index c6e3fc028bf2..53acd330a3ac 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceAuthorizationRuleResource.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NamespaceAuthorizationRuleResource.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.NotificationHubs.Samples { - public partial class Sample_NotificationHubNamespaceAuthorizationRuleResource + public partial class Sample_NamespaceAuthorizationRuleResource { - // NameSpaceAuthorizationRuleCreate + // Namespaces_CreateOrUpdateAuthorizationRule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Update_NameSpaceAuthorizationRuleCreate() + public async Task Update_NamespacesCreateOrUpdateAuthorizationRule() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceAuthorizationRuleCreate.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/AuthorizationRuleCreateOrUpdate.json // this example is just showing the usage of "Namespaces_CreateOrUpdateAuthorizationRule" 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 @@ -31,25 +31,25 @@ public async Task Update_NameSpaceAuthorizationRuleCreate() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this NotificationHubNamespaceAuthorizationRuleResource created on azure - // for more information of creating NotificationHubNamespaceAuthorizationRuleResource, please refer to the document of NotificationHubNamespaceAuthorizationRuleResource + // this example assumes you already have this NamespaceAuthorizationRuleResource created on azure + // for more information of creating NamespaceAuthorizationRuleResource, please refer to the document of NamespaceAuthorizationRuleResource string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; string resourceGroupName = "5ktrial"; string namespaceName = "nh-sdk-ns"; string authorizationRuleName = "sdk-AuthRules-1788"; - ResourceIdentifier notificationHubNamespaceAuthorizationRuleResourceId = NotificationHubNamespaceAuthorizationRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); - NotificationHubNamespaceAuthorizationRuleResource notificationHubNamespaceAuthorizationRule = client.GetNotificationHubNamespaceAuthorizationRuleResource(notificationHubNamespaceAuthorizationRuleResourceId); + ResourceIdentifier namespaceAuthorizationRuleResourceId = NamespaceAuthorizationRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); + NamespaceAuthorizationRuleResource namespaceAuthorizationRule = client.GetNamespaceAuthorizationRuleResource(namespaceAuthorizationRuleResourceId); // invoke the operation - SharedAccessAuthorizationRuleCreateOrUpdateContent content = new SharedAccessAuthorizationRuleCreateOrUpdateContent(new SharedAccessAuthorizationRuleProperties() + NotificationHubAuthorizationRuleData data = new NotificationHubAuthorizationRuleData(new AzureLocation("placeholder")) + { + Properties = new SharedAccessAuthorizationRuleProperties(new AuthorizationRuleAccessRight[] { - Rights = -{ AuthorizationRuleAccessRight.Listen,AuthorizationRuleAccessRight.Send -}, - }); - ArmOperation lro = await notificationHubNamespaceAuthorizationRule.UpdateAsync(WaitUntil.Completed, content); - NotificationHubNamespaceAuthorizationRuleResource result = lro.Value; + }), + }; + ArmOperation lro = await namespaceAuthorizationRule.UpdateAsync(WaitUntil.Completed, data); + NamespaceAuthorizationRuleResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -58,12 +58,12 @@ public async Task Update_NameSpaceAuthorizationRuleCreate() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // NameSpaceAuthorizationRuleDelete + // Namespaces_DeleteAuthorizationRule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Delete_NameSpaceAuthorizationRuleDelete() + public async Task Delete_NamespacesDeleteAuthorizationRule() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceAuthorizationRuleDelete.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/AuthorizationRuleDelete.json // this example is just showing the usage of "Namespaces_DeleteAuthorizationRule" 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 @@ -71,27 +71,27 @@ public async Task Delete_NameSpaceAuthorizationRuleDelete() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this NotificationHubNamespaceAuthorizationRuleResource created on azure - // for more information of creating NotificationHubNamespaceAuthorizationRuleResource, please refer to the document of NotificationHubNamespaceAuthorizationRuleResource + // this example assumes you already have this NamespaceAuthorizationRuleResource created on azure + // for more information of creating NamespaceAuthorizationRuleResource, please refer to the document of NamespaceAuthorizationRuleResource string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; string resourceGroupName = "5ktrial"; string namespaceName = "nh-sdk-ns"; string authorizationRuleName = "RootManageSharedAccessKey"; - ResourceIdentifier notificationHubNamespaceAuthorizationRuleResourceId = NotificationHubNamespaceAuthorizationRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); - NotificationHubNamespaceAuthorizationRuleResource notificationHubNamespaceAuthorizationRule = client.GetNotificationHubNamespaceAuthorizationRuleResource(notificationHubNamespaceAuthorizationRuleResourceId); + ResourceIdentifier namespaceAuthorizationRuleResourceId = NamespaceAuthorizationRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); + NamespaceAuthorizationRuleResource namespaceAuthorizationRule = client.GetNamespaceAuthorizationRuleResource(namespaceAuthorizationRuleResourceId); // invoke the operation - await notificationHubNamespaceAuthorizationRule.DeleteAsync(WaitUntil.Completed); + await namespaceAuthorizationRule.DeleteAsync(WaitUntil.Completed); Console.WriteLine($"Succeeded"); } - // NameSpaceAuthorizationRuleGet + // Namespaces_GetAuthorizationRule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_NameSpaceAuthorizationRuleGet() + public async Task Get_NamespacesGetAuthorizationRule() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceAuthorizationRuleGet.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/AuthorizationRuleGet.json // this example is just showing the usage of "Namespaces_GetAuthorizationRule" 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 @@ -99,17 +99,17 @@ public async Task Get_NameSpaceAuthorizationRuleGet() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this NotificationHubNamespaceAuthorizationRuleResource created on azure - // for more information of creating NotificationHubNamespaceAuthorizationRuleResource, please refer to the document of NotificationHubNamespaceAuthorizationRuleResource + // this example assumes you already have this NamespaceAuthorizationRuleResource created on azure + // for more information of creating NamespaceAuthorizationRuleResource, please refer to the document of NamespaceAuthorizationRuleResource string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; string resourceGroupName = "5ktrial"; string namespaceName = "nh-sdk-ns"; string authorizationRuleName = "RootManageSharedAccessKey"; - ResourceIdentifier notificationHubNamespaceAuthorizationRuleResourceId = NotificationHubNamespaceAuthorizationRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); - NotificationHubNamespaceAuthorizationRuleResource notificationHubNamespaceAuthorizationRule = client.GetNotificationHubNamespaceAuthorizationRuleResource(notificationHubNamespaceAuthorizationRuleResourceId); + ResourceIdentifier namespaceAuthorizationRuleResourceId = NamespaceAuthorizationRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); + NamespaceAuthorizationRuleResource namespaceAuthorizationRule = client.GetNamespaceAuthorizationRuleResource(namespaceAuthorizationRuleResourceId); // invoke the operation - NotificationHubNamespaceAuthorizationRuleResource result = await notificationHubNamespaceAuthorizationRule.GetAsync(); + NamespaceAuthorizationRuleResource result = await namespaceAuthorizationRule.GetAsync(); // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -118,12 +118,12 @@ public async Task Get_NameSpaceAuthorizationRuleGet() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // NameSpaceAuthorizationRuleListKey + // Namespaces_ListKeys [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetKeys_NameSpaceAuthorizationRuleListKey() + public async Task GetKeys_NamespacesListKeys() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceAuthorizationRuleListKey.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/AuthorizationRuleListKeys.json // this example is just showing the usage of "Namespaces_ListKeys" 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 @@ -131,27 +131,27 @@ public async Task GetKeys_NameSpaceAuthorizationRuleListKey() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this NotificationHubNamespaceAuthorizationRuleResource created on azure - // for more information of creating NotificationHubNamespaceAuthorizationRuleResource, please refer to the document of NotificationHubNamespaceAuthorizationRuleResource + // this example assumes you already have this NamespaceAuthorizationRuleResource created on azure + // for more information of creating NamespaceAuthorizationRuleResource, please refer to the document of NamespaceAuthorizationRuleResource string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; string resourceGroupName = "5ktrial"; string namespaceName = "nh-sdk-ns"; string authorizationRuleName = "RootManageSharedAccessKey"; - ResourceIdentifier notificationHubNamespaceAuthorizationRuleResourceId = NotificationHubNamespaceAuthorizationRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); - NotificationHubNamespaceAuthorizationRuleResource notificationHubNamespaceAuthorizationRule = client.GetNotificationHubNamespaceAuthorizationRuleResource(notificationHubNamespaceAuthorizationRuleResourceId); + ResourceIdentifier namespaceAuthorizationRuleResourceId = NamespaceAuthorizationRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); + NamespaceAuthorizationRuleResource namespaceAuthorizationRule = client.GetNamespaceAuthorizationRuleResource(namespaceAuthorizationRuleResourceId); // invoke the operation - NotificationHubResourceKeys result = await notificationHubNamespaceAuthorizationRule.GetKeysAsync(); + NotificationHubResourceKeys result = await namespaceAuthorizationRule.GetKeysAsync(); Console.WriteLine($"Succeeded: {result}"); } - // NameSpaceAuthorizationRuleRegenerateKey + // Namespaces_RegenerateKeys [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task RegenerateKeys_NameSpaceAuthorizationRuleRegenerateKey() + public async Task RegenerateKeys_NamespacesRegenerateKeys() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceAuthorizationRuleRegenrateKey.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/AuthorizationRuleRegenerateKey.json // this example is just showing the usage of "Namespaces_RegenerateKeys" 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 @@ -159,21 +159,18 @@ public async Task RegenerateKeys_NameSpaceAuthorizationRuleRegenerateKey() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this NotificationHubNamespaceAuthorizationRuleResource created on azure - // for more information of creating NotificationHubNamespaceAuthorizationRuleResource, please refer to the document of NotificationHubNamespaceAuthorizationRuleResource + // this example assumes you already have this NamespaceAuthorizationRuleResource created on azure + // for more information of creating NamespaceAuthorizationRuleResource, please refer to the document of NamespaceAuthorizationRuleResource string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; string resourceGroupName = "5ktrial"; string namespaceName = "nh-sdk-ns"; string authorizationRuleName = "RootManageSharedAccessKey"; - ResourceIdentifier notificationHubNamespaceAuthorizationRuleResourceId = NotificationHubNamespaceAuthorizationRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); - NotificationHubNamespaceAuthorizationRuleResource notificationHubNamespaceAuthorizationRule = client.GetNotificationHubNamespaceAuthorizationRuleResource(notificationHubNamespaceAuthorizationRuleResourceId); + ResourceIdentifier namespaceAuthorizationRuleResourceId = NamespaceAuthorizationRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); + NamespaceAuthorizationRuleResource namespaceAuthorizationRule = client.GetNamespaceAuthorizationRuleResource(namespaceAuthorizationRuleResourceId); // invoke the operation - NotificationHubPolicyKey notificationHubPolicyKey = new NotificationHubPolicyKey() - { - PolicyKey = "PrimaryKey", - }; - NotificationHubResourceKeys result = await notificationHubNamespaceAuthorizationRule.RegenerateKeysAsync(notificationHubPolicyKey); + PolicyKeyResource policyKeyResource = new PolicyKeyResource(PolicyKeyType.PrimaryKey); + NotificationHubResourceKeys result = await namespaceAuthorizationRule.RegenerateKeysAsync(policyKeyResource); Console.WriteLine($"Succeeded: {result}"); } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubAuthorizationRuleCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NamespaceNotificationHubAuthorizationRuleCollection.cs similarity index 73% rename from sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubAuthorizationRuleCollection.cs rename to sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NamespaceNotificationHubAuthorizationRuleCollection.cs index 28f2ce470f62..39cd0af0607e 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubAuthorizationRuleCollection.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NamespaceNotificationHubAuthorizationRuleCollection.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.NotificationHubs.Samples { - public partial class Sample_NotificationHubAuthorizationRuleCollection + public partial class Sample_NamespaceNotificationHubAuthorizationRuleCollection { - // NotificationHubAuthorizationRuleCreate + // NotificationHubs_CreateOrUpdateAuthorizationRule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task CreateOrUpdate_NotificationHubAuthorizationRuleCreate() + public async Task CreateOrUpdate_NotificationHubsCreateOrUpdateAuthorizationRule() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubAuthorizationRuleCreate.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/NotificationHubs/AuthorizationRuleCreateOrUpdate.json // this example is just showing the usage of "NotificationHubs_CreateOrUpdateAuthorizationRule" 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 @@ -40,20 +40,20 @@ public async Task CreateOrUpdate_NotificationHubAuthorizationRuleCreate() ResourceIdentifier notificationHubResourceId = NotificationHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, notificationHubName); NotificationHubResource notificationHub = client.GetNotificationHubResource(notificationHubResourceId); - // get the collection of this NotificationHubAuthorizationRuleResource - NotificationHubAuthorizationRuleCollection collection = notificationHub.GetNotificationHubAuthorizationRules(); + // get the collection of this NamespaceNotificationHubAuthorizationRuleResource + NamespaceNotificationHubAuthorizationRuleCollection collection = notificationHub.GetNamespaceNotificationHubAuthorizationRules(); // invoke the operation - string authorizationRuleName = "DefaultListenSharedAccessSignature"; - SharedAccessAuthorizationRuleCreateOrUpdateContent content = new SharedAccessAuthorizationRuleCreateOrUpdateContent(new SharedAccessAuthorizationRuleProperties() + string authorizationRuleName = "MyManageSharedAccessKey"; + NotificationHubAuthorizationRuleData data = new NotificationHubAuthorizationRuleData(new AzureLocation("placeholder")) + { + Properties = new SharedAccessAuthorizationRuleProperties(new AuthorizationRuleAccessRight[] { - Rights = -{ AuthorizationRuleAccessRight.Listen,AuthorizationRuleAccessRight.Send -}, - }); - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, authorizationRuleName, content); - NotificationHubAuthorizationRuleResource result = lro.Value; + }), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, authorizationRuleName, data); + NamespaceNotificationHubAuthorizationRuleResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -62,12 +62,12 @@ public async Task CreateOrUpdate_NotificationHubAuthorizationRuleCreate() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // NotificationHubAuthorizationRuleGet + // NotificationHubs_GetAuthorizationRule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_NotificationHubAuthorizationRuleGet() + public async Task Get_NotificationHubsGetAuthorizationRule() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubAuthorizationRuleGet.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/NotificationHubs/AuthorizationRuleGet.json // this example is just showing the usage of "NotificationHubs_GetAuthorizationRule" 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 @@ -84,12 +84,12 @@ public async Task Get_NotificationHubAuthorizationRuleGet() ResourceIdentifier notificationHubResourceId = NotificationHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, notificationHubName); NotificationHubResource notificationHub = client.GetNotificationHubResource(notificationHubResourceId); - // get the collection of this NotificationHubAuthorizationRuleResource - NotificationHubAuthorizationRuleCollection collection = notificationHub.GetNotificationHubAuthorizationRules(); + // get the collection of this NamespaceNotificationHubAuthorizationRuleResource + NamespaceNotificationHubAuthorizationRuleCollection collection = notificationHub.GetNamespaceNotificationHubAuthorizationRules(); // invoke the operation string authorizationRuleName = "DefaultListenSharedAccessSignature"; - NotificationHubAuthorizationRuleResource result = await collection.GetAsync(authorizationRuleName); + NamespaceNotificationHubAuthorizationRuleResource result = await collection.GetAsync(authorizationRuleName); // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -98,12 +98,12 @@ public async Task Get_NotificationHubAuthorizationRuleGet() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // NotificationHubAuthorizationRuleGet + // NotificationHubs_GetAuthorizationRule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Exists_NotificationHubAuthorizationRuleGet() + public async Task Exists_NotificationHubsGetAuthorizationRule() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubAuthorizationRuleGet.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/NotificationHubs/AuthorizationRuleGet.json // this example is just showing the usage of "NotificationHubs_GetAuthorizationRule" 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 @@ -120,8 +120,8 @@ public async Task Exists_NotificationHubAuthorizationRuleGet() ResourceIdentifier notificationHubResourceId = NotificationHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, notificationHubName); NotificationHubResource notificationHub = client.GetNotificationHubResource(notificationHubResourceId); - // get the collection of this NotificationHubAuthorizationRuleResource - NotificationHubAuthorizationRuleCollection collection = notificationHub.GetNotificationHubAuthorizationRules(); + // get the collection of this NamespaceNotificationHubAuthorizationRuleResource + NamespaceNotificationHubAuthorizationRuleCollection collection = notificationHub.GetNamespaceNotificationHubAuthorizationRules(); // invoke the operation string authorizationRuleName = "DefaultListenSharedAccessSignature"; @@ -130,12 +130,12 @@ public async Task Exists_NotificationHubAuthorizationRuleGet() Console.WriteLine($"Succeeded: {result}"); } - // NotificationHubAuthorizationRuleGet + // NotificationHubs_GetAuthorizationRule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetIfExists_NotificationHubAuthorizationRuleGet() + public async Task GetIfExists_NotificationHubsGetAuthorizationRule() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubAuthorizationRuleGet.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/NotificationHubs/AuthorizationRuleGet.json // this example is just showing the usage of "NotificationHubs_GetAuthorizationRule" 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 @@ -152,13 +152,13 @@ public async Task GetIfExists_NotificationHubAuthorizationRuleGet() ResourceIdentifier notificationHubResourceId = NotificationHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, notificationHubName); NotificationHubResource notificationHub = client.GetNotificationHubResource(notificationHubResourceId); - // get the collection of this NotificationHubAuthorizationRuleResource - NotificationHubAuthorizationRuleCollection collection = notificationHub.GetNotificationHubAuthorizationRules(); + // get the collection of this NamespaceNotificationHubAuthorizationRuleResource + NamespaceNotificationHubAuthorizationRuleCollection collection = notificationHub.GetNamespaceNotificationHubAuthorizationRules(); // invoke the operation string authorizationRuleName = "DefaultListenSharedAccessSignature"; - NullableResponse response = await collection.GetIfExistsAsync(authorizationRuleName); - NotificationHubAuthorizationRuleResource result = response.HasValue ? response.Value : null; + NullableResponse response = await collection.GetIfExistsAsync(authorizationRuleName); + NamespaceNotificationHubAuthorizationRuleResource result = response.HasValue ? response.Value : null; if (result == null) { @@ -174,12 +174,12 @@ public async Task GetIfExists_NotificationHubAuthorizationRuleGet() } } - // NotificationHubAuthorizationRuleListAll + // NotificationHubs_ListAuthorizationRules [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAll_NotificationHubAuthorizationRuleListAll() + public async Task GetAll_NotificationHubsListAuthorizationRules() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubAuthorizationRuleListAll.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/NotificationHubs/AuthorizationRuleList.json // this example is just showing the usage of "NotificationHubs_ListAuthorizationRules" 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 @@ -196,11 +196,11 @@ public async Task GetAll_NotificationHubAuthorizationRuleListAll() ResourceIdentifier notificationHubResourceId = NotificationHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, notificationHubName); NotificationHubResource notificationHub = client.GetNotificationHubResource(notificationHubResourceId); - // get the collection of this NotificationHubAuthorizationRuleResource - NotificationHubAuthorizationRuleCollection collection = notificationHub.GetNotificationHubAuthorizationRules(); + // get the collection of this NamespaceNotificationHubAuthorizationRuleResource + NamespaceNotificationHubAuthorizationRuleCollection collection = notificationHub.GetNamespaceNotificationHubAuthorizationRules(); // invoke the operation and iterate over the result - await foreach (NotificationHubAuthorizationRuleResource item in collection.GetAllAsync()) + await foreach (NamespaceNotificationHubAuthorizationRuleResource item in collection.GetAllAsync()) { // the variable item is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubAuthorizationRuleResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NamespaceNotificationHubAuthorizationRuleResource.cs similarity index 51% rename from sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubAuthorizationRuleResource.cs rename to sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NamespaceNotificationHubAuthorizationRuleResource.cs index f35ae397d7a6..c5c2ae6c1759 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubAuthorizationRuleResource.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NamespaceNotificationHubAuthorizationRuleResource.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.NotificationHubs.Samples { - public partial class Sample_NotificationHubAuthorizationRuleResource + public partial class Sample_NamespaceNotificationHubAuthorizationRuleResource { - // NotificationHubAuthorizationRuleCreate + // NotificationHubs_CreateOrUpdateAuthorizationRule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Update_NotificationHubAuthorizationRuleCreate() + public async Task Update_NotificationHubsCreateOrUpdateAuthorizationRule() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubAuthorizationRuleCreate.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/NotificationHubs/AuthorizationRuleCreateOrUpdate.json // this example is just showing the usage of "NotificationHubs_CreateOrUpdateAuthorizationRule" 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 @@ -31,26 +31,26 @@ public async Task Update_NotificationHubAuthorizationRuleCreate() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this NotificationHubAuthorizationRuleResource created on azure - // for more information of creating NotificationHubAuthorizationRuleResource, please refer to the document of NotificationHubAuthorizationRuleResource + // this example assumes you already have this NamespaceNotificationHubAuthorizationRuleResource created on azure + // for more information of creating NamespaceNotificationHubAuthorizationRuleResource, please refer to the document of NamespaceNotificationHubAuthorizationRuleResource string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; string resourceGroupName = "5ktrial"; string namespaceName = "nh-sdk-ns"; string notificationHubName = "nh-sdk-hub"; - string authorizationRuleName = "DefaultListenSharedAccessSignature"; - ResourceIdentifier notificationHubAuthorizationRuleResourceId = NotificationHubAuthorizationRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); - NotificationHubAuthorizationRuleResource notificationHubAuthorizationRule = client.GetNotificationHubAuthorizationRuleResource(notificationHubAuthorizationRuleResourceId); + string authorizationRuleName = "MyManageSharedAccessKey"; + ResourceIdentifier namespaceNotificationHubAuthorizationRuleResourceId = NamespaceNotificationHubAuthorizationRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); + NamespaceNotificationHubAuthorizationRuleResource namespaceNotificationHubAuthorizationRule = client.GetNamespaceNotificationHubAuthorizationRuleResource(namespaceNotificationHubAuthorizationRuleResourceId); // invoke the operation - SharedAccessAuthorizationRuleCreateOrUpdateContent content = new SharedAccessAuthorizationRuleCreateOrUpdateContent(new SharedAccessAuthorizationRuleProperties() + NotificationHubAuthorizationRuleData data = new NotificationHubAuthorizationRuleData(new AzureLocation("placeholder")) + { + Properties = new SharedAccessAuthorizationRuleProperties(new AuthorizationRuleAccessRight[] { - Rights = -{ AuthorizationRuleAccessRight.Listen,AuthorizationRuleAccessRight.Send -}, - }); - ArmOperation lro = await notificationHubAuthorizationRule.UpdateAsync(WaitUntil.Completed, content); - NotificationHubAuthorizationRuleResource result = lro.Value; + }), + }; + ArmOperation lro = await namespaceNotificationHubAuthorizationRule.UpdateAsync(WaitUntil.Completed, data); + NamespaceNotificationHubAuthorizationRuleResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -59,12 +59,12 @@ public async Task Update_NotificationHubAuthorizationRuleCreate() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // NotificationHubAuthorizationRuleDelete + // NotificationHubs_DeleteAuthorizationRule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Delete_NotificationHubAuthorizationRuleDelete() + public async Task Delete_NotificationHubsDeleteAuthorizationRule() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubAuthorizationRuleDelete.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/NotificationHubs/AuthorizationRuleDelete.json // this example is just showing the usage of "NotificationHubs_DeleteAuthorizationRule" 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 @@ -72,28 +72,28 @@ public async Task Delete_NotificationHubAuthorizationRuleDelete() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this NotificationHubAuthorizationRuleResource created on azure - // for more information of creating NotificationHubAuthorizationRuleResource, please refer to the document of NotificationHubAuthorizationRuleResource + // this example assumes you already have this NamespaceNotificationHubAuthorizationRuleResource created on azure + // for more information of creating NamespaceNotificationHubAuthorizationRuleResource, please refer to the document of NamespaceNotificationHubAuthorizationRuleResource string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; string resourceGroupName = "5ktrial"; string namespaceName = "nh-sdk-ns"; string notificationHubName = "nh-sdk-hub"; string authorizationRuleName = "DefaultListenSharedAccessSignature"; - ResourceIdentifier notificationHubAuthorizationRuleResourceId = NotificationHubAuthorizationRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); - NotificationHubAuthorizationRuleResource notificationHubAuthorizationRule = client.GetNotificationHubAuthorizationRuleResource(notificationHubAuthorizationRuleResourceId); + ResourceIdentifier namespaceNotificationHubAuthorizationRuleResourceId = NamespaceNotificationHubAuthorizationRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); + NamespaceNotificationHubAuthorizationRuleResource namespaceNotificationHubAuthorizationRule = client.GetNamespaceNotificationHubAuthorizationRuleResource(namespaceNotificationHubAuthorizationRuleResourceId); // invoke the operation - await notificationHubAuthorizationRule.DeleteAsync(WaitUntil.Completed); + await namespaceNotificationHubAuthorizationRule.DeleteAsync(WaitUntil.Completed); Console.WriteLine($"Succeeded"); } - // NotificationHubAuthorizationRuleGet + // NotificationHubs_GetAuthorizationRule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_NotificationHubAuthorizationRuleGet() + public async Task Get_NotificationHubsGetAuthorizationRule() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubAuthorizationRuleGet.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/NotificationHubs/AuthorizationRuleGet.json // this example is just showing the usage of "NotificationHubs_GetAuthorizationRule" 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 @@ -101,18 +101,18 @@ public async Task Get_NotificationHubAuthorizationRuleGet() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this NotificationHubAuthorizationRuleResource created on azure - // for more information of creating NotificationHubAuthorizationRuleResource, please refer to the document of NotificationHubAuthorizationRuleResource + // this example assumes you already have this NamespaceNotificationHubAuthorizationRuleResource created on azure + // for more information of creating NamespaceNotificationHubAuthorizationRuleResource, please refer to the document of NamespaceNotificationHubAuthorizationRuleResource string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; string resourceGroupName = "5ktrial"; string namespaceName = "nh-sdk-ns"; string notificationHubName = "nh-sdk-hub"; string authorizationRuleName = "DefaultListenSharedAccessSignature"; - ResourceIdentifier notificationHubAuthorizationRuleResourceId = NotificationHubAuthorizationRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); - NotificationHubAuthorizationRuleResource notificationHubAuthorizationRule = client.GetNotificationHubAuthorizationRuleResource(notificationHubAuthorizationRuleResourceId); + ResourceIdentifier namespaceNotificationHubAuthorizationRuleResourceId = NamespaceNotificationHubAuthorizationRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); + NamespaceNotificationHubAuthorizationRuleResource namespaceNotificationHubAuthorizationRule = client.GetNamespaceNotificationHubAuthorizationRuleResource(namespaceNotificationHubAuthorizationRuleResourceId); // invoke the operation - NotificationHubAuthorizationRuleResource result = await notificationHubAuthorizationRule.GetAsync(); + NamespaceNotificationHubAuthorizationRuleResource result = await namespaceNotificationHubAuthorizationRule.GetAsync(); // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -121,12 +121,12 @@ public async Task Get_NotificationHubAuthorizationRuleGet() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // NotificationHubAuthorizationRuleListKey + // NotificationHubs_ListKeys [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetKeys_NotificationHubAuthorizationRuleListKey() + public async Task GetKeys_NotificationHubsListKeys() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubAuthorizationRuleListKey.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/NotificationHubs/AuthorizationRuleListKeys.json // this example is just showing the usage of "NotificationHubs_ListKeys" 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 @@ -134,28 +134,28 @@ public async Task GetKeys_NotificationHubAuthorizationRuleListKey() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this NotificationHubAuthorizationRuleResource created on azure - // for more information of creating NotificationHubAuthorizationRuleResource, please refer to the document of NotificationHubAuthorizationRuleResource + // this example assumes you already have this NamespaceNotificationHubAuthorizationRuleResource created on azure + // for more information of creating NamespaceNotificationHubAuthorizationRuleResource, please refer to the document of NamespaceNotificationHubAuthorizationRuleResource string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; string resourceGroupName = "5ktrial"; string namespaceName = "nh-sdk-ns"; string notificationHubName = "nh-sdk-hub"; string authorizationRuleName = "sdk-AuthRules-5800"; - ResourceIdentifier notificationHubAuthorizationRuleResourceId = NotificationHubAuthorizationRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); - NotificationHubAuthorizationRuleResource notificationHubAuthorizationRule = client.GetNotificationHubAuthorizationRuleResource(notificationHubAuthorizationRuleResourceId); + ResourceIdentifier namespaceNotificationHubAuthorizationRuleResourceId = NamespaceNotificationHubAuthorizationRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); + NamespaceNotificationHubAuthorizationRuleResource namespaceNotificationHubAuthorizationRule = client.GetNamespaceNotificationHubAuthorizationRuleResource(namespaceNotificationHubAuthorizationRuleResourceId); // invoke the operation - NotificationHubResourceKeys result = await notificationHubAuthorizationRule.GetKeysAsync(); + NotificationHubResourceKeys result = await namespaceNotificationHubAuthorizationRule.GetKeysAsync(); Console.WriteLine($"Succeeded: {result}"); } - // NotificationHubAuthorizationRuleRegenrateKey + // NotificationHubs_RegenerateKeys [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task RegenerateKeys_NotificationHubAuthorizationRuleRegenrateKey() + public async Task RegenerateKeys_NotificationHubsRegenerateKeys() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubAuthorizationRuleRegenrateKey.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/NotificationHubs/AuthorizationRuleRegenerateKey.json // this example is just showing the usage of "NotificationHubs_RegenerateKeys" 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 @@ -163,22 +163,19 @@ public async Task RegenerateKeys_NotificationHubAuthorizationRuleRegenrateKey() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this NotificationHubAuthorizationRuleResource created on azure - // for more information of creating NotificationHubAuthorizationRuleResource, please refer to the document of NotificationHubAuthorizationRuleResource + // this example assumes you already have this NamespaceNotificationHubAuthorizationRuleResource created on azure + // for more information of creating NamespaceNotificationHubAuthorizationRuleResource, please refer to the document of NamespaceNotificationHubAuthorizationRuleResource string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; string resourceGroupName = "5ktrial"; string namespaceName = "nh-sdk-ns"; string notificationHubName = "nh-sdk-hub"; string authorizationRuleName = "DefaultListenSharedAccessSignature"; - ResourceIdentifier notificationHubAuthorizationRuleResourceId = NotificationHubAuthorizationRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); - NotificationHubAuthorizationRuleResource notificationHubAuthorizationRule = client.GetNotificationHubAuthorizationRuleResource(notificationHubAuthorizationRuleResourceId); + ResourceIdentifier namespaceNotificationHubAuthorizationRuleResourceId = NamespaceNotificationHubAuthorizationRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); + NamespaceNotificationHubAuthorizationRuleResource namespaceNotificationHubAuthorizationRule = client.GetNamespaceNotificationHubAuthorizationRuleResource(namespaceNotificationHubAuthorizationRuleResourceId); // invoke the operation - NotificationHubPolicyKey notificationHubPolicyKey = new NotificationHubPolicyKey() - { - PolicyKey = "PrimaryKey", - }; - NotificationHubResourceKeys result = await notificationHubAuthorizationRule.RegenerateKeysAsync(notificationHubPolicyKey); + PolicyKeyResource policyKeyResource = new PolicyKeyResource(PolicyKeyType.PrimaryKey); + NotificationHubResourceKeys result = await namespaceNotificationHubAuthorizationRule.RegenerateKeysAsync(policyKeyResource); Console.WriteLine($"Succeeded: {result}"); } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubCollection.cs index ae3fa5514098..5006f5a6bd35 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubCollection.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubCollection.cs @@ -18,13 +18,13 @@ namespace Azure.ResourceManager.NotificationHubs.Samples { public partial class Sample_NotificationHubCollection { - // NotificationHubCreate + // NotificationHubs_Get [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task CreateOrUpdate_NotificationHubCreate() + public async Task Get_NotificationHubsGet() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubCreate.json - // this example is just showing the usage of "NotificationHubs_CreateOrUpdate" 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/Get.json + // this example is just showing the usage of "NotificationHubs_Get" 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(); @@ -44,9 +44,7 @@ public async Task CreateOrUpdate_NotificationHubCreate() // invoke the operation string notificationHubName = "nh-sdk-hub"; - NotificationHubCreateOrUpdateContent content = new NotificationHubCreateOrUpdateContent(new AzureLocation("eastus")); - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, notificationHubName, content); - NotificationHubResource result = lro.Value; + NotificationHubResource result = await collection.GetAsync(notificationHubName); // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -55,12 +53,12 @@ public async Task CreateOrUpdate_NotificationHubCreate() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // NotificationHubGet + // NotificationHubs_Get [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_NotificationHubGet() + public async Task Exists_NotificationHubsGet() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubGet.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/NotificationHubs/Get.json // this example is just showing the usage of "NotificationHubs_Get" 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 @@ -81,21 +79,17 @@ public async Task Get_NotificationHubGet() // invoke the operation string notificationHubName = "nh-sdk-hub"; - NotificationHubResource result = await collection.GetAsync(notificationHubName); + bool result = await collection.ExistsAsync(notificationHubName); - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - NotificationHubData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded: {result}"); } - // NotificationHubGet + // NotificationHubs_Get [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Exists_NotificationHubGet() + public async Task GetIfExists_NotificationHubsGet() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubGet.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/NotificationHubs/Get.json // this example is just showing the usage of "NotificationHubs_Get" 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 @@ -116,18 +110,30 @@ public async Task Exists_NotificationHubGet() // invoke the operation string notificationHubName = "nh-sdk-hub"; - bool result = await collection.ExistsAsync(notificationHubName); + NullableResponse response = await collection.GetIfExistsAsync(notificationHubName); + NotificationHubResource result = response.HasValue ? response.Value : null; - Console.WriteLine($"Succeeded: {result}"); + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NotificationHubData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } } - // NotificationHubGet + // NotificationHubs_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetIfExists_NotificationHubGet() + public async Task CreateOrUpdate_NotificationHubsCreateOrUpdate() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubGet.json - // this example is just showing the usage of "NotificationHubs_Get" 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/CreateOrUpdate.json + // this example is just showing the usage of "NotificationHubs_CreateOrUpdate" 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(); @@ -147,29 +153,26 @@ public async Task GetIfExists_NotificationHubGet() // invoke the operation string notificationHubName = "nh-sdk-hub"; - NullableResponse response = await collection.GetIfExistsAsync(notificationHubName); - NotificationHubResource result = response.HasValue ? response.Value : null; - - if (result == null) - { - Console.WriteLine($"Succeeded with null as result"); - } - else + NotificationHubData data = new NotificationHubData(new AzureLocation("eastus")) { - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - NotificationHubData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } + Properties = new NotificationHubProperties(), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, notificationHubName, data); + NotificationHubResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NotificationHubData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // NotificationHubListByNameSpace + // NotificationHubs_List [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAll_NotificationHubListByNameSpace() + public async Task GetAll_NotificationHubsList() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubListByNameSpace.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/NotificationHubs/List.json // this example is just showing the usage of "NotificationHubs_List" 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 diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceCollection.cs index b55481d30189..ad672bc5ebfb 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceCollection.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceCollection.cs @@ -19,13 +19,13 @@ namespace Azure.ResourceManager.NotificationHubs.Samples { public partial class Sample_NotificationHubNamespaceCollection { - // NameSpaceCreate + // Namespaces_Get [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task CreateOrUpdate_NameSpaceCreate() + public async Task Get_NamespacesGet() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceCreate.json - // this example is just showing the usage of "Namespaces_CreateOrUpdate" 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/Get.json + // this example is just showing the usage of "Namespaces_Get" 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(); @@ -44,20 +44,7 @@ public async Task CreateOrUpdate_NameSpaceCreate() // invoke the operation string namespaceName = "nh-sdk-ns"; - NotificationHubNamespaceCreateOrUpdateContent content = new NotificationHubNamespaceCreateOrUpdateContent(new AzureLocation("South Central US")) - { - Sku = new NotificationHubSku(NotificationHubSkuName.Standard) - { - Tier = "Standard", - }, - Tags = -{ -["tag1"] = "value1", -["tag2"] = "value2", -}, - }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, namespaceName, content); - NotificationHubNamespaceResource result = lro.Value; + NotificationHubNamespaceResource result = await collection.GetAsync(namespaceName); // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -66,12 +53,12 @@ public async Task CreateOrUpdate_NameSpaceCreate() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // NameSpaceGet + // Namespaces_Get [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_NameSpaceGet() + public async Task Exists_NamespacesGet() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceGet.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/Get.json // this example is just showing the usage of "Namespaces_Get" 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 @@ -91,21 +78,17 @@ public async Task Get_NameSpaceGet() // invoke the operation string namespaceName = "nh-sdk-ns"; - NotificationHubNamespaceResource result = await collection.GetAsync(namespaceName); + bool result = await collection.ExistsAsync(namespaceName); - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - NotificationHubNamespaceData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded: {result}"); } - // NameSpaceGet + // Namespaces_Get [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Exists_NameSpaceGet() + public async Task GetIfExists_NamespacesGet() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceGet.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/Get.json // this example is just showing the usage of "Namespaces_Get" 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 @@ -125,18 +108,30 @@ public async Task Exists_NameSpaceGet() // invoke the operation string namespaceName = "nh-sdk-ns"; - bool result = await collection.ExistsAsync(namespaceName); + NullableResponse response = await collection.GetIfExistsAsync(namespaceName); + NotificationHubNamespaceResource result = response.HasValue ? response.Value : null; - Console.WriteLine($"Succeeded: {result}"); + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NotificationHubNamespaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } } - // NameSpaceGet + // Namespaces_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetIfExists_NameSpaceGet() + public async Task CreateOrUpdate_NamespacesCreateOrUpdate() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceGet.json - // this example is just showing the usage of "Namespaces_Get" 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/CreateOrUpdate.json + // this example is just showing the usage of "Namespaces_CreateOrUpdate" 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(); @@ -155,29 +150,51 @@ public async Task GetIfExists_NameSpaceGet() // invoke the operation string namespaceName = "nh-sdk-ns"; - NullableResponse response = await collection.GetIfExistsAsync(namespaceName); - NotificationHubNamespaceResource result = response.HasValue ? response.Value : null; - - if (result == null) + NotificationHubNamespaceData data = new NotificationHubNamespaceData(new AzureLocation("South Central US"), new NotificationHubSku(NotificationHubSkuName.Standard) { - Console.WriteLine($"Succeeded with null as result"); - } - else + Tier = "Standard", + }) { - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - NotificationHubNamespaceData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } + Properties = new NamespaceProperties() + { + ZoneRedundancy = ZoneRedundancyPreference.Enabled, + NetworkAcls = new NetworkAcls() + { + IPRules = +{ +new IPRule("185.48.100.00/24",new AuthorizationRuleAccessRight[] +{ +AuthorizationRuleAccessRight.Manage,AuthorizationRuleAccessRight.Send,AuthorizationRuleAccessRight.Listen +}) +}, + PublicNetworkRuleRights = +{ +AuthorizationRuleAccessRight.Listen +}, + }, + }, + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, namespaceName, data); + NotificationHubNamespaceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NotificationHubNamespaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // NameSpaceListByResourceGroup + // Namespaces_List [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAll_NameSpaceListByResourceGroup() + public async Task GetAll_NamespacesList() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceListByResourceGroup.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/ListByResourceGroup.json // this example is just showing the usage of "Namespaces_List" 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 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 190f19d3840c..16145c91274c 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 @@ -19,12 +19,40 @@ namespace Azure.ResourceManager.NotificationHubs.Samples { public partial class Sample_NotificationHubNamespaceResource { - // NameSpaceCheckNameAvailability + // NotificationHubs_CheckNotificationHubAvailability [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task CheckNotificationHubNamespaceAvailability_NameSpaceCheckNameAvailability() + public async Task CheckNotificationHubAvailability_NotificationHubsCheckNotificationHubAvailability() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceCheckNameAvailability.json + // 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(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NotificationHubNamespaceResource created on azure + // 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"; + 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); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Namespaces_CheckAvailability + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CheckNotificationHubNamespaceAvailability_NamespacesCheckAvailability() + { + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/CheckAvailability.json // this example is just showing the usage of "Namespaces_CheckAvailability" 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 @@ -45,13 +73,13 @@ public async Task CheckNotificationHubNamespaceAvailability_NameSpaceCheckNameAv Console.WriteLine($"Succeeded: {result}"); } - // NameSpaceUpdate + // Namespaces_Get [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Update_NameSpaceUpdate() + public async Task Get_NamespacesGet() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceUpdate.json - // this example is just showing the usage of "Namespaces_Patch" 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/Get.json + // this example is just showing the usage of "Namespaces_Get" 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(); @@ -67,19 +95,7 @@ public async Task Update_NameSpaceUpdate() NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); // invoke the operation - NotificationHubNamespacePatch patch = new NotificationHubNamespacePatch() - { - Tags = -{ -["tag1"] = "value1", -["tag2"] = "value2", -}, - Sku = new NotificationHubSku(NotificationHubSkuName.Standard) - { - Tier = "Standard", - }, - }; - NotificationHubNamespaceResource result = await notificationHubNamespace.UpdateAsync(patch); + NotificationHubNamespaceResource result = await notificationHubNamespace.GetAsync(); // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -88,13 +104,13 @@ public async Task Update_NameSpaceUpdate() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // NameSpaceDelete + // Namespaces_Update [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Delete_NameSpaceDelete() + public async Task Update_NamespacesUpdate() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceDelete.json - // this example is just showing the usage of "Namespaces_Delete" 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/Update.json + // this example is just showing the usage of "Namespaces_Update" 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(); @@ -110,18 +126,40 @@ public async Task Delete_NameSpaceDelete() NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); // invoke the operation - await notificationHubNamespace.DeleteAsync(WaitUntil.Completed); + NotificationHubNamespacePatch patch = new NotificationHubNamespacePatch() + { + Sku = new NotificationHubSku(NotificationHubSkuName.Free), + Properties = new NamespaceProperties() + { + PnsCredentials = new PnsCredentials() + { + GcmCredentialProperties = new GcmCredentialProperties("#############################") + { + GcmEndpoint = "https://fcm.googleapis.com/fcm/send", + }, + }, + }, + Tags = +{ +["tag1"] = "value3", +}, + }; + NotificationHubNamespaceResource result = await notificationHubNamespace.UpdateAsync(patch); - Console.WriteLine($"Succeeded"); + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NotificationHubNamespaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // NameSpaceGet + // Namespaces_Delete [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_NameSpaceGet() + public async Task Delete_NamespacesDelete() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceGet.json - // this example is just showing the usage of "Namespaces_Get" 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/Delete.json + // this example is just showing the usage of "Namespaces_Delete" 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(); @@ -137,21 +175,17 @@ public async Task Get_NameSpaceGet() NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); // invoke the operation - NotificationHubNamespaceResource result = await notificationHubNamespace.GetAsync(); + await notificationHubNamespace.DeleteAsync(WaitUntil.Completed); - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - NotificationHubNamespaceData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded"); } - // NameSpaceList + // Namespaces_ListAll [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetNotificationHubNamespaces_NameSpaceList() + public async Task GetNotificationHubNamespaces_NamespacesListAll() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceList.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/ListBySubscription.json // this example is just showing the usage of "Namespaces_ListAll" 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 @@ -178,13 +212,13 @@ public async Task GetNotificationHubNamespaces_NameSpaceList() Console.WriteLine($"Succeeded"); } - // notificationHubCheckNameAvailability + // Namespaces_GetPnsCredentials [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task CheckNotificationHubAvailability_NotificationHubCheckNameAvailability() + public async Task GetPnsCredentials_NamespacesGetPnsCredentials() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubCheckNameAvailability.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(); @@ -195,13 +229,12 @@ public async Task CheckNotificationHubAvailability_NotificationHubCheckNameAvail // 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}"); } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubResource.cs index 232ea7aa09cb..1a2226a56de2 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubResource.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubResource.cs @@ -6,7 +6,6 @@ #nullable disable using System; -using System.Collections.Generic; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -19,13 +18,13 @@ namespace Azure.ResourceManager.NotificationHubs.Samples { public partial class Sample_NotificationHubResource { - // NotificationHubPatch + // NotificationHubs_Get [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Update_NotificationHubPatch() + public async Task Get_NotificationHubsGet() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubPatch.json - // this example is just showing the usage of "NotificationHubs_Patch" 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/Get.json + // this example is just showing the usage of "NotificationHubs_Get" 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(); @@ -35,15 +34,14 @@ public async Task Update_NotificationHubPatch() // this example assumes you already have this NotificationHubResource created on azure // for more information of creating NotificationHubResource, please refer to the document of NotificationHubResource string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; - string resourceGroupName = "sdkresourceGroup"; + string resourceGroupName = "5ktrial"; string namespaceName = "nh-sdk-ns"; - string notificationHubName = "sdk-notificationHubs-8708"; + string notificationHubName = "nh-sdk-hub"; ResourceIdentifier notificationHubResourceId = NotificationHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, notificationHubName); NotificationHubResource notificationHub = client.GetNotificationHubResource(notificationHubResourceId); // invoke the operation - NotificationHubPatch patch = new NotificationHubPatch(new AzureLocation("placeholder")); - NotificationHubResource result = await notificationHub.UpdateAsync(patch); + NotificationHubResource result = await notificationHub.GetAsync(); // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -52,13 +50,13 @@ public async Task Update_NotificationHubPatch() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // NotificationHubDelete + // NotificationHubs_Update [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Delete_NotificationHubDelete() + public async Task Update_NotificationHubsUpdate() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubDelete.json - // this example is just showing the usage of "NotificationHubs_Delete" 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/Update.json + // this example is just showing the usage of "NotificationHubs_Update" 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(); @@ -68,25 +66,40 @@ public async Task Delete_NotificationHubDelete() // this example assumes you already have this NotificationHubResource created on azure // for more information of creating NotificationHubResource, please refer to the document of NotificationHubResource string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; - string resourceGroupName = "5ktrial"; + string resourceGroupName = "sdkresourceGroup"; string namespaceName = "nh-sdk-ns"; - string notificationHubName = "nh-sdk-hub"; + string notificationHubName = "sdk-notificationHubs-8708"; ResourceIdentifier notificationHubResourceId = NotificationHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, notificationHubName); NotificationHubResource notificationHub = client.GetNotificationHubResource(notificationHubResourceId); // invoke the operation - await notificationHub.DeleteAsync(WaitUntil.Completed); + NotificationHubPatch patch = new NotificationHubPatch() + { + Properties = new NotificationHubProperties() + { + RegistrationTtl = "10675199.02:48:05.4775807", + GcmCredentialProperties = new GcmCredentialProperties("###################################") + { + GcmEndpoint = "https://fcm.googleapis.com/fcm/send", + }, + }, + }; + NotificationHubResource result = await notificationHub.UpdateAsync(patch); - Console.WriteLine($"Succeeded"); + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NotificationHubData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // NotificationHubGet + // NotificationHubs_Delete [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_NotificationHubGet() + public async Task Delete_NotificationHubsDelete() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubGet.json - // this example is just showing the usage of "NotificationHubs_Get" 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/Delete.json + // this example is just showing the usage of "NotificationHubs_Delete" 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(); @@ -103,21 +116,17 @@ public async Task Get_NotificationHubGet() NotificationHubResource notificationHub = client.GetNotificationHubResource(notificationHubResourceId); // invoke the operation - NotificationHubResource result = await notificationHub.GetAsync(); + await notificationHub.DeleteAsync(WaitUntil.Completed); - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - NotificationHubData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded"); } - // debugsend + // NotificationHubs_DebugSend [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task DebugSend_Debugsend() + public async Task DebugSend_NotificationHubsDebugSend() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubDebugSend.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/NotificationHubs/DebugSend.json // this example is just showing the usage of "NotificationHubs_DebugSend" 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 @@ -135,24 +144,17 @@ public async Task DebugSend_Debugsend() NotificationHubResource notificationHub = client.GetNotificationHubResource(notificationHubResourceId); // invoke the operation - BinaryData anyObject = BinaryData.FromObjectAsJson(new Dictionary() - { - ["data"] = new Dictionary() - { - ["message"] = "Hello" - } - }); - NotificationHubTestSendResult result = await notificationHub.DebugSendAsync(anyObject: anyObject); + NotificationHubTestSendResult result = await notificationHub.DebugSendAsync(); Console.WriteLine($"Succeeded: {result}"); } - // notificationHubPnsCredentials + // NotificationHubs_GetPnsCredentials [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetPnsCredentials_NotificationHubPnsCredentials() + public async Task GetPnsCredentials_NotificationHubsGetPnsCredentials() { - // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubPnsCredentials.json + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/NotificationHubs/PnsCredentialsGet.json // this example is just showing the usage of "NotificationHubs_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 diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubsPrivateLinkResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubsPrivateLinkResource.cs new file mode 100644 index 000000000000..1919a11268ca --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubsPrivateLinkResource.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Samples +{ + public partial class Sample_NotificationHubsPrivateLinkResource + { + // PrivateEndpointConnections_GetGroupId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_PrivateEndpointConnectionsGetGroupId() + { + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/PrivateLinkResourceGet.json + // this example is just showing the usage of "PrivateEndpointConnections_GetGroupId" 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(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NotificationHubsPrivateLinkResource created on azure + // for more information of creating NotificationHubsPrivateLinkResource, please refer to the document of NotificationHubsPrivateLinkResource + string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; + string resourceGroupName = "5ktrial"; + string namespaceName = "nh-sdk-ns"; + string subResourceName = "namespace"; + ResourceIdentifier notificationHubsPrivateLinkResourceId = NotificationHubsPrivateLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, subResourceName); + NotificationHubsPrivateLinkResource notificationHubsPrivateLinkResource = client.GetNotificationHubsPrivateLinkResource(notificationHubsPrivateLinkResourceId); + + // invoke the operation + NotificationHubsPrivateLinkResource result = await notificationHubsPrivateLinkResource.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NotificationHubsPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubsPrivateLinkResourceCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubsPrivateLinkResourceCollection.cs new file mode 100644 index 000000000000..fa97e0c8b886 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubsPrivateLinkResourceCollection.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Samples +{ + public partial class Sample_NotificationHubsPrivateLinkResourceCollection + { + // PrivateEndpointConnections_GetGroupId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_PrivateEndpointConnectionsGetGroupId() + { + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/PrivateLinkResourceGet.json + // this example is just showing the usage of "PrivateEndpointConnections_GetGroupId" 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(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NotificationHubNamespaceResource created on azure + // 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"; + ResourceIdentifier notificationHubNamespaceResourceId = NotificationHubNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); + + // get the collection of this NotificationHubsPrivateLinkResource + NotificationHubsPrivateLinkResourceCollection collection = notificationHubNamespace.GetNotificationHubsPrivateLinkResources(); + + // invoke the operation + string subResourceName = "namespace"; + NotificationHubsPrivateLinkResource result = await collection.GetAsync(subResourceName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NotificationHubsPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PrivateEndpointConnections_GetGroupId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_PrivateEndpointConnectionsGetGroupId() + { + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/PrivateLinkResourceGet.json + // this example is just showing the usage of "PrivateEndpointConnections_GetGroupId" 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(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NotificationHubNamespaceResource created on azure + // 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"; + ResourceIdentifier notificationHubNamespaceResourceId = NotificationHubNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); + + // get the collection of this NotificationHubsPrivateLinkResource + NotificationHubsPrivateLinkResourceCollection collection = notificationHubNamespace.GetNotificationHubsPrivateLinkResources(); + + // invoke the operation + string subResourceName = "namespace"; + bool result = await collection.ExistsAsync(subResourceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // PrivateEndpointConnections_GetGroupId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateEndpointConnectionsGetGroupId() + { + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/PrivateLinkResourceGet.json + // this example is just showing the usage of "PrivateEndpointConnections_GetGroupId" 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(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NotificationHubNamespaceResource created on azure + // 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"; + ResourceIdentifier notificationHubNamespaceResourceId = NotificationHubNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); + + // get the collection of this NotificationHubsPrivateLinkResource + NotificationHubsPrivateLinkResourceCollection collection = notificationHubNamespace.GetNotificationHubsPrivateLinkResources(); + + // invoke the operation + string subResourceName = "namespace"; + NullableResponse response = await collection.GetIfExistsAsync(subResourceName); + NotificationHubsPrivateLinkResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NotificationHubsPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // PrivateEndpointConnections_ListGroupIds + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_PrivateEndpointConnectionsListGroupIds() + { + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/PrivateLinkResourceList.json + // this example is just showing the usage of "PrivateEndpointConnections_ListGroupIds" 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(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NotificationHubNamespaceResource created on azure + // 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"; + ResourceIdentifier notificationHubNamespaceResourceId = NotificationHubNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); + + // get the collection of this NotificationHubsPrivateLinkResource + NotificationHubsPrivateLinkResourceCollection collection = notificationHubNamespace.GetNotificationHubsPrivateLinkResources(); + + // invoke the operation and iterate over the result + await foreach (NotificationHubsPrivateLinkResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NotificationHubsPrivateLinkResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_PrivateEndpointConnectionResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_PrivateEndpointConnectionResource.cs new file mode 100644 index 000000000000..61f9eb4648a4 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_PrivateEndpointConnectionResource.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.NotificationHubs; +using Azure.ResourceManager.NotificationHubs.Models; + +namespace Azure.ResourceManager.NotificationHubs.Samples +{ + public partial class Sample_PrivateEndpointConnectionResource + { + // PrivateEndpointConnections_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_PrivateEndpointConnectionsUpdate() + { + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/PrivateEndpointConnectionUpdate.json + // this example is just showing the usage of "PrivateEndpointConnections_Update" 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(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PrivateEndpointConnectionResource created on azure + // for more information of creating PrivateEndpointConnectionResource, please refer to the document of PrivateEndpointConnectionResource + string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; + string resourceGroupName = "5ktrial"; + string namespaceName = "nh-sdk-ns"; + string privateEndpointConnectionName = "nh-sdk-ns.1fa229cd-bf3f-47f0-8c49-afb36723997e"; + ResourceIdentifier privateEndpointConnectionResourceId = PrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, privateEndpointConnectionName); + PrivateEndpointConnectionResource privateEndpointConnectionResource = client.GetPrivateEndpointConnectionResource(privateEndpointConnectionResourceId); + + // invoke the operation + PrivateEndpointConnectionResourceData data = new PrivateEndpointConnectionResourceData() + { + Properties = new PrivateEndpointConnectionProperties() + { + ConnectionState = new RemotePrivateLinkServiceConnectionState() + { + Status = PrivateLinkConnectionStatus.Approved, + }, + }, + }; + ArmOperation lro = await privateEndpointConnectionResource.UpdateAsync(WaitUntil.Completed, data); + PrivateEndpointConnectionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PrivateEndpointConnectionResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PrivateEndpointConnections_Delete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_PrivateEndpointConnectionsDelete() + { + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/PrivateEndpointConnectionDelete.json + // this example is just showing the usage of "PrivateEndpointConnections_Delete" 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(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PrivateEndpointConnectionResource created on azure + // for more information of creating PrivateEndpointConnectionResource, please refer to the document of PrivateEndpointConnectionResource + string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; + string resourceGroupName = "5ktrial"; + string namespaceName = "nh-sdk-ns"; + string privateEndpointConnectionName = "nh-sdk-ns.1fa229cd-bf3f-47f0-8c49-afb36723997e"; + ResourceIdentifier privateEndpointConnectionResourceId = PrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, privateEndpointConnectionName); + PrivateEndpointConnectionResource privateEndpointConnectionResource = client.GetPrivateEndpointConnectionResource(privateEndpointConnectionResourceId); + + // invoke the operation + await privateEndpointConnectionResource.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // PrivateEndpointConnections_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_PrivateEndpointConnectionsGet() + { + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/PrivateEndpointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_Get" 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(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PrivateEndpointConnectionResource created on azure + // for more information of creating PrivateEndpointConnectionResource, please refer to the document of PrivateEndpointConnectionResource + string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; + string resourceGroupName = "5ktrial"; + string namespaceName = "nh-sdk-ns"; + string privateEndpointConnectionName = "nh-sdk-ns.1fa229cd-bf3f-47f0-8c49-afb36723997e"; + ResourceIdentifier privateEndpointConnectionResourceId = PrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, privateEndpointConnectionName); + PrivateEndpointConnectionResource privateEndpointConnectionResource = client.GetPrivateEndpointConnectionResource(privateEndpointConnectionResourceId); + + // invoke the operation + PrivateEndpointConnectionResource result = await privateEndpointConnectionResource.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PrivateEndpointConnectionResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_PrivateEndpointConnectionResourceCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_PrivateEndpointConnectionResourceCollection.cs new file mode 100644 index 000000000000..ac76046a2b46 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_PrivateEndpointConnectionResourceCollection.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.NotificationHubs; +using Azure.ResourceManager.NotificationHubs.Models; + +namespace Azure.ResourceManager.NotificationHubs.Samples +{ + public partial class Sample_PrivateEndpointConnectionResourceCollection + { + // PrivateEndpointConnections_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_PrivateEndpointConnectionsUpdate() + { + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/PrivateEndpointConnectionUpdate.json + // this example is just showing the usage of "PrivateEndpointConnections_Update" 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(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NotificationHubNamespaceResource created on azure + // 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"; + ResourceIdentifier notificationHubNamespaceResourceId = NotificationHubNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); + + // get the collection of this PrivateEndpointConnectionResource + PrivateEndpointConnectionResourceCollection collection = notificationHubNamespace.GetPrivateEndpointConnectionResources(); + + // invoke the operation + string privateEndpointConnectionName = "nh-sdk-ns.1fa229cd-bf3f-47f0-8c49-afb36723997e"; + PrivateEndpointConnectionResourceData data = new PrivateEndpointConnectionResourceData() + { + Properties = new PrivateEndpointConnectionProperties() + { + ConnectionState = new RemotePrivateLinkServiceConnectionState() + { + Status = PrivateLinkConnectionStatus.Approved, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, data); + PrivateEndpointConnectionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PrivateEndpointConnectionResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PrivateEndpointConnections_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_PrivateEndpointConnectionsGet() + { + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/PrivateEndpointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_Get" 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(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NotificationHubNamespaceResource created on azure + // 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"; + ResourceIdentifier notificationHubNamespaceResourceId = NotificationHubNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); + + // get the collection of this PrivateEndpointConnectionResource + PrivateEndpointConnectionResourceCollection collection = notificationHubNamespace.GetPrivateEndpointConnectionResources(); + + // invoke the operation + string privateEndpointConnectionName = "nh-sdk-ns.1fa229cd-bf3f-47f0-8c49-afb36723997e"; + PrivateEndpointConnectionResource result = await collection.GetAsync(privateEndpointConnectionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PrivateEndpointConnectionResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PrivateEndpointConnections_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_PrivateEndpointConnectionsGet() + { + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/PrivateEndpointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_Get" 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(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NotificationHubNamespaceResource created on azure + // 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"; + ResourceIdentifier notificationHubNamespaceResourceId = NotificationHubNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); + + // get the collection of this PrivateEndpointConnectionResource + PrivateEndpointConnectionResourceCollection collection = notificationHubNamespace.GetPrivateEndpointConnectionResources(); + + // invoke the operation + string privateEndpointConnectionName = "nh-sdk-ns.1fa229cd-bf3f-47f0-8c49-afb36723997e"; + bool result = await collection.ExistsAsync(privateEndpointConnectionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // PrivateEndpointConnections_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateEndpointConnectionsGet() + { + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/PrivateEndpointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_Get" 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(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NotificationHubNamespaceResource created on azure + // 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"; + ResourceIdentifier notificationHubNamespaceResourceId = NotificationHubNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); + + // get the collection of this PrivateEndpointConnectionResource + PrivateEndpointConnectionResourceCollection collection = notificationHubNamespace.GetPrivateEndpointConnectionResources(); + + // invoke the operation + string privateEndpointConnectionName = "nh-sdk-ns.1fa229cd-bf3f-47f0-8c49-afb36723997e"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + PrivateEndpointConnectionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PrivateEndpointConnectionResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // PrivateEndpointConnections_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_PrivateEndpointConnectionsList() + { + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/preview/2023-10-01-preview/examples/Namespaces/PrivateEndpointConnectionList.json + // this example is just showing the usage of "PrivateEndpointConnections_List" 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(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NotificationHubNamespaceResource created on azure + // 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"; + ResourceIdentifier notificationHubNamespaceResourceId = NotificationHubNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); + + // get the collection of this PrivateEndpointConnectionResource + PrivateEndpointConnectionResourceCollection collection = notificationHubNamespace.GetPrivateEndpointConnectionResources(); + + // invoke the operation and iterate over the result + await foreach (PrivateEndpointConnectionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PrivateEndpointConnectionResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/ArmNotificationHubsModelFactory.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/ArmNotificationHubsModelFactory.cs index a3b335296e3a..a75921485186 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/ArmNotificationHubsModelFactory.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/ArmNotificationHubsModelFactory.cs @@ -24,8 +24,11 @@ public static partial class ArmNotificationHubsModelFactory /// The systemData. /// The tags. /// The location. - /// True if the name is available and can be used to create new Namespace/NotificationHub. Otherwise false. - /// The sku of the created namespace. + /// + /// Gets or sets true if the name is available and can be used to + /// create new Namespace/NotificationHub. Otherwise false. + /// + /// The Sku description for a namespace. /// A new instance for mocking. public static NotificationHubAvailabilityResult NotificationHubAvailabilityResult(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, bool? isAvailiable = null, NotificationHubSku sku = null) { @@ -34,82 +37,106 @@ public static NotificationHubAvailabilityResult NotificationHubAvailabilityResul return new NotificationHubAvailabilityResult(id, name, resourceType, systemData, tags, location, isAvailiable, sku); } - /// Initializes a new instance of NotificationHubNamespaceCreateOrUpdateContent. + /// Initializes a new instance of NotificationHubData. /// The id. /// The name. /// The resourceType. /// The systemData. /// The tags. /// The location. - /// The name of the namespace. - /// Provisioning state of the Namespace. - /// Specifies the targeted region in which the namespace should be created. It can be any of the following values: Australia East, Australia Southeast, Central US, East US, East US 2, West US, North Central US, South Central US, East Asia, Southeast Asia, Brazil South, Japan East, Japan West, North Europe, West Europe. - /// Identifier for Azure Insights metrics. - /// Status of the namespace. It can be any of these values:1 = Created/Active2 = Creating3 = Suspended4 = Deleting. - /// The time the namespace was created. - /// The time the namespace was updated. - /// Endpoint you can use to perform NotificationHub operations. - /// The Id of the Azure subscription associated with the namespace. - /// ScaleUnit where the namespace gets created. - /// Whether or not the namespace is currently enabled. - /// Whether or not the namespace is set as Critical. - /// Data center for the namespace. - /// The namespace type. - /// The sku of the created namespace. - /// A new instance for mocking. - public static NotificationHubNamespaceCreateOrUpdateContent NotificationHubNamespaceCreateOrUpdateContent(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string namespaceName = null, string provisioningState = null, string region = null, string metricId = null, string status = null, DateTimeOffset? createdOn = null, DateTimeOffset? updatedOn = null, Uri serviceBusEndpoint = null, string subscriptionId = null, string scaleUnit = null, bool? isEnabled = null, bool? isCritical = null, string dataCenter = null, NotificationHubNamespaceType? namespaceType = null, NotificationHubSku sku = null) + /// NotificationHub properties. + /// The Sku description for a namespace. + /// 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, NotificationHubProperties properties = null, NotificationHubSku sku = null) { tags ??= new Dictionary(); - return new NotificationHubNamespaceCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, namespaceName, provisioningState, region, metricId, status, createdOn, updatedOn, serviceBusEndpoint, subscriptionId, scaleUnit, isEnabled, isCritical, dataCenter, namespaceType, sku); + return new NotificationHubData(id, name, resourceType, systemData, tags, location, properties, sku); } - /// Initializes a new instance of NotificationHubNamespaceData. + /// Initializes a new instance of NotificationHubProperties. + /// 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 NotificationHubProperties NotificationHubProperties(string notificationHubName = null, string registrationTtl = null, IEnumerable authorizationRules = null, ApnsCredentialProperties apnsCredentialProperties = null, WnsCredentialProperties wnsCredentialProperties = null, GcmCredentialProperties gcmCredentialProperties = null, MpnsCredentialProperties mpnsCredentialProperties = null, AdmCredentialProperties admCredentialProperties = null, BaiduCredentialProperties baiduCredentialProperties = null, BrowserCredentialProperties browserCredentialProperties = null, XiaomiCredentialProperties xiaomiCredentialProperties = null, FcmV1CredentialProperties fcmV1CredentialProperties = null, long? dailyMaxActiveDevices = null) + { + authorizationRules ??= new List(); + + return new NotificationHubProperties(notificationHubName, registrationTtl, authorizationRules?.ToList(), apnsCredentialProperties != null ? new NotificationHubApnsCredential(apnsCredentialProperties) : null, wnsCredentialProperties != null ? new NotificationHubWnsCredential(wnsCredentialProperties) : null, gcmCredentialProperties != null ? new NotificationHubGcmCredential(gcmCredentialProperties) : null, mpnsCredentialProperties != null ? new NotificationHubMpnsCredential(mpnsCredentialProperties) : null, admCredentialProperties != null ? new NotificationHubAdmCredential(admCredentialProperties) : null, baiduCredentialProperties != null ? new NotificationHubBaiduCredential(baiduCredentialProperties) : null, browserCredentialProperties != null ? new BrowserCredential(browserCredentialProperties) : null, xiaomiCredentialProperties != null ? new XiaomiCredential(xiaomiCredentialProperties) : null, fcmV1CredentialProperties != null ? new FcmV1Credential(fcmV1CredentialProperties) : null, dailyMaxActiveDevices); + } + + /// Initializes a new instance of SharedAccessAuthorizationRuleProperties. + /// 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 rights = 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) + { + rights ??= new List(); + + return new SharedAccessAuthorizationRuleProperties(rights?.ToList(), primaryKey, secondaryKey, keyName, modifiedOn, createdOn, claimType, claimValue, revision); + } + + /// Initializes a new instance of NotificationHubTestSendResult. /// The id. /// The name. /// The resourceType. /// The systemData. /// The tags. /// The location. - /// The name of the namespace. - /// Provisioning state of the Namespace. - /// Specifies the targeted region in which the namespace should be created. It can be any of the following values: Australia East, Australia Southeast, Central US, East US, East US 2, West US, North Central US, South Central US, East Asia, Southeast Asia, Brazil South, Japan East, Japan West, North Europe, West Europe. - /// Identifier for Azure Insights metrics. - /// Status of the namespace. It can be any of these values:1 = Created/Active2 = Creating3 = Suspended4 = Deleting. - /// The time the namespace was created. - /// The time the namespace was updated. - /// Endpoint you can use to perform NotificationHub operations. - /// The Id of the Azure subscription associated with the namespace. - /// ScaleUnit where the namespace gets created. - /// Whether or not the namespace is currently enabled. - /// Whether or not the namespace is set as Critical. - /// Data center for the namespace. - /// The namespace type. - /// The sku of the created namespace. - /// A new instance for mocking. - public static NotificationHubNamespaceData NotificationHubNamespaceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string namespaceName = null, string provisioningState = null, string region = null, string metricId = null, string status = null, DateTimeOffset? createdOn = null, DateTimeOffset? updatedOn = null, Uri serviceBusEndpoint = null, string subscriptionId = null, string scaleUnit = null, bool? isEnabled = null, bool? isCritical = null, string dataCenter = null, NotificationHubNamespaceType? namespaceType = null, NotificationHubSku sku = null) + /// Result of DebugSend operations. + /// 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, DebugSendResult properties = null) { tags ??= new Dictionary(); - return new NotificationHubNamespaceData(id, name, resourceType, systemData, tags, location, namespaceName, provisioningState, region, metricId, status, createdOn, updatedOn, serviceBusEndpoint, subscriptionId, scaleUnit, isEnabled, isCritical, dataCenter, namespaceType, sku); + return new NotificationHubTestSendResult(id, name, resourceType, systemData, tags, location, properties); } - /// Initializes a new instance of SharedAccessAuthorizationRuleProperties. - /// The rights associated with the rule. - /// A base64-encoded 256-bit primary key for signing and validating the SAS token. - /// A base64-encoded 256-bit primary key for signing and validating the SAS token. - /// A string that describes the authorization rule. - /// A string that describes the claim type. - /// A string that describes the claim value. - /// The last modified time for this rule. - /// The created time for this rule. - /// The revision number for the rule. - /// A new instance for mocking. - public static SharedAccessAuthorizationRuleProperties SharedAccessAuthorizationRuleProperties(IEnumerable rights = null, string primaryKey = null, string secondaryKey = null, string keyName = null, string claimType = null, string claimValue = null, DateTimeOffset? modifiedOn = null, DateTimeOffset? createdOn = null, int? revision = null) + /// Initializes a new instance of DebugSendResult. + /// Gets or sets successful send. + /// Gets or sets send failure. + /// Gets or sets actual failure description. + /// A new instance for mocking. + public static DebugSendResult DebugSendResult(long? success = null, long? failure = null, IEnumerable results = null) { - rights ??= new List(); + results ??= new List(); - return new SharedAccessAuthorizationRuleProperties(rights?.ToList(), primaryKey, secondaryKey, keyName, claimType, claimValue, modifiedOn, createdOn, revision); + return new DebugSendResult(success, failure, results?.ToList()); + } + + /// Initializes a new instance of RegistrationResult. + /// PNS type. + /// PNS handle. + /// Registration id. + /// Notification outcome. + /// A new instance for mocking. + public static RegistrationResult RegistrationResult(string applicationPlatform = null, string pnsHandle = null, string registrationId = null, string outcome = null) + { + return new RegistrationResult(applicationPlatform, pnsHandle, registrationId, outcome); } /// Initializes a new instance of NotificationHubAuthorizationRuleData. @@ -119,154 +146,159 @@ public static SharedAccessAuthorizationRuleProperties SharedAccessAuthorizationR /// The systemData. /// The tags. /// The location. - /// The rights associated with the rule. - /// A base64-encoded 256-bit primary key for signing and validating the SAS token. - /// A base64-encoded 256-bit primary key for signing and validating the SAS token. - /// A string that describes the authorization rule. - /// A string that describes the claim type. - /// A string that describes the claim value. - /// The last modified time for this rule. - /// The created time for this rule. - /// The revision number for the rule. - /// The sku of the created namespace. + /// SharedAccessAuthorizationRule properties. /// 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 rights = null, string primaryKey = null, string secondaryKey = null, string keyName = null, string claimType = null, string claimValue = null, DateTimeOffset? modifiedOn = null, DateTimeOffset? createdOn = null, int? revision = null, NotificationHubSku sku = null) + public static NotificationHubAuthorizationRuleData NotificationHubAuthorizationRuleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SharedAccessAuthorizationRuleProperties properties = null) { tags ??= new Dictionary(); - rights ??= new List(); - return new NotificationHubAuthorizationRuleData(id, name, resourceType, systemData, tags, location, rights?.ToList(), primaryKey, secondaryKey, keyName, claimType, claimValue, modifiedOn, createdOn, revision, sku); + return new NotificationHubAuthorizationRuleData(id, name, resourceType, systemData, tags, location, properties); } /// Initializes a new instance of NotificationHubResourceKeys. - /// PrimaryConnectionString of the AuthorizationRule. - /// SecondaryConnectionString of the created AuthorizationRule. - /// PrimaryKey of the created AuthorizationRule. - /// SecondaryKey of the created AuthorizationRule. - /// KeyName of the created AuthorizationRule. + /// 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); } - /// Initializes a new instance of NotificationHubCreateOrUpdateContent. + /// Initializes a new instance of NotificationHubPnsCredentials. /// The id. /// The name. /// The resourceType. /// The systemData. /// The tags. /// The location. - /// The NotificationHub name. - /// The RegistrationTtl of the created NotificationHub. - /// The AuthorizationRules of the created NotificationHub. - /// The ApnsCredential of the created NotificationHub. - /// The WnsCredential of the created NotificationHub. - /// The GcmCredential of the created NotificationHub. - /// The MpnsCredential of the created NotificationHub. - /// The AdmCredential of the created NotificationHub. - /// The BaiduCredential of the created NotificationHub. - /// The sku of the created namespace. - /// A new instance for mocking. - public static NotificationHubCreateOrUpdateContent NotificationHubCreateOrUpdateContent(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, 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, NotificationHubSku sku = null) + /// Collection of Notification Hub or Notification Hub Namespace PNS credentials. + /// 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, PnsCredentials properties = null) { tags ??= new Dictionary(); - authorizationRules ??= new List(); - return new NotificationHubCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, notificationHubName, registrationTtl, authorizationRules?.ToList(), apnsCredential, wnsCredential, gcmCredential, mpnsCredential, admCredential, baiduCredential, sku); + return new NotificationHubPnsCredentials(id, name, resourceType, systemData, tags, location, properties); } - /// Initializes a new instance of NotificationHubData. + /// Initializes a new instance of NotificationHubNamespaceData. /// The id. /// The name. /// The resourceType. /// The systemData. /// The tags. /// The location. - /// The NotificationHub name. - /// The RegistrationTtl of the created NotificationHub. - /// The AuthorizationRules of the created NotificationHub. - /// The ApnsCredential of the created NotificationHub. - /// The WnsCredential of the created NotificationHub. - /// The GcmCredential of the created NotificationHub. - /// The MpnsCredential of the created NotificationHub. - /// The AdmCredential of the created NotificationHub. - /// The BaiduCredential of the created NotificationHub. - /// The sku of the created namespace. - /// 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, 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, NotificationHubSku sku = null) + /// The Sku description for a namespace. + /// Represents namespace properties. + /// A new instance for mocking. + public static NotificationHubNamespaceData NotificationHubNamespaceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NotificationHubSku sku = null, NamespaceProperties properties = null) { tags ??= new Dictionary(); - authorizationRules ??= new List(); - return new NotificationHubData(id, name, resourceType, systemData, tags, location, notificationHubName, registrationTtl, authorizationRules?.ToList(), apnsCredential, wnsCredential, gcmCredential, mpnsCredential, admCredential, baiduCredential, sku); + return new NotificationHubNamespaceData(id, name, resourceType, systemData, tags, location, sku, properties); } - /// Initializes a new instance of NotificationHubPatch. - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The NotificationHub name. - /// The RegistrationTtl of the created NotificationHub. - /// The AuthorizationRules of the created NotificationHub. - /// The ApnsCredential of the created NotificationHub. - /// The WnsCredential of the created NotificationHub. - /// The GcmCredential of the created NotificationHub. - /// The MpnsCredential of the created NotificationHub. - /// The AdmCredential of the created NotificationHub. - /// The BaiduCredential of the created NotificationHub. - /// The sku of the created namespace. - /// A new instance for mocking. - public static NotificationHubPatch NotificationHubPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, 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, NotificationHubSku sku = null) + /// Initializes a new instance of NamespaceProperties. + /// + /// Name of the Notification Hubs namespace. This is immutable property, set automatically + /// by the service when the namespace is created. + /// + /// Defines values for OperationProvisioningState. + /// Namespace status. + /// Gets or sets whether or not the namespace is currently enabled. + /// Gets or sets whether or not the namespace is set as Critical. + /// Namespace subscription id. + /// + /// Region. The value is always set to the same value as Namespace.Location, so we are deprecating + /// this property. + /// + /// Azure Insights Metrics id. + /// Time when the namespace was created. + /// Time when the namespace was updated. + /// Defines values for NamespaceType. + /// Allowed replication region. + /// Namespace SKU name. + /// A collection of network authorization rules. + /// Collection of Notification Hub or Notification Hub Namespace PNS credentials. + /// + /// Gets or sets endpoint you can use to perform NotificationHub + /// operations. + /// + /// Private Endpoint Connections for namespace. + /// Gets or sets scaleUnit where the namespace gets created. + /// Deprecated. + /// Type of public network access. + /// A new instance for mocking. + public static NamespaceProperties NamespaceProperties(string namespaceName = null, OperationProvisioningState? provisioningState = null, NamespaceStatus? status = null, bool? enabled = null, bool? critical = null, string subscriptionId = null, string region = null, string metricId = null, DateTimeOffset? createdOn = null, DateTimeOffset? updatedOn = null, NotificationHubNamespaceType? namespaceType = null, ReplicationRegion? replicationRegion = null, ZoneRedundancyPreference? zoneRedundancy = null, NetworkAcls networkAcls = null, PnsCredentials pnsCredentials = null, string serviceBusEndpoint = null, IEnumerable privateEndpointConnections = null, string scaleUnit = null, string dataCenter = null, PublicNetworkAccess? publicNetworkAccess = null) { - tags ??= new Dictionary(); - authorizationRules ??= new List(); + privateEndpointConnections ??= new List(); - return new NotificationHubPatch(id, name, resourceType, systemData, tags, location, notificationHubName, registrationTtl, authorizationRules?.ToList(), apnsCredential, wnsCredential, gcmCredential, mpnsCredential, admCredential, baiduCredential, sku); + return new NamespaceProperties(namespaceName, provisioningState, status, enabled, critical, subscriptionId, region, metricId, createdOn, updatedOn, namespaceType, replicationRegion, zoneRedundancy, networkAcls, pnsCredentials, serviceBusEndpoint, privateEndpointConnections?.ToList(), scaleUnit, dataCenter, publicNetworkAccess); } - /// Initializes a new instance of NotificationHubTestSendResult. + /// Initializes a new instance of PrivateEndpointConnectionResourceData. /// The id. /// The name. /// The resourceType. /// The systemData. - /// The tags. - /// The location. - /// successful send. - /// send failure. - /// actual failure description. - /// The sku of the created namespace. - /// 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, BinaryData results = null, NotificationHubSku sku = null) + /// Private Endpoint Connection properties. + /// A new instance for mocking. + public static PrivateEndpointConnectionResourceData PrivateEndpointConnectionResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, PrivateEndpointConnectionProperties properties = null) { - tags ??= new Dictionary(); + return new PrivateEndpointConnectionResourceData(id, name, resourceType, systemData, properties); + } + + /// Initializes a new instance of PrivateEndpointConnectionProperties. + /// State of Private Endpoint Connection. + /// Represents a Private Endpoint that is connected to Notification Hubs namespace using Private Endpoint Connection. + /// List of group ids. For Notification Hubs, it always contains a single "namespace" element. + /// State of the Private Link Service connection. + /// A new instance for mocking. + public static PrivateEndpointConnectionProperties PrivateEndpointConnectionProperties(NotificationHubsPrivateEndpointConnectionProvisioningState? provisioningState = null, ResourceIdentifier privateEndpointId = null, IEnumerable groupIds = null, RemotePrivateLinkServiceConnectionState connectionState = null) + { + groupIds ??= new List(); - return new NotificationHubTestSendResult(id, name, resourceType, systemData, tags, location, success, failure, results, sku); + return new PrivateEndpointConnectionProperties(provisioningState, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, groupIds?.ToList(), connectionState); } - /// Initializes a new instance of NotificationHubPnsCredentials. + /// Initializes a new instance of RemotePrivateLinkServiceConnectionState. + /// State of Private Link Connection. + /// Human-friendly description. + /// Human-friendly description of required actions. + /// A new instance for mocking. + public static RemotePrivateLinkServiceConnectionState RemotePrivateLinkServiceConnectionState(PrivateLinkConnectionStatus? status = null, string description = null, string actionsRequired = null) + { + return new RemotePrivateLinkServiceConnectionState(status, description, actionsRequired); + } + + /// Initializes a new instance of NotificationHubsPrivateLinkResourceData. /// The id. /// The name. /// The resourceType. /// The systemData. - /// The tags. - /// The location. - /// The ApnsCredential of the created NotificationHub. - /// The WnsCredential of the created NotificationHub. - /// The GcmCredential of the created NotificationHub. - /// The MpnsCredential of the created NotificationHub. - /// The AdmCredential of the created NotificationHub. - /// The BaiduCredential of the created NotificationHub. - /// The sku of the created namespace. - /// 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, NotificationHubApnsCredential apnsCredential = null, NotificationHubWnsCredential wnsCredential = null, NotificationHubGcmCredential gcmCredential = null, NotificationHubMpnsCredential mpnsCredential = null, NotificationHubAdmCredential admCredential = null, NotificationHubBaiduCredential baiduCredential = null, NotificationHubSku sku = null) + /// Represents properties of Private Link Resource. + /// A new instance for mocking. + public static NotificationHubsPrivateLinkResourceData NotificationHubsPrivateLinkResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, NotificationHubsPrivateLinkResourceProperties properties = null) { - tags ??= new Dictionary(); + return new NotificationHubsPrivateLinkResourceData(id, name, resourceType, systemData, properties); + } + + /// Initializes a new instance of NotificationHubsPrivateLinkResourceProperties. + /// A Group Id for Private Link. For Notification Hubs, it is always set to "namespace". + /// Required members. For Notification Hubs, it's always a collection with a single "namespace" item. + /// Required DNS zone names. For Notification Hubs, it contains two CNames for Service Bus and Notification Hubs zones. + /// A new instance for mocking. + public static NotificationHubsPrivateLinkResourceProperties NotificationHubsPrivateLinkResourceProperties(string groupId = null, IEnumerable requiredMembers = null, IEnumerable requiredZoneNames = null) + { + requiredMembers ??= new List(); + requiredZoneNames ??= new List(); - return new NotificationHubPnsCredentials(id, name, resourceType, systemData, tags, location, apnsCredential, wnsCredential, gcmCredential, mpnsCredential, admCredential, baiduCredential, sku); + return new NotificationHubsPrivateLinkResourceProperties(groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList()); } } } 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 abb488051ec2..52ba14eb417a 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/NotificationHubsExtensions.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/NotificationHubsExtensions.cs @@ -50,77 +50,115 @@ private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtens return new SubscriptionResourceExtensionClient(client, scope); }); } - #region NotificationHubNamespaceResource + #region NotificationHubResource /// - /// 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 instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static NotificationHubNamespaceResource GetNotificationHubNamespaceResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static NotificationHubResource GetNotificationHubResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - NotificationHubNamespaceResource.ValidateResourceId(id); - return new NotificationHubNamespaceResource(client, id); + NotificationHubResource.ValidateResourceId(id); + return new NotificationHubResource(client, id); } ); } #endregion - #region NotificationHubNamespaceAuthorizationRuleResource + #region NamespaceNotificationHubAuthorizationRuleResource /// - /// 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 instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static NotificationHubNamespaceAuthorizationRuleResource GetNotificationHubNamespaceAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static NamespaceNotificationHubAuthorizationRuleResource GetNamespaceNotificationHubAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - NotificationHubNamespaceAuthorizationRuleResource.ValidateResourceId(id); - return new NotificationHubNamespaceAuthorizationRuleResource(client, id); + NamespaceNotificationHubAuthorizationRuleResource.ValidateResourceId(id); + return new NamespaceNotificationHubAuthorizationRuleResource(client, id); } ); } #endregion - #region NotificationHubAuthorizationRuleResource + #region NamespaceAuthorizationRuleResource /// - /// 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 instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static NotificationHubAuthorizationRuleResource GetNotificationHubAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static NamespaceAuthorizationRuleResource GetNamespaceAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - NotificationHubAuthorizationRuleResource.ValidateResourceId(id); - return new NotificationHubAuthorizationRuleResource(client, id); + NamespaceAuthorizationRuleResource.ValidateResourceId(id); + return new NamespaceAuthorizationRuleResource(client, id); } ); } #endregion - #region NotificationHubResource + #region NotificationHubNamespaceResource /// - /// 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 instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static NotificationHubResource GetNotificationHubResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static NotificationHubNamespaceResource GetNotificationHubNamespaceResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - NotificationHubResource.ValidateResourceId(id); - return new NotificationHubResource(client, id); + NotificationHubNamespaceResource.ValidateResourceId(id); + return new NotificationHubNamespaceResource(client, id); + } + ); + } + #endregion + + #region PrivateEndpointConnectionResource + /// + /// 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 instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static PrivateEndpointConnectionResource GetPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + PrivateEndpointConnectionResource.ValidateResourceId(id); + return new PrivateEndpointConnectionResource(client, id); + } + ); + } + #endregion + + #region NotificationHubsPrivateLinkResource + /// + /// 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 instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static NotificationHubsPrivateLinkResource GetNotificationHubsPrivateLinkResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + NotificationHubsPrivateLinkResource.ValidateResourceId(id); + return new NotificationHubsPrivateLinkResource(client, id); } ); } @@ -135,7 +173,7 @@ public static NotificationHubNamespaceCollection GetNotificationHubNamespaces(th } /// - /// Returns the description for the specified namespace. + /// Returns the given namespace. /// /// /// Request Path @@ -148,7 +186,7 @@ public static NotificationHubNamespaceCollection GetNotificationHubNamespaces(th /// /// /// The instance the method will execute against. - /// The namespace name. + /// Namespace name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -159,7 +197,7 @@ public static async Task> GetNotifica } /// - /// Returns the description for the specified namespace. + /// Returns the given namespace. /// /// /// Request Path @@ -172,7 +210,7 @@ public static async Task> GetNotifica /// /// /// The instance the method will execute against. - /// The namespace name. + /// Namespace name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -196,7 +234,7 @@ public static Response GetNotificationHubNames /// /// /// The instance the method will execute against. - /// The namespace name. + /// Request content. /// The cancellation token to use. /// is null. public static async Task> CheckNotificationHubNamespaceAvailabilityAsync(this SubscriptionResource subscriptionResource, NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) @@ -220,7 +258,7 @@ public static async Task> CheckNotif /// /// /// The instance the method will execute against. - /// The namespace name. + /// Request content. /// The cancellation token to use. /// is null. public static Response CheckNotificationHubNamespaceAvailability(this SubscriptionResource subscriptionResource, NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) @@ -231,7 +269,7 @@ public static Response CheckNotificationHubNa } /// - /// Lists all the available namespaces within the subscription irrespective of the resourceGroups. + /// Lists all the available namespaces within the subscription. /// /// /// Request Path @@ -244,15 +282,17 @@ public static Response CheckNotificationHubNa /// /// /// The instance the method will execute against. + /// Skip token for subsequent requests. + /// Maximum number of results to return. /// The cancellation token to use. /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetNotificationHubNamespacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + public static AsyncPageable GetNotificationHubNamespacesAsync(this SubscriptionResource subscriptionResource, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNotificationHubNamespacesAsync(cancellationToken); + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNotificationHubNamespacesAsync(skipToken, top, cancellationToken); } /// - /// Lists all the available namespaces within the subscription irrespective of the resourceGroups. + /// Lists all the available namespaces within the subscription. /// /// /// Request Path @@ -265,11 +305,13 @@ public static AsyncPageable GetNotificationHub /// /// /// The instance the method will execute against. + /// Skip token for subsequent requests. + /// Maximum number of results to return. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetNotificationHubNamespaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + public static Pageable GetNotificationHubNamespaces(this SubscriptionResource subscriptionResource, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNotificationHubNamespaces(cancellationToken); + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNotificationHubNamespaces(skipToken, top, cancellationToken); } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index d7306a039ab7..5a9f4878b437 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -57,7 +57,7 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// /// /// - /// The namespace name. + /// Request content. /// The cancellation token to use. public virtual async Task> CheckNotificationHubNamespaceAvailabilityAsync(NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) { @@ -88,7 +88,7 @@ public virtual async Task> CheckNoti /// /// /// - /// The namespace name. + /// Request content. /// The cancellation token to use. public virtual Response CheckNotificationHubNamespaceAvailability(NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) { @@ -107,7 +107,7 @@ public virtual Response CheckNotificationHubN } /// - /// Lists all the available namespaces within the subscription irrespective of the resourceGroups. + /// Lists all the available namespaces within the subscription. /// /// /// Request Path @@ -119,17 +119,19 @@ public virtual Response CheckNotificationHubN /// /// /// + /// Skip token for subsequent requests. + /// Maximum number of results to return. /// The cancellation token to use. /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNotificationHubNamespacesAsync(CancellationToken cancellationToken = default) + public virtual AsyncPageable GetNotificationHubNamespacesAsync(string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => NotificationHubNamespaceNamespacesRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NotificationHubNamespaceNamespacesRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + HttpMessage FirstPageRequest(int? pageSizeHint) => NotificationHubNamespaceNamespacesRestClient.CreateListAllRequest(Id.SubscriptionId, skipToken, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NotificationHubNamespaceNamespacesRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId, skipToken, top); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NotificationHubNamespaceResource(Client, NotificationHubNamespaceData.DeserializeNotificationHubNamespaceData(e)), NotificationHubNamespaceNamespacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNotificationHubNamespaces", "value", "nextLink", cancellationToken); } /// - /// Lists all the available namespaces within the subscription irrespective of the resourceGroups. + /// Lists all the available namespaces within the subscription. /// /// /// Request Path @@ -141,12 +143,14 @@ public virtual AsyncPageable GetNotificationHu /// /// /// + /// Skip token for subsequent requests. + /// Maximum number of results to return. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNotificationHubNamespaces(CancellationToken cancellationToken = default) + public virtual Pageable GetNotificationHubNamespaces(string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => NotificationHubNamespaceNamespacesRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NotificationHubNamespaceNamespacesRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + HttpMessage FirstPageRequest(int? pageSizeHint) => NotificationHubNamespaceNamespacesRestClient.CreateListAllRequest(Id.SubscriptionId, skipToken, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NotificationHubNamespaceNamespacesRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId, skipToken, top); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NotificationHubNamespaceResource(Client, NotificationHubNamespaceData.DeserializeNotificationHubNamespaceData(e)), NotificationHubNamespaceNamespacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNotificationHubNamespaces", "value", "nextLink", cancellationToken); } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/LongRunningOperation/NotificationHubNamespaceOperationSource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/LongRunningOperation/NotificationHubNamespaceOperationSource.cs new file mode 100644 index 000000000000..effd516d5f65 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/LongRunningOperation/NotificationHubNamespaceOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NotificationHubs +{ + internal class NotificationHubNamespaceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal NotificationHubNamespaceOperationSource(ArmClient client) + { + _client = client; + } + + NotificationHubNamespaceResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = NotificationHubNamespaceData.DeserializeNotificationHubNamespaceData(document.RootElement); + return new NotificationHubNamespaceResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = NotificationHubNamespaceData.DeserializeNotificationHubNamespaceData(document.RootElement); + return new NotificationHubNamespaceResource(_client, data); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/LongRunningOperation/PrivateEndpointConnectionResourceOperationSource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/LongRunningOperation/PrivateEndpointConnectionResourceOperationSource.cs new file mode 100644 index 000000000000..40e87e8479b5 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/LongRunningOperation/PrivateEndpointConnectionResourceOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NotificationHubs +{ + internal class PrivateEndpointConnectionResourceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal PrivateEndpointConnectionResourceOperationSource(ArmClient client) + { + _client = client; + } + + PrivateEndpointConnectionResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = PrivateEndpointConnectionResourceData.DeserializePrivateEndpointConnectionResourceData(document.RootElement); + return new PrivateEndpointConnectionResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = PrivateEndpointConnectionResourceData.DeserializePrivateEndpointConnectionResourceData(document.RootElement); + return new PrivateEndpointConnectionResource(_client, data); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/AdmCredentialProperties.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/AdmCredentialProperties.Serialization.cs new file mode 100644 index 000000000000..9bf855605c51 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/AdmCredentialProperties.Serialization.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class AdmCredentialProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("clientId"u8); + writer.WriteStringValue(ClientId); + writer.WritePropertyName("clientSecret"u8); + writer.WriteStringValue(ClientSecret); + writer.WritePropertyName("authTokenUrl"u8); + writer.WriteStringValue(AuthTokenUri.AbsoluteUri); + writer.WriteEndObject(); + } + + internal static AdmCredentialProperties DeserializeAdmCredentialProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string clientId = default; + string clientSecret = default; + Uri authTokenUrl = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("clientId"u8)) + { + clientId = property.Value.GetString(); + continue; + } + if (property.NameEquals("clientSecret"u8)) + { + clientSecret = property.Value.GetString(); + continue; + } + if (property.NameEquals("authTokenUrl"u8)) + { + authTokenUrl = new Uri(property.Value.GetString()); + continue; + } + } + return new AdmCredentialProperties(clientId, clientSecret, authTokenUrl); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/AdmCredentialProperties.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/AdmCredentialProperties.cs new file mode 100644 index 000000000000..97568d9729b2 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/AdmCredentialProperties.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub AdmCredential. + public partial class AdmCredentialProperties + { + /// Initializes a new instance of AdmCredentialProperties. + /// Gets or sets the client identifier. + /// Gets or sets the credential secret access key. + /// Gets or sets the URL of the authorization token. + /// , or is null. + public AdmCredentialProperties(string clientId, string clientSecret, Uri authTokenUri) + { + Argument.AssertNotNull(clientId, nameof(clientId)); + Argument.AssertNotNull(clientSecret, nameof(clientSecret)); + Argument.AssertNotNull(authTokenUri, nameof(authTokenUri)); + + ClientId = clientId; + ClientSecret = clientSecret; + AuthTokenUri = authTokenUri; + } + + /// Gets or sets the client identifier. + public string ClientId { get; set; } + /// Gets or sets the credential secret access key. + public string ClientSecret { get; set; } + /// Gets or sets the URL of the authorization token. + public Uri AuthTokenUri { get; set; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/ApnsCredentialProperties.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/ApnsCredentialProperties.Serialization.cs new file mode 100644 index 000000000000..9bd615697629 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/ApnsCredentialProperties.Serialization.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class ApnsCredentialProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ApnsCertificate)) + { + writer.WritePropertyName("apnsCertificate"u8); + writer.WriteStringValue(ApnsCertificate); + } + if (Optional.IsDefined(CertificateKey)) + { + writer.WritePropertyName("certificateKey"u8); + writer.WriteStringValue(CertificateKey); + } + writer.WritePropertyName("endpoint"u8); + writer.WriteStringValue(Endpoint); + if (Optional.IsDefined(Thumbprint)) + { + writer.WritePropertyName("thumbprint"u8); + writer.WriteStringValue(Thumbprint); + } + if (Optional.IsDefined(KeyId)) + { + writer.WritePropertyName("keyId"u8); + writer.WriteStringValue(KeyId); + } + if (Optional.IsDefined(AppName)) + { + writer.WritePropertyName("appName"u8); + writer.WriteStringValue(AppName); + } + if (Optional.IsDefined(AppId)) + { + writer.WritePropertyName("appId"u8); + writer.WriteStringValue(AppId); + } + if (Optional.IsDefined(Token)) + { + writer.WritePropertyName("token"u8); + writer.WriteStringValue(Token); + } + writer.WriteEndObject(); + } + + internal static ApnsCredentialProperties DeserializeApnsCredentialProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional apnsCertificate = default; + Optional certificateKey = default; + string endpoint = default; + Optional thumbprint = default; + Optional keyId = default; + Optional appName = default; + Optional appId = default; + Optional token = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("apnsCertificate"u8)) + { + apnsCertificate = property.Value.GetString(); + continue; + } + if (property.NameEquals("certificateKey"u8)) + { + certificateKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("endpoint"u8)) + { + endpoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("thumbprint"u8)) + { + thumbprint = property.Value.GetString(); + continue; + } + if (property.NameEquals("keyId"u8)) + { + keyId = property.Value.GetString(); + continue; + } + if (property.NameEquals("appName"u8)) + { + appName = property.Value.GetString(); + continue; + } + if (property.NameEquals("appId"u8)) + { + appId = property.Value.GetString(); + continue; + } + if (property.NameEquals("token"u8)) + { + token = property.Value.GetString(); + continue; + } + } + return new ApnsCredentialProperties(apnsCertificate.Value, certificateKey.Value, endpoint, thumbprint.Value, keyId.Value, appName.Value, appId.Value, token.Value); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/ApnsCredentialProperties.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/ApnsCredentialProperties.cs new file mode 100644 index 000000000000..d9994a76a7a3 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/ApnsCredentialProperties.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub ApnsCredential. + public partial class ApnsCredentialProperties + { + /// Initializes a new instance of ApnsCredentialProperties. + /// Gets or sets the endpoint of this credential. + /// is null. + public ApnsCredentialProperties(string endpoint) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + + Endpoint = endpoint; + } + + /// Initializes a new instance of ApnsCredentialProperties. + /// Gets or sets the APNS certificate. + /// Gets or sets the certificate key. + /// Gets or sets the endpoint of this credential. + /// Gets or sets the APNS certificate Thumbprint. + /// + /// Gets or sets a 10-character key identifier (kid) key, obtained from + /// your developer account + /// + /// Gets or sets the name of the application. + /// + /// Gets or sets the issuer (iss) registered claim key, whose value is + /// your 10-character Team ID, obtained from your developer account + /// + /// + /// Gets or sets provider Authentication Token, obtained through your + /// developer account + /// + internal ApnsCredentialProperties(string apnsCertificate, string certificateKey, string endpoint, string thumbprint, string keyId, string appName, string appId, string token) + { + ApnsCertificate = apnsCertificate; + CertificateKey = certificateKey; + Endpoint = endpoint; + Thumbprint = thumbprint; + KeyId = keyId; + AppName = appName; + AppId = appId; + Token = token; + } + + /// Gets or sets the APNS certificate. + public string ApnsCertificate { get; set; } + /// Gets or sets the certificate key. + public string CertificateKey { get; set; } + /// Gets or sets the endpoint of this credential. + public string Endpoint { get; set; } + /// Gets or sets the APNS certificate Thumbprint. + public string Thumbprint { get; set; } + /// + /// Gets or sets a 10-character key identifier (kid) key, obtained from + /// your developer account + /// + public string KeyId { get; set; } + /// Gets or sets the name of the application. + public string AppName { get; set; } + /// + /// Gets or sets the issuer (iss) registered claim key, whose value is + /// your 10-character Team ID, obtained from your developer account + /// + public string AppId { get; set; } + /// + /// Gets or sets provider Authentication Token, obtained through your + /// developer account + /// + public string Token { get; set; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/AuthorizationRuleAccessRight.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/AuthorizationRuleAccessRight.Serialization.cs deleted file mode 100644 index 4ae0c95cc47c..000000000000 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/AuthorizationRuleAccessRight.Serialization.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.NotificationHubs.Models -{ - internal static partial class AuthorizationRuleAccessRightExtensions - { - public static string ToSerialString(this AuthorizationRuleAccessRight value) => value switch - { - AuthorizationRuleAccessRight.Manage => "Manage", - AuthorizationRuleAccessRight.Send => "Send", - AuthorizationRuleAccessRight.Listen => "Listen", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AuthorizationRuleAccessRight value.") - }; - - public static AuthorizationRuleAccessRight ToAuthorizationRuleAccessRight(this string value) - { - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Manage")) return AuthorizationRuleAccessRight.Manage; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Send")) return AuthorizationRuleAccessRight.Send; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Listen")) return AuthorizationRuleAccessRight.Listen; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AuthorizationRuleAccessRight value."); - } - } -} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/AuthorizationRuleAccessRight.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/AuthorizationRuleAccessRight.cs index 91f26f876391..44bdf7a9be57 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/AuthorizationRuleAccessRight.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/AuthorizationRuleAccessRight.cs @@ -5,16 +5,50 @@ #nullable disable +using System; +using System.ComponentModel; + namespace Azure.ResourceManager.NotificationHubs.Models { - /// The AuthorizationRuleAccessRight. - public enum AuthorizationRuleAccessRight + /// Defines values for AccessRights. + public readonly partial struct AuthorizationRuleAccessRight : IEquatable { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AuthorizationRuleAccessRight(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ManageValue = "Manage"; + private const string SendValue = "Send"; + private const string ListenValue = "Listen"; + /// Manage. - Manage, + public static AuthorizationRuleAccessRight Manage { get; } = new AuthorizationRuleAccessRight(ManageValue); /// Send. - Send, + public static AuthorizationRuleAccessRight Send { get; } = new AuthorizationRuleAccessRight(SendValue); /// Listen. - Listen + public static AuthorizationRuleAccessRight Listen { get; } = new AuthorizationRuleAccessRight(ListenValue); + /// Determines if two values are the same. + public static bool operator ==(AuthorizationRuleAccessRight left, AuthorizationRuleAccessRight right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AuthorizationRuleAccessRight left, AuthorizationRuleAccessRight right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AuthorizationRuleAccessRight(string value) => new AuthorizationRuleAccessRight(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AuthorizationRuleAccessRight other && Equals(other); + /// + public bool Equals(AuthorizationRuleAccessRight other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BaiduCredentialProperties.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BaiduCredentialProperties.Serialization.cs new file mode 100644 index 000000000000..84ebc395bbcf --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BaiduCredentialProperties.Serialization.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class BaiduCredentialProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("baiduApiKey"u8); + writer.WriteStringValue(BaiduApiKey); + writer.WritePropertyName("baiduEndPoint"u8); + writer.WriteStringValue(BaiduEndPoint); + writer.WritePropertyName("baiduSecretKey"u8); + writer.WriteStringValue(BaiduSecretKey); + writer.WriteEndObject(); + } + + internal static BaiduCredentialProperties DeserializeBaiduCredentialProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string baiduApiKey = default; + string baiduEndPoint = default; + string baiduSecretKey = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("baiduApiKey"u8)) + { + baiduApiKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("baiduEndPoint"u8)) + { + baiduEndPoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("baiduSecretKey"u8)) + { + baiduSecretKey = property.Value.GetString(); + continue; + } + } + return new BaiduCredentialProperties(baiduApiKey, baiduEndPoint, baiduSecretKey); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BaiduCredentialProperties.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BaiduCredentialProperties.cs new file mode 100644 index 000000000000..28d1f96fbe8a --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BaiduCredentialProperties.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub BaiduCredential. + public partial class BaiduCredentialProperties + { + /// Initializes a new instance of BaiduCredentialProperties. + /// Gets or sets baidu Api Key. + /// Gets or sets baidu Endpoint. + /// Gets or sets baidu Secret Key. + /// , or is null. + public BaiduCredentialProperties(string baiduApiKey, string baiduEndPoint, string baiduSecretKey) + { + Argument.AssertNotNull(baiduApiKey, nameof(baiduApiKey)); + Argument.AssertNotNull(baiduEndPoint, nameof(baiduEndPoint)); + Argument.AssertNotNull(baiduSecretKey, nameof(baiduSecretKey)); + + BaiduApiKey = baiduApiKey; + BaiduEndPoint = baiduEndPoint; + BaiduSecretKey = baiduSecretKey; + } + + /// Gets or sets baidu Api Key. + public string BaiduApiKey { get; set; } + /// Gets or sets baidu Endpoint. + public string BaiduEndPoint { get; set; } + /// Gets or sets baidu Secret Key. + public string BaiduSecretKey { get; set; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredential.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredential.Serialization.cs new file mode 100644 index 000000000000..3e81fc7bab92 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredential.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + internal partial class BrowserCredential : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + writer.WriteEndObject(); + } + + internal static BrowserCredential DeserializeBrowserCredential(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BrowserCredentialProperties properties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = BrowserCredentialProperties.DeserializeBrowserCredentialProperties(property.Value); + continue; + } + } + return new BrowserCredential(properties); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredential.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredential.cs new file mode 100644 index 000000000000..158f50f54752 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredential.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub BrowserCredential. + internal partial class BrowserCredential + { + /// Initializes a new instance of BrowserCredential. + /// Description of a NotificationHub BrowserCredential. + /// is null. + public BrowserCredential(BrowserCredentialProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + } + + /// Description of a NotificationHub BrowserCredential. + public BrowserCredentialProperties Properties { get; set; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredentialProperties.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredentialProperties.Serialization.cs new file mode 100644 index 000000000000..120a331c6a98 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredentialProperties.Serialization.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class BrowserCredentialProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("subject"u8); + writer.WriteStringValue(Subject); + writer.WritePropertyName("vapidPrivateKey"u8); + writer.WriteStringValue(VapidPrivateKey); + writer.WritePropertyName("vapidPublicKey"u8); + writer.WriteStringValue(VapidPublicKey); + writer.WriteEndObject(); + } + + internal static BrowserCredentialProperties DeserializeBrowserCredentialProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string subject = default; + string vapidPrivateKey = default; + string vapidPublicKey = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("subject"u8)) + { + subject = property.Value.GetString(); + continue; + } + if (property.NameEquals("vapidPrivateKey"u8)) + { + vapidPrivateKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("vapidPublicKey"u8)) + { + vapidPublicKey = property.Value.GetString(); + continue; + } + } + return new BrowserCredentialProperties(subject, vapidPrivateKey, vapidPublicKey); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredentialProperties.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredentialProperties.cs new file mode 100644 index 000000000000..691ffb0f9700 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredentialProperties.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub BrowserCredential. + public partial class BrowserCredentialProperties + { + /// Initializes a new instance of BrowserCredentialProperties. + /// Gets or sets web push subject. + /// Gets or sets VAPID private key. + /// Gets or sets VAPID public key. + /// , or is null. + public BrowserCredentialProperties(string subject, string vapidPrivateKey, string vapidPublicKey) + { + Argument.AssertNotNull(subject, nameof(subject)); + Argument.AssertNotNull(vapidPrivateKey, nameof(vapidPrivateKey)); + Argument.AssertNotNull(vapidPublicKey, nameof(vapidPublicKey)); + + Subject = subject; + VapidPrivateKey = vapidPrivateKey; + VapidPublicKey = vapidPublicKey; + } + + /// Gets or sets web push subject. + public string Subject { get; set; } + /// Gets or sets VAPID private key. + public string VapidPrivateKey { get; set; } + /// Gets or sets VAPID public key. + public string VapidPublicKey { get; set; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/DebugSendResult.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/DebugSendResult.Serialization.cs new file mode 100644 index 000000000000..5582e3d51e9c --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/DebugSendResult.Serialization.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class DebugSendResult : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static DebugSendResult DeserializeDebugSendResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional success = default; + Optional failure = default; + Optional> results = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("success"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + success = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("failure"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + failure = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("results"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RegistrationResult.DeserializeRegistrationResult(item)); + } + results = array; + continue; + } + } + return new DebugSendResult(Optional.ToNullable(success), Optional.ToNullable(failure), Optional.ToList(results)); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/DebugSendResult.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/DebugSendResult.cs new file mode 100644 index 000000000000..9f84f35c4da5 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/DebugSendResult.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Result of DebugSend operations. + public partial class DebugSendResult + { + /// Initializes a new instance of DebugSendResult. + public DebugSendResult() + { + Results = new ChangeTrackingList(); + } + + /// Initializes a new instance of DebugSendResult. + /// Gets or sets successful send. + /// Gets or sets send failure. + /// Gets or sets actual failure description. + internal DebugSendResult(long? success, long? failure, IReadOnlyList results) + { + Success = success; + Failure = failure; + Results = results; + } + + /// Gets or sets successful send. + public long? Success { get; } + /// Gets or sets send failure. + public long? Failure { get; } + /// Gets or sets actual failure description. + public IReadOnlyList Results { get; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1Credential.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1Credential.Serialization.cs new file mode 100644 index 000000000000..cb13cae2960e --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1Credential.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + internal partial class FcmV1Credential : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + writer.WriteEndObject(); + } + + internal static FcmV1Credential DeserializeFcmV1Credential(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FcmV1CredentialProperties properties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = FcmV1CredentialProperties.DeserializeFcmV1CredentialProperties(property.Value); + continue; + } + } + return new FcmV1Credential(properties); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1Credential.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1Credential.cs new file mode 100644 index 000000000000..a0bbce9e4973 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1Credential.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub FcmV1Credential. + internal partial class FcmV1Credential + { + /// Initializes a new instance of FcmV1Credential. + /// Description of a NotificationHub FcmV1Credential. + /// is null. + public FcmV1Credential(FcmV1CredentialProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + } + + /// Description of a NotificationHub FcmV1Credential. + public FcmV1CredentialProperties Properties { get; set; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1CredentialProperties.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1CredentialProperties.Serialization.cs new file mode 100644 index 000000000000..c9f57aaa9dbd --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1CredentialProperties.Serialization.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class FcmV1CredentialProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("clientEmail"u8); + writer.WriteStringValue(ClientEmail); + writer.WritePropertyName("privateKey"u8); + writer.WriteStringValue(PrivateKey); + writer.WritePropertyName("projectId"u8); + writer.WriteStringValue(ProjectId); + writer.WriteEndObject(); + } + + internal static FcmV1CredentialProperties DeserializeFcmV1CredentialProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string clientEmail = default; + string privateKey = default; + string projectId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("clientEmail"u8)) + { + clientEmail = property.Value.GetString(); + continue; + } + if (property.NameEquals("privateKey"u8)) + { + privateKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("projectId"u8)) + { + projectId = property.Value.GetString(); + continue; + } + } + return new FcmV1CredentialProperties(clientEmail, privateKey, projectId); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1CredentialProperties.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1CredentialProperties.cs new file mode 100644 index 000000000000..b097acd67b92 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1CredentialProperties.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub FcmV1Credential. + public partial class FcmV1CredentialProperties + { + /// Initializes a new instance of FcmV1CredentialProperties. + /// Gets or sets client email. + /// Gets or sets private key. + /// Gets or sets project id. + /// , or is null. + public FcmV1CredentialProperties(string clientEmail, string privateKey, string projectId) + { + Argument.AssertNotNull(clientEmail, nameof(clientEmail)); + Argument.AssertNotNull(privateKey, nameof(privateKey)); + Argument.AssertNotNull(projectId, nameof(projectId)); + + ClientEmail = clientEmail; + PrivateKey = privateKey; + ProjectId = projectId; + } + + /// Gets or sets client email. + public string ClientEmail { get; set; } + /// Gets or sets private key. + public string PrivateKey { get; set; } + /// Gets or sets project id. + public string ProjectId { get; set; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/GcmCredentialProperties.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/GcmCredentialProperties.Serialization.cs new file mode 100644 index 000000000000..345f371c1346 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/GcmCredentialProperties.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class GcmCredentialProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(GcmEndpoint)) + { + writer.WritePropertyName("gcmEndpoint"u8); + writer.WriteStringValue(GcmEndpoint); + } + writer.WritePropertyName("googleApiKey"u8); + writer.WriteStringValue(GoogleApiKey); + writer.WriteEndObject(); + } + + internal static GcmCredentialProperties DeserializeGcmCredentialProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional gcmEndpoint = default; + string googleApiKey = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("gcmEndpoint"u8)) + { + gcmEndpoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("googleApiKey"u8)) + { + googleApiKey = property.Value.GetString(); + continue; + } + } + return new GcmCredentialProperties(gcmEndpoint.Value, googleApiKey); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/GcmCredentialProperties.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/GcmCredentialProperties.cs new file mode 100644 index 000000000000..30efc2bbc5cd --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/GcmCredentialProperties.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub GcmCredential. + public partial class GcmCredentialProperties + { + /// Initializes a new instance of GcmCredentialProperties. + /// Gets or sets the Google API key. + /// is null. + public GcmCredentialProperties(string googleApiKey) + { + Argument.AssertNotNull(googleApiKey, nameof(googleApiKey)); + + GoogleApiKey = googleApiKey; + } + + /// Initializes a new instance of GcmCredentialProperties. + /// Gets or sets the GCM endpoint. + /// Gets or sets the Google API key. + internal GcmCredentialProperties(string gcmEndpoint, string googleApiKey) + { + GcmEndpoint = gcmEndpoint; + GoogleApiKey = googleApiKey; + } + + /// Gets or sets the GCM endpoint. + public string GcmEndpoint { get; set; } + /// Gets or sets the Google API key. + public string GoogleApiKey { get; set; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/IPRule.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/IPRule.Serialization.cs new file mode 100644 index 000000000000..3aec8210f606 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/IPRule.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class IPRule : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("ipMask"u8); + writer.WriteStringValue(IPMask); + writer.WritePropertyName("rights"u8); + writer.WriteStartArray(); + foreach (var item in Rights) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + writer.WriteEndObject(); + } + + internal static IPRule DeserializeIPRule(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string ipMask = default; + IList rights = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ipMask"u8)) + { + ipMask = property.Value.GetString(); + continue; + } + if (property.NameEquals("rights"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new AuthorizationRuleAccessRight(item.GetString())); + } + rights = array; + continue; + } + } + return new IPRule(ipMask, rights); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/IPRule.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/IPRule.cs new file mode 100644 index 000000000000..668294034413 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/IPRule.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// A network authorization rule that filters traffic based on IP address. + public partial class IPRule + { + /// Initializes a new instance of IPRule. + /// IP mask. + /// List of access rights. + /// or is null. + public IPRule(string ipMask, IEnumerable rights) + { + Argument.AssertNotNull(ipMask, nameof(ipMask)); + Argument.AssertNotNull(rights, nameof(rights)); + + IPMask = ipMask; + Rights = rights.ToList(); + } + + /// Initializes a new instance of IPRule. + /// IP mask. + /// List of access rights. + internal IPRule(string ipMask, IList rights) + { + IPMask = ipMask; + Rights = rights; + } + + /// IP mask. + public string IPMask { get; set; } + /// List of access rights. + public IList Rights { get; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/MpnsCredentialProperties.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/MpnsCredentialProperties.Serialization.cs new file mode 100644 index 000000000000..0f8357276608 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/MpnsCredentialProperties.Serialization.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class MpnsCredentialProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("mpnsCertificate"u8); + writer.WriteStringValue(MpnsCertificate); + writer.WritePropertyName("certificateKey"u8); + writer.WriteStringValue(CertificateKey); + writer.WritePropertyName("thumbprint"u8); + writer.WriteStringValue(Thumbprint); + writer.WriteEndObject(); + } + + internal static MpnsCredentialProperties DeserializeMpnsCredentialProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string mpnsCertificate = default; + string certificateKey = default; + string thumbprint = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("mpnsCertificate"u8)) + { + mpnsCertificate = property.Value.GetString(); + continue; + } + if (property.NameEquals("certificateKey"u8)) + { + certificateKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("thumbprint"u8)) + { + thumbprint = property.Value.GetString(); + continue; + } + } + return new MpnsCredentialProperties(mpnsCertificate, certificateKey, thumbprint); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/MpnsCredentialProperties.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/MpnsCredentialProperties.cs new file mode 100644 index 000000000000..4ae41cbb071b --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/MpnsCredentialProperties.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub MpnsCredential. + public partial class MpnsCredentialProperties + { + /// Initializes a new instance of MpnsCredentialProperties. + /// Gets or sets the MPNS certificate. + /// Gets or sets the certificate key for this credential. + /// Gets or sets the MPNS certificate Thumbprint. + /// , or is null. + public MpnsCredentialProperties(string mpnsCertificate, string certificateKey, string thumbprint) + { + Argument.AssertNotNull(mpnsCertificate, nameof(mpnsCertificate)); + Argument.AssertNotNull(certificateKey, nameof(certificateKey)); + Argument.AssertNotNull(thumbprint, nameof(thumbprint)); + + MpnsCertificate = mpnsCertificate; + CertificateKey = certificateKey; + Thumbprint = thumbprint; + } + + /// Gets or sets the MPNS certificate. + public string MpnsCertificate { get; set; } + /// Gets or sets the certificate key for this credential. + public string CertificateKey { get; set; } + /// Gets or sets the MPNS certificate Thumbprint. + public string Thumbprint { get; set; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NamespaceProperties.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NamespaceProperties.Serialization.cs new file mode 100644 index 000000000000..bb8b6b037c2b --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NamespaceProperties.Serialization.cs @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class NamespaceProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(NamespaceType)) + { + writer.WritePropertyName("namespaceType"u8); + writer.WriteStringValue(NamespaceType.Value.ToString()); + } + if (Optional.IsDefined(ReplicationRegion)) + { + writer.WritePropertyName("replicationRegion"u8); + writer.WriteStringValue(ReplicationRegion.Value.ToString()); + } + if (Optional.IsDefined(ZoneRedundancy)) + { + writer.WritePropertyName("zoneRedundancy"u8); + writer.WriteStringValue(ZoneRedundancy.Value.ToString()); + } + if (Optional.IsDefined(NetworkAcls)) + { + writer.WritePropertyName("networkAcls"u8); + writer.WriteObjectValue(NetworkAcls); + } + if (Optional.IsDefined(PnsCredentials)) + { + writer.WritePropertyName("pnsCredentials"u8); + writer.WriteObjectValue(PnsCredentials); + } + if (Optional.IsDefined(ScaleUnit)) + { + writer.WritePropertyName("scaleUnit"u8); + writer.WriteStringValue(ScaleUnit); + } + if (Optional.IsDefined(DataCenter)) + { + writer.WritePropertyName("dataCenter"u8); + writer.WriteStringValue(DataCenter); + } + if (Optional.IsDefined(PublicNetworkAccess)) + { + writer.WritePropertyName("publicNetworkAccess"u8); + writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static NamespaceProperties DeserializeNamespaceProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional provisioningState = default; + Optional status = default; + Optional enabled = default; + Optional critical = default; + Optional subscriptionId = default; + Optional region = default; + Optional metricId = default; + Optional createdAt = default; + Optional updatedAt = default; + Optional namespaceType = default; + Optional replicationRegion = default; + Optional zoneRedundancy = default; + Optional networkAcls = default; + Optional pnsCredentials = default; + Optional serviceBusEndpoint = default; + Optional> privateEndpointConnections = default; + Optional scaleUnit = default; + Optional dataCenter = default; + Optional publicNetworkAccess = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new OperationProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new NamespaceStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("critical"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + critical = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("region"u8)) + { + region = property.Value.GetString(); + continue; + } + if (property.NameEquals("metricId"u8)) + { + metricId = property.Value.GetString(); + continue; + } + if (property.NameEquals("createdAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("updatedAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updatedAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("namespaceType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + namespaceType = new NotificationHubNamespaceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("replicationRegion"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + replicationRegion = new ReplicationRegion(property.Value.GetString()); + continue; + } + if (property.NameEquals("zoneRedundancy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + zoneRedundancy = new ZoneRedundancyPreference(property.Value.GetString()); + continue; + } + if (property.NameEquals("networkAcls"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkAcls = NetworkAcls.DeserializeNetworkAcls(property.Value); + continue; + } + if (property.NameEquals("pnsCredentials"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + pnsCredentials = PnsCredentials.DeserializePnsCredentials(property.Value); + continue; + } + if (property.NameEquals("serviceBusEndpoint"u8)) + { + serviceBusEndpoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("privateEndpointConnections"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PrivateEndpointConnectionResourceData.DeserializePrivateEndpointConnectionResourceData(item)); + } + privateEndpointConnections = array; + continue; + } + if (property.NameEquals("scaleUnit"u8)) + { + scaleUnit = property.Value.GetString(); + continue; + } + if (property.NameEquals("dataCenter"u8)) + { + dataCenter = property.Value.GetString(); + continue; + } + if (property.NameEquals("publicNetworkAccess"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = new PublicNetworkAccess(property.Value.GetString()); + continue; + } + } + return new NamespaceProperties(name.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(status), Optional.ToNullable(enabled), Optional.ToNullable(critical), subscriptionId.Value, region.Value, metricId.Value, Optional.ToNullable(createdAt), Optional.ToNullable(updatedAt), Optional.ToNullable(namespaceType), Optional.ToNullable(replicationRegion), Optional.ToNullable(zoneRedundancy), networkAcls.Value, pnsCredentials.Value, serviceBusEndpoint.Value, Optional.ToList(privateEndpointConnections), scaleUnit.Value, dataCenter.Value, Optional.ToNullable(publicNetworkAccess)); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NamespaceProperties.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NamespaceProperties.cs new file mode 100644 index 000000000000..f4cc290c998a --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NamespaceProperties.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Represents namespace properties. + public partial class NamespaceProperties + { + /// Initializes a new instance of NamespaceProperties. + public NamespaceProperties() + { + PrivateEndpointConnections = new ChangeTrackingList(); + } + + /// Initializes a new instance of NamespaceProperties. + /// + /// Name of the Notification Hubs namespace. This is immutable property, set automatically + /// by the service when the namespace is created. + /// + /// Defines values for OperationProvisioningState. + /// Namespace status. + /// Gets or sets whether or not the namespace is currently enabled. + /// Gets or sets whether or not the namespace is set as Critical. + /// Namespace subscription id. + /// + /// Region. The value is always set to the same value as Namespace.Location, so we are deprecating + /// this property. + /// + /// Azure Insights Metrics id. + /// Time when the namespace was created. + /// Time when the namespace was updated. + /// Defines values for NamespaceType. + /// Allowed replication region. + /// Namespace SKU name. + /// A collection of network authorization rules. + /// Collection of Notification Hub or Notification Hub Namespace PNS credentials. + /// + /// Gets or sets endpoint you can use to perform NotificationHub + /// operations. + /// + /// Private Endpoint Connections for namespace. + /// Gets or sets scaleUnit where the namespace gets created. + /// Deprecated. + /// Type of public network access. + internal NamespaceProperties(string namespaceName, OperationProvisioningState? provisioningState, NamespaceStatus? status, bool? enabled, bool? critical, string subscriptionId, string region, string metricId, DateTimeOffset? createdOn, DateTimeOffset? updatedOn, NotificationHubNamespaceType? namespaceType, ReplicationRegion? replicationRegion, ZoneRedundancyPreference? zoneRedundancy, NetworkAcls networkAcls, PnsCredentials pnsCredentials, string serviceBusEndpoint, IReadOnlyList privateEndpointConnections, string scaleUnit, string dataCenter, PublicNetworkAccess? publicNetworkAccess) + { + NamespaceName = namespaceName; + ProvisioningState = provisioningState; + Status = status; + Enabled = enabled; + Critical = critical; + SubscriptionId = subscriptionId; + Region = region; + MetricId = metricId; + CreatedOn = createdOn; + UpdatedOn = updatedOn; + NamespaceType = namespaceType; + ReplicationRegion = replicationRegion; + ZoneRedundancy = zoneRedundancy; + NetworkAcls = networkAcls; + PnsCredentials = pnsCredentials; + ServiceBusEndpoint = serviceBusEndpoint; + PrivateEndpointConnections = privateEndpointConnections; + ScaleUnit = scaleUnit; + DataCenter = dataCenter; + PublicNetworkAccess = publicNetworkAccess; + } + + /// + /// Name of the Notification Hubs namespace. This is immutable property, set automatically + /// by the service when the namespace is created. + /// + public string NamespaceName { get; } + /// Defines values for OperationProvisioningState. + public OperationProvisioningState? ProvisioningState { get; set; } + /// Namespace status. + public NamespaceStatus? Status { get; set; } + /// Gets or sets whether or not the namespace is currently enabled. + public bool? Enabled { get; } + /// Gets or sets whether or not the namespace is set as Critical. + public bool? Critical { get; } + /// Namespace subscription id. + public string SubscriptionId { get; } + /// + /// Region. The value is always set to the same value as Namespace.Location, so we are deprecating + /// this property. + /// + public string Region { get; } + /// Azure Insights Metrics id. + public string MetricId { get; } + /// Time when the namespace was created. + public DateTimeOffset? CreatedOn { get; } + /// Time when the namespace was updated. + public DateTimeOffset? UpdatedOn { get; } + /// Defines values for NamespaceType. + public NotificationHubNamespaceType? NamespaceType { get; set; } + /// Allowed replication region. + public ReplicationRegion? ReplicationRegion { get; set; } + /// Namespace SKU name. + public ZoneRedundancyPreference? ZoneRedundancy { get; set; } + /// A collection of network authorization rules. + public NetworkAcls NetworkAcls { get; set; } + /// Collection of Notification Hub or Notification Hub Namespace PNS credentials. + public PnsCredentials PnsCredentials { get; set; } + /// + /// Gets or sets endpoint you can use to perform NotificationHub + /// operations. + /// + public string ServiceBusEndpoint { get; } + /// Private Endpoint Connections for namespace. + public IReadOnlyList PrivateEndpointConnections { get; } + /// Gets or sets scaleUnit where the namespace gets created. + public string ScaleUnit { get; set; } + /// Deprecated. + public string DataCenter { get; set; } + /// Type of public network access. + public PublicNetworkAccess? PublicNetworkAccess { get; set; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NamespaceStatus.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NamespaceStatus.cs new file mode 100644 index 000000000000..5f65356d6c9e --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NamespaceStatus.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Namespace status. + public readonly partial struct NamespaceStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NamespaceStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CreatedValue = "Created"; + private const string CreatingValue = "Creating"; + private const string SuspendedValue = "Suspended"; + private const string DeletingValue = "Deleting"; + + /// Created. + public static NamespaceStatus Created { get; } = new NamespaceStatus(CreatedValue); + /// Creating. + public static NamespaceStatus Creating { get; } = new NamespaceStatus(CreatingValue); + /// Suspended. + public static NamespaceStatus Suspended { get; } = new NamespaceStatus(SuspendedValue); + /// Deleting. + public static NamespaceStatus Deleting { get; } = new NamespaceStatus(DeletingValue); + /// Determines if two values are the same. + public static bool operator ==(NamespaceStatus left, NamespaceStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NamespaceStatus left, NamespaceStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator NamespaceStatus(string value) => new NamespaceStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NamespaceStatus other && Equals(other); + /// + public bool Equals(NamespaceStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NetworkAcls.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NetworkAcls.Serialization.cs new file mode 100644 index 000000000000..29b0459b868d --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NetworkAcls.Serialization.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class NetworkAcls : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(IPRules)) + { + writer.WritePropertyName("ipRules"u8); + writer.WriteStartArray(); + foreach (var item in IPRules) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(PublicNetworkRule)) + { + writer.WritePropertyName("publicNetworkRule"u8); + writer.WriteObjectValue(PublicNetworkRule); + } + writer.WriteEndObject(); + } + + internal static NetworkAcls DeserializeNetworkAcls(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> ipRules = default; + Optional publicNetworkRule = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ipRules"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(IPRule.DeserializeIPRule(item)); + } + ipRules = array; + continue; + } + if (property.NameEquals("publicNetworkRule"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkRule = PublicInternetAuthorizationRule.DeserializePublicInternetAuthorizationRule(property.Value); + continue; + } + } + return new NetworkAcls(Optional.ToList(ipRules), publicNetworkRule.Value); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NetworkAcls.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NetworkAcls.cs new file mode 100644 index 000000000000..1b827accef21 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NetworkAcls.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// A collection of network authorization rules. + public partial class NetworkAcls + { + /// Initializes a new instance of NetworkAcls. + public NetworkAcls() + { + IPRules = new ChangeTrackingList(); + } + + /// Initializes a new instance of NetworkAcls. + /// List of IP rules. + /// A default (public Internet) network authorization rule, which contains rights if no other network rule matches. + internal NetworkAcls(IList ipRules, PublicInternetAuthorizationRule publicNetworkRule) + { + IPRules = ipRules; + PublicNetworkRule = publicNetworkRule; + } + + /// List of IP rules. + public IList IPRules { get; } + /// A default (public Internet) network authorization rule, which contains rights if no other network rule matches. + internal PublicInternetAuthorizationRule PublicNetworkRule { get; set; } + /// List of access rights. + public IList PublicNetworkRuleRights + { + get => PublicNetworkRule is null ? default : PublicNetworkRule.Rights; + set => PublicNetworkRule = new PublicInternetAuthorizationRule(value); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAdmCredential.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAdmCredential.Serialization.cs index 740e74eacdb3..ed4be75f5cbf 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAdmCredential.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAdmCredential.Serialization.cs @@ -5,35 +5,18 @@ #nullable disable -using System; using System.Text.Json; using Azure.Core; namespace Azure.ResourceManager.NotificationHubs.Models { - public partial class NotificationHubAdmCredential : IUtf8JsonSerializable + internal partial class NotificationHubAdmCredential : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(ClientId)) - { - writer.WritePropertyName("clientId"u8); - writer.WriteStringValue(ClientId); - } - if (Optional.IsDefined(ClientSecret)) - { - writer.WritePropertyName("clientSecret"u8); - writer.WriteStringValue(ClientSecret); - } - if (Optional.IsDefined(AuthTokenUri)) - { - writer.WritePropertyName("authTokenUrl"u8); - writer.WriteStringValue(AuthTokenUri.AbsoluteUri); - } - writer.WriteEndObject(); + writer.WriteObjectValue(Properties); writer.WriteEndObject(); } @@ -43,44 +26,16 @@ internal static NotificationHubAdmCredential DeserializeNotificationHubAdmCreden { return null; } - Optional clientId = default; - Optional clientSecret = default; - Optional authTokenUrl = default; + AdmCredentialProperties properties = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("clientId"u8)) - { - clientId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("clientSecret"u8)) - { - clientSecret = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("authTokenUrl"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - authTokenUrl = new Uri(property0.Value.GetString()); - continue; - } - } + properties = AdmCredentialProperties.DeserializeAdmCredentialProperties(property.Value); continue; } } - return new NotificationHubAdmCredential(clientId.Value, clientSecret.Value, authTokenUrl.Value); + return new NotificationHubAdmCredential(properties); } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAdmCredential.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAdmCredential.cs index 45cc2110f032..a565cb4e7af3 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAdmCredential.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAdmCredential.cs @@ -6,33 +6,24 @@ #nullable disable using System; +using Azure.Core; namespace Azure.ResourceManager.NotificationHubs.Models { /// Description of a NotificationHub AdmCredential. - public partial class NotificationHubAdmCredential + internal partial class NotificationHubAdmCredential { /// Initializes a new instance of NotificationHubAdmCredential. - public NotificationHubAdmCredential() + /// Description of a NotificationHub AdmCredential. + /// is null. + public NotificationHubAdmCredential(AdmCredentialProperties properties) { - } + Argument.AssertNotNull(properties, nameof(properties)); - /// Initializes a new instance of NotificationHubAdmCredential. - /// The client identifier. - /// The credential secret access key. - /// The URL of the authorization token. - internal NotificationHubAdmCredential(string clientId, string clientSecret, Uri authTokenUri) - { - ClientId = clientId; - ClientSecret = clientSecret; - AuthTokenUri = authTokenUri; + Properties = properties; } - /// The client identifier. - public string ClientId { get; set; } - /// The credential secret access key. - public string ClientSecret { get; set; } - /// The URL of the authorization token. - public Uri AuthTokenUri { get; set; } + /// Description of a NotificationHub AdmCredential. + public AdmCredentialProperties Properties { get; set; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubApnsCredential.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubApnsCredential.Serialization.cs index c8740dd09320..d2d26aed132a 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubApnsCredential.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubApnsCredential.Serialization.cs @@ -5,7 +5,6 @@ #nullable disable -using System; using System.Text.Json; using Azure.Core; @@ -17,48 +16,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(ApnsCertificate)) - { - writer.WritePropertyName("apnsCertificate"u8); - writer.WriteStringValue(ApnsCertificate); - } - if (Optional.IsDefined(CertificateKey)) - { - writer.WritePropertyName("certificateKey"u8); - writer.WriteStringValue(CertificateKey); - } - if (Optional.IsDefined(Endpoint)) - { - writer.WritePropertyName("endpoint"u8); - writer.WriteStringValue(Endpoint.AbsoluteUri); - } - if (Optional.IsDefined(ThumbprintString)) - { - writer.WritePropertyName("thumbprint"u8); - writer.WriteStringValue(ThumbprintString); - } - if (Optional.IsDefined(KeyId)) - { - writer.WritePropertyName("keyId"u8); - writer.WriteStringValue(KeyId); - } - if (Optional.IsDefined(AppName)) - { - writer.WritePropertyName("appName"u8); - writer.WriteStringValue(AppName); - } - if (Optional.IsDefined(AppId)) - { - writer.WritePropertyName("appId"u8); - writer.WriteStringValue(AppId); - } - if (Optional.IsDefined(Token)) - { - writer.WritePropertyName("token"u8); - writer.WriteStringValue(Token); - } - writer.WriteEndObject(); + writer.WriteObjectValue(Properties); writer.WriteEndObject(); } @@ -68,74 +26,16 @@ internal static NotificationHubApnsCredential DeserializeNotificationHubApnsCred { return null; } - Optional apnsCertificate = default; - Optional certificateKey = default; - Optional endpoint = default; - Optional thumbprint = default; - Optional keyId = default; - Optional appName = default; - Optional appId = default; - Optional token = default; + ApnsCredentialProperties properties = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("apnsCertificate"u8)) - { - apnsCertificate = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("certificateKey"u8)) - { - certificateKey = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("endpoint"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - endpoint = new Uri(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("thumbprint"u8)) - { - thumbprint = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("keyId"u8)) - { - keyId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("appName"u8)) - { - appName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("appId"u8)) - { - appId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("token"u8)) - { - token = property0.Value.GetString(); - continue; - } - } + properties = ApnsCredentialProperties.DeserializeApnsCredentialProperties(property.Value); continue; } } - return new NotificationHubApnsCredential(apnsCertificate.Value, certificateKey.Value, endpoint.Value, thumbprint.Value, keyId.Value, appName.Value, appId.Value, token.Value); + return new NotificationHubApnsCredential(properties); } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubApnsCredential.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubApnsCredential.cs index 5262d3d99c08..b60596579cb2 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubApnsCredential.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubApnsCredential.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using Azure.Core; namespace Azure.ResourceManager.NotificationHubs.Models { @@ -13,46 +14,16 @@ namespace Azure.ResourceManager.NotificationHubs.Models public partial class NotificationHubApnsCredential { /// Initializes a new instance of NotificationHubApnsCredential. - public NotificationHubApnsCredential() + /// Description of a NotificationHub ApnsCredential. + /// is null. + public NotificationHubApnsCredential(ApnsCredentialProperties properties) { - } + Argument.AssertNotNull(properties, nameof(properties)); - /// Initializes a new instance of NotificationHubApnsCredential. - /// The APNS certificate. Specify if using Certificate Authentication Mode. - /// The APNS certificate password if it exists. - /// The APNS endpoint of this credential. If using Certificate Authentication Mode and Sandbox specify 'gateway.sandbox.push.apple.com'. If using Certificate Authentication Mode and Production specify 'gateway.push.apple.com'. If using Token Authentication Mode and Sandbox specify 'https://api.development.push.apple.com:443/3/device'. If using Token Authentication Mode and Production specify 'https://api.push.apple.com:443/3/device'. - /// The APNS certificate thumbprint. Specify if using Certificate Authentication Mode. - /// A 10-character key identifier (kid) key, obtained from your developer account. Specify if using Token Authentication Mode. - /// The name of the application or BundleId. Specify if using Token Authentication Mode. - /// The issuer (iss) registered claim key. The value is a 10-character TeamId, obtained from your developer account. Specify if using Token Authentication Mode. - /// Provider Authentication Token, obtained through your developer account. Specify if using Token Authentication Mode. - internal NotificationHubApnsCredential(string apnsCertificate, string certificateKey, Uri endpoint, string thumbprintString, string keyId, string appName, string appId, string token) - { - ApnsCertificate = apnsCertificate; - CertificateKey = certificateKey; - Endpoint = endpoint; - ThumbprintString = thumbprintString; - KeyId = keyId; - AppName = appName; - AppId = appId; - Token = token; + Properties = properties; } - /// The APNS certificate. Specify if using Certificate Authentication Mode. - public string ApnsCertificate { get; set; } - /// The APNS certificate password if it exists. - public string CertificateKey { get; set; } - /// The APNS endpoint of this credential. If using Certificate Authentication Mode and Sandbox specify 'gateway.sandbox.push.apple.com'. If using Certificate Authentication Mode and Production specify 'gateway.push.apple.com'. If using Token Authentication Mode and Sandbox specify 'https://api.development.push.apple.com:443/3/device'. If using Token Authentication Mode and Production specify 'https://api.push.apple.com:443/3/device'. - public Uri Endpoint { get; set; } - /// The APNS certificate thumbprint. Specify if using Certificate Authentication Mode. - public string ThumbprintString { get; set; } - /// A 10-character key identifier (kid) key, obtained from your developer account. Specify if using Token Authentication Mode. - public string KeyId { get; set; } - /// The name of the application or BundleId. Specify if using Token Authentication Mode. - public string AppName { get; set; } - /// The issuer (iss) registered claim key. The value is a 10-character TeamId, obtained from your developer account. Specify if using Token Authentication Mode. - public string AppId { get; set; } - /// Provider Authentication Token, obtained through your developer account. Specify if using Token Authentication Mode. - public string Token { get; set; } + /// Description of a NotificationHub ApnsCredential. + public ApnsCredentialProperties Properties { get; set; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAuthorizationRuleData.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAuthorizationRuleData.Serialization.cs index 45e5b1938bb3..de80b6be5f4a 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAuthorizationRuleData.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAuthorizationRuleData.Serialization.cs @@ -5,7 +5,6 @@ #nullable disable -using System; using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -19,10 +18,10 @@ public partial class NotificationHubAuthorizationRuleData : IUtf8JsonSerializabl void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsDefined(Sku)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); } if (Optional.IsCollectionDefined(Tags)) { @@ -37,19 +36,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsCollectionDefined(Rights)) - { - writer.WritePropertyName("rights"u8); - writer.WriteStartArray(); - foreach (var item in Rights) - { - writer.WriteStringValue(item.ToSerialString()); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); writer.WriteEndObject(); } @@ -59,31 +45,22 @@ internal static NotificationHubAuthorizationRuleData DeserializeNotificationHubA { return null; } - Optional sku = default; + Optional properties = default; Optional> tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; Optional systemData = default; - Optional> rights = default; - Optional primaryKey = default; - Optional secondaryKey = default; - Optional keyName = default; - Optional claimType = default; - Optional claimValue = default; - Optional modifiedTime = default; - Optional createdTime = default; - Optional revision = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("sku"u8)) + if (property.NameEquals("properties"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - sku = NotificationHubSku.DeserializeNotificationHubSku(property.Value); + properties = SharedAccessAuthorizationRuleProperties.DeserializeSharedAccessAuthorizationRuleProperties(property.Value); continue; } if (property.NameEquals("tags"u8)) @@ -129,86 +106,8 @@ internal static NotificationHubAuthorizationRuleData DeserializeNotificationHubA systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("rights"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString().ToAuthorizationRuleAccessRight()); - } - rights = array; - continue; - } - if (property0.NameEquals("primaryKey"u8)) - { - primaryKey = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("secondaryKey"u8)) - { - secondaryKey = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("keyName"u8)) - { - keyName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("claimType"u8)) - { - claimType = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("claimValue"u8)) - { - claimValue = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("modifiedTime"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - modifiedTime = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("createdTime"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createdTime = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("revision"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - revision = property0.Value.GetInt32(); - continue; - } - } - continue; - } } - return new NotificationHubAuthorizationRuleData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToList(rights), primaryKey.Value, secondaryKey.Value, keyName.Value, claimType.Value, claimValue.Value, Optional.ToNullable(modifiedTime), Optional.ToNullable(createdTime), Optional.ToNullable(revision), sku.Value); + return new NotificationHubAuthorizationRuleData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAvailabilityContent.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAvailabilityContent.Serialization.cs index 261cace453f4..8f9c61fbfad7 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAvailabilityContent.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAvailabilityContent.Serialization.cs @@ -15,16 +15,16 @@ public partial class NotificationHubAvailabilityContent : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsDefined(Sku)) - { - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); - } if (Optional.IsDefined(IsAvailiable)) { writer.WritePropertyName("isAvailiable"u8); writer.WriteBooleanValue(IsAvailiable.Value); } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku); + } if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAvailabilityContent.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAvailabilityContent.cs index edddba43e5b1..73272458017b 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAvailabilityContent.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAvailabilityContent.cs @@ -10,7 +10,10 @@ namespace Azure.ResourceManager.NotificationHubs.Models { - /// Parameters supplied to the Check Name Availability for Namespace and NotificationHubs. + /// + /// Parameters supplied to the Check Name Availability for Namespace and + /// NotificationHubs. + /// public partial class NotificationHubAvailabilityContent : TrackedResourceData { /// Initializes a new instance of NotificationHubAvailabilityContent. @@ -19,9 +22,9 @@ public NotificationHubAvailabilityContent(AzureLocation location) : base(locatio { } - /// The sku of the created namespace. - public NotificationHubSku Sku { get; set; } - /// True if the name is available and can be used to create new Namespace/NotificationHub. Otherwise false. + /// Not used and deprecated since API version 2023-01-01-preview. public bool? IsAvailiable { get; set; } + /// The Sku description for a namespace. + public NotificationHubSku Sku { get; set; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAvailabilityResult.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAvailabilityResult.cs index 2d8efb035beb..d51a2430003e 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAvailabilityResult.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAvailabilityResult.cs @@ -27,17 +27,23 @@ public NotificationHubAvailabilityResult(AzureLocation location) : base(location /// The systemData. /// The tags. /// The location. - /// True if the name is available and can be used to create new Namespace/NotificationHub. Otherwise false. - /// The sku of the created namespace. + /// + /// Gets or sets true if the name is available and can be used to + /// create new Namespace/NotificationHub. Otherwise false. + /// + /// The Sku description for a namespace. internal NotificationHubAvailabilityResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, bool? isAvailiable, NotificationHubSku sku) : base(id, name, resourceType, systemData, tags, location) { IsAvailiable = isAvailiable; Sku = sku; } - /// True if the name is available and can be used to create new Namespace/NotificationHub. Otherwise false. + /// + /// Gets or sets true if the name is available and can be used to + /// create new Namespace/NotificationHub. Otherwise false. + /// public bool? IsAvailiable { get; set; } - /// The sku of the created namespace. + /// The Sku description for a namespace. public NotificationHubSku Sku { get; set; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubBaiduCredential.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubBaiduCredential.Serialization.cs index 5fe1d336917f..c014534c192d 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubBaiduCredential.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubBaiduCredential.Serialization.cs @@ -5,35 +5,18 @@ #nullable disable -using System; using System.Text.Json; using Azure.Core; namespace Azure.ResourceManager.NotificationHubs.Models { - public partial class NotificationHubBaiduCredential : IUtf8JsonSerializable + internal partial class NotificationHubBaiduCredential : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(BaiduApiKey)) - { - writer.WritePropertyName("baiduApiKey"u8); - writer.WriteStringValue(BaiduApiKey); - } - if (Optional.IsDefined(BaiduEndpoint)) - { - writer.WritePropertyName("baiduEndPoint"u8); - writer.WriteStringValue(BaiduEndpoint.AbsoluteUri); - } - if (Optional.IsDefined(BaiduSecretKey)) - { - writer.WritePropertyName("baiduSecretKey"u8); - writer.WriteStringValue(BaiduSecretKey); - } - writer.WriteEndObject(); + writer.WriteObjectValue(Properties); writer.WriteEndObject(); } @@ -43,44 +26,16 @@ internal static NotificationHubBaiduCredential DeserializeNotificationHubBaiduCr { return null; } - Optional baiduApiKey = default; - Optional baiduEndPoint = default; - Optional baiduSecretKey = default; + BaiduCredentialProperties properties = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("baiduApiKey"u8)) - { - baiduApiKey = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("baiduEndPoint"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - baiduEndPoint = new Uri(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("baiduSecretKey"u8)) - { - baiduSecretKey = property0.Value.GetString(); - continue; - } - } + properties = BaiduCredentialProperties.DeserializeBaiduCredentialProperties(property.Value); continue; } } - return new NotificationHubBaiduCredential(baiduApiKey.Value, baiduEndPoint.Value, baiduSecretKey.Value); + return new NotificationHubBaiduCredential(properties); } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubBaiduCredential.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubBaiduCredential.cs index 2a8876b24d0e..f07bdcc96058 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubBaiduCredential.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubBaiduCredential.cs @@ -6,33 +6,24 @@ #nullable disable using System; +using Azure.Core; namespace Azure.ResourceManager.NotificationHubs.Models { /// Description of a NotificationHub BaiduCredential. - public partial class NotificationHubBaiduCredential + internal partial class NotificationHubBaiduCredential { /// Initializes a new instance of NotificationHubBaiduCredential. - public NotificationHubBaiduCredential() + /// Description of a NotificationHub BaiduCredential. + /// is null. + public NotificationHubBaiduCredential(BaiduCredentialProperties properties) { - } + Argument.AssertNotNull(properties, nameof(properties)); - /// Initializes a new instance of NotificationHubBaiduCredential. - /// Baidu Api Key. - /// Baidu Endpoint. - /// Baidu Secret Key. - internal NotificationHubBaiduCredential(string baiduApiKey, Uri baiduEndpoint, string baiduSecretKey) - { - BaiduApiKey = baiduApiKey; - BaiduEndpoint = baiduEndpoint; - BaiduSecretKey = baiduSecretKey; + Properties = properties; } - /// Baidu Api Key. - public string BaiduApiKey { get; set; } - /// Baidu Endpoint. - public Uri BaiduEndpoint { get; set; } - /// Baidu Secret Key. - public string BaiduSecretKey { get; set; } + /// Description of a NotificationHub BaiduCredential. + public BaiduCredentialProperties Properties { get; set; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubCreateOrUpdateContent.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubCreateOrUpdateContent.Serialization.cs deleted file mode 100644 index 3713603f81f2..000000000000 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubCreateOrUpdateContent.Serialization.cs +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NotificationHubs.Models -{ - public partial class NotificationHubCreateOrUpdateContent : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Sku)) - { - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); - } - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(NotificationHubName)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(NotificationHubName); - } - if (Optional.IsDefined(RegistrationTtl)) - { - writer.WritePropertyName("registrationTtl"u8); - writer.WriteStringValue(RegistrationTtl.Value, "c"); - } - if (Optional.IsCollectionDefined(AuthorizationRules)) - { - writer.WritePropertyName("authorizationRules"u8); - writer.WriteStartArray(); - foreach (var item in AuthorizationRules) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(ApnsCredential)) - { - writer.WritePropertyName("apnsCredential"u8); - writer.WriteObjectValue(ApnsCredential); - } - if (Optional.IsDefined(WnsCredential)) - { - writer.WritePropertyName("wnsCredential"u8); - writer.WriteObjectValue(WnsCredential); - } - if (Optional.IsDefined(GcmCredential)) - { - writer.WritePropertyName("gcmCredential"u8); - writer.WriteObjectValue(GcmCredential); - } - if (Optional.IsDefined(MpnsCredential)) - { - writer.WritePropertyName("mpnsCredential"u8); - writer.WriteObjectValue(MpnsCredential); - } - if (Optional.IsDefined(AdmCredential)) - { - writer.WritePropertyName("admCredential"u8); - writer.WriteObjectValue(AdmCredential); - } - if (Optional.IsDefined(BaiduCredential)) - { - writer.WritePropertyName("baiduCredential"u8); - writer.WriteObjectValue(BaiduCredential); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static NotificationHubCreateOrUpdateContent DeserializeNotificationHubCreateOrUpdateContent(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Optional sku = default; - Optional> tags = default; - AzureLocation location = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - Optional systemData = default; - Optional name0 = default; - Optional registrationTtl = default; - Optional> authorizationRules = default; - Optional apnsCredential = default; - Optional wnsCredential = default; - Optional gcmCredential = default; - Optional mpnsCredential = default; - Optional admCredential = default; - Optional baiduCredential = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("sku"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sku = NotificationHubSku.DeserializeNotificationHubSku(property.Value); - continue; - } - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("name"u8)) - { - name0 = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("registrationTtl"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - registrationTtl = property0.Value.GetTimeSpan("c"); - continue; - } - if (property0.NameEquals("authorizationRules"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(SharedAccessAuthorizationRuleProperties.DeserializeSharedAccessAuthorizationRuleProperties(item)); - } - authorizationRules = array; - continue; - } - if (property0.NameEquals("apnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - apnsCredential = NotificationHubApnsCredential.DeserializeNotificationHubApnsCredential(property0.Value); - continue; - } - if (property0.NameEquals("wnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - wnsCredential = NotificationHubWnsCredential.DeserializeNotificationHubWnsCredential(property0.Value); - continue; - } - if (property0.NameEquals("gcmCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - gcmCredential = NotificationHubGcmCredential.DeserializeNotificationHubGcmCredential(property0.Value); - continue; - } - if (property0.NameEquals("mpnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - mpnsCredential = NotificationHubMpnsCredential.DeserializeNotificationHubMpnsCredential(property0.Value); - continue; - } - if (property0.NameEquals("admCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - admCredential = NotificationHubAdmCredential.DeserializeNotificationHubAdmCredential(property0.Value); - continue; - } - if (property0.NameEquals("baiduCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - baiduCredential = NotificationHubBaiduCredential.DeserializeNotificationHubBaiduCredential(property0.Value); - continue; - } - } - continue; - } - } - return new NotificationHubCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, name0.Value, Optional.ToNullable(registrationTtl), Optional.ToList(authorizationRules), apnsCredential.Value, wnsCredential.Value, gcmCredential.Value, mpnsCredential.Value, admCredential.Value, baiduCredential.Value, sku.Value); - } - } -} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubCreateOrUpdateContent.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubCreateOrUpdateContent.cs deleted file mode 100644 index 1d3bf5d80301..000000000000 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubCreateOrUpdateContent.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NotificationHubs.Models -{ - /// Parameters supplied to the CreateOrUpdate NotificationHub operation. - public partial class NotificationHubCreateOrUpdateContent : TrackedResourceData - { - /// Initializes a new instance of NotificationHubCreateOrUpdateContent. - /// The location. - public NotificationHubCreateOrUpdateContent(AzureLocation location) : base(location) - { - AuthorizationRules = new ChangeTrackingList(); - } - - /// Initializes a new instance of NotificationHubCreateOrUpdateContent. - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The NotificationHub name. - /// The RegistrationTtl of the created NotificationHub. - /// The AuthorizationRules of the created NotificationHub. - /// The ApnsCredential of the created NotificationHub. - /// The WnsCredential of the created NotificationHub. - /// The GcmCredential of the created NotificationHub. - /// The MpnsCredential of the created NotificationHub. - /// The AdmCredential of the created NotificationHub. - /// The BaiduCredential of the created NotificationHub. - /// The sku of the created namespace. - internal NotificationHubCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string notificationHubName, TimeSpan? registrationTtl, IList authorizationRules, NotificationHubApnsCredential apnsCredential, NotificationHubWnsCredential wnsCredential, NotificationHubGcmCredential gcmCredential, NotificationHubMpnsCredential mpnsCredential, NotificationHubAdmCredential admCredential, NotificationHubBaiduCredential baiduCredential, NotificationHubSku sku) : base(id, name, resourceType, systemData, tags, location) - { - NotificationHubName = notificationHubName; - RegistrationTtl = registrationTtl; - AuthorizationRules = authorizationRules; - ApnsCredential = apnsCredential; - WnsCredential = wnsCredential; - GcmCredential = gcmCredential; - MpnsCredential = mpnsCredential; - AdmCredential = admCredential; - BaiduCredential = baiduCredential; - Sku = sku; - } - - /// The NotificationHub name. - public string NotificationHubName { get; set; } - /// The RegistrationTtl of the created NotificationHub. - public TimeSpan? RegistrationTtl { get; set; } - /// The AuthorizationRules of the created NotificationHub. - public IList AuthorizationRules { get; } - /// The ApnsCredential of the created NotificationHub. - public NotificationHubApnsCredential ApnsCredential { get; set; } - /// The WnsCredential of the created NotificationHub. - public NotificationHubWnsCredential WnsCredential { get; set; } - /// The GcmCredential of the created NotificationHub. - public NotificationHubGcmCredential GcmCredential { get; set; } - /// The MpnsCredential of the created NotificationHub. - public NotificationHubMpnsCredential MpnsCredential { get; set; } - /// The AdmCredential of the created NotificationHub. - public NotificationHubAdmCredential AdmCredential { get; set; } - /// The BaiduCredential of the created NotificationHub. - public NotificationHubBaiduCredential BaiduCredential { get; set; } - /// The sku of the created namespace. - public NotificationHubSku Sku { get; set; } - } -} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubData.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubData.Serialization.cs index 91f45ec948ad..7d025c4c9bce 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubData.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubData.Serialization.cs @@ -5,7 +5,6 @@ #nullable disable -using System; using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -19,6 +18,11 @@ public partial class NotificationHubData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); @@ -37,59 +41,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(NotificationHubName)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(NotificationHubName); - } - if (Optional.IsDefined(RegistrationTtl)) - { - writer.WritePropertyName("registrationTtl"u8); - writer.WriteStringValue(RegistrationTtl.Value, "c"); - } - if (Optional.IsCollectionDefined(AuthorizationRules)) - { - writer.WritePropertyName("authorizationRules"u8); - writer.WriteStartArray(); - foreach (var item in AuthorizationRules) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(ApnsCredential)) - { - writer.WritePropertyName("apnsCredential"u8); - writer.WriteObjectValue(ApnsCredential); - } - if (Optional.IsDefined(WnsCredential)) - { - writer.WritePropertyName("wnsCredential"u8); - writer.WriteObjectValue(WnsCredential); - } - if (Optional.IsDefined(GcmCredential)) - { - writer.WritePropertyName("gcmCredential"u8); - writer.WriteObjectValue(GcmCredential); - } - if (Optional.IsDefined(MpnsCredential)) - { - writer.WritePropertyName("mpnsCredential"u8); - writer.WriteObjectValue(MpnsCredential); - } - if (Optional.IsDefined(AdmCredential)) - { - writer.WritePropertyName("admCredential"u8); - writer.WriteObjectValue(AdmCredential); - } - if (Optional.IsDefined(BaiduCredential)) - { - writer.WritePropertyName("baiduCredential"u8); - writer.WriteObjectValue(BaiduCredential); - } - writer.WriteEndObject(); writer.WriteEndObject(); } @@ -99,6 +50,7 @@ internal static NotificationHubData DeserializeNotificationHubData(JsonElement e { return null; } + Optional properties = default; Optional sku = default; Optional> tags = default; AzureLocation location = default; @@ -106,17 +58,17 @@ internal static NotificationHubData DeserializeNotificationHubData(JsonElement e string name = default; ResourceType type = default; Optional systemData = default; - Optional name0 = default; - Optional registrationTtl = default; - Optional> authorizationRules = default; - Optional apnsCredential = default; - Optional wnsCredential = default; - Optional gcmCredential = default; - Optional mpnsCredential = default; - Optional admCredential = default; - Optional baiduCredential = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = NotificationHubProperties.DeserializeNotificationHubProperties(property.Value); + continue; + } if (property.NameEquals("sku"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -169,102 +121,8 @@ internal static NotificationHubData DeserializeNotificationHubData(JsonElement e systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("name"u8)) - { - name0 = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("registrationTtl"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - registrationTtl = property0.Value.GetTimeSpan("c"); - continue; - } - if (property0.NameEquals("authorizationRules"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(SharedAccessAuthorizationRuleProperties.DeserializeSharedAccessAuthorizationRuleProperties(item)); - } - authorizationRules = array; - continue; - } - if (property0.NameEquals("apnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - apnsCredential = NotificationHubApnsCredential.DeserializeNotificationHubApnsCredential(property0.Value); - continue; - } - if (property0.NameEquals("wnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - wnsCredential = NotificationHubWnsCredential.DeserializeNotificationHubWnsCredential(property0.Value); - continue; - } - if (property0.NameEquals("gcmCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - gcmCredential = NotificationHubGcmCredential.DeserializeNotificationHubGcmCredential(property0.Value); - continue; - } - if (property0.NameEquals("mpnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - mpnsCredential = NotificationHubMpnsCredential.DeserializeNotificationHubMpnsCredential(property0.Value); - continue; - } - if (property0.NameEquals("admCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - admCredential = NotificationHubAdmCredential.DeserializeNotificationHubAdmCredential(property0.Value); - continue; - } - if (property0.NameEquals("baiduCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - baiduCredential = NotificationHubBaiduCredential.DeserializeNotificationHubBaiduCredential(property0.Value); - continue; - } - } - continue; - } } - return new NotificationHubData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, name0.Value, Optional.ToNullable(registrationTtl), Optional.ToList(authorizationRules), apnsCredential.Value, wnsCredential.Value, gcmCredential.Value, mpnsCredential.Value, admCredential.Value, baiduCredential.Value, sku.Value); + return new NotificationHubData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, sku.Value); } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubGcmCredential.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubGcmCredential.Serialization.cs index 1a1494904bf4..7eb961b9c98d 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubGcmCredential.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubGcmCredential.Serialization.cs @@ -5,30 +5,18 @@ #nullable disable -using System; using System.Text.Json; using Azure.Core; namespace Azure.ResourceManager.NotificationHubs.Models { - public partial class NotificationHubGcmCredential : IUtf8JsonSerializable + internal partial class NotificationHubGcmCredential : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(GcmEndpoint)) - { - writer.WritePropertyName("gcmEndpoint"u8); - writer.WriteStringValue(GcmEndpoint.AbsoluteUri); - } - if (Optional.IsDefined(GcmApiKey)) - { - writer.WritePropertyName("googleApiKey"u8); - writer.WriteStringValue(GcmApiKey); - } - writer.WriteEndObject(); + writer.WriteObjectValue(Properties); writer.WriteEndObject(); } @@ -38,38 +26,16 @@ internal static NotificationHubGcmCredential DeserializeNotificationHubGcmCreden { return null; } - Optional gcmEndpoint = default; - Optional googleApiKey = default; + GcmCredentialProperties properties = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("gcmEndpoint"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - gcmEndpoint = new Uri(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("googleApiKey"u8)) - { - googleApiKey = property0.Value.GetString(); - continue; - } - } + properties = GcmCredentialProperties.DeserializeGcmCredentialProperties(property.Value); continue; } } - return new NotificationHubGcmCredential(gcmEndpoint.Value, googleApiKey.Value); + return new NotificationHubGcmCredential(properties); } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubGcmCredential.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubGcmCredential.cs index ac1ab69d74f4..bbe11b36d2c0 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubGcmCredential.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubGcmCredential.cs @@ -6,29 +6,24 @@ #nullable disable using System; +using Azure.Core; namespace Azure.ResourceManager.NotificationHubs.Models { /// Description of a NotificationHub GcmCredential. - public partial class NotificationHubGcmCredential + internal partial class NotificationHubGcmCredential { /// Initializes a new instance of NotificationHubGcmCredential. - public NotificationHubGcmCredential() + /// Description of a NotificationHub GcmCredential. + /// is null. + public NotificationHubGcmCredential(GcmCredentialProperties properties) { - } + Argument.AssertNotNull(properties, nameof(properties)); - /// Initializes a new instance of NotificationHubGcmCredential. - /// The FCM legacy endpoint. Default value is 'https://fcm.googleapis.com/fcm/send'. - /// The Google API key. - internal NotificationHubGcmCredential(Uri gcmEndpoint, string gcmApiKey) - { - GcmEndpoint = gcmEndpoint; - GcmApiKey = gcmApiKey; + Properties = properties; } - /// The FCM legacy endpoint. Default value is 'https://fcm.googleapis.com/fcm/send'. - public Uri GcmEndpoint { get; set; } - /// The Google API key. - public string GcmApiKey { get; set; } + /// Description of a NotificationHub GcmCredential. + public GcmCredentialProperties Properties { get; set; } } } 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 8f97f3a20718..ae0f0a07df20 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubListResult.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubListResult.cs @@ -21,17 +21,17 @@ internal NotificationHubListResult() } /// Initializes a new instance of NotificationHubListResult. - /// Result of the List NotificationHub operation. - /// Link to the next set of results. Not empty if Value contains incomplete list of NotificationHub. + /// Gets or sets result of the List AuthorizationRules operation. + /// Gets or sets link to the next set of results. internal NotificationHubListResult(IReadOnlyList value, string nextLink) { Value = value; NextLink = nextLink; } - /// Result of the List NotificationHub operation. + /// Gets or sets result of the List AuthorizationRules operation. public IReadOnlyList Value { get; } - /// Link to the next set of results. Not empty if Value contains incomplete list of NotificationHub. + /// Gets or sets link to the next set of results. public string NextLink { get; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubMpnsCredential.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubMpnsCredential.Serialization.cs index 51db9d8d75e1..81b82aeb6bb6 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubMpnsCredential.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubMpnsCredential.Serialization.cs @@ -16,23 +16,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(MpnsCertificate)) - { - writer.WritePropertyName("mpnsCertificate"u8); - writer.WriteStringValue(MpnsCertificate); - } - if (Optional.IsDefined(CertificateKey)) - { - writer.WritePropertyName("certificateKey"u8); - writer.WriteStringValue(CertificateKey); - } - if (Optional.IsDefined(ThumbprintString)) - { - writer.WritePropertyName("thumbprint"u8); - writer.WriteStringValue(ThumbprintString); - } - writer.WriteEndObject(); + writer.WriteObjectValue(Properties); writer.WriteEndObject(); } @@ -42,40 +26,16 @@ internal static NotificationHubMpnsCredential DeserializeNotificationHubMpnsCred { return null; } - Optional mpnsCertificate = default; - Optional certificateKey = default; - Optional thumbprint = default; + MpnsCredentialProperties properties = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("mpnsCertificate"u8)) - { - mpnsCertificate = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("certificateKey"u8)) - { - certificateKey = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("thumbprint"u8)) - { - thumbprint = property0.Value.GetString(); - continue; - } - } + properties = MpnsCredentialProperties.DeserializeMpnsCredentialProperties(property.Value); continue; } } - return new NotificationHubMpnsCredential(mpnsCertificate.Value, certificateKey.Value, thumbprint.Value); + return new NotificationHubMpnsCredential(properties); } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubMpnsCredential.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubMpnsCredential.cs index 49def47af56e..327a83401b23 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubMpnsCredential.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubMpnsCredential.cs @@ -5,32 +5,25 @@ #nullable disable +using System; +using Azure.Core; + namespace Azure.ResourceManager.NotificationHubs.Models { /// Description of a NotificationHub MpnsCredential. public partial class NotificationHubMpnsCredential { /// Initializes a new instance of NotificationHubMpnsCredential. - public NotificationHubMpnsCredential() + /// Description of a NotificationHub MpnsCredential. + /// is null. + public NotificationHubMpnsCredential(MpnsCredentialProperties properties) { - } + Argument.AssertNotNull(properties, nameof(properties)); - /// Initializes a new instance of NotificationHubMpnsCredential. - /// The MPNS certificate. - /// The certificate key for this credential. - /// The MPNS certificate Thumbprint. - internal NotificationHubMpnsCredential(string mpnsCertificate, string certificateKey, string thumbprintString) - { - MpnsCertificate = mpnsCertificate; - CertificateKey = certificateKey; - ThumbprintString = thumbprintString; + Properties = properties; } - /// The MPNS certificate. - public string MpnsCertificate { get; set; } - /// The certificate key for this credential. - public string CertificateKey { get; set; } - /// The MPNS certificate Thumbprint. - public string ThumbprintString { get; set; } + /// Description of a NotificationHub MpnsCredential. + public MpnsCredentialProperties Properties { get; set; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceCreateOrUpdateContent.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceCreateOrUpdateContent.Serialization.cs deleted file mode 100644 index 4caefe2cb6dd..000000000000 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceCreateOrUpdateContent.Serialization.cs +++ /dev/null @@ -1,301 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NotificationHubs.Models -{ - public partial class NotificationHubNamespaceCreateOrUpdateContent : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Sku)) - { - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); - } - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(NamespaceName)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(NamespaceName); - } - if (Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (Optional.IsDefined(Region)) - { - writer.WritePropertyName("region"u8); - writer.WriteStringValue(Region); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status); - } - if (Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("createdAt"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); - } - if (Optional.IsDefined(UpdatedOn)) - { - writer.WritePropertyName("updatedAt"u8); - writer.WriteStringValue(UpdatedOn.Value, "O"); - } - if (Optional.IsDefined(ServiceBusEndpoint)) - { - writer.WritePropertyName("serviceBusEndpoint"u8); - writer.WriteStringValue(ServiceBusEndpoint.AbsoluteUri); - } - if (Optional.IsDefined(SubscriptionId)) - { - writer.WritePropertyName("subscriptionId"u8); - writer.WriteStringValue(SubscriptionId); - } - if (Optional.IsDefined(ScaleUnit)) - { - writer.WritePropertyName("scaleUnit"u8); - writer.WriteStringValue(ScaleUnit); - } - if (Optional.IsDefined(IsEnabled)) - { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled.Value); - } - if (Optional.IsDefined(IsCritical)) - { - writer.WritePropertyName("critical"u8); - writer.WriteBooleanValue(IsCritical.Value); - } - if (Optional.IsDefined(DataCenter)) - { - writer.WritePropertyName("dataCenter"u8); - writer.WriteStringValue(DataCenter); - } - if (Optional.IsDefined(NamespaceType)) - { - writer.WritePropertyName("namespaceType"u8); - writer.WriteStringValue(NamespaceType.Value.ToSerialString()); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static NotificationHubNamespaceCreateOrUpdateContent DeserializeNotificationHubNamespaceCreateOrUpdateContent(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Optional sku = default; - Optional> tags = default; - AzureLocation location = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - Optional systemData = default; - Optional name0 = default; - Optional provisioningState = default; - Optional region = default; - Optional metricId = default; - Optional status = default; - Optional createdAt = default; - Optional updatedAt = default; - Optional serviceBusEndpoint = default; - Optional subscriptionId = default; - Optional scaleUnit = default; - Optional enabled = default; - Optional critical = default; - Optional dataCenter = default; - Optional namespaceType = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("sku"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sku = NotificationHubSku.DeserializeNotificationHubSku(property.Value); - continue; - } - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("name"u8)) - { - name0 = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("region"u8)) - { - region = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("metricId"u8)) - { - metricId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("status"u8)) - { - status = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("createdAt"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createdAt = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("updatedAt"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - updatedAt = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("serviceBusEndpoint"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - serviceBusEndpoint = new Uri(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("subscriptionId"u8)) - { - subscriptionId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("scaleUnit"u8)) - { - scaleUnit = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("enabled"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enabled = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("critical"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - critical = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("dataCenter"u8)) - { - dataCenter = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("namespaceType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - namespaceType = property0.Value.GetString().ToNotificationHubNamespaceType(); - continue; - } - } - continue; - } - } - return new NotificationHubNamespaceCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, name0.Value, provisioningState.Value, region.Value, metricId.Value, status.Value, Optional.ToNullable(createdAt), Optional.ToNullable(updatedAt), serviceBusEndpoint.Value, subscriptionId.Value, scaleUnit.Value, Optional.ToNullable(enabled), Optional.ToNullable(critical), dataCenter.Value, Optional.ToNullable(namespaceType), sku.Value); - } - } -} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceCreateOrUpdateContent.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceCreateOrUpdateContent.cs deleted file mode 100644 index 54781a8f0612..000000000000 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceCreateOrUpdateContent.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NotificationHubs.Models -{ - /// Parameters supplied to the CreateOrUpdate Namespace operation. - public partial class NotificationHubNamespaceCreateOrUpdateContent : TrackedResourceData - { - /// Initializes a new instance of NotificationHubNamespaceCreateOrUpdateContent. - /// The location. - public NotificationHubNamespaceCreateOrUpdateContent(AzureLocation location) : base(location) - { - } - - /// Initializes a new instance of NotificationHubNamespaceCreateOrUpdateContent. - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The name of the namespace. - /// Provisioning state of the Namespace. - /// Specifies the targeted region in which the namespace should be created. It can be any of the following values: Australia East, Australia Southeast, Central US, East US, East US 2, West US, North Central US, South Central US, East Asia, Southeast Asia, Brazil South, Japan East, Japan West, North Europe, West Europe. - /// Identifier for Azure Insights metrics. - /// Status of the namespace. It can be any of these values:1 = Created/Active2 = Creating3 = Suspended4 = Deleting. - /// The time the namespace was created. - /// The time the namespace was updated. - /// Endpoint you can use to perform NotificationHub operations. - /// The Id of the Azure subscription associated with the namespace. - /// ScaleUnit where the namespace gets created. - /// Whether or not the namespace is currently enabled. - /// Whether or not the namespace is set as Critical. - /// Data center for the namespace. - /// The namespace type. - /// The sku of the created namespace. - internal NotificationHubNamespaceCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string namespaceName, string provisioningState, string region, string metricId, string status, DateTimeOffset? createdOn, DateTimeOffset? updatedOn, Uri serviceBusEndpoint, string subscriptionId, string scaleUnit, bool? isEnabled, bool? isCritical, string dataCenter, NotificationHubNamespaceType? namespaceType, NotificationHubSku sku) : base(id, name, resourceType, systemData, tags, location) - { - NamespaceName = namespaceName; - ProvisioningState = provisioningState; - Region = region; - MetricId = metricId; - Status = status; - CreatedOn = createdOn; - UpdatedOn = updatedOn; - ServiceBusEndpoint = serviceBusEndpoint; - SubscriptionId = subscriptionId; - ScaleUnit = scaleUnit; - IsEnabled = isEnabled; - IsCritical = isCritical; - DataCenter = dataCenter; - NamespaceType = namespaceType; - Sku = sku; - } - - /// The name of the namespace. - public string NamespaceName { get; set; } - /// Provisioning state of the Namespace. - public string ProvisioningState { get; set; } - /// Specifies the targeted region in which the namespace should be created. It can be any of the following values: Australia East, Australia Southeast, Central US, East US, East US 2, West US, North Central US, South Central US, East Asia, Southeast Asia, Brazil South, Japan East, Japan West, North Europe, West Europe. - public string Region { get; set; } - /// Identifier for Azure Insights metrics. - public string MetricId { get; } - /// Status of the namespace. It can be any of these values:1 = Created/Active2 = Creating3 = Suspended4 = Deleting. - public string Status { get; set; } - /// The time the namespace was created. - public DateTimeOffset? CreatedOn { get; set; } - /// The time the namespace was updated. - public DateTimeOffset? UpdatedOn { get; set; } - /// Endpoint you can use to perform NotificationHub operations. - public Uri ServiceBusEndpoint { get; set; } - /// The Id of the Azure subscription associated with the namespace. - public string SubscriptionId { get; set; } - /// ScaleUnit where the namespace gets created. - public string ScaleUnit { get; set; } - /// Whether or not the namespace is currently enabled. - public bool? IsEnabled { get; set; } - /// Whether or not the namespace is set as Critical. - public bool? IsCritical { get; set; } - /// Data center for the namespace. - public string DataCenter { get; set; } - /// The namespace type. - public NotificationHubNamespaceType? NamespaceType { get; set; } - /// The sku of the created namespace. - public NotificationHubSku Sku { get; set; } - } -} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceData.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceData.Serialization.cs index b55d4e6fafc0..a3dd72989fdb 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceData.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceData.Serialization.cs @@ -5,7 +5,6 @@ #nullable disable -using System; using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -19,10 +18,12 @@ public partial class NotificationHubNamespaceData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsDefined(Sku)) + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku); + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); } if (Optional.IsCollectionDefined(Tags)) { @@ -37,74 +38,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(NamespaceName)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(NamespaceName); - } - if (Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (Optional.IsDefined(Region)) - { - writer.WritePropertyName("region"u8); - writer.WriteStringValue(Region); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status); - } - if (Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("createdAt"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); - } - if (Optional.IsDefined(UpdatedOn)) - { - writer.WritePropertyName("updatedAt"u8); - writer.WriteStringValue(UpdatedOn.Value, "O"); - } - if (Optional.IsDefined(ServiceBusEndpoint)) - { - writer.WritePropertyName("serviceBusEndpoint"u8); - writer.WriteStringValue(ServiceBusEndpoint.AbsoluteUri); - } - if (Optional.IsDefined(SubscriptionId)) - { - writer.WritePropertyName("subscriptionId"u8); - writer.WriteStringValue(SubscriptionId); - } - if (Optional.IsDefined(ScaleUnit)) - { - writer.WritePropertyName("scaleUnit"u8); - writer.WriteStringValue(ScaleUnit); - } - if (Optional.IsDefined(IsEnabled)) - { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled.Value); - } - if (Optional.IsDefined(IsCritical)) - { - writer.WritePropertyName("critical"u8); - writer.WriteBooleanValue(IsCritical.Value); - } - if (Optional.IsDefined(DataCenter)) - { - writer.WritePropertyName("dataCenter"u8); - writer.WriteStringValue(DataCenter); - } - if (Optional.IsDefined(NamespaceType)) - { - writer.WritePropertyName("namespaceType"u8); - writer.WriteStringValue(NamespaceType.Value.ToSerialString()); - } - writer.WriteEndObject(); writer.WriteEndObject(); } @@ -114,36 +47,28 @@ internal static NotificationHubNamespaceData DeserializeNotificationHubNamespace { return null; } - Optional sku = default; + NotificationHubSku sku = default; + Optional properties = default; Optional> tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; Optional systemData = default; - Optional name0 = default; - Optional provisioningState = default; - Optional region = default; - Optional metricId = default; - Optional status = default; - Optional createdAt = default; - Optional updatedAt = default; - Optional serviceBusEndpoint = default; - Optional subscriptionId = default; - Optional scaleUnit = default; - Optional enabled = default; - Optional critical = default; - Optional dataCenter = default; - Optional namespaceType = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) + { + sku = NotificationHubSku.DeserializeNotificationHubSku(property.Value); + continue; + } + if (property.NameEquals("properties"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - sku = NotificationHubSku.DeserializeNotificationHubSku(property.Value); + properties = NamespaceProperties.DeserializeNamespaceProperties(property.Value); continue; } if (property.NameEquals("tags"u8)) @@ -189,114 +114,8 @@ internal static NotificationHubNamespaceData DeserializeNotificationHubNamespace systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("name"u8)) - { - name0 = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("region"u8)) - { - region = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("metricId"u8)) - { - metricId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("status"u8)) - { - status = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("createdAt"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createdAt = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("updatedAt"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - updatedAt = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("serviceBusEndpoint"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - serviceBusEndpoint = new Uri(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("subscriptionId"u8)) - { - subscriptionId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("scaleUnit"u8)) - { - scaleUnit = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("enabled"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enabled = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("critical"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - critical = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("dataCenter"u8)) - { - dataCenter = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("namespaceType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - namespaceType = property0.Value.GetString().ToNotificationHubNamespaceType(); - continue; - } - } - continue; - } } - return new NotificationHubNamespaceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, name0.Value, provisioningState.Value, region.Value, metricId.Value, status.Value, Optional.ToNullable(createdAt), Optional.ToNullable(updatedAt), serviceBusEndpoint.Value, subscriptionId.Value, scaleUnit.Value, Optional.ToNullable(enabled), Optional.ToNullable(critical), dataCenter.Value, Optional.ToNullable(namespaceType), sku.Value); + return new NotificationHubNamespaceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku, properties.Value); } } } 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 a450ab2fa92f..eef605b3942f 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceListResult.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceListResult.cs @@ -21,17 +21,17 @@ internal NotificationHubNamespaceListResult() } /// Initializes a new instance of NotificationHubNamespaceListResult. - /// Result of the List Namespace operation. - /// Link to the next set of results. Not empty if Value contains incomplete list of Namespaces. + /// Gets or sets result of the List AuthorizationRules operation. + /// Gets or sets link to the next set of results. internal NotificationHubNamespaceListResult(IReadOnlyList value, string nextLink) { Value = value; NextLink = nextLink; } - /// Result of the List Namespace operation. + /// Gets or sets result of the List AuthorizationRules operation. public IReadOnlyList Value { get; } - /// Link to the next set of results. Not empty if Value contains incomplete list of Namespaces. + /// Gets or sets link to the next set of results. public string NextLink { get; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespacePatch.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespacePatch.Serialization.cs index c4ddf703859f..c5afb8069da0 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespacePatch.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespacePatch.Serialization.cs @@ -15,6 +15,16 @@ public partial class NotificationHubNamespacePatch : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -26,11 +36,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - if (Optional.IsDefined(Sku)) - { - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); - } writer.WriteEndObject(); } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespacePatch.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespacePatch.cs index a0b35e8f25c0..223ce1a7e9ab 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespacePatch.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespacePatch.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.NotificationHubs.Models { - /// Parameters supplied to the Patch Namespace operation. + /// Patch parameter for NamespaceResource. public partial class NotificationHubNamespacePatch { /// Initializes a new instance of NotificationHubNamespacePatch. @@ -19,9 +19,11 @@ public NotificationHubNamespacePatch() Tags = new ChangeTrackingDictionary(); } - /// Resource tags. - public IDictionary Tags { get; } - /// The sku of the created namespace. + /// The Sku description for a namespace. public NotificationHubSku Sku { get; set; } + /// Represents namespace properties. + public NamespaceProperties Properties { get; set; } + /// Dictionary of <string>. + public IDictionary Tags { get; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceType.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceType.Serialization.cs deleted file mode 100644 index a3ec4d1f1383..000000000000 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceType.Serialization.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.NotificationHubs.Models -{ - internal static partial class NotificationHubNamespaceTypeExtensions - { - public static string ToSerialString(this NotificationHubNamespaceType value) => value switch - { - NotificationHubNamespaceType.Messaging => "Messaging", - NotificationHubNamespaceType.NotificationHub => "NotificationHub", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown NotificationHubNamespaceType value.") - }; - - public static NotificationHubNamespaceType ToNotificationHubNamespaceType(this string value) - { - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Messaging")) return NotificationHubNamespaceType.Messaging; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "NotificationHub")) return NotificationHubNamespaceType.NotificationHub; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown NotificationHubNamespaceType value."); - } - } -} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceType.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceType.cs index a58b2e3fab9d..f722d1a8cf16 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceType.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceType.cs @@ -5,14 +5,47 @@ #nullable disable +using System; +using System.ComponentModel; + namespace Azure.ResourceManager.NotificationHubs.Models { - /// The namespace type. - public enum NotificationHubNamespaceType + /// Defines values for NamespaceType. + public readonly partial struct NotificationHubNamespaceType : IEquatable { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NotificationHubNamespaceType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MessagingValue = "Messaging"; + private const string NotificationHubValue = "NotificationHub"; + /// Messaging. - Messaging, + public static NotificationHubNamespaceType Messaging { get; } = new NotificationHubNamespaceType(MessagingValue); /// NotificationHub. - NotificationHub + public static NotificationHubNamespaceType NotificationHub { get; } = new NotificationHubNamespaceType(NotificationHubValue); + /// Determines if two values are the same. + public static bool operator ==(NotificationHubNamespaceType left, NotificationHubNamespaceType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NotificationHubNamespaceType left, NotificationHubNamespaceType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator NotificationHubNamespaceType(string value) => new NotificationHubNamespaceType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NotificationHubNamespaceType other && Equals(other); + /// + public bool Equals(NotificationHubNamespaceType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPatch.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPatch.Serialization.cs index 659cf89c21d2..bb5bde4fb434 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPatch.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPatch.Serialization.cs @@ -5,11 +5,8 @@ #nullable disable -using System; -using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.Models; namespace Azure.ResourceManager.NotificationHubs.Models { @@ -18,6 +15,11 @@ public partial class NotificationHubPatch : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); @@ -34,236 +36,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(NotificationHubName)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(NotificationHubName); - } - if (Optional.IsDefined(RegistrationTtl)) - { - writer.WritePropertyName("registrationTtl"u8); - writer.WriteStringValue(RegistrationTtl.Value, "c"); - } - if (Optional.IsCollectionDefined(AuthorizationRules)) - { - writer.WritePropertyName("authorizationRules"u8); - writer.WriteStartArray(); - foreach (var item in AuthorizationRules) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(ApnsCredential)) - { - writer.WritePropertyName("apnsCredential"u8); - writer.WriteObjectValue(ApnsCredential); - } - if (Optional.IsDefined(WnsCredential)) - { - writer.WritePropertyName("wnsCredential"u8); - writer.WriteObjectValue(WnsCredential); - } - if (Optional.IsDefined(GcmCredential)) - { - writer.WritePropertyName("gcmCredential"u8); - writer.WriteObjectValue(GcmCredential); - } - if (Optional.IsDefined(MpnsCredential)) - { - writer.WritePropertyName("mpnsCredential"u8); - writer.WriteObjectValue(MpnsCredential); - } - if (Optional.IsDefined(AdmCredential)) - { - writer.WritePropertyName("admCredential"u8); - writer.WriteObjectValue(AdmCredential); - } - if (Optional.IsDefined(BaiduCredential)) - { - writer.WritePropertyName("baiduCredential"u8); - writer.WriteObjectValue(BaiduCredential); - } - writer.WriteEndObject(); writer.WriteEndObject(); } - - internal static NotificationHubPatch DeserializeNotificationHubPatch(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Optional sku = default; - Optional> tags = default; - AzureLocation location = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - Optional systemData = default; - Optional name0 = default; - Optional registrationTtl = default; - Optional> authorizationRules = default; - Optional apnsCredential = default; - Optional wnsCredential = default; - Optional gcmCredential = default; - Optional mpnsCredential = default; - Optional admCredential = default; - Optional baiduCredential = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("sku"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sku = NotificationHubSku.DeserializeNotificationHubSku(property.Value); - continue; - } - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("name"u8)) - { - name0 = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("registrationTtl"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - registrationTtl = property0.Value.GetTimeSpan("c"); - continue; - } - if (property0.NameEquals("authorizationRules"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(SharedAccessAuthorizationRuleProperties.DeserializeSharedAccessAuthorizationRuleProperties(item)); - } - authorizationRules = array; - continue; - } - if (property0.NameEquals("apnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - apnsCredential = NotificationHubApnsCredential.DeserializeNotificationHubApnsCredential(property0.Value); - continue; - } - if (property0.NameEquals("wnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - wnsCredential = NotificationHubWnsCredential.DeserializeNotificationHubWnsCredential(property0.Value); - continue; - } - if (property0.NameEquals("gcmCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - gcmCredential = NotificationHubGcmCredential.DeserializeNotificationHubGcmCredential(property0.Value); - continue; - } - if (property0.NameEquals("mpnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - mpnsCredential = NotificationHubMpnsCredential.DeserializeNotificationHubMpnsCredential(property0.Value); - continue; - } - if (property0.NameEquals("admCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - admCredential = NotificationHubAdmCredential.DeserializeNotificationHubAdmCredential(property0.Value); - continue; - } - if (property0.NameEquals("baiduCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - baiduCredential = NotificationHubBaiduCredential.DeserializeNotificationHubBaiduCredential(property0.Value); - continue; - } - } - continue; - } - } - return new NotificationHubPatch(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, name0.Value, Optional.ToNullable(registrationTtl), Optional.ToList(authorizationRules), apnsCredential.Value, wnsCredential.Value, gcmCredential.Value, mpnsCredential.Value, admCredential.Value, baiduCredential.Value, sku.Value); - } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPatch.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPatch.cs index 92fb58937710..81df06b4521e 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPatch.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPatch.cs @@ -5,73 +5,25 @@ #nullable disable -using System; using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Models; namespace Azure.ResourceManager.NotificationHubs.Models { - /// Parameters supplied to the patch NotificationHub operation. - public partial class NotificationHubPatch : TrackedResourceData + /// Patch parameter for NamespaceResource. + public partial class NotificationHubPatch { /// Initializes a new instance of NotificationHubPatch. - /// The location. - public NotificationHubPatch(AzureLocation location) : base(location) + public NotificationHubPatch() { - AuthorizationRules = new ChangeTrackingList(); + Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of NotificationHubPatch. - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The NotificationHub name. - /// The RegistrationTtl of the created NotificationHub. - /// The AuthorizationRules of the created NotificationHub. - /// The ApnsCredential of the created NotificationHub. - /// The WnsCredential of the created NotificationHub. - /// The GcmCredential of the created NotificationHub. - /// The MpnsCredential of the created NotificationHub. - /// The AdmCredential of the created NotificationHub. - /// The BaiduCredential of the created NotificationHub. - /// The sku of the created namespace. - internal NotificationHubPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string notificationHubName, TimeSpan? registrationTtl, IList authorizationRules, NotificationHubApnsCredential apnsCredential, NotificationHubWnsCredential wnsCredential, NotificationHubGcmCredential gcmCredential, NotificationHubMpnsCredential mpnsCredential, NotificationHubAdmCredential admCredential, NotificationHubBaiduCredential baiduCredential, NotificationHubSku sku) : base(id, name, resourceType, systemData, tags, location) - { - NotificationHubName = notificationHubName; - RegistrationTtl = registrationTtl; - AuthorizationRules = authorizationRules; - ApnsCredential = apnsCredential; - WnsCredential = wnsCredential; - GcmCredential = gcmCredential; - MpnsCredential = mpnsCredential; - AdmCredential = admCredential; - BaiduCredential = baiduCredential; - Sku = sku; - } - - /// The NotificationHub name. - public string NotificationHubName { get; set; } - /// The RegistrationTtl of the created NotificationHub. - public TimeSpan? RegistrationTtl { get; set; } - /// The AuthorizationRules of the created NotificationHub. - public IList AuthorizationRules { get; } - /// The ApnsCredential of the created NotificationHub. - public NotificationHubApnsCredential ApnsCredential { get; set; } - /// The WnsCredential of the created NotificationHub. - public NotificationHubWnsCredential WnsCredential { get; set; } - /// The GcmCredential of the created NotificationHub. - public NotificationHubGcmCredential GcmCredential { get; set; } - /// The MpnsCredential of the created NotificationHub. - public NotificationHubMpnsCredential MpnsCredential { get; set; } - /// The AdmCredential of the created NotificationHub. - public NotificationHubAdmCredential AdmCredential { get; set; } - /// The BaiduCredential of the created NotificationHub. - public NotificationHubBaiduCredential BaiduCredential { get; set; } - /// The sku of the created namespace. + /// NotificationHub properties. + public NotificationHubProperties Properties { get; set; } + /// The Sku description for a namespace. public NotificationHubSku Sku { get; set; } + /// Dictionary of <string>. + public IDictionary Tags { get; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPnsCredentials.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPnsCredentials.Serialization.cs index 09ee431146bc..fe20a29ecbe6 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPnsCredentials.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPnsCredentials.Serialization.cs @@ -17,10 +17,10 @@ public partial class NotificationHubPnsCredentials : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsDefined(Sku)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); } if (Optional.IsCollectionDefined(Tags)) { @@ -35,39 +35,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(ApnsCredential)) - { - writer.WritePropertyName("apnsCredential"u8); - writer.WriteObjectValue(ApnsCredential); - } - if (Optional.IsDefined(WnsCredential)) - { - writer.WritePropertyName("wnsCredential"u8); - writer.WriteObjectValue(WnsCredential); - } - if (Optional.IsDefined(GcmCredential)) - { - writer.WritePropertyName("gcmCredential"u8); - writer.WriteObjectValue(GcmCredential); - } - if (Optional.IsDefined(MpnsCredential)) - { - writer.WritePropertyName("mpnsCredential"u8); - writer.WriteObjectValue(MpnsCredential); - } - if (Optional.IsDefined(AdmCredential)) - { - writer.WritePropertyName("admCredential"u8); - writer.WriteObjectValue(AdmCredential); - } - if (Optional.IsDefined(BaiduCredential)) - { - writer.WritePropertyName("baiduCredential"u8); - writer.WriteObjectValue(BaiduCredential); - } - writer.WriteEndObject(); writer.WriteEndObject(); } @@ -77,28 +44,22 @@ internal static NotificationHubPnsCredentials DeserializeNotificationHubPnsCrede { return null; } - Optional sku = default; + Optional properties = default; Optional> tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; Optional systemData = default; - Optional apnsCredential = default; - Optional wnsCredential = default; - Optional gcmCredential = default; - Optional mpnsCredential = default; - Optional admCredential = default; - Optional baiduCredential = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("sku"u8)) + if (property.NameEquals("properties"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - sku = NotificationHubSku.DeserializeNotificationHubSku(property.Value); + properties = PnsCredentials.DeserializePnsCredentials(property.Value); continue; } if (property.NameEquals("tags"u8)) @@ -144,74 +105,8 @@ internal static NotificationHubPnsCredentials DeserializeNotificationHubPnsCrede systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("apnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - apnsCredential = NotificationHubApnsCredential.DeserializeNotificationHubApnsCredential(property0.Value); - continue; - } - if (property0.NameEquals("wnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - wnsCredential = NotificationHubWnsCredential.DeserializeNotificationHubWnsCredential(property0.Value); - continue; - } - if (property0.NameEquals("gcmCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - gcmCredential = NotificationHubGcmCredential.DeserializeNotificationHubGcmCredential(property0.Value); - continue; - } - if (property0.NameEquals("mpnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - mpnsCredential = NotificationHubMpnsCredential.DeserializeNotificationHubMpnsCredential(property0.Value); - continue; - } - if (property0.NameEquals("admCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - admCredential = NotificationHubAdmCredential.DeserializeNotificationHubAdmCredential(property0.Value); - continue; - } - if (property0.NameEquals("baiduCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - baiduCredential = NotificationHubBaiduCredential.DeserializeNotificationHubBaiduCredential(property0.Value); - continue; - } - } - continue; - } } - return new NotificationHubPnsCredentials(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, apnsCredential.Value, wnsCredential.Value, gcmCredential.Value, mpnsCredential.Value, admCredential.Value, baiduCredential.Value, sku.Value); + return new NotificationHubPnsCredentials(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPnsCredentials.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPnsCredentials.cs index b8cb85540cbd..021fa8824346 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPnsCredentials.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPnsCredentials.cs @@ -11,7 +11,10 @@ namespace Azure.ResourceManager.NotificationHubs.Models { - /// Description of a NotificationHub PNS Credentials. + /// + /// Description of a NotificationHub PNS Credentials. This is a response of the POST requests that return namespace or hubs + /// PNS credentials. + /// public partial class NotificationHubPnsCredentials : TrackedResourceData { /// Initializes a new instance of NotificationHubPnsCredentials. @@ -27,37 +30,13 @@ public NotificationHubPnsCredentials(AzureLocation location) : base(location) /// The systemData. /// The tags. /// The location. - /// The ApnsCredential of the created NotificationHub. - /// The WnsCredential of the created NotificationHub. - /// The GcmCredential of the created NotificationHub. - /// The MpnsCredential of the created NotificationHub. - /// The AdmCredential of the created NotificationHub. - /// The BaiduCredential of the created NotificationHub. - /// The sku of the created namespace. - internal NotificationHubPnsCredentials(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NotificationHubApnsCredential apnsCredential, NotificationHubWnsCredential wnsCredential, NotificationHubGcmCredential gcmCredential, NotificationHubMpnsCredential mpnsCredential, NotificationHubAdmCredential admCredential, NotificationHubBaiduCredential baiduCredential, NotificationHubSku sku) : base(id, name, resourceType, systemData, tags, location) + /// Collection of Notification Hub or Notification Hub Namespace PNS credentials. + internal NotificationHubPnsCredentials(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, PnsCredentials properties) : base(id, name, resourceType, systemData, tags, location) { - ApnsCredential = apnsCredential; - WnsCredential = wnsCredential; - GcmCredential = gcmCredential; - MpnsCredential = mpnsCredential; - AdmCredential = admCredential; - BaiduCredential = baiduCredential; - Sku = sku; + Properties = properties; } - /// The ApnsCredential of the created NotificationHub. - public NotificationHubApnsCredential ApnsCredential { get; set; } - /// The WnsCredential of the created NotificationHub. - public NotificationHubWnsCredential WnsCredential { get; set; } - /// The GcmCredential of the created NotificationHub. - public NotificationHubGcmCredential GcmCredential { get; set; } - /// The MpnsCredential of the created NotificationHub. - public NotificationHubMpnsCredential MpnsCredential { get; set; } - /// The AdmCredential of the created NotificationHub. - public NotificationHubAdmCredential AdmCredential { get; set; } - /// The BaiduCredential of the created NotificationHub. - public NotificationHubBaiduCredential BaiduCredential { get; set; } - /// The sku of the created namespace. - public NotificationHubSku Sku { get; set; } + /// Collection of Notification Hub or Notification Hub Namespace PNS credentials. + public PnsCredentials Properties { get; set; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPolicyKey.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPolicyKey.Serialization.cs deleted file mode 100644 index 5f8e9743ad52..000000000000 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPolicyKey.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NotificationHubs.Models -{ - public partial class NotificationHubPolicyKey : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(PolicyKey)) - { - writer.WritePropertyName("policyKey"u8); - writer.WriteStringValue(PolicyKey); - } - writer.WriteEndObject(); - } - } -} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPolicyKey.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPolicyKey.cs deleted file mode 100644 index 7590d29b92e8..000000000000 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPolicyKey.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.NotificationHubs.Models -{ - /// Namespace/NotificationHub Regenerate Keys. - public partial class NotificationHubPolicyKey - { - /// Initializes a new instance of NotificationHubPolicyKey. - public NotificationHubPolicyKey() - { - } - - /// Name of the key that has to be regenerated for the Namespace/Notification Hub Authorization Rule. The value can be Primary Key/Secondary Key. - public string PolicyKey { get; set; } - } -} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubProperties.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubProperties.Serialization.cs new file mode 100644 index 000000000000..f342de264056 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubProperties.Serialization.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class NotificationHubProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(NotificationHubName)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(NotificationHubName); + } + if (Optional.IsDefined(RegistrationTtl)) + { + writer.WritePropertyName("registrationTtl"u8); + writer.WriteStringValue(RegistrationTtl); + } + if (Optional.IsDefined(ApnsCredential)) + { + writer.WritePropertyName("apnsCredential"u8); + writer.WriteObjectValue(ApnsCredential); + } + if (Optional.IsDefined(WnsCredential)) + { + writer.WritePropertyName("wnsCredential"u8); + writer.WriteObjectValue(WnsCredential); + } + if (Optional.IsDefined(GcmCredential)) + { + writer.WritePropertyName("gcmCredential"u8); + writer.WriteObjectValue(GcmCredential); + } + if (Optional.IsDefined(MpnsCredential)) + { + writer.WritePropertyName("mpnsCredential"u8); + writer.WriteObjectValue(MpnsCredential); + } + if (Optional.IsDefined(AdmCredential)) + { + writer.WritePropertyName("admCredential"u8); + writer.WriteObjectValue(AdmCredential); + } + if (Optional.IsDefined(BaiduCredential)) + { + writer.WritePropertyName("baiduCredential"u8); + writer.WriteObjectValue(BaiduCredential); + } + if (Optional.IsDefined(BrowserCredential)) + { + writer.WritePropertyName("browserCredential"u8); + writer.WriteObjectValue(BrowserCredential); + } + if (Optional.IsDefined(XiaomiCredential)) + { + writer.WritePropertyName("xiaomiCredential"u8); + writer.WriteObjectValue(XiaomiCredential); + } + if (Optional.IsDefined(FcmV1Credential)) + { + writer.WritePropertyName("fcmV1Credential"u8); + writer.WriteObjectValue(FcmV1Credential); + } + writer.WriteEndObject(); + } + + internal static NotificationHubProperties DeserializeNotificationHubProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional registrationTtl = default; + Optional> authorizationRules = default; + Optional apnsCredential = default; + Optional wnsCredential = default; + Optional gcmCredential = default; + Optional mpnsCredential = default; + Optional admCredential = default; + Optional baiduCredential = default; + Optional browserCredential = default; + Optional xiaomiCredential = default; + Optional fcmV1Credential = default; + Optional dailyMaxActiveDevices = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("registrationTtl"u8)) + { + registrationTtl = property.Value.GetString(); + continue; + } + if (property.NameEquals("authorizationRules"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SharedAccessAuthorizationRuleProperties.DeserializeSharedAccessAuthorizationRuleProperties(item)); + } + authorizationRules = array; + continue; + } + if (property.NameEquals("apnsCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + apnsCredential = NotificationHubApnsCredential.DeserializeNotificationHubApnsCredential(property.Value); + continue; + } + if (property.NameEquals("wnsCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + wnsCredential = NotificationHubWnsCredential.DeserializeNotificationHubWnsCredential(property.Value); + continue; + } + if (property.NameEquals("gcmCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + gcmCredential = NotificationHubGcmCredential.DeserializeNotificationHubGcmCredential(property.Value); + continue; + } + if (property.NameEquals("mpnsCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mpnsCredential = NotificationHubMpnsCredential.DeserializeNotificationHubMpnsCredential(property.Value); + continue; + } + if (property.NameEquals("admCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + admCredential = NotificationHubAdmCredential.DeserializeNotificationHubAdmCredential(property.Value); + continue; + } + if (property.NameEquals("baiduCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + baiduCredential = NotificationHubBaiduCredential.DeserializeNotificationHubBaiduCredential(property.Value); + continue; + } + if (property.NameEquals("browserCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + browserCredential = BrowserCredential.DeserializeBrowserCredential(property.Value); + continue; + } + if (property.NameEquals("xiaomiCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + xiaomiCredential = XiaomiCredential.DeserializeXiaomiCredential(property.Value); + continue; + } + if (property.NameEquals("fcmV1Credential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fcmV1Credential = FcmV1Credential.DeserializeFcmV1Credential(property.Value); + continue; + } + if (property.NameEquals("dailyMaxActiveDevices"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dailyMaxActiveDevices = property.Value.GetInt64(); + continue; + } + } + return new NotificationHubProperties(name.Value, registrationTtl.Value, Optional.ToList(authorizationRules), apnsCredential.Value, wnsCredential.Value, gcmCredential.Value, mpnsCredential.Value, admCredential.Value, baiduCredential.Value, browserCredential.Value, xiaomiCredential.Value, fcmV1Credential.Value, Optional.ToNullable(dailyMaxActiveDevices)); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubProperties.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubProperties.cs new file mode 100644 index 000000000000..33af6b4ee2db --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubProperties.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// NotificationHub properties. + public partial class NotificationHubProperties + { + /// Initializes a new instance of NotificationHubProperties. + public NotificationHubProperties() + { + AuthorizationRules = new ChangeTrackingList(); + } + + /// Initializes a new instance of NotificationHubProperties. + /// 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. + /// + internal NotificationHubProperties(string notificationHubName, string registrationTtl, IReadOnlyList authorizationRules, NotificationHubApnsCredential apnsCredential, NotificationHubWnsCredential wnsCredential, NotificationHubGcmCredential gcmCredential, NotificationHubMpnsCredential mpnsCredential, NotificationHubAdmCredential admCredential, NotificationHubBaiduCredential baiduCredential, BrowserCredential browserCredential, XiaomiCredential xiaomiCredential, FcmV1Credential fcmV1Credential, long? dailyMaxActiveDevices) + { + NotificationHubName = notificationHubName; + RegistrationTtl = registrationTtl; + AuthorizationRules = authorizationRules; + ApnsCredential = apnsCredential; + WnsCredential = wnsCredential; + GcmCredential = gcmCredential; + MpnsCredential = mpnsCredential; + AdmCredential = admCredential; + BaiduCredential = baiduCredential; + BrowserCredential = browserCredential; + XiaomiCredential = xiaomiCredential; + FcmV1Credential = fcmV1Credential; + DailyMaxActiveDevices = dailyMaxActiveDevices; + } + + /// Gets or sets the NotificationHub name. + public string NotificationHubName { get; set; } + /// Gets or sets the RegistrationTtl of the created NotificationHub. + public string RegistrationTtl { get; set; } + /// Gets or sets the AuthorizationRules of the created NotificationHub. + public IReadOnlyList AuthorizationRules { get; } + /// Description of a NotificationHub ApnsCredential. + internal NotificationHubApnsCredential ApnsCredential { get; set; } + /// Description of a NotificationHub ApnsCredential. + public ApnsCredentialProperties ApnsCredentialProperties + { + get => ApnsCredential is null ? default : ApnsCredential.Properties; + set => ApnsCredential = new NotificationHubApnsCredential(value); + } + + /// Description of a NotificationHub WnsCredential. + internal NotificationHubWnsCredential WnsCredential { get; set; } + /// Description of a NotificationHub WnsCredential. + public WnsCredentialProperties WnsCredentialProperties + { + get => WnsCredential is null ? default : WnsCredential.Properties; + set => WnsCredential = new NotificationHubWnsCredential(value); + } + + /// Description of a NotificationHub GcmCredential. + internal NotificationHubGcmCredential GcmCredential { get; set; } + /// Description of a NotificationHub GcmCredential. + public GcmCredentialProperties GcmCredentialProperties + { + get => GcmCredential is null ? default : GcmCredential.Properties; + set => GcmCredential = new NotificationHubGcmCredential(value); + } + + /// Description of a NotificationHub MpnsCredential. + internal NotificationHubMpnsCredential MpnsCredential { get; set; } + /// Description of a NotificationHub MpnsCredential. + public MpnsCredentialProperties MpnsCredentialProperties + { + get => MpnsCredential is null ? default : MpnsCredential.Properties; + set => MpnsCredential = new NotificationHubMpnsCredential(value); + } + + /// Description of a NotificationHub AdmCredential. + internal NotificationHubAdmCredential AdmCredential { get; set; } + /// Description of a NotificationHub AdmCredential. + public AdmCredentialProperties AdmCredentialProperties + { + get => AdmCredential is null ? default : AdmCredential.Properties; + set => AdmCredential = new NotificationHubAdmCredential(value); + } + + /// Description of a NotificationHub BaiduCredential. + internal NotificationHubBaiduCredential BaiduCredential { get; set; } + /// Description of a NotificationHub BaiduCredential. + public BaiduCredentialProperties BaiduCredentialProperties + { + get => BaiduCredential is null ? default : BaiduCredential.Properties; + set => BaiduCredential = new NotificationHubBaiduCredential(value); + } + + /// Description of a NotificationHub BrowserCredential. + internal BrowserCredential BrowserCredential { get; set; } + /// Description of a NotificationHub BrowserCredential. + public BrowserCredentialProperties BrowserCredentialProperties + { + get => BrowserCredential is null ? default : BrowserCredential.Properties; + set => BrowserCredential = new BrowserCredential(value); + } + + /// Description of a NotificationHub XiaomiCredential. + internal XiaomiCredential XiaomiCredential { get; set; } + /// Description of a NotificationHub XiaomiCredentialProperties. + public XiaomiCredentialProperties XiaomiCredentialProperties + { + get => XiaomiCredential is null ? default : XiaomiCredential.Properties; + set => XiaomiCredential = new XiaomiCredential(value); + } + + /// Description of a NotificationHub FcmV1Credential. + internal FcmV1Credential FcmV1Credential { get; set; } + /// Description of a NotificationHub FcmV1Credential. + public FcmV1CredentialProperties FcmV1CredentialProperties + { + get => FcmV1Credential is null ? default : FcmV1Credential.Properties; + set => FcmV1Credential = new FcmV1Credential(value); + } + + /// Gets the daily max active devices. + public long? DailyMaxActiveDevices { get; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubResourceKeys.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubResourceKeys.cs index de01f985ff6f..4499b4b4ecd0 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubResourceKeys.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubResourceKeys.cs @@ -7,7 +7,7 @@ namespace Azure.ResourceManager.NotificationHubs.Models { - /// Namespace/NotificationHub Connection String. + /// Response for the POST request that returns Namespace or NotificationHub access keys (connection strings). public partial class NotificationHubResourceKeys { /// Initializes a new instance of NotificationHubResourceKeys. @@ -16,11 +16,14 @@ internal NotificationHubResourceKeys() } /// Initializes a new instance of NotificationHubResourceKeys. - /// PrimaryConnectionString of the AuthorizationRule. - /// SecondaryConnectionString of the created AuthorizationRule. - /// PrimaryKey of the created AuthorizationRule. - /// SecondaryKey of the created AuthorizationRule. - /// KeyName of the created AuthorizationRule. + /// 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. internal NotificationHubResourceKeys(string primaryConnectionString, string secondaryConnectionString, string primaryKey, string secondaryKey, string keyName) { PrimaryConnectionString = primaryConnectionString; @@ -30,15 +33,18 @@ internal NotificationHubResourceKeys(string primaryConnectionString, string seco KeyName = keyName; } - /// PrimaryConnectionString of the AuthorizationRule. + /// Gets or sets primaryConnectionString of the AuthorizationRule. public string PrimaryConnectionString { get; } - /// SecondaryConnectionString of the created AuthorizationRule. + /// + /// Gets or sets secondaryConnectionString of the created + /// AuthorizationRule + /// public string SecondaryConnectionString { get; } - /// PrimaryKey of the created AuthorizationRule. + /// Gets or sets primaryKey of the created AuthorizationRule. public string PrimaryKey { get; } - /// SecondaryKey of the created AuthorizationRule. + /// Gets or sets secondaryKey of the created AuthorizationRule. public string SecondaryKey { get; } - /// KeyName of the created AuthorizationRule. + /// Gets or sets keyName of the created AuthorizationRule. public string KeyName { get; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubSku.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubSku.cs index daf5c55d7a3a..55c7ceec1e86 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubSku.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubSku.cs @@ -11,18 +11,18 @@ namespace Azure.ResourceManager.NotificationHubs.Models public partial class NotificationHubSku { /// Initializes a new instance of NotificationHubSku. - /// Name of the notification hub sku. + /// Namespace SKU name. public NotificationHubSku(NotificationHubSkuName name) { Name = name; } /// Initializes a new instance of NotificationHubSku. - /// Name of the notification hub sku. - /// The tier of particular sku. - /// The Sku size. - /// The Sku Family. - /// The capacity of the resource. + /// Namespace SKU name. + /// Gets or sets the tier of particular sku. + /// Gets or sets the Sku size. + /// Gets or sets the Sku Family. + /// Gets or sets the capacity of the resource. internal NotificationHubSku(NotificationHubSkuName name, string tier, string size, string family, int? capacity) { Name = name; @@ -32,15 +32,15 @@ internal NotificationHubSku(NotificationHubSkuName name, string tier, string siz Capacity = capacity; } - /// Name of the notification hub sku. + /// Namespace SKU name. public NotificationHubSkuName Name { get; set; } - /// The tier of particular sku. + /// Gets or sets the tier of particular sku. public string Tier { get; set; } - /// The Sku size. + /// Gets or sets the Sku size. public string Size { get; set; } - /// The Sku Family. + /// Gets or sets the Sku Family. public string Family { get; set; } - /// The capacity of the resource. + /// Gets or sets the capacity of the resource. public int? Capacity { get; set; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubSkuName.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubSkuName.cs index df1f3bd02c66..76b5d5188a33 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubSkuName.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubSkuName.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.NotificationHubs.Models { - /// Name of the notification hub sku. + /// Namespace SKU name. public readonly partial struct NotificationHubSkuName : IEquatable { private readonly string _value; diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubTestSendResult.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubTestSendResult.Serialization.cs index 3215d97cac17..aa3489d44969 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubTestSendResult.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubTestSendResult.Serialization.cs @@ -5,7 +5,6 @@ #nullable disable -using System; using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -18,10 +17,10 @@ public partial class NotificationHubTestSendResult : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsDefined(Sku)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); } if (Optional.IsCollectionDefined(Tags)) { @@ -36,31 +35,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Success)) - { - writer.WritePropertyName("success"u8); - writer.WriteNumberValue(Success.Value); - } - if (Optional.IsDefined(Failure)) - { - writer.WritePropertyName("failure"u8); - writer.WriteNumberValue(Failure.Value); - } - if (Optional.IsDefined(Results)) - { - writer.WritePropertyName("results"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(Results); -#else - using (JsonDocument document = JsonDocument.Parse(Results)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); writer.WriteEndObject(); } @@ -70,25 +44,22 @@ internal static NotificationHubTestSendResult DeserializeNotificationHubTestSend { return null; } - Optional sku = default; + Optional properties = default; Optional> tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; Optional systemData = default; - Optional success = default; - Optional failure = default; - Optional results = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("sku"u8)) + if (property.NameEquals("properties"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - sku = NotificationHubSku.DeserializeNotificationHubSku(property.Value); + properties = DebugSendResult.DeserializeDebugSendResult(property.Value); continue; } if (property.NameEquals("tags"u8)) @@ -134,47 +105,8 @@ internal static NotificationHubTestSendResult DeserializeNotificationHubTestSend systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("success"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - success = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("failure"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - failure = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("results"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - results = BinaryData.FromString(property0.Value.GetRawText()); - continue; - } - } - continue; - } } - return new NotificationHubTestSendResult(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(success), Optional.ToNullable(failure), results.Value, sku.Value); + return new NotificationHubTestSendResult(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubTestSendResult.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubTestSendResult.cs index 82cccd75795d..c1ed63aafc3d 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubTestSendResult.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubTestSendResult.cs @@ -5,7 +5,6 @@ #nullable disable -using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -28,54 +27,13 @@ public NotificationHubTestSendResult(AzureLocation location) : base(location) /// The systemData. /// The tags. /// The location. - /// successful send. - /// send failure. - /// actual failure description. - /// The sku of the created namespace. - internal NotificationHubTestSendResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, int? success, int? failure, BinaryData results, NotificationHubSku sku) : base(id, name, resourceType, systemData, tags, location) + /// Result of DebugSend operations. + internal NotificationHubTestSendResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DebugSendResult properties) : base(id, name, resourceType, systemData, tags, location) { - Success = success; - Failure = failure; - Results = results; - Sku = sku; + Properties = properties; } - /// successful send. - public int? Success { get; set; } - /// send failure. - public int? Failure { get; set; } - /// - /// actual failure description - /// - /// To assign an object to this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - public BinaryData Results { get; set; } - /// The sku of the created namespace. - public NotificationHubSku Sku { get; set; } + /// Result of DebugSend operations. + public DebugSendResult Properties { get; set; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubWnsCredential.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubWnsCredential.Serialization.cs index 59a36c66dc1f..f43df55db813 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubWnsCredential.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubWnsCredential.Serialization.cs @@ -5,35 +5,18 @@ #nullable disable -using System; using System.Text.Json; using Azure.Core; namespace Azure.ResourceManager.NotificationHubs.Models { - public partial class NotificationHubWnsCredential : IUtf8JsonSerializable + internal partial class NotificationHubWnsCredential : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(PackageSid)) - { - writer.WritePropertyName("packageSid"u8); - writer.WriteStringValue(PackageSid); - } - if (Optional.IsDefined(SecretKey)) - { - writer.WritePropertyName("secretKey"u8); - writer.WriteStringValue(SecretKey); - } - if (Optional.IsDefined(WindowsLiveEndpoint)) - { - writer.WritePropertyName("windowsLiveEndpoint"u8); - writer.WriteStringValue(WindowsLiveEndpoint.AbsoluteUri); - } - writer.WriteEndObject(); + writer.WriteObjectValue(Properties); writer.WriteEndObject(); } @@ -43,44 +26,16 @@ internal static NotificationHubWnsCredential DeserializeNotificationHubWnsCreden { return null; } - Optional packageSid = default; - Optional secretKey = default; - Optional windowsLiveEndpoint = default; + WnsCredentialProperties properties = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("packageSid"u8)) - { - packageSid = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("secretKey"u8)) - { - secretKey = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("windowsLiveEndpoint"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - windowsLiveEndpoint = new Uri(property0.Value.GetString()); - continue; - } - } + properties = WnsCredentialProperties.DeserializeWnsCredentialProperties(property.Value); continue; } } - return new NotificationHubWnsCredential(packageSid.Value, secretKey.Value, windowsLiveEndpoint.Value); + return new NotificationHubWnsCredential(properties); } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubWnsCredential.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubWnsCredential.cs index 20bddac035e1..4bde270488ca 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubWnsCredential.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubWnsCredential.cs @@ -6,33 +6,24 @@ #nullable disable using System; +using Azure.Core; namespace Azure.ResourceManager.NotificationHubs.Models { /// Description of a NotificationHub WnsCredential. - public partial class NotificationHubWnsCredential + internal partial class NotificationHubWnsCredential { /// Initializes a new instance of NotificationHubWnsCredential. - public NotificationHubWnsCredential() + /// Description of a NotificationHub WnsCredential. + /// is null. + public NotificationHubWnsCredential(WnsCredentialProperties properties) { - } + Argument.AssertNotNull(properties, nameof(properties)); - /// Initializes a new instance of NotificationHubWnsCredential. - /// The package ID for this credential. - /// The secret key. - /// The Windows Live endpoint. - internal NotificationHubWnsCredential(string packageSid, string secretKey, Uri windowsLiveEndpoint) - { - PackageSid = packageSid; - SecretKey = secretKey; - WindowsLiveEndpoint = windowsLiveEndpoint; + Properties = properties; } - /// The package ID for this credential. - public string PackageSid { get; set; } - /// The secret key. - public string SecretKey { get; set; } - /// The Windows Live endpoint. - public Uri WindowsLiveEndpoint { get; set; } + /// Description of a NotificationHub WnsCredential. + public WnsCredentialProperties Properties { get; set; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateEndpointConnectionProvisioningState.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateEndpointConnectionProvisioningState.cs new file mode 100644 index 000000000000..8245c6764f1e --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateEndpointConnectionProvisioningState.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// State of Private Endpoint Connection. + public readonly partial struct NotificationHubsPrivateEndpointConnectionProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NotificationHubsPrivateEndpointConnectionProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string SucceededValue = "Succeeded"; + private const string CreatingValue = "Creating"; + private const string UpdatingValue = "Updating"; + private const string UpdatingByProxyValue = "UpdatingByProxy"; + private const string DeletingValue = "Deleting"; + private const string DeletingByProxyValue = "DeletingByProxy"; + private const string DeletedValue = "Deleted"; + + /// Unknown. + public static NotificationHubsPrivateEndpointConnectionProvisioningState Unknown { get; } = new NotificationHubsPrivateEndpointConnectionProvisioningState(UnknownValue); + /// Succeeded. + public static NotificationHubsPrivateEndpointConnectionProvisioningState Succeeded { get; } = new NotificationHubsPrivateEndpointConnectionProvisioningState(SucceededValue); + /// Creating. + public static NotificationHubsPrivateEndpointConnectionProvisioningState Creating { get; } = new NotificationHubsPrivateEndpointConnectionProvisioningState(CreatingValue); + /// Updating. + public static NotificationHubsPrivateEndpointConnectionProvisioningState Updating { get; } = new NotificationHubsPrivateEndpointConnectionProvisioningState(UpdatingValue); + /// UpdatingByProxy. + public static NotificationHubsPrivateEndpointConnectionProvisioningState UpdatingByProxy { get; } = new NotificationHubsPrivateEndpointConnectionProvisioningState(UpdatingByProxyValue); + /// Deleting. + public static NotificationHubsPrivateEndpointConnectionProvisioningState Deleting { get; } = new NotificationHubsPrivateEndpointConnectionProvisioningState(DeletingValue); + /// DeletingByProxy. + public static NotificationHubsPrivateEndpointConnectionProvisioningState DeletingByProxy { get; } = new NotificationHubsPrivateEndpointConnectionProvisioningState(DeletingByProxyValue); + /// Deleted. + public static NotificationHubsPrivateEndpointConnectionProvisioningState Deleted { get; } = new NotificationHubsPrivateEndpointConnectionProvisioningState(DeletedValue); + /// Determines if two values are the same. + public static bool operator ==(NotificationHubsPrivateEndpointConnectionProvisioningState left, NotificationHubsPrivateEndpointConnectionProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NotificationHubsPrivateEndpointConnectionProvisioningState left, NotificationHubsPrivateEndpointConnectionProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator NotificationHubsPrivateEndpointConnectionProvisioningState(string value) => new NotificationHubsPrivateEndpointConnectionProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NotificationHubsPrivateEndpointConnectionProvisioningState other && Equals(other); + /// + public bool Equals(NotificationHubsPrivateEndpointConnectionProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceData.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceData.Serialization.cs new file mode 100644 index 000000000000..141977559c36 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceData.Serialization.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NotificationHubs.Models; + +namespace Azure.ResourceManager.NotificationHubs +{ + public partial class NotificationHubsPrivateLinkResourceData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + + internal static NotificationHubsPrivateLinkResourceData DeserializeNotificationHubsPrivateLinkResourceData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = NotificationHubsPrivateLinkResourceProperties.DeserializeNotificationHubsPrivateLinkResourceProperties(property.Value); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new NotificationHubsPrivateLinkResourceData(id, name, type, systemData.Value, properties.Value); + } + } +} 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 new file mode 100644 index 000000000000..41dc6159d840 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + internal partial class NotificationHubsPrivateLinkResourceListResult + { + internal static NotificationHubsPrivateLinkResourceListResult DeserializeNotificationHubsPrivateLinkResourceListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + 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()) + { + array.Add(NotificationHubsPrivateLinkResourceData.DeserializeNotificationHubsPrivateLinkResourceData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new NotificationHubsPrivateLinkResourceListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceListResult.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceListResult.cs new file mode 100644 index 000000000000..769fbaced139 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// The response of the List Private Link Resources operation. + internal partial class NotificationHubsPrivateLinkResourceListResult + { + /// Initializes a new instance of NotificationHubsPrivateLinkResourceListResult. + internal NotificationHubsPrivateLinkResourceListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of NotificationHubsPrivateLinkResourceListResult. + /// Gets or sets result of the List AuthorizationRules operation. + /// Gets or sets link to the next set of results. + internal NotificationHubsPrivateLinkResourceListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Gets or sets result of the List AuthorizationRules operation. + public IReadOnlyList Value { get; } + /// Gets or sets link to the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceProperties.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceProperties.Serialization.cs new file mode 100644 index 000000000000..49e4188a6621 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceProperties.Serialization.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class NotificationHubsPrivateLinkResourceProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static NotificationHubsPrivateLinkResourceProperties DeserializeNotificationHubsPrivateLinkResourceProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional groupId = default; + Optional> requiredMembers = default; + Optional> requiredZoneNames = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("groupId"u8)) + { + groupId = property.Value.GetString(); + continue; + } + if (property.NameEquals("requiredMembers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + requiredMembers = array; + continue; + } + if (property.NameEquals("requiredZoneNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + requiredZoneNames = array; + continue; + } + } + return new NotificationHubsPrivateLinkResourceProperties(groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames)); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceProperties.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceProperties.cs new file mode 100644 index 000000000000..227b9865ecea --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceProperties.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Represents properties of Private Link Resource. + public partial class NotificationHubsPrivateLinkResourceProperties + { + /// Initializes a new instance of NotificationHubsPrivateLinkResourceProperties. + public NotificationHubsPrivateLinkResourceProperties() + { + RequiredMembers = new ChangeTrackingList(); + RequiredZoneNames = new ChangeTrackingList(); + } + + /// Initializes a new instance of NotificationHubsPrivateLinkResourceProperties. + /// A Group Id for Private Link. For Notification Hubs, it is always set to "namespace". + /// Required members. For Notification Hubs, it's always a collection with a single "namespace" item. + /// Required DNS zone names. For Notification Hubs, it contains two CNames for Service Bus and Notification Hubs zones. + internal NotificationHubsPrivateLinkResourceProperties(string groupId, IReadOnlyList requiredMembers, IReadOnlyList requiredZoneNames) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; + } + + /// A Group Id for Private Link. For Notification Hubs, it is always set to "namespace". + public string GroupId { get; } + /// Required members. For Notification Hubs, it's always a collection with a single "namespace" item. + public IReadOnlyList RequiredMembers { get; } + /// Required DNS zone names. For Notification Hubs, it contains two CNames for Service Bus and Notification Hubs zones. + public IReadOnlyList RequiredZoneNames { get; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/OperationProvisioningState.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/OperationProvisioningState.cs new file mode 100644 index 000000000000..80829e41167c --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/OperationProvisioningState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Defines values for OperationProvisioningState. + public readonly partial struct OperationProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OperationProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string InProgressValue = "InProgress"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string PendingValue = "Pending"; + private const string DisabledValue = "Disabled"; + + /// Unknown. + public static OperationProvisioningState Unknown { get; } = new OperationProvisioningState(UnknownValue); + /// InProgress. + public static OperationProvisioningState InProgress { get; } = new OperationProvisioningState(InProgressValue); + /// Succeeded. + public static OperationProvisioningState Succeeded { get; } = new OperationProvisioningState(SucceededValue); + /// Failed. + public static OperationProvisioningState Failed { get; } = new OperationProvisioningState(FailedValue); + /// Canceled. + public static OperationProvisioningState Canceled { get; } = new OperationProvisioningState(CanceledValue); + /// Pending. + public static OperationProvisioningState Pending { get; } = new OperationProvisioningState(PendingValue); + /// Disabled. + public static OperationProvisioningState Disabled { get; } = new OperationProvisioningState(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(OperationProvisioningState left, OperationProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OperationProvisioningState left, OperationProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator OperationProvisioningState(string value) => new OperationProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OperationProvisioningState other && Equals(other); + /// + public bool Equals(OperationProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PnsCredentials.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PnsCredentials.Serialization.cs new file mode 100644 index 000000000000..fbd9dad66a60 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PnsCredentials.Serialization.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class PnsCredentials : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(AdmCredential)) + { + writer.WritePropertyName("admCredential"u8); + writer.WriteObjectValue(AdmCredential); + } + if (Optional.IsDefined(ApnsCredential)) + { + writer.WritePropertyName("apnsCredential"u8); + writer.WriteObjectValue(ApnsCredential); + } + if (Optional.IsDefined(BaiduCredential)) + { + writer.WritePropertyName("baiduCredential"u8); + writer.WriteObjectValue(BaiduCredential); + } + if (Optional.IsDefined(BrowserCredential)) + { + writer.WritePropertyName("browserCredential"u8); + writer.WriteObjectValue(BrowserCredential); + } + if (Optional.IsDefined(GcmCredential)) + { + writer.WritePropertyName("gcmCredential"u8); + writer.WriteObjectValue(GcmCredential); + } + if (Optional.IsDefined(MpnsCredential)) + { + writer.WritePropertyName("mpnsCredential"u8); + writer.WriteObjectValue(MpnsCredential); + } + if (Optional.IsDefined(WnsCredential)) + { + writer.WritePropertyName("wnsCredential"u8); + writer.WriteObjectValue(WnsCredential); + } + if (Optional.IsDefined(XiaomiCredential)) + { + writer.WritePropertyName("xiaomiCredential"u8); + writer.WriteObjectValue(XiaomiCredential); + } + if (Optional.IsDefined(FcmV1Credential)) + { + writer.WritePropertyName("fcmV1Credential"u8); + writer.WriteObjectValue(FcmV1Credential); + } + writer.WriteEndObject(); + } + + internal static PnsCredentials DeserializePnsCredentials(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional admCredential = default; + Optional apnsCredential = default; + Optional baiduCredential = default; + Optional browserCredential = default; + Optional gcmCredential = default; + Optional mpnsCredential = default; + Optional wnsCredential = default; + Optional xiaomiCredential = default; + Optional fcmV1Credential = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("admCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + admCredential = NotificationHubAdmCredential.DeserializeNotificationHubAdmCredential(property.Value); + continue; + } + if (property.NameEquals("apnsCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + apnsCredential = NotificationHubApnsCredential.DeserializeNotificationHubApnsCredential(property.Value); + continue; + } + if (property.NameEquals("baiduCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + baiduCredential = NotificationHubBaiduCredential.DeserializeNotificationHubBaiduCredential(property.Value); + continue; + } + if (property.NameEquals("browserCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + browserCredential = BrowserCredential.DeserializeBrowserCredential(property.Value); + continue; + } + if (property.NameEquals("gcmCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + gcmCredential = NotificationHubGcmCredential.DeserializeNotificationHubGcmCredential(property.Value); + continue; + } + if (property.NameEquals("mpnsCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mpnsCredential = NotificationHubMpnsCredential.DeserializeNotificationHubMpnsCredential(property.Value); + continue; + } + if (property.NameEquals("wnsCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + wnsCredential = NotificationHubWnsCredential.DeserializeNotificationHubWnsCredential(property.Value); + continue; + } + if (property.NameEquals("xiaomiCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + xiaomiCredential = XiaomiCredential.DeserializeXiaomiCredential(property.Value); + continue; + } + if (property.NameEquals("fcmV1Credential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fcmV1Credential = FcmV1Credential.DeserializeFcmV1Credential(property.Value); + continue; + } + } + return new PnsCredentials(admCredential.Value, apnsCredential.Value, baiduCredential.Value, browserCredential.Value, gcmCredential.Value, mpnsCredential.Value, wnsCredential.Value, xiaomiCredential.Value, fcmV1Credential.Value); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PnsCredentials.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PnsCredentials.cs new file mode 100644 index 000000000000..123ab202463a --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PnsCredentials.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Collection of Notification Hub or Notification Hub Namespace PNS credentials. + public partial class PnsCredentials + { + /// Initializes a new instance of PnsCredentials. + public PnsCredentials() + { + } + + /// Initializes a new instance of PnsCredentials. + /// 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. + internal PnsCredentials(NotificationHubAdmCredential admCredential, NotificationHubApnsCredential apnsCredential, NotificationHubBaiduCredential baiduCredential, BrowserCredential browserCredential, NotificationHubGcmCredential gcmCredential, NotificationHubMpnsCredential mpnsCredential, NotificationHubWnsCredential wnsCredential, XiaomiCredential xiaomiCredential, FcmV1Credential fcmV1Credential) + { + AdmCredential = admCredential; + ApnsCredential = apnsCredential; + BaiduCredential = baiduCredential; + BrowserCredential = browserCredential; + GcmCredential = gcmCredential; + MpnsCredential = mpnsCredential; + WnsCredential = wnsCredential; + XiaomiCredential = xiaomiCredential; + FcmV1Credential = fcmV1Credential; + } + + /// Description of a NotificationHub AdmCredential. + internal NotificationHubAdmCredential AdmCredential { get; set; } + /// Description of a NotificationHub AdmCredential. + public AdmCredentialProperties AdmCredentialProperties + { + get => AdmCredential is null ? default : AdmCredential.Properties; + set => AdmCredential = new NotificationHubAdmCredential(value); + } + + /// Description of a NotificationHub ApnsCredential. + internal NotificationHubApnsCredential ApnsCredential { get; set; } + /// Description of a NotificationHub ApnsCredential. + public ApnsCredentialProperties ApnsCredentialProperties + { + get => ApnsCredential is null ? default : ApnsCredential.Properties; + set => ApnsCredential = new NotificationHubApnsCredential(value); + } + + /// Description of a NotificationHub BaiduCredential. + internal NotificationHubBaiduCredential BaiduCredential { get; set; } + /// Description of a NotificationHub BaiduCredential. + public BaiduCredentialProperties BaiduCredentialProperties + { + get => BaiduCredential is null ? default : BaiduCredential.Properties; + set => BaiduCredential = new NotificationHubBaiduCredential(value); + } + + /// Description of a NotificationHub BrowserCredential. + internal BrowserCredential BrowserCredential { get; set; } + /// Description of a NotificationHub BrowserCredential. + public BrowserCredentialProperties BrowserCredentialProperties + { + get => BrowserCredential is null ? default : BrowserCredential.Properties; + set => BrowserCredential = new BrowserCredential(value); + } + + /// Description of a NotificationHub GcmCredential. + internal NotificationHubGcmCredential GcmCredential { get; set; } + /// Description of a NotificationHub GcmCredential. + public GcmCredentialProperties GcmCredentialProperties + { + get => GcmCredential is null ? default : GcmCredential.Properties; + set => GcmCredential = new NotificationHubGcmCredential(value); + } + + /// Description of a NotificationHub MpnsCredential. + internal NotificationHubMpnsCredential MpnsCredential { get; set; } + /// Description of a NotificationHub MpnsCredential. + public MpnsCredentialProperties MpnsCredentialProperties + { + get => MpnsCredential is null ? default : MpnsCredential.Properties; + set => MpnsCredential = new NotificationHubMpnsCredential(value); + } + + /// Description of a NotificationHub WnsCredential. + internal NotificationHubWnsCredential WnsCredential { get; set; } + /// Description of a NotificationHub WnsCredential. + public WnsCredentialProperties WnsCredentialProperties + { + get => WnsCredential is null ? default : WnsCredential.Properties; + set => WnsCredential = new NotificationHubWnsCredential(value); + } + + /// Description of a NotificationHub XiaomiCredential. + internal XiaomiCredential XiaomiCredential { get; set; } + /// Description of a NotificationHub XiaomiCredentialProperties. + public XiaomiCredentialProperties XiaomiCredentialProperties + { + get => XiaomiCredential is null ? default : XiaomiCredential.Properties; + set => XiaomiCredential = new XiaomiCredential(value); + } + + /// Description of a NotificationHub FcmV1Credential. + internal FcmV1Credential FcmV1Credential { get; set; } + /// Description of a NotificationHub FcmV1Credential. + public FcmV1CredentialProperties FcmV1CredentialProperties + { + get => FcmV1Credential is null ? default : FcmV1Credential.Properties; + set => FcmV1Credential = new FcmV1Credential(value); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleCreateOrUpdateContent.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PolicyKeyResource.Serialization.cs similarity index 67% rename from sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleCreateOrUpdateContent.Serialization.cs rename to sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PolicyKeyResource.Serialization.cs index 9b582c8a5918..3d8ce2d25b73 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleCreateOrUpdateContent.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PolicyKeyResource.Serialization.cs @@ -10,13 +10,13 @@ namespace Azure.ResourceManager.NotificationHubs.Models { - public partial class SharedAccessAuthorizationRuleCreateOrUpdateContent : IUtf8JsonSerializable + public partial class PolicyKeyResource : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + writer.WritePropertyName("policyKey"u8); + writer.WriteStringValue(PolicyKey.ToString()); writer.WriteEndObject(); } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PolicyKeyResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PolicyKeyResource.cs new file mode 100644 index 000000000000..4360828b8069 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PolicyKeyResource.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Namespace / NotificationHub Regenerate Keys request. + public partial class PolicyKeyResource + { + /// Initializes a new instance of PolicyKeyResource. + /// Type of Shared Access Policy Key (primary or secondary). + public PolicyKeyResource(PolicyKeyType policyKey) + { + PolicyKey = policyKey; + } + + /// Type of Shared Access Policy Key (primary or secondary). + public PolicyKeyType PolicyKey { get; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PolicyKeyType.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PolicyKeyType.cs new file mode 100644 index 000000000000..9b03b113dce1 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PolicyKeyType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Type of Shared Access Policy Key (primary or secondary). + public readonly partial struct PolicyKeyType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PolicyKeyType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PrimaryKeyValue = "PrimaryKey"; + private const string SecondaryKeyValue = "SecondaryKey"; + + /// PrimaryKey. + public static PolicyKeyType PrimaryKey { get; } = new PolicyKeyType(PrimaryKeyValue); + /// SecondaryKey. + public static PolicyKeyType SecondaryKey { get; } = new PolicyKeyType(SecondaryKeyValue); + /// Determines if two values are the same. + public static bool operator ==(PolicyKeyType left, PolicyKeyType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PolicyKeyType left, PolicyKeyType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PolicyKeyType(string value) => new PolicyKeyType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PolicyKeyType other && Equals(other); + /// + public bool Equals(PolicyKeyType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs new file mode 100644 index 000000000000..70bb6b0a55fc --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class PrivateEndpointConnectionProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(PrivateEndpoint)) + { + writer.WritePropertyName("privateEndpoint"u8); + JsonSerializer.Serialize(writer, PrivateEndpoint); + } + if (Optional.IsDefined(ConnectionState)) + { + writer.WritePropertyName("privateLinkServiceConnectionState"u8); + writer.WriteObjectValue(ConnectionState); + } + writer.WriteEndObject(); + } + + internal static PrivateEndpointConnectionProperties DeserializePrivateEndpointConnectionProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional privateEndpoint = default; + Optional> groupIds = default; + Optional privateLinkServiceConnectionState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new NotificationHubsPrivateEndpointConnectionProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("privateEndpoint"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + privateEndpoint = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("groupIds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + groupIds = array; + continue; + } + if (property.NameEquals("privateLinkServiceConnectionState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + privateLinkServiceConnectionState = RemotePrivateLinkServiceConnectionState.DeserializeRemotePrivateLinkServiceConnectionState(property.Value); + continue; + } + } + return new PrivateEndpointConnectionProperties(Optional.ToNullable(provisioningState), privateEndpoint, Optional.ToList(groupIds), privateLinkServiceConnectionState.Value); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionProperties.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionProperties.cs new file mode 100644 index 000000000000..ccf4d2537b1d --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionProperties.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Private Endpoint Connection properties. + public partial class PrivateEndpointConnectionProperties + { + /// Initializes a new instance of PrivateEndpointConnectionProperties. + public PrivateEndpointConnectionProperties() + { + GroupIds = new ChangeTrackingList(); + } + + /// Initializes a new instance of PrivateEndpointConnectionProperties. + /// State of Private Endpoint Connection. + /// Represents a Private Endpoint that is connected to Notification Hubs namespace using Private Endpoint Connection. + /// List of group ids. For Notification Hubs, it always contains a single "namespace" element. + /// State of the Private Link Service connection. + internal PrivateEndpointConnectionProperties(NotificationHubsPrivateEndpointConnectionProvisioningState? provisioningState, SubResource privateEndpoint, IReadOnlyList groupIds, RemotePrivateLinkServiceConnectionState connectionState) + { + ProvisioningState = provisioningState; + PrivateEndpoint = privateEndpoint; + GroupIds = groupIds; + ConnectionState = connectionState; + } + + /// State of Private Endpoint Connection. + public NotificationHubsPrivateEndpointConnectionProvisioningState? ProvisioningState { get; set; } + /// Represents a Private Endpoint that is connected to Notification Hubs namespace using Private Endpoint Connection. + internal SubResource PrivateEndpoint { get; set; } + /// Gets Id. + public ResourceIdentifier PrivateEndpointId + { + get => PrivateEndpoint is null ? default : PrivateEndpoint.Id; + } + + /// List of group ids. For Notification Hubs, it always contains a single "namespace" element. + public IReadOnlyList GroupIds { get; } + /// State of the Private Link Service connection. + public RemotePrivateLinkServiceConnectionState ConnectionState { get; set; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceData.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceData.Serialization.cs new file mode 100644 index 000000000000..c544f65e3d2f --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceData.Serialization.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NotificationHubs.Models; + +namespace Azure.ResourceManager.NotificationHubs +{ + public partial class PrivateEndpointConnectionResourceData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + + internal static PrivateEndpointConnectionResourceData DeserializePrivateEndpointConnectionResourceData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = PrivateEndpointConnectionProperties.DeserializePrivateEndpointConnectionProperties(property.Value); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new PrivateEndpointConnectionResourceData(id, name, type, systemData.Value, properties.Value); + } + } +} 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 new file mode 100644 index 000000000000..5b07f5e1f158 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + internal partial class PrivateEndpointConnectionResourceListResult + { + internal static PrivateEndpointConnectionResourceListResult DeserializePrivateEndpointConnectionResourceListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + 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()) + { + array.Add(PrivateEndpointConnectionResourceData.DeserializePrivateEndpointConnectionResourceData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new PrivateEndpointConnectionResourceListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceListResult.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceListResult.cs new file mode 100644 index 000000000000..1f3696083a21 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// The response of the List Private Endpoint Connections operation. + internal partial class PrivateEndpointConnectionResourceListResult + { + /// Initializes a new instance of PrivateEndpointConnectionResourceListResult. + internal PrivateEndpointConnectionResourceListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of PrivateEndpointConnectionResourceListResult. + /// Gets or sets result of the List AuthorizationRules operation. + /// Gets or sets link to the next set of results. + internal PrivateEndpointConnectionResourceListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Gets or sets result of the List AuthorizationRules operation. + public IReadOnlyList Value { get; } + /// Gets or sets link to the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateLinkConnectionStatus.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateLinkConnectionStatus.cs new file mode 100644 index 000000000000..3875006c26bd --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateLinkConnectionStatus.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// State of Private Link Connection. + public readonly partial struct PrivateLinkConnectionStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PrivateLinkConnectionStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DisconnectedValue = "Disconnected"; + private const string PendingValue = "Pending"; + private const string ApprovedValue = "Approved"; + private const string RejectedValue = "Rejected"; + + /// Disconnected. + public static PrivateLinkConnectionStatus Disconnected { get; } = new PrivateLinkConnectionStatus(DisconnectedValue); + /// Pending. + public static PrivateLinkConnectionStatus Pending { get; } = new PrivateLinkConnectionStatus(PendingValue); + /// Approved. + public static PrivateLinkConnectionStatus Approved { get; } = new PrivateLinkConnectionStatus(ApprovedValue); + /// Rejected. + public static PrivateLinkConnectionStatus Rejected { get; } = new PrivateLinkConnectionStatus(RejectedValue); + /// Determines if two values are the same. + public static bool operator ==(PrivateLinkConnectionStatus left, PrivateLinkConnectionStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PrivateLinkConnectionStatus left, PrivateLinkConnectionStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PrivateLinkConnectionStatus(string value) => new PrivateLinkConnectionStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PrivateLinkConnectionStatus other && Equals(other); + /// + public bool Equals(PrivateLinkConnectionStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PublicInternetAuthorizationRule.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PublicInternetAuthorizationRule.Serialization.cs new file mode 100644 index 000000000000..e61038ab54d7 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PublicInternetAuthorizationRule.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + internal partial class PublicInternetAuthorizationRule : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("rights"u8); + writer.WriteStartArray(); + foreach (var item in Rights) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + writer.WriteEndObject(); + } + + internal static PublicInternetAuthorizationRule DeserializePublicInternetAuthorizationRule(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList rights = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("rights"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new AuthorizationRuleAccessRight(item.GetString())); + } + rights = array; + continue; + } + } + return new PublicInternetAuthorizationRule(rights); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PublicInternetAuthorizationRule.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PublicInternetAuthorizationRule.cs new file mode 100644 index 000000000000..a42abae404a9 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PublicInternetAuthorizationRule.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// A default (public Internet) network authorization rule, which contains rights if no other network rule matches. + internal partial class PublicInternetAuthorizationRule + { + /// Initializes a new instance of PublicInternetAuthorizationRule. + /// List of access rights. + /// is null. + public PublicInternetAuthorizationRule(IEnumerable rights) + { + Argument.AssertNotNull(rights, nameof(rights)); + + Rights = rights.ToList(); + } + + /// Initializes a new instance of PublicInternetAuthorizationRule. + /// List of access rights. + internal PublicInternetAuthorizationRule(IList rights) + { + Rights = rights; + } + + /// List of access rights. + public IList Rights { get; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PublicNetworkAccess.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PublicNetworkAccess.cs new file mode 100644 index 000000000000..31071e80dd15 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PublicNetworkAccess.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Type of public network access. + public readonly partial struct PublicNetworkAccess : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PublicNetworkAccess(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Enabled. + public static PublicNetworkAccess Enabled { get; } = new PublicNetworkAccess(EnabledValue); + /// Disabled. + public static PublicNetworkAccess Disabled { get; } = new PublicNetworkAccess(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(PublicNetworkAccess left, PublicNetworkAccess right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PublicNetworkAccess left, PublicNetworkAccess right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PublicNetworkAccess(string value) => new PublicNetworkAccess(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PublicNetworkAccess other && Equals(other); + /// + public bool Equals(PublicNetworkAccess other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/RegistrationResult.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/RegistrationResult.Serialization.cs new file mode 100644 index 000000000000..77f42644f8b0 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/RegistrationResult.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class RegistrationResult + { + internal static RegistrationResult DeserializeRegistrationResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional applicationPlatform = default; + Optional pnsHandle = default; + Optional registrationId = default; + Optional outcome = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("applicationPlatform"u8)) + { + applicationPlatform = property.Value.GetString(); + continue; + } + if (property.NameEquals("pnsHandle"u8)) + { + pnsHandle = property.Value.GetString(); + continue; + } + if (property.NameEquals("registrationId"u8)) + { + registrationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("outcome"u8)) + { + outcome = property.Value.GetString(); + continue; + } + } + return new RegistrationResult(applicationPlatform.Value, pnsHandle.Value, registrationId.Value, outcome.Value); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/RegistrationResult.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/RegistrationResult.cs new file mode 100644 index 000000000000..0d1d6faa3e04 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/RegistrationResult.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Notification result for a single registration. + public partial class RegistrationResult + { + /// Initializes a new instance of RegistrationResult. + internal RegistrationResult() + { + } + + /// Initializes a new instance of RegistrationResult. + /// PNS type. + /// PNS handle. + /// Registration id. + /// Notification outcome. + internal RegistrationResult(string applicationPlatform, string pnsHandle, string registrationId, string outcome) + { + ApplicationPlatform = applicationPlatform; + PnsHandle = pnsHandle; + RegistrationId = registrationId; + Outcome = outcome; + } + + /// PNS type. + public string ApplicationPlatform { get; } + /// PNS handle. + public string PnsHandle { get; } + /// Registration id. + public string RegistrationId { get; } + /// Notification outcome. + public string Outcome { get; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/RemotePrivateLinkServiceConnectionState.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/RemotePrivateLinkServiceConnectionState.Serialization.cs new file mode 100644 index 000000000000..3d889f3e8c63 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/RemotePrivateLinkServiceConnectionState.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class RemotePrivateLinkServiceConnectionState : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static RemotePrivateLinkServiceConnectionState DeserializeRemotePrivateLinkServiceConnectionState(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional status = default; + Optional description = default; + Optional actionsRequired = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new PrivateLinkConnectionStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("actionsRequired"u8)) + { + actionsRequired = property.Value.GetString(); + continue; + } + } + return new RemotePrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, actionsRequired.Value); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/RemotePrivateLinkServiceConnectionState.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/RemotePrivateLinkServiceConnectionState.cs new file mode 100644 index 000000000000..a34e8b70a4cb --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/RemotePrivateLinkServiceConnectionState.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// State of the Private Link Service connection. + public partial class RemotePrivateLinkServiceConnectionState + { + /// Initializes a new instance of RemotePrivateLinkServiceConnectionState. + public RemotePrivateLinkServiceConnectionState() + { + } + + /// Initializes a new instance of RemotePrivateLinkServiceConnectionState. + /// State of Private Link Connection. + /// Human-friendly description. + /// Human-friendly description of required actions. + internal RemotePrivateLinkServiceConnectionState(PrivateLinkConnectionStatus? status, string description, string actionsRequired) + { + Status = status; + Description = description; + ActionsRequired = actionsRequired; + } + + /// State of Private Link Connection. + public PrivateLinkConnectionStatus? Status { get; set; } + /// Human-friendly description. + public string Description { get; } + /// Human-friendly description of required actions. + public string ActionsRequired { get; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/ReplicationRegion.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/ReplicationRegion.cs new file mode 100644 index 000000000000..3882dd80f500 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/ReplicationRegion.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Allowed replication region. + public readonly partial struct ReplicationRegion : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ReplicationRegion(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "Default"; + private const string WestUs2Value = "WestUs2"; + private const string NorthEuropeValue = "NorthEurope"; + private const string AustraliaEastValue = "AustraliaEast"; + private const string BrazilSouthValue = "BrazilSouth"; + private const string SouthEastAsiaValue = "SouthEastAsia"; + private const string SouthAfricaNorthValue = "SouthAfricaNorth"; + private const string NoneValue = "None"; + + /// Default. + public static ReplicationRegion Default { get; } = new ReplicationRegion(DefaultValue); + /// WestUs2. + public static ReplicationRegion WestUs2 { get; } = new ReplicationRegion(WestUs2Value); + /// NorthEurope. + public static ReplicationRegion NorthEurope { get; } = new ReplicationRegion(NorthEuropeValue); + /// AustraliaEast. + public static ReplicationRegion AustraliaEast { get; } = new ReplicationRegion(AustraliaEastValue); + /// BrazilSouth. + public static ReplicationRegion BrazilSouth { get; } = new ReplicationRegion(BrazilSouthValue); + /// SouthEastAsia. + public static ReplicationRegion SouthEastAsia { get; } = new ReplicationRegion(SouthEastAsiaValue); + /// SouthAfricaNorth. + public static ReplicationRegion SouthAfricaNorth { get; } = new ReplicationRegion(SouthAfricaNorthValue); + /// None. + public static ReplicationRegion None { get; } = new ReplicationRegion(NoneValue); + /// Determines if two values are the same. + public static bool operator ==(ReplicationRegion left, ReplicationRegion right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ReplicationRegion left, ReplicationRegion right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ReplicationRegion(string value) => new ReplicationRegion(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ReplicationRegion other && Equals(other); + /// + public bool Equals(ReplicationRegion other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleCreateOrUpdateContent.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleCreateOrUpdateContent.cs deleted file mode 100644 index 70781c0d90d7..000000000000 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleCreateOrUpdateContent.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; - -namespace Azure.ResourceManager.NotificationHubs.Models -{ - /// Parameters supplied to the CreateOrUpdate Namespace AuthorizationRules. - public partial class SharedAccessAuthorizationRuleCreateOrUpdateContent - { - /// Initializes a new instance of SharedAccessAuthorizationRuleCreateOrUpdateContent. - /// Properties of the Namespace AuthorizationRules. - /// is null. - public SharedAccessAuthorizationRuleCreateOrUpdateContent(SharedAccessAuthorizationRuleProperties properties) - { - Argument.AssertNotNull(properties, nameof(properties)); - - Properties = properties; - } - - /// Properties of the Namespace AuthorizationRules. - public SharedAccessAuthorizationRuleProperties Properties { get; } - } -} 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 5c8e1ed2805d..681263a17aa9 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleListResult.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleListResult.cs @@ -21,17 +21,17 @@ internal SharedAccessAuthorizationRuleListResult() } /// Initializes a new instance of SharedAccessAuthorizationRuleListResult. - /// Result of the List AuthorizationRules operation. - /// Link to the next set of results. Not empty if Value contains incomplete list of AuthorizationRules. + /// Gets or sets result of the List AuthorizationRules operation. + /// Gets or sets link to the next set of results. internal SharedAccessAuthorizationRuleListResult(IReadOnlyList value, string nextLink) { Value = value; NextLink = nextLink; } - /// Result of the List AuthorizationRules operation. + /// Gets or sets result of the List AuthorizationRules operation. public IReadOnlyList Value { get; } - /// Link to the next set of results. Not empty if Value contains incomplete list of AuthorizationRules. + /// Gets or sets link to the next set of results. public string NextLink { get; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleProperties.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleProperties.Serialization.cs index 6dfd894e3618..e5514aefa2da 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleProperties.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleProperties.Serialization.cs @@ -17,15 +17,22 @@ public partial class SharedAccessAuthorizationRuleProperties : IUtf8JsonSerializ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsCollectionDefined(Rights)) + writer.WritePropertyName("rights"u8); + writer.WriteStartArray(); + foreach (var item in Rights) { - writer.WritePropertyName("rights"u8); - writer.WriteStartArray(); - foreach (var item in Rights) - { - writer.WriteStringValue(item.ToSerialString()); - } - writer.WriteEndArray(); + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + if (Optional.IsDefined(PrimaryKey)) + { + writer.WritePropertyName("primaryKey"u8); + writer.WriteStringValue(PrimaryKey); + } + if (Optional.IsDefined(SecondaryKey)) + { + writer.WritePropertyName("secondaryKey"u8); + writer.WriteStringValue(SecondaryKey); } writer.WriteEndObject(); } @@ -36,27 +43,23 @@ internal static SharedAccessAuthorizationRuleProperties DeserializeSharedAccessA { return null; } - Optional> rights = default; + IList rights = default; Optional primaryKey = default; Optional secondaryKey = default; Optional keyName = default; - Optional claimType = default; - Optional claimValue = default; Optional modifiedTime = default; Optional createdTime = default; + Optional claimType = default; + Optional claimValue = default; Optional revision = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("rights"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(item.GetString().ToAuthorizationRuleAccessRight()); + array.Add(new AuthorizationRuleAccessRight(item.GetString())); } rights = array; continue; @@ -76,16 +79,6 @@ internal static SharedAccessAuthorizationRuleProperties DeserializeSharedAccessA keyName = property.Value.GetString(); continue; } - if (property.NameEquals("claimType"u8)) - { - claimType = property.Value.GetString(); - continue; - } - if (property.NameEquals("claimValue"u8)) - { - claimValue = property.Value.GetString(); - continue; - } if (property.NameEquals("modifiedTime"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -104,6 +97,16 @@ internal static SharedAccessAuthorizationRuleProperties DeserializeSharedAccessA createdTime = property.Value.GetDateTimeOffset("O"); continue; } + if (property.NameEquals("claimType"u8)) + { + claimType = property.Value.GetString(); + continue; + } + if (property.NameEquals("claimValue"u8)) + { + claimValue = property.Value.GetString(); + continue; + } if (property.NameEquals("revision"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -114,7 +117,7 @@ internal static SharedAccessAuthorizationRuleProperties DeserializeSharedAccessA continue; } } - return new SharedAccessAuthorizationRuleProperties(Optional.ToList(rights), primaryKey.Value, secondaryKey.Value, keyName.Value, claimType.Value, claimValue.Value, Optional.ToNullable(modifiedTime), Optional.ToNullable(createdTime), Optional.ToNullable(revision)); + return new SharedAccessAuthorizationRuleProperties(rights, primaryKey.Value, secondaryKey.Value, keyName.Value, Optional.ToNullable(modifiedTime), Optional.ToNullable(createdTime), claimType.Value, claimValue.Value, Optional.ToNullable(revision)); } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleProperties.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleProperties.cs index c03f934b5ef4..9d6a69723bf2 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleProperties.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleProperties.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; using Azure.Core; namespace Azure.ResourceManager.NotificationHubs.Models @@ -15,51 +16,67 @@ namespace Azure.ResourceManager.NotificationHubs.Models public partial class SharedAccessAuthorizationRuleProperties { /// Initializes a new instance of SharedAccessAuthorizationRuleProperties. - public SharedAccessAuthorizationRuleProperties() + /// Gets or sets the rights associated with the rule. + /// is null. + public SharedAccessAuthorizationRuleProperties(IEnumerable rights) { - Rights = new ChangeTrackingList(); + Argument.AssertNotNull(rights, nameof(rights)); + + Rights = rights.ToList(); } /// Initializes a new instance of SharedAccessAuthorizationRuleProperties. - /// The rights associated with the rule. - /// A base64-encoded 256-bit primary key for signing and validating the SAS token. - /// A base64-encoded 256-bit primary key for signing and validating the SAS token. - /// A string that describes the authorization rule. - /// A string that describes the claim type. - /// A string that describes the claim value. - /// The last modified time for this rule. - /// The created time for this rule. - /// The revision number for the rule. - internal SharedAccessAuthorizationRuleProperties(IList rights, string primaryKey, string secondaryKey, string keyName, string claimType, string claimValue, DateTimeOffset? modifiedOn, DateTimeOffset? createdOn, int? revision) + /// 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. + internal SharedAccessAuthorizationRuleProperties(IList rights, string primaryKey, string secondaryKey, string keyName, DateTimeOffset? modifiedOn, DateTimeOffset? createdOn, string claimType, string claimValue, int? revision) { Rights = rights; PrimaryKey = primaryKey; SecondaryKey = secondaryKey; KeyName = keyName; - ClaimType = claimType; - ClaimValue = claimValue; ModifiedOn = modifiedOn; CreatedOn = createdOn; + ClaimType = claimType; + ClaimValue = claimValue; Revision = revision; } - /// The rights associated with the rule. + /// Gets or sets the rights associated with the rule. public IList Rights { get; } - /// A base64-encoded 256-bit primary key for signing and validating the SAS token. - public string PrimaryKey { get; } - /// A base64-encoded 256-bit primary key for signing and validating the SAS token. - public string SecondaryKey { get; } - /// A string that describes the authorization rule. + /// + /// Gets a base64-encoded 256-bit primary key for signing and + /// validating the SAS token. + /// + public string PrimaryKey { get; set; } + /// + /// Gets a base64-encoded 256-bit primary key for signing and + /// validating the SAS token. + /// + public string SecondaryKey { get; set; } + /// Gets a string that describes the authorization rule. public string KeyName { get; } - /// A string that describes the claim type. - public string ClaimType { get; } - /// A string that describes the claim value. - public string ClaimValue { get; } - /// The last modified time for this rule. + /// Gets the last modified time for this rule. public DateTimeOffset? ModifiedOn { get; } - /// The created time for this rule. + /// Gets the created time for this rule. public DateTimeOffset? CreatedOn { get; } - /// The revision number for the rule. + /// Gets a string that describes the claim type. + public string ClaimType { get; } + /// Gets a string that describes the claim value. + public string ClaimValue { get; } + /// Gets the revision number for the rule. public int? Revision { get; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/WnsCredentialProperties.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/WnsCredentialProperties.Serialization.cs new file mode 100644 index 000000000000..55cf567c51d6 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/WnsCredentialProperties.Serialization.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class WnsCredentialProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(PackageSid)) + { + writer.WritePropertyName("packageSid"u8); + writer.WriteStringValue(PackageSid); + } + if (Optional.IsDefined(SecretKey)) + { + writer.WritePropertyName("secretKey"u8); + writer.WriteStringValue(SecretKey); + } + if (Optional.IsDefined(WindowsLiveEndpoint)) + { + writer.WritePropertyName("windowsLiveEndpoint"u8); + writer.WriteStringValue(WindowsLiveEndpoint); + } + if (Optional.IsDefined(CertificateKey)) + { + writer.WritePropertyName("certificateKey"u8); + writer.WriteStringValue(CertificateKey); + } + if (Optional.IsDefined(WnsCertificate)) + { + writer.WritePropertyName("wnsCertificate"u8); + writer.WriteStringValue(WnsCertificate); + } + writer.WriteEndObject(); + } + + internal static WnsCredentialProperties DeserializeWnsCredentialProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional packageSid = default; + Optional secretKey = default; + Optional windowsLiveEndpoint = default; + Optional certificateKey = default; + Optional wnsCertificate = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("packageSid"u8)) + { + packageSid = property.Value.GetString(); + continue; + } + if (property.NameEquals("secretKey"u8)) + { + secretKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("windowsLiveEndpoint"u8)) + { + windowsLiveEndpoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("certificateKey"u8)) + { + certificateKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("wnsCertificate"u8)) + { + wnsCertificate = property.Value.GetString(); + continue; + } + } + return new WnsCredentialProperties(packageSid.Value, secretKey.Value, windowsLiveEndpoint.Value, certificateKey.Value, wnsCertificate.Value); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/WnsCredentialProperties.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/WnsCredentialProperties.cs new file mode 100644 index 000000000000..e29791cff4d2 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/WnsCredentialProperties.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub WnsCredential. + public partial class WnsCredentialProperties + { + /// Initializes a new instance of WnsCredentialProperties. + public WnsCredentialProperties() + { + } + + /// Initializes a new instance of WnsCredentialProperties. + /// Gets or sets the package ID for this credential. + /// Gets or sets the secret key. + /// Gets or sets the Windows Live endpoint. + /// Ges or sets the WNS Certificate Key. + /// Gets or sets the WNS Certificate. + internal WnsCredentialProperties(string packageSid, string secretKey, string windowsLiveEndpoint, string certificateKey, string wnsCertificate) + { + PackageSid = packageSid; + SecretKey = secretKey; + WindowsLiveEndpoint = windowsLiveEndpoint; + CertificateKey = certificateKey; + WnsCertificate = wnsCertificate; + } + + /// Gets or sets the package ID for this credential. + public string PackageSid { get; set; } + /// Gets or sets the secret key. + public string SecretKey { get; set; } + /// Gets or sets the Windows Live endpoint. + public string WindowsLiveEndpoint { get; set; } + /// Ges or sets the WNS Certificate Key. + public string CertificateKey { get; set; } + /// Gets or sets the WNS Certificate. + public string WnsCertificate { get; set; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/XiaomiCredential.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/XiaomiCredential.Serialization.cs new file mode 100644 index 000000000000..b36d68db69fd --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/XiaomiCredential.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + internal partial class XiaomiCredential : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + writer.WriteEndObject(); + } + + internal static XiaomiCredential DeserializeXiaomiCredential(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + XiaomiCredentialProperties properties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = XiaomiCredentialProperties.DeserializeXiaomiCredentialProperties(property.Value); + continue; + } + } + return new XiaomiCredential(properties); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/XiaomiCredential.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/XiaomiCredential.cs new file mode 100644 index 000000000000..af28908eb909 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/XiaomiCredential.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub XiaomiCredential. + internal partial class XiaomiCredential + { + /// Initializes a new instance of XiaomiCredential. + /// Description of a NotificationHub XiaomiCredentialProperties. + /// is null. + public XiaomiCredential(XiaomiCredentialProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + } + + /// Description of a NotificationHub XiaomiCredentialProperties. + public XiaomiCredentialProperties Properties { get; set; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/XiaomiCredentialProperties.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/XiaomiCredentialProperties.Serialization.cs new file mode 100644 index 000000000000..ff4f8dab9dc6 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/XiaomiCredentialProperties.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class XiaomiCredentialProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(AppSecret)) + { + writer.WritePropertyName("appSecret"u8); + writer.WriteStringValue(AppSecret); + } + if (Optional.IsDefined(Endpoint)) + { + writer.WritePropertyName("endpoint"u8); + writer.WriteStringValue(Endpoint); + } + writer.WriteEndObject(); + } + + internal static XiaomiCredentialProperties DeserializeXiaomiCredentialProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional appSecret = default; + Optional endpoint = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("appSecret"u8)) + { + appSecret = property.Value.GetString(); + continue; + } + if (property.NameEquals("endpoint"u8)) + { + endpoint = property.Value.GetString(); + continue; + } + } + return new XiaomiCredentialProperties(appSecret.Value, endpoint.Value); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/XiaomiCredentialProperties.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/XiaomiCredentialProperties.cs new file mode 100644 index 000000000000..fe40e78d7af8 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/XiaomiCredentialProperties.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub XiaomiCredentialProperties. + public partial class XiaomiCredentialProperties + { + /// Initializes a new instance of XiaomiCredentialProperties. + public XiaomiCredentialProperties() + { + } + + /// Initializes a new instance of XiaomiCredentialProperties. + /// Gets or sets app secret. + /// Gets or sets xiaomi service endpoint. + internal XiaomiCredentialProperties(string appSecret, string endpoint) + { + AppSecret = appSecret; + Endpoint = endpoint; + } + + /// Gets or sets app secret. + public string AppSecret { get; set; } + /// Gets or sets xiaomi service endpoint. + public string Endpoint { get; set; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/ZoneRedundancyPreference.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/ZoneRedundancyPreference.cs new file mode 100644 index 000000000000..04a809d7a510 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/ZoneRedundancyPreference.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Namespace SKU name. + public readonly partial struct ZoneRedundancyPreference : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ZoneRedundancyPreference(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DisabledValue = "Disabled"; + private const string EnabledValue = "Enabled"; + + /// Disabled. + public static ZoneRedundancyPreference Disabled { get; } = new ZoneRedundancyPreference(DisabledValue); + /// Enabled. + public static ZoneRedundancyPreference Enabled { get; } = new ZoneRedundancyPreference(EnabledValue); + /// Determines if two values are the same. + public static bool operator ==(ZoneRedundancyPreference left, ZoneRedundancyPreference right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ZoneRedundancyPreference left, ZoneRedundancyPreference right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ZoneRedundancyPreference(string value) => new ZoneRedundancyPreference(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ZoneRedundancyPreference other && Equals(other); + /// + public bool Equals(ZoneRedundancyPreference other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NamespaceAuthorizationRuleCollection.cs similarity index 56% rename from sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleCollection.cs rename to sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NamespaceAuthorizationRuleCollection.cs index 29fcbc92d4f2..961552c702f7 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleCollection.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NamespaceAuthorizationRuleCollection.cs @@ -16,33 +16,32 @@ using Azure.Core; using Azure.Core.Pipeline; using Azure.ResourceManager; -using Azure.ResourceManager.NotificationHubs.Models; namespace Azure.ResourceManager.NotificationHubs { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetNotificationHubNamespaceAuthorizationRules method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetNamespaceAuthorizationRules method from an instance of . /// - public partial class NotificationHubNamespaceAuthorizationRuleCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class NamespaceAuthorizationRuleCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics; - private readonly NamespacesRestOperations _notificationHubNamespaceAuthorizationRuleNamespacesRestClient; + private readonly ClientDiagnostics _namespaceAuthorizationRuleNamespacesClientDiagnostics; + private readonly NamespacesRestOperations _namespaceAuthorizationRuleNamespacesRestClient; - /// Initializes a new instance of the class for mocking. - protected NotificationHubNamespaceAuthorizationRuleCollection() + /// Initializes a new instance of the class for mocking. + protected NamespaceAuthorizationRuleCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal NotificationHubNamespaceAuthorizationRuleCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal NamespaceAuthorizationRuleCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NotificationHubs", NotificationHubNamespaceAuthorizationRuleResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(NotificationHubNamespaceAuthorizationRuleResource.ResourceType, out string notificationHubNamespaceAuthorizationRuleNamespacesApiVersion); - _notificationHubNamespaceAuthorizationRuleNamespacesRestClient = new NamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, notificationHubNamespaceAuthorizationRuleNamespacesApiVersion); + _namespaceAuthorizationRuleNamespacesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NotificationHubs", NamespaceAuthorizationRuleResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(NamespaceAuthorizationRuleResource.ResourceType, out string namespaceAuthorizationRuleNamespacesApiVersion); + _namespaceAuthorizationRuleNamespacesRestClient = new NamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, namespaceAuthorizationRuleNamespacesApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -59,7 +58,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id @@ -69,21 +68,21 @@ 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 shared access authorization rule. + /// Request content. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateContent content, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string authorizationRuleName, NotificationHubAuthorizationRuleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(data, nameof(data)); - using var scope = _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceAuthorizationRuleCollection.CreateOrUpdate"); + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.CreateOrUpdateAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, content, cancellationToken).ConfigureAwait(false); - var operation = new NotificationHubsArmOperation(Response.FromValue(new NotificationHubNamespaceAuthorizationRuleResource(Client, response), response.GetRawResponse())); + var response = await _namespaceAuthorizationRuleNamespacesRestClient.CreateOrUpdateAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, data, cancellationToken).ConfigureAwait(false); + var operation = new NotificationHubsArmOperation(Response.FromValue(new NamespaceAuthorizationRuleResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -100,7 +99,7 @@ public virtual async Task /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id @@ -110,21 +109,21 @@ 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 shared access authorization rule. + /// Request content. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateContent content, CancellationToken cancellationToken = default) + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string authorizationRuleName, NotificationHubAuthorizationRuleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(data, nameof(data)); - using var scope = _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceAuthorizationRuleCollection.CreateOrUpdate"); + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleCollection.CreateOrUpdate"); scope.Start(); try { - var response = _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.CreateOrUpdateAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, content, cancellationToken); - var operation = new NotificationHubsArmOperation(Response.FromValue(new NotificationHubNamespaceAuthorizationRuleResource(Client, response), response.GetRawResponse())); + var response = _namespaceAuthorizationRuleNamespacesRestClient.CreateOrUpdateAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, data, cancellationToken); + var operation = new NotificationHubsArmOperation(Response.FromValue(new NamespaceAuthorizationRuleResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -141,7 +140,7 @@ public virtual ArmOperation C /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id @@ -149,22 +148,22 @@ public virtual ArmOperation C /// /// /// - /// Authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string authorizationRuleName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - using var scope = _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceAuthorizationRuleCollection.Get"); + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleCollection.Get"); scope.Start(); try { - var response = await _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken).ConfigureAwait(false); + var response = await _namespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NotificationHubNamespaceAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new NamespaceAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -178,7 +177,7 @@ public virtual async Task /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id @@ -186,22 +185,22 @@ public virtual async Task /// /// - /// Authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string authorizationRuleName, CancellationToken cancellationToken = default) + public virtual Response Get(string authorizationRuleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - using var scope = _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceAuthorizationRuleCollection.Get"); + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleCollection.Get"); scope.Start(); try { - var response = _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken); + var response = _namespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NotificationHubNamespaceAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new NamespaceAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -215,7 +214,7 @@ public virtual Response Get(s /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules /// /// /// Operation Id @@ -224,12 +223,12 @@ public virtual Response Get(s /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.CreateListAuthorizationRulesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.CreateListAuthorizationRulesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NotificationHubNamespaceAuthorizationRuleResource(Client, NotificationHubAuthorizationRuleData.DeserializeNotificationHubAuthorizationRuleData(e)), _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics, Pipeline, "NotificationHubNamespaceAuthorizationRuleCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _namespaceAuthorizationRuleNamespacesRestClient.CreateListAuthorizationRulesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _namespaceAuthorizationRuleNamespacesRestClient.CreateListAuthorizationRulesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NamespaceAuthorizationRuleResource(Client, NotificationHubAuthorizationRuleData.DeserializeNotificationHubAuthorizationRuleData(e)), _namespaceAuthorizationRuleNamespacesClientDiagnostics, Pipeline, "NamespaceAuthorizationRuleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -237,7 +236,7 @@ public virtual AsyncPageable /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules /// /// /// Operation Id @@ -246,12 +245,12 @@ public virtual AsyncPageable /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.CreateListAuthorizationRulesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.CreateListAuthorizationRulesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NotificationHubNamespaceAuthorizationRuleResource(Client, NotificationHubAuthorizationRuleData.DeserializeNotificationHubAuthorizationRuleData(e)), _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics, Pipeline, "NotificationHubNamespaceAuthorizationRuleCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _namespaceAuthorizationRuleNamespacesRestClient.CreateListAuthorizationRulesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _namespaceAuthorizationRuleNamespacesRestClient.CreateListAuthorizationRulesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NamespaceAuthorizationRuleResource(Client, NotificationHubAuthorizationRuleData.DeserializeNotificationHubAuthorizationRuleData(e)), _namespaceAuthorizationRuleNamespacesClientDiagnostics, Pipeline, "NamespaceAuthorizationRuleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -259,7 +258,7 @@ public virtual Pageable GetAl /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id @@ -267,7 +266,7 @@ public virtual Pageable GetAl /// /// /// - /// Authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -275,11 +274,11 @@ public virtual async Task> ExistsAsync(string authorizationRuleNa { Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - using var scope = _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceAuthorizationRuleCollection.Exists"); + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleCollection.Exists"); scope.Start(); try { - var response = await _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _namespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -294,7 +293,7 @@ public virtual async Task> ExistsAsync(string authorizationRuleNa /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id @@ -302,7 +301,7 @@ public virtual async Task> ExistsAsync(string authorizationRuleNa /// /// /// - /// Authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -310,11 +309,11 @@ public virtual Response Exists(string authorizationRuleName, CancellationT { Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - using var scope = _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceAuthorizationRuleCollection.Exists"); + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleCollection.Exists"); scope.Start(); try { - var response = _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken: cancellationToken); + var response = _namespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -329,7 +328,7 @@ public virtual Response Exists(string authorizationRuleName, CancellationT /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id @@ -337,22 +336,22 @@ public virtual Response Exists(string authorizationRuleName, CancellationT /// /// /// - /// Authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string authorizationRuleName, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - using var scope = _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceAuthorizationRuleCollection.GetIfExists"); + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleCollection.GetIfExists"); scope.Start(); try { - var response = await _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _namespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NotificationHubNamespaceAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NamespaceAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -366,7 +365,7 @@ public virtual async Task /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id @@ -374,22 +373,22 @@ public virtual async Task /// /// - /// Authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string authorizationRuleName, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string authorizationRuleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - using var scope = _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceAuthorizationRuleCollection.GetIfExists"); + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleCollection.GetIfExists"); scope.Start(); try { - var response = _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken: cancellationToken); + var response = _namespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NotificationHubNamespaceAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NamespaceAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -398,7 +397,7 @@ public virtual NullableResponse IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -408,7 +407,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NamespaceAuthorizationRuleResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NamespaceAuthorizationRuleResource.cs new file mode 100644 index 000000000000..d5a60c637db3 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NamespaceAuthorizationRuleResource.cs @@ -0,0 +1,715 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NotificationHubs.Models; + +namespace Azure.ResourceManager.NotificationHubs +{ + /// + /// A Class representing a NamespaceAuthorizationRule along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetNamespaceAuthorizationRuleResource method. + /// Otherwise you can get one from its parent resource using the GetNamespaceAuthorizationRule method. + /// + public partial class NamespaceAuthorizationRuleResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _namespaceAuthorizationRuleNamespacesClientDiagnostics; + private readonly NamespacesRestOperations _namespaceAuthorizationRuleNamespacesRestClient; + private readonly NotificationHubAuthorizationRuleData _data; + + /// Initializes a new instance of the class for mocking. + protected NamespaceAuthorizationRuleResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal NamespaceAuthorizationRuleResource(ArmClient client, NotificationHubAuthorizationRuleData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal NamespaceAuthorizationRuleResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _namespaceAuthorizationRuleNamespacesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NotificationHubs", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string namespaceAuthorizationRuleNamespacesApiVersion); + _namespaceAuthorizationRuleNamespacesRestClient = new NamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, namespaceAuthorizationRuleNamespacesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NotificationHubs/namespaces/authorizationRules"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual NotificationHubAuthorizationRuleData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets an authorization rule for a namespace by name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// Namespaces_GetAuthorizationRule + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleResource.Get"); + scope.Start(); + try + { + var response = await _namespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NamespaceAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets an authorization rule for a namespace by name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// Namespaces_GetAuthorizationRule + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleResource.Get"); + scope.Start(); + try + { + var response = _namespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NamespaceAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a namespace authorization rule + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// Namespaces_DeleteAuthorizationRule + /// + /// + /// + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleResource.Delete"); + scope.Start(); + try + { + var response = await _namespaceAuthorizationRuleNamespacesRestClient.DeleteAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new NotificationHubsArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a namespace authorization rule + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// Namespaces_DeleteAuthorizationRule + /// + /// + /// + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleResource.Delete"); + scope.Start(); + try + { + var response = _namespaceAuthorizationRuleNamespacesRestClient.DeleteAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new NotificationHubsArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates an authorization rule for a namespace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// Namespaces_CreateOrUpdateAuthorizationRule + /// + /// + /// + /// 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. + /// Request content. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, NotificationHubAuthorizationRuleData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleResource.Update"); + scope.Start(); + try + { + var response = await _namespaceAuthorizationRuleNamespacesRestClient.CreateOrUpdateAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new NotificationHubsArmOperation(Response.FromValue(new NamespaceAuthorizationRuleResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates an authorization rule for a namespace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// Namespaces_CreateOrUpdateAuthorizationRule + /// + /// + /// + /// 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. + /// Request content. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, NotificationHubAuthorizationRuleData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleResource.Update"); + scope.Start(); + try + { + var response = _namespaceAuthorizationRuleNamespacesRestClient.CreateOrUpdateAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new NotificationHubsArmOperation(Response.FromValue(new NamespaceAuthorizationRuleResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the Primary and Secondary ConnectionStrings to the namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}/listKeys + /// + /// + /// Operation Id + /// Namespaces_ListKeys + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetKeysAsync(CancellationToken cancellationToken = default) + { + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleResource.GetKeys"); + scope.Start(); + try + { + var response = await _namespaceAuthorizationRuleNamespacesRestClient.ListKeysAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the Primary and Secondary ConnectionStrings to the namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}/listKeys + /// + /// + /// Operation Id + /// Namespaces_ListKeys + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetKeys(CancellationToken cancellationToken = default) + { + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleResource.GetKeys"); + scope.Start(); + try + { + var response = _namespaceAuthorizationRuleNamespacesRestClient.ListKeys(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Regenerates the Primary/Secondary Keys to the Namespace Authorization Rule + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}/regenerateKeys + /// + /// + /// Operation Id + /// Namespaces_RegenerateKeys + /// + /// + /// + /// Request content. + /// The cancellation token to use. + /// is null. + public virtual async Task> RegenerateKeysAsync(PolicyKeyResource policyKeyResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(policyKeyResource, nameof(policyKeyResource)); + + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleResource.RegenerateKeys"); + scope.Start(); + try + { + var response = await _namespaceAuthorizationRuleNamespacesRestClient.RegenerateKeysAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyKeyResource, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Regenerates the Primary/Secondary Keys to the Namespace Authorization Rule + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}/regenerateKeys + /// + /// + /// Operation Id + /// Namespaces_RegenerateKeys + /// + /// + /// + /// Request content. + /// The cancellation token to use. + /// is null. + public virtual Response RegenerateKeys(PolicyKeyResource policyKeyResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(policyKeyResource, nameof(policyKeyResource)); + + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleResource.RegenerateKeys"); + scope.Start(); + try + { + var response = _namespaceAuthorizationRuleNamespacesRestClient.RegenerateKeys(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyKeyResource, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// Namespaces_GetAuthorizationRule + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _namespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NamespaceAuthorizationRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// Namespaces_GetAuthorizationRule + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _namespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NamespaceAuthorizationRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags[key] = value; + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// Namespaces_GetAuthorizationRule + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _namespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NamespaceAuthorizationRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// Namespaces_GetAuthorizationRule + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _namespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NamespaceAuthorizationRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// Namespaces_GetAuthorizationRule + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _namespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NamespaceAuthorizationRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// Namespaces_GetAuthorizationRule + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _namespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NamespaceAuthorizationRuleResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _namespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NamespaceAuthorizationRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags.Remove(key); + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NamespaceNotificationHubAuthorizationRuleCollection.cs similarity index 56% rename from sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleCollection.cs rename to sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NamespaceNotificationHubAuthorizationRuleCollection.cs index cc21e8115a40..4b4daff98786 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleCollection.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NamespaceNotificationHubAuthorizationRuleCollection.cs @@ -16,33 +16,32 @@ using Azure.Core; using Azure.Core.Pipeline; using Azure.ResourceManager; -using Azure.ResourceManager.NotificationHubs.Models; namespace Azure.ResourceManager.NotificationHubs { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetNotificationHubAuthorizationRules method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetNamespaceNotificationHubAuthorizationRules method from an instance of . /// - public partial class NotificationHubAuthorizationRuleCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class NamespaceNotificationHubAuthorizationRuleCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics; - private readonly NotificationHubsRestOperations _notificationHubAuthorizationRuleNotificationHubsRestClient; + private readonly ClientDiagnostics _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics; + private readonly NotificationHubsRestOperations _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient; - /// Initializes a new instance of the class for mocking. - protected NotificationHubAuthorizationRuleCollection() + /// Initializes a new instance of the class for mocking. + protected NamespaceNotificationHubAuthorizationRuleCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal NotificationHubAuthorizationRuleCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal NamespaceNotificationHubAuthorizationRuleCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NotificationHubs", NotificationHubAuthorizationRuleResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(NotificationHubAuthorizationRuleResource.ResourceType, out string notificationHubAuthorizationRuleNotificationHubsApiVersion); - _notificationHubAuthorizationRuleNotificationHubsRestClient = new NotificationHubsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, notificationHubAuthorizationRuleNotificationHubsApiVersion); + _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NotificationHubs", NamespaceNotificationHubAuthorizationRuleResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(NamespaceNotificationHubAuthorizationRuleResource.ResourceType, out string namespaceNotificationHubAuthorizationRuleNotificationHubsApiVersion); + _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient = new NotificationHubsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, namespaceNotificationHubAuthorizationRuleNotificationHubsApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -59,7 +58,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id @@ -69,21 +68,21 @@ 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 shared access authorization rule. + /// Request content. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateContent content, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string authorizationRuleName, NotificationHubAuthorizationRuleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(data, nameof(data)); - using var scope = _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NotificationHubAuthorizationRuleCollection.CreateOrUpdate"); + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _notificationHubAuthorizationRuleNotificationHubsRestClient.CreateOrUpdateAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, content, cancellationToken).ConfigureAwait(false); - var operation = new NotificationHubsArmOperation(Response.FromValue(new NotificationHubAuthorizationRuleResource(Client, response), response.GetRawResponse())); + var response = await _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.CreateOrUpdateAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, data, cancellationToken).ConfigureAwait(false); + var operation = new NotificationHubsArmOperation(Response.FromValue(new NamespaceNotificationHubAuthorizationRuleResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -100,7 +99,7 @@ public virtual async Task /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id @@ -110,21 +109,21 @@ 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 shared access authorization rule. + /// Request content. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateContent content, CancellationToken cancellationToken = default) + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string authorizationRuleName, NotificationHubAuthorizationRuleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(data, nameof(data)); - using var scope = _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NotificationHubAuthorizationRuleCollection.CreateOrUpdate"); + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleCollection.CreateOrUpdate"); scope.Start(); try { - var response = _notificationHubAuthorizationRuleNotificationHubsRestClient.CreateOrUpdateAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, content, cancellationToken); - var operation = new NotificationHubsArmOperation(Response.FromValue(new NotificationHubAuthorizationRuleResource(Client, response), response.GetRawResponse())); + var response = _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.CreateOrUpdateAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, data, cancellationToken); + var operation = new NotificationHubsArmOperation(Response.FromValue(new NamespaceNotificationHubAuthorizationRuleResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -141,7 +140,7 @@ public virtual ArmOperation CreateOrUp /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id @@ -149,22 +148,22 @@ public virtual ArmOperation CreateOrUp /// /// /// - /// authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string authorizationRuleName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - using var scope = _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NotificationHubAuthorizationRuleCollection.Get"); + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleCollection.Get"); scope.Start(); try { - var response = await _notificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken).ConfigureAwait(false); + var response = await _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NotificationHubAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new NamespaceNotificationHubAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -178,7 +177,7 @@ public virtual async Task> Ge /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id @@ -186,22 +185,22 @@ public virtual async Task> Ge /// /// /// - /// authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string authorizationRuleName, CancellationToken cancellationToken = default) + public virtual Response Get(string authorizationRuleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - using var scope = _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NotificationHubAuthorizationRuleCollection.Get"); + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleCollection.Get"); scope.Start(); try { - var response = _notificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken); + var response = _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NotificationHubAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new NamespaceNotificationHubAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -215,7 +214,7 @@ public virtual Response Get(string aut /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules /// /// /// Operation Id @@ -224,12 +223,12 @@ public virtual Response Get(string aut /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationHubAuthorizationRuleNotificationHubsRestClient.CreateListAuthorizationRulesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _notificationHubAuthorizationRuleNotificationHubsRestClient.CreateListAuthorizationRulesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NotificationHubAuthorizationRuleResource(Client, NotificationHubAuthorizationRuleData.DeserializeNotificationHubAuthorizationRuleData(e)), _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics, Pipeline, "NotificationHubAuthorizationRuleCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.CreateListAuthorizationRulesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.CreateListAuthorizationRulesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NamespaceNotificationHubAuthorizationRuleResource(Client, NotificationHubAuthorizationRuleData.DeserializeNotificationHubAuthorizationRuleData(e)), _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics, Pipeline, "NamespaceNotificationHubAuthorizationRuleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -237,7 +236,7 @@ public virtual AsyncPageable GetAllAsy /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules /// /// /// Operation Id @@ -246,12 +245,12 @@ public virtual AsyncPageable GetAllAsy /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationHubAuthorizationRuleNotificationHubsRestClient.CreateListAuthorizationRulesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _notificationHubAuthorizationRuleNotificationHubsRestClient.CreateListAuthorizationRulesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NotificationHubAuthorizationRuleResource(Client, NotificationHubAuthorizationRuleData.DeserializeNotificationHubAuthorizationRuleData(e)), _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics, Pipeline, "NotificationHubAuthorizationRuleCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.CreateListAuthorizationRulesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.CreateListAuthorizationRulesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NamespaceNotificationHubAuthorizationRuleResource(Client, NotificationHubAuthorizationRuleData.DeserializeNotificationHubAuthorizationRuleData(e)), _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics, Pipeline, "NamespaceNotificationHubAuthorizationRuleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -259,7 +258,7 @@ public virtual Pageable GetAll(Cancell /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id @@ -267,7 +266,7 @@ public virtual Pageable GetAll(Cancell /// /// /// - /// authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -275,11 +274,11 @@ public virtual async Task> ExistsAsync(string authorizationRuleNa { Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - using var scope = _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NotificationHubAuthorizationRuleCollection.Exists"); + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleCollection.Exists"); scope.Start(); try { - var response = await _notificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -294,7 +293,7 @@ public virtual async Task> ExistsAsync(string authorizationRuleNa /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id @@ -302,7 +301,7 @@ public virtual async Task> ExistsAsync(string authorizationRuleNa /// /// /// - /// authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -310,11 +309,11 @@ public virtual Response Exists(string authorizationRuleName, CancellationT { Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - using var scope = _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NotificationHubAuthorizationRuleCollection.Exists"); + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleCollection.Exists"); scope.Start(); try { - var response = _notificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken); + var response = _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -329,7 +328,7 @@ public virtual Response Exists(string authorizationRuleName, CancellationT /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id @@ -337,22 +336,22 @@ public virtual Response Exists(string authorizationRuleName, CancellationT /// /// /// - /// authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string authorizationRuleName, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - using var scope = _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NotificationHubAuthorizationRuleCollection.GetIfExists"); + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleCollection.GetIfExists"); scope.Start(); try { - var response = await _notificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NotificationHubAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NamespaceNotificationHubAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -366,7 +365,7 @@ public virtual async Task /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id @@ -374,22 +373,22 @@ public virtual async Task /// /// - /// authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string authorizationRuleName, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string authorizationRuleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); - using var scope = _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NotificationHubAuthorizationRuleCollection.GetIfExists"); + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleCollection.GetIfExists"); scope.Start(); try { - var response = _notificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken); + var response = _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NotificationHubAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NamespaceNotificationHubAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -398,7 +397,7 @@ public virtual NullableResponse GetIfE } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -408,7 +407,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NamespaceNotificationHubAuthorizationRuleResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NamespaceNotificationHubAuthorizationRuleResource.cs new file mode 100644 index 000000000000..37d30355f879 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NamespaceNotificationHubAuthorizationRuleResource.cs @@ -0,0 +1,715 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NotificationHubs.Models; + +namespace Azure.ResourceManager.NotificationHubs +{ + /// + /// A Class representing a NamespaceNotificationHubAuthorizationRule along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetNamespaceNotificationHubAuthorizationRuleResource method. + /// Otherwise you can get one from its parent resource using the GetNamespaceNotificationHubAuthorizationRule method. + /// + public partial class NamespaceNotificationHubAuthorizationRuleResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics; + private readonly NotificationHubsRestOperations _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient; + private readonly NotificationHubAuthorizationRuleData _data; + + /// Initializes a new instance of the class for mocking. + protected NamespaceNotificationHubAuthorizationRuleResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal NamespaceNotificationHubAuthorizationRuleResource(ArmClient client, NotificationHubAuthorizationRuleData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal NamespaceNotificationHubAuthorizationRuleResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NotificationHubs", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string namespaceNotificationHubAuthorizationRuleNotificationHubsApiVersion); + _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient = new NotificationHubsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, namespaceNotificationHubAuthorizationRuleNotificationHubsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NotificationHubs/namespaces/notificationHubs/authorizationRules"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual NotificationHubAuthorizationRuleData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets an authorization rule for a NotificationHub by name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// NotificationHubs_GetAuthorizationRule + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleResource.Get"); + scope.Start(); + try + { + var response = await _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NamespaceNotificationHubAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets an authorization rule for a NotificationHub by name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// NotificationHubs_GetAuthorizationRule + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleResource.Get"); + scope.Start(); + try + { + var response = _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NamespaceNotificationHubAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a notificationHub authorization rule + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// NotificationHubs_DeleteAuthorizationRule + /// + /// + /// + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleResource.Delete"); + scope.Start(); + try + { + var response = await _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.DeleteAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new NotificationHubsArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a notificationHub authorization rule + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// NotificationHubs_DeleteAuthorizationRule + /// + /// + /// + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleResource.Delete"); + scope.Start(); + try + { + var response = _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.DeleteAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new NotificationHubsArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates/Updates an authorization rule for a NotificationHub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// NotificationHubs_CreateOrUpdateAuthorizationRule + /// + /// + /// + /// 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. + /// Request content. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, NotificationHubAuthorizationRuleData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleResource.Update"); + scope.Start(); + try + { + var response = await _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.CreateOrUpdateAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new NotificationHubsArmOperation(Response.FromValue(new NamespaceNotificationHubAuthorizationRuleResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates/Updates an authorization rule for a NotificationHub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// NotificationHubs_CreateOrUpdateAuthorizationRule + /// + /// + /// + /// 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. + /// Request content. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, NotificationHubAuthorizationRuleData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleResource.Update"); + scope.Start(); + try + { + var response = _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.CreateOrUpdateAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new NotificationHubsArmOperation(Response.FromValue(new NamespaceNotificationHubAuthorizationRuleResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the Primary and Secondary ConnectionStrings to the NotificationHub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName}/listKeys + /// + /// + /// Operation Id + /// NotificationHubs_ListKeys + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetKeysAsync(CancellationToken cancellationToken = default) + { + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleResource.GetKeys"); + scope.Start(); + try + { + var response = await _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.ListKeysAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the Primary and Secondary ConnectionStrings to the NotificationHub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName}/listKeys + /// + /// + /// Operation Id + /// NotificationHubs_ListKeys + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetKeys(CancellationToken cancellationToken = default) + { + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleResource.GetKeys"); + scope.Start(); + try + { + var response = _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.ListKeys(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName}/regenerateKeys + /// + /// + /// Operation Id + /// NotificationHubs_RegenerateKeys + /// + /// + /// + /// Request content. + /// The cancellation token to use. + /// is null. + public virtual async Task> RegenerateKeysAsync(PolicyKeyResource policyKeyResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(policyKeyResource, nameof(policyKeyResource)); + + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleResource.RegenerateKeys"); + scope.Start(); + try + { + var response = await _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.RegenerateKeysAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyKeyResource, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName}/regenerateKeys + /// + /// + /// Operation Id + /// NotificationHubs_RegenerateKeys + /// + /// + /// + /// Request content. + /// The cancellation token to use. + /// is null. + public virtual Response RegenerateKeys(PolicyKeyResource policyKeyResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(policyKeyResource, nameof(policyKeyResource)); + + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleResource.RegenerateKeys"); + scope.Start(); + try + { + var response = _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.RegenerateKeys(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyKeyResource, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// NotificationHubs_GetAuthorizationRule + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NamespaceNotificationHubAuthorizationRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// NotificationHubs_GetAuthorizationRule + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NamespaceNotificationHubAuthorizationRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags[key] = value; + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// NotificationHubs_GetAuthorizationRule + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NamespaceNotificationHubAuthorizationRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// NotificationHubs_GetAuthorizationRule + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NamespaceNotificationHubAuthorizationRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// NotificationHubs_GetAuthorizationRule + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NamespaceNotificationHubAuthorizationRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// NotificationHubs_GetAuthorizationRule + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _namespaceNotificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NamespaceNotificationHubAuthorizationRuleResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _namespaceNotificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NamespaceNotificationHubAuthorizationRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags.Remove(key); + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleData.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleData.cs index 55e55db4b8da..1fd21a696243 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleData.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleData.cs @@ -5,7 +5,6 @@ #nullable disable -using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -15,7 +14,7 @@ namespace Azure.ResourceManager.NotificationHubs { /// /// A class representing the NotificationHubAuthorizationRule data model. - /// Description of a Namespace AuthorizationRules. + /// Response for POST requests that return single SharedAccessAuthorizationRule. /// public partial class NotificationHubAuthorizationRuleData : TrackedResourceData { @@ -23,7 +22,6 @@ public partial class NotificationHubAuthorizationRuleData : TrackedResourceData /// The location. public NotificationHubAuthorizationRuleData(AzureLocation location) : base(location) { - Rights = new ChangeTrackingList(); } /// Initializes a new instance of NotificationHubAuthorizationRuleData. @@ -33,49 +31,13 @@ public NotificationHubAuthorizationRuleData(AzureLocation location) : base(locat /// The systemData. /// The tags. /// The location. - /// The rights associated with the rule. - /// A base64-encoded 256-bit primary key for signing and validating the SAS token. - /// A base64-encoded 256-bit primary key for signing and validating the SAS token. - /// A string that describes the authorization rule. - /// A string that describes the claim type. - /// A string that describes the claim value. - /// The last modified time for this rule. - /// The created time for this rule. - /// The revision number for the rule. - /// The sku of the created namespace. - internal NotificationHubAuthorizationRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IList rights, string primaryKey, string secondaryKey, string keyName, string claimType, string claimValue, DateTimeOffset? modifiedOn, DateTimeOffset? createdOn, int? revision, NotificationHubSku sku) : base(id, name, resourceType, systemData, tags, location) + /// SharedAccessAuthorizationRule properties. + internal NotificationHubAuthorizationRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SharedAccessAuthorizationRuleProperties properties) : base(id, name, resourceType, systemData, tags, location) { - Rights = rights; - PrimaryKey = primaryKey; - SecondaryKey = secondaryKey; - KeyName = keyName; - ClaimType = claimType; - ClaimValue = claimValue; - ModifiedOn = modifiedOn; - CreatedOn = createdOn; - Revision = revision; - Sku = sku; + Properties = properties; } - /// The rights associated with the rule. - public IList Rights { get; } - /// A base64-encoded 256-bit primary key for signing and validating the SAS token. - public string PrimaryKey { get; } - /// A base64-encoded 256-bit primary key for signing and validating the SAS token. - public string SecondaryKey { get; } - /// A string that describes the authorization rule. - public string KeyName { get; } - /// A string that describes the claim type. - public string ClaimType { get; } - /// A string that describes the claim value. - public string ClaimValue { get; } - /// The last modified time for this rule. - public DateTimeOffset? ModifiedOn { get; } - /// The created time for this rule. - public DateTimeOffset? CreatedOn { get; } - /// The revision number for the rule. - public int? Revision { get; } - /// The sku of the created namespace. - public NotificationHubSku Sku { get; set; } + /// SharedAccessAuthorizationRule properties. + public SharedAccessAuthorizationRuleProperties Properties { get; set; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleResource.cs deleted file mode 100644 index 5041315666fa..000000000000 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleResource.cs +++ /dev/null @@ -1,426 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.NotificationHubs.Models; - -namespace Azure.ResourceManager.NotificationHubs -{ - /// - /// A Class representing a NotificationHubAuthorizationRule along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetNotificationHubAuthorizationRuleResource method. - /// Otherwise you can get one from its parent resource using the GetNotificationHubAuthorizationRule method. - /// - public partial class NotificationHubAuthorizationRuleResource : ArmResource - { - /// Generate the resource identifier of a instance. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics; - private readonly NotificationHubsRestOperations _notificationHubAuthorizationRuleNotificationHubsRestClient; - private readonly NotificationHubAuthorizationRuleData _data; - - /// Initializes a new instance of the class for mocking. - protected NotificationHubAuthorizationRuleResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal NotificationHubAuthorizationRuleResource(ArmClient client, NotificationHubAuthorizationRuleData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal NotificationHubAuthorizationRuleResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NotificationHubs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string notificationHubAuthorizationRuleNotificationHubsApiVersion); - _notificationHubAuthorizationRuleNotificationHubsRestClient = new NotificationHubsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, notificationHubAuthorizationRuleNotificationHubsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.NotificationHubs/namespaces/notificationHubs/AuthorizationRules"; - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual NotificationHubAuthorizationRuleData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// - /// Gets an authorization rule for a NotificationHub by name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName} - /// - /// - /// Operation Id - /// NotificationHubs_GetAuthorizationRule - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NotificationHubAuthorizationRuleResource.Get"); - scope.Start(); - try - { - var response = await _notificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NotificationHubAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets an authorization rule for a NotificationHub by name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName} - /// - /// - /// Operation Id - /// NotificationHubs_GetAuthorizationRule - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NotificationHubAuthorizationRuleResource.Get"); - scope.Start(); - try - { - var response = _notificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NotificationHubAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Deletes a notificationHub authorization rule - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName} - /// - /// - /// Operation Id - /// NotificationHubs_DeleteAuthorizationRule - /// - /// - /// - /// 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. - /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NotificationHubAuthorizationRuleResource.Delete"); - scope.Start(); - try - { - var response = await _notificationHubAuthorizationRuleNotificationHubsRestClient.DeleteAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NotificationHubsArmOperation(response); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Deletes a notificationHub authorization rule - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName} - /// - /// - /// Operation Id - /// NotificationHubs_DeleteAuthorizationRule - /// - /// - /// - /// 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. - /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NotificationHubAuthorizationRuleResource.Delete"); - scope.Start(); - try - { - var response = _notificationHubAuthorizationRuleNotificationHubsRestClient.DeleteAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NotificationHubsArmOperation(response); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Creates/Updates an authorization rule for a NotificationHub - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName} - /// - /// - /// Operation Id - /// NotificationHubs_CreateOrUpdateAuthorizationRule - /// - /// - /// - /// 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. - /// The shared access authorization rule. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, SharedAccessAuthorizationRuleCreateOrUpdateContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NotificationHubAuthorizationRuleResource.Update"); - scope.Start(); - try - { - var response = await _notificationHubAuthorizationRuleNotificationHubsRestClient.CreateOrUpdateAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new NotificationHubsArmOperation(Response.FromValue(new NotificationHubAuthorizationRuleResource(Client, response), response.GetRawResponse())); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Creates/Updates an authorization rule for a NotificationHub - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName} - /// - /// - /// Operation Id - /// NotificationHubs_CreateOrUpdateAuthorizationRule - /// - /// - /// - /// 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. - /// The shared access authorization rule. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, SharedAccessAuthorizationRuleCreateOrUpdateContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NotificationHubAuthorizationRuleResource.Update"); - scope.Start(); - try - { - var response = _notificationHubAuthorizationRuleNotificationHubsRestClient.CreateOrUpdateAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new NotificationHubsArmOperation(Response.FromValue(new NotificationHubAuthorizationRuleResource(Client, response), response.GetRawResponse())); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the Primary and Secondary ConnectionStrings to the NotificationHub - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/listKeys - /// - /// - /// Operation Id - /// NotificationHubs_ListKeys - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetKeysAsync(CancellationToken cancellationToken = default) - { - using var scope = _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NotificationHubAuthorizationRuleResource.GetKeys"); - scope.Start(); - try - { - var response = await _notificationHubAuthorizationRuleNotificationHubsRestClient.ListKeysAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the Primary and Secondary ConnectionStrings to the NotificationHub - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/listKeys - /// - /// - /// Operation Id - /// NotificationHubs_ListKeys - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetKeys(CancellationToken cancellationToken = default) - { - using var scope = _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NotificationHubAuthorizationRuleResource.GetKeys"); - scope.Start(); - try - { - var response = _notificationHubAuthorizationRuleNotificationHubsRestClient.ListKeys(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys - /// - /// - /// Operation Id - /// NotificationHubs_RegenerateKeys - /// - /// - /// - /// Parameters supplied to regenerate the NotificationHub Authorization Rule Key. - /// The cancellation token to use. - /// is null. - public virtual async Task> RegenerateKeysAsync(NotificationHubPolicyKey notificationHubPolicyKey, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(notificationHubPolicyKey, nameof(notificationHubPolicyKey)); - - using var scope = _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NotificationHubAuthorizationRuleResource.RegenerateKeys"); - scope.Start(); - try - { - var response = await _notificationHubAuthorizationRuleNotificationHubsRestClient.RegenerateKeysAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, notificationHubPolicyKey, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys - /// - /// - /// Operation Id - /// NotificationHubs_RegenerateKeys - /// - /// - /// - /// Parameters supplied to regenerate the NotificationHub Authorization Rule Key. - /// The cancellation token to use. - /// is null. - public virtual Response RegenerateKeys(NotificationHubPolicyKey notificationHubPolicyKey, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(notificationHubPolicyKey, nameof(notificationHubPolicyKey)); - - using var scope = _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NotificationHubAuthorizationRuleResource.RegenerateKeys"); - scope.Start(); - try - { - var response = _notificationHubAuthorizationRuleNotificationHubsRestClient.RegenerateKeys(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, notificationHubPolicyKey, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubCollection.cs index 84635db0d66f..df3620bf3475 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubCollection.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubCollection.cs @@ -16,7 +16,6 @@ using Azure.Core; using Azure.Core.Pipeline; using Azure.ResourceManager; -using Azure.ResourceManager.NotificationHubs.Models; namespace Azure.ResourceManager.NotificationHubs { @@ -68,21 +67,21 @@ 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. - /// The notification hub name. - /// Parameters supplied to the create/update a NotificationHub Resource. + /// Notification Hub name. + /// Request content. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string notificationHubName, NotificationHubCreateOrUpdateContent content, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string notificationHubName, NotificationHubData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(data, nameof(data)); using var scope = _notificationHubClientDiagnostics.CreateScope("NotificationHubCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _notificationHubRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationHubName, content, cancellationToken).ConfigureAwait(false); + var response = await _notificationHubRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationHubName, data, cancellationToken).ConfigureAwait(false); var operation = new NotificationHubsArmOperation(Response.FromValue(new NotificationHubResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); @@ -109,21 +108,21 @@ public virtual async Task> CreateOrUpdateA /// /// /// 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. - /// The notification hub name. - /// Parameters supplied to the create/update a NotificationHub Resource. + /// Notification Hub name. + /// Request content. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string notificationHubName, NotificationHubCreateOrUpdateContent content, CancellationToken cancellationToken = default) + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string notificationHubName, NotificationHubData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(data, nameof(data)); using var scope = _notificationHubClientDiagnostics.CreateScope("NotificationHubCollection.CreateOrUpdate"); scope.Start(); try { - var response = _notificationHubRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationHubName, content, cancellationToken); + var response = _notificationHubRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationHubName, data, cancellationToken); var operation = new NotificationHubsArmOperation(Response.FromValue(new NotificationHubResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); @@ -137,7 +136,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wa } /// - /// Lists the notification hubs associated with a namespace. + /// Gets the notification hub. /// /// /// Request Path @@ -149,7 +148,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wa /// /// /// - /// The notification hub name. + /// Notification Hub name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -174,7 +173,7 @@ public virtual async Task> GetAsync(string not } /// - /// Lists the notification hubs associated with a namespace. + /// Gets the notification hub. /// /// /// Request Path @@ -186,7 +185,7 @@ public virtual async Task> GetAsync(string not /// /// /// - /// The notification hub name. + /// Notification Hub name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -223,12 +222,14 @@ public virtual Response Get(string notificationHubName, /// /// /// + /// Continuation token. + /// Page size. /// The cancellation token to use. /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + public virtual AsyncPageable GetAllAsync(string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationHubRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _notificationHubRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationHubRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, skipToken, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _notificationHubRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, skipToken, top); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NotificationHubResource(Client, NotificationHubData.DeserializeNotificationHubData(e)), _notificationHubClientDiagnostics, Pipeline, "NotificationHubCollection.GetAll", "value", "nextLink", cancellationToken); } @@ -245,12 +246,14 @@ public virtual AsyncPageable GetAllAsync(CancellationTo /// /// /// + /// Continuation token. + /// Page size. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationHubRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _notificationHubRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationHubRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, skipToken, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _notificationHubRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, skipToken, top); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NotificationHubResource(Client, NotificationHubData.DeserializeNotificationHubData(e)), _notificationHubClientDiagnostics, Pipeline, "NotificationHubCollection.GetAll", "value", "nextLink", cancellationToken); } @@ -267,7 +270,7 @@ public virtual Pageable GetAll(CancellationToken cancel /// /// /// - /// The notification hub name. + /// Notification Hub name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -302,7 +305,7 @@ public virtual async Task> ExistsAsync(string notificationHubName /// /// /// - /// The notification hub name. + /// Notification Hub name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -337,7 +340,7 @@ public virtual Response Exists(string notificationHubName, CancellationTok /// /// /// - /// The notification hub name. + /// Notification Hub name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -374,7 +377,7 @@ public virtual async Task> GetIfExists /// /// /// - /// The notification hub name. + /// Notification Hub name. /// 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/NotificationHubData.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubData.cs index f165adfe7cee..d4f183b7b082 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubData.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubData.cs @@ -5,7 +5,6 @@ #nullable disable -using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -15,7 +14,7 @@ namespace Azure.ResourceManager.NotificationHubs { /// /// A class representing the NotificationHub data model. - /// Description of a NotificationHub Resource. + /// Notification Hub Resource. /// public partial class NotificationHubData : TrackedResourceData { @@ -23,7 +22,6 @@ public partial class NotificationHubData : TrackedResourceData /// The location. public NotificationHubData(AzureLocation location) : base(location) { - AuthorizationRules = new ChangeTrackingList(); } /// Initializes a new instance of NotificationHubData. @@ -33,49 +31,17 @@ public NotificationHubData(AzureLocation location) : base(location) /// The systemData. /// The tags. /// The location. - /// The NotificationHub name. - /// The RegistrationTtl of the created NotificationHub. - /// The AuthorizationRules of the created NotificationHub. - /// The ApnsCredential of the created NotificationHub. - /// The WnsCredential of the created NotificationHub. - /// The GcmCredential of the created NotificationHub. - /// The MpnsCredential of the created NotificationHub. - /// The AdmCredential of the created NotificationHub. - /// The BaiduCredential of the created NotificationHub. - /// The sku of the created namespace. - internal NotificationHubData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string notificationHubName, TimeSpan? registrationTtl, IList authorizationRules, NotificationHubApnsCredential apnsCredential, NotificationHubWnsCredential wnsCredential, NotificationHubGcmCredential gcmCredential, NotificationHubMpnsCredential mpnsCredential, NotificationHubAdmCredential admCredential, NotificationHubBaiduCredential baiduCredential, NotificationHubSku sku) : base(id, name, resourceType, systemData, tags, location) + /// NotificationHub properties. + /// The Sku description for a namespace. + internal NotificationHubData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NotificationHubProperties properties, NotificationHubSku sku) : base(id, name, resourceType, systemData, tags, location) { - NotificationHubName = notificationHubName; - RegistrationTtl = registrationTtl; - AuthorizationRules = authorizationRules; - ApnsCredential = apnsCredential; - WnsCredential = wnsCredential; - GcmCredential = gcmCredential; - MpnsCredential = mpnsCredential; - AdmCredential = admCredential; - BaiduCredential = baiduCredential; + Properties = properties; Sku = sku; } - /// The NotificationHub name. - public string NotificationHubName { get; set; } - /// The RegistrationTtl of the created NotificationHub. - public TimeSpan? RegistrationTtl { get; set; } - /// The AuthorizationRules of the created NotificationHub. - public IList AuthorizationRules { get; } - /// The ApnsCredential of the created NotificationHub. - public NotificationHubApnsCredential ApnsCredential { get; set; } - /// The WnsCredential of the created NotificationHub. - public NotificationHubWnsCredential WnsCredential { get; set; } - /// The GcmCredential of the created NotificationHub. - public NotificationHubGcmCredential GcmCredential { get; set; } - /// The MpnsCredential of the created NotificationHub. - public NotificationHubMpnsCredential MpnsCredential { get; set; } - /// The AdmCredential of the created NotificationHub. - public NotificationHubAdmCredential AdmCredential { get; set; } - /// The BaiduCredential of the created NotificationHub. - public NotificationHubBaiduCredential BaiduCredential { get; set; } - /// The sku of the created namespace. + /// NotificationHub properties. + public NotificationHubProperties Properties { get; set; } + /// The Sku description for a namespace. public NotificationHubSku Sku { get; set; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleResource.cs deleted file mode 100644 index 8413ab3f4590..000000000000 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleResource.cs +++ /dev/null @@ -1,426 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.NotificationHubs.Models; - -namespace Azure.ResourceManager.NotificationHubs -{ - /// - /// A Class representing a NotificationHubNamespaceAuthorizationRule along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetNotificationHubNamespaceAuthorizationRuleResource method. - /// Otherwise you can get one from its parent resource using the GetNotificationHubNamespaceAuthorizationRule method. - /// - public partial class NotificationHubNamespaceAuthorizationRuleResource : ArmResource - { - /// Generate the resource identifier of a instance. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics; - private readonly NamespacesRestOperations _notificationHubNamespaceAuthorizationRuleNamespacesRestClient; - private readonly NotificationHubAuthorizationRuleData _data; - - /// Initializes a new instance of the class for mocking. - protected NotificationHubNamespaceAuthorizationRuleResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal NotificationHubNamespaceAuthorizationRuleResource(ArmClient client, NotificationHubAuthorizationRuleData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal NotificationHubNamespaceAuthorizationRuleResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NotificationHubs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string notificationHubNamespaceAuthorizationRuleNamespacesApiVersion); - _notificationHubNamespaceAuthorizationRuleNamespacesRestClient = new NamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, notificationHubNamespaceAuthorizationRuleNamespacesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.NotificationHubs/namespaces/AuthorizationRules"; - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual NotificationHubAuthorizationRuleData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// - /// Gets an authorization rule for a namespace by name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName} - /// - /// - /// Operation Id - /// Namespaces_GetAuthorizationRule - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceAuthorizationRuleResource.Get"); - scope.Start(); - try - { - var response = await _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NotificationHubNamespaceAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets an authorization rule for a namespace by name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName} - /// - /// - /// Operation Id - /// Namespaces_GetAuthorizationRule - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceAuthorizationRuleResource.Get"); - scope.Start(); - try - { - var response = _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NotificationHubNamespaceAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Deletes a namespace authorization rule - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName} - /// - /// - /// Operation Id - /// Namespaces_DeleteAuthorizationRule - /// - /// - /// - /// 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. - /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceAuthorizationRuleResource.Delete"); - scope.Start(); - try - { - var response = await _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.DeleteAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NotificationHubsArmOperation(response); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Deletes a namespace authorization rule - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName} - /// - /// - /// Operation Id - /// Namespaces_DeleteAuthorizationRule - /// - /// - /// - /// 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. - /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceAuthorizationRuleResource.Delete"); - scope.Start(); - try - { - var response = _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.DeleteAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NotificationHubsArmOperation(response); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Creates an authorization rule for a namespace - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName} - /// - /// - /// Operation Id - /// Namespaces_CreateOrUpdateAuthorizationRule - /// - /// - /// - /// 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. - /// The shared access authorization rule. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, SharedAccessAuthorizationRuleCreateOrUpdateContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceAuthorizationRuleResource.Update"); - scope.Start(); - try - { - var response = await _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.CreateOrUpdateAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new NotificationHubsArmOperation(Response.FromValue(new NotificationHubNamespaceAuthorizationRuleResource(Client, response), response.GetRawResponse())); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Creates an authorization rule for a namespace - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName} - /// - /// - /// Operation Id - /// Namespaces_CreateOrUpdateAuthorizationRule - /// - /// - /// - /// 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. - /// The shared access authorization rule. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, SharedAccessAuthorizationRuleCreateOrUpdateContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceAuthorizationRuleResource.Update"); - scope.Start(); - try - { - var response = _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.CreateOrUpdateAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new NotificationHubsArmOperation(Response.FromValue(new NotificationHubNamespaceAuthorizationRuleResource(Client, response), response.GetRawResponse())); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the Primary and Secondary ConnectionStrings to the namespace - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys - /// - /// - /// Operation Id - /// Namespaces_ListKeys - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetKeysAsync(CancellationToken cancellationToken = default) - { - using var scope = _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceAuthorizationRuleResource.GetKeys"); - scope.Start(); - try - { - var response = await _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.ListKeysAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the Primary and Secondary ConnectionStrings to the namespace - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys - /// - /// - /// Operation Id - /// Namespaces_ListKeys - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetKeys(CancellationToken cancellationToken = default) - { - using var scope = _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceAuthorizationRuleResource.GetKeys"); - scope.Start(); - try - { - var response = _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.ListKeys(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Regenerates the Primary/Secondary Keys to the Namespace Authorization Rule - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys - /// - /// - /// Operation Id - /// Namespaces_RegenerateKeys - /// - /// - /// - /// Parameters supplied to regenerate the Namespace Authorization Rule Key. - /// The cancellation token to use. - /// is null. - public virtual async Task> RegenerateKeysAsync(NotificationHubPolicyKey notificationHubPolicyKey, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(notificationHubPolicyKey, nameof(notificationHubPolicyKey)); - - using var scope = _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceAuthorizationRuleResource.RegenerateKeys"); - scope.Start(); - try - { - var response = await _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.RegenerateKeysAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, notificationHubPolicyKey, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Regenerates the Primary/Secondary Keys to the Namespace Authorization Rule - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys - /// - /// - /// Operation Id - /// Namespaces_RegenerateKeys - /// - /// - /// - /// Parameters supplied to regenerate the Namespace Authorization Rule Key. - /// The cancellation token to use. - /// is null. - public virtual Response RegenerateKeys(NotificationHubPolicyKey notificationHubPolicyKey, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(notificationHubPolicyKey, nameof(notificationHubPolicyKey)); - - using var scope = _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceAuthorizationRuleResource.RegenerateKeys"); - scope.Start(); - try - { - var response = _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.RegenerateKeys(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, notificationHubPolicyKey, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceCollection.cs index 920c00b6ac58..5287e8ae4b17 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceCollection.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceCollection.cs @@ -16,7 +16,6 @@ using Azure.Core; using Azure.Core.Pipeline; using Azure.ResourceManager; -using Azure.ResourceManager.NotificationHubs.Models; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.NotificationHubs @@ -56,7 +55,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Creates/Updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + /// Creates / Updates a Notification Hub namespace. This operation is idempotent. /// /// /// Request Path @@ -69,22 +68,22 @@ 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. - /// The namespace name. - /// Parameters supplied to create a Namespace Resource. + /// Namespace name. + /// Request content. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string namespaceName, NotificationHubNamespaceCreateOrUpdateContent content, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string namespaceName, NotificationHubNamespaceData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(data, nameof(data)); using var scope = _notificationHubNamespaceNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _notificationHubNamespaceNamespacesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, content, cancellationToken).ConfigureAwait(false); - var operation = new NotificationHubsArmOperation(Response.FromValue(new NotificationHubNamespaceResource(Client, response), response.GetRawResponse())); + var response = await _notificationHubNamespaceNamespacesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, data, cancellationToken).ConfigureAwait(false); + var operation = new NotificationHubsArmOperation(new NotificationHubNamespaceOperationSource(Client), _notificationHubNamespaceNamespacesClientDiagnostics, Pipeline, _notificationHubNamespaceNamespacesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -97,7 +96,7 @@ public virtual async Task> Create } /// - /// Creates/Updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + /// Creates / Updates a Notification Hub namespace. This operation is idempotent. /// /// /// Request Path @@ -110,22 +109,22 @@ public virtual async Task> Create /// /// /// 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. - /// The namespace name. - /// Parameters supplied to create a Namespace Resource. + /// Namespace name. + /// Request content. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string namespaceName, NotificationHubNamespaceCreateOrUpdateContent content, CancellationToken cancellationToken = default) + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string namespaceName, NotificationHubNamespaceData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(data, nameof(data)); using var scope = _notificationHubNamespaceNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceCollection.CreateOrUpdate"); scope.Start(); try { - var response = _notificationHubNamespaceNamespacesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, content, cancellationToken); - var operation = new NotificationHubsArmOperation(Response.FromValue(new NotificationHubNamespaceResource(Client, response), response.GetRawResponse())); + var response = _notificationHubNamespaceNamespacesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, data, cancellationToken); + var operation = new NotificationHubsArmOperation(new NotificationHubNamespaceOperationSource(Client), _notificationHubNamespaceNamespacesClientDiagnostics, Pipeline, _notificationHubNamespaceNamespacesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -138,7 +137,7 @@ public virtual ArmOperation CreateOrUpdate(Wai } /// - /// Returns the description for the specified namespace. + /// Returns the given namespace. /// /// /// Request Path @@ -150,7 +149,7 @@ public virtual ArmOperation CreateOrUpdate(Wai /// /// /// - /// The namespace name. + /// Namespace name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -175,7 +174,7 @@ public virtual async Task> GetAsync(s } /// - /// Returns the description for the specified namespace. + /// Returns the given namespace. /// /// /// Request Path @@ -187,7 +186,7 @@ public virtual async Task> GetAsync(s /// /// /// - /// The namespace name. + /// Namespace name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -212,7 +211,7 @@ public virtual Response Get(string namespaceNa } /// - /// Lists the available namespaces within a resourceGroup. + /// Lists the available namespaces within a resource group. /// /// /// Request Path @@ -224,17 +223,19 @@ public virtual Response Get(string namespaceNa /// /// /// + /// Skip token for subsequent requests. + /// Maximum number of results to return. /// The cancellation token to use. /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + public virtual AsyncPageable GetAllAsync(string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationHubNamespaceNamespacesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _notificationHubNamespaceNamespacesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationHubNamespaceNamespacesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, skipToken, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _notificationHubNamespaceNamespacesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, skipToken, top); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NotificationHubNamespaceResource(Client, NotificationHubNamespaceData.DeserializeNotificationHubNamespaceData(e)), _notificationHubNamespaceNamespacesClientDiagnostics, Pipeline, "NotificationHubNamespaceCollection.GetAll", "value", "nextLink", cancellationToken); } /// - /// Lists the available namespaces within a resourceGroup. + /// Lists the available namespaces within a resource group. /// /// /// Request Path @@ -246,12 +247,14 @@ public virtual AsyncPageable GetAllAsync(Cance /// /// /// + /// Skip token for subsequent requests. + /// Maximum number of results to return. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationHubNamespaceNamespacesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _notificationHubNamespaceNamespacesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationHubNamespaceNamespacesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, skipToken, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _notificationHubNamespaceNamespacesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, skipToken, top); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NotificationHubNamespaceResource(Client, NotificationHubNamespaceData.DeserializeNotificationHubNamespaceData(e)), _notificationHubNamespaceNamespacesClientDiagnostics, Pipeline, "NotificationHubNamespaceCollection.GetAll", "value", "nextLink", cancellationToken); } @@ -268,7 +271,7 @@ public virtual Pageable GetAll(CancellationTok /// /// /// - /// The namespace name. + /// Namespace name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -303,7 +306,7 @@ public virtual async Task> ExistsAsync(string namespaceName, Canc /// /// /// - /// The namespace name. + /// Namespace name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -338,7 +341,7 @@ public virtual Response Exists(string namespaceName, CancellationToken can /// /// /// - /// The namespace name. + /// Namespace name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -375,7 +378,7 @@ public virtual async Task> Ge /// /// /// - /// The namespace name. + /// Namespace name. /// 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/NotificationHubNamespaceData.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceData.cs index 0449af9f6b48..82d81f667a12 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceData.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceData.cs @@ -15,14 +15,19 @@ namespace Azure.ResourceManager.NotificationHubs { /// /// A class representing the NotificationHubNamespace data model. - /// Description of a Namespace resource. + /// Notification Hubs Namespace Resource. /// public partial class NotificationHubNamespaceData : TrackedResourceData { /// Initializes a new instance of NotificationHubNamespaceData. /// The location. - public NotificationHubNamespaceData(AzureLocation location) : base(location) + /// The Sku description for a namespace. + /// is null. + public NotificationHubNamespaceData(AzureLocation location, NotificationHubSku sku) : base(location) { + Argument.AssertNotNull(sku, nameof(sku)); + + Sku = sku; } /// Initializes a new instance of NotificationHubNamespaceData. @@ -32,69 +37,17 @@ public NotificationHubNamespaceData(AzureLocation location) : base(location) /// The systemData. /// The tags. /// The location. - /// The name of the namespace. - /// Provisioning state of the Namespace. - /// Specifies the targeted region in which the namespace should be created. It can be any of the following values: Australia East, Australia Southeast, Central US, East US, East US 2, West US, North Central US, South Central US, East Asia, Southeast Asia, Brazil South, Japan East, Japan West, North Europe, West Europe. - /// Identifier for Azure Insights metrics. - /// Status of the namespace. It can be any of these values:1 = Created/Active2 = Creating3 = Suspended4 = Deleting. - /// The time the namespace was created. - /// The time the namespace was updated. - /// Endpoint you can use to perform NotificationHub operations. - /// The Id of the Azure subscription associated with the namespace. - /// ScaleUnit where the namespace gets created. - /// Whether or not the namespace is currently enabled. - /// Whether or not the namespace is set as Critical. - /// Data center for the namespace. - /// The namespace type. - /// The sku of the created namespace. - internal NotificationHubNamespaceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string namespaceName, string provisioningState, string region, string metricId, string status, DateTimeOffset? createdOn, DateTimeOffset? updatedOn, Uri serviceBusEndpoint, string subscriptionId, string scaleUnit, bool? isEnabled, bool? isCritical, string dataCenter, NotificationHubNamespaceType? namespaceType, NotificationHubSku sku) : base(id, name, resourceType, systemData, tags, location) + /// The Sku description for a namespace. + /// Represents namespace properties. + internal NotificationHubNamespaceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NotificationHubSku sku, NamespaceProperties properties) : base(id, name, resourceType, systemData, tags, location) { - NamespaceName = namespaceName; - ProvisioningState = provisioningState; - Region = region; - MetricId = metricId; - Status = status; - CreatedOn = createdOn; - UpdatedOn = updatedOn; - ServiceBusEndpoint = serviceBusEndpoint; - SubscriptionId = subscriptionId; - ScaleUnit = scaleUnit; - IsEnabled = isEnabled; - IsCritical = isCritical; - DataCenter = dataCenter; - NamespaceType = namespaceType; Sku = sku; + Properties = properties; } - /// The name of the namespace. - public string NamespaceName { get; set; } - /// Provisioning state of the Namespace. - public string ProvisioningState { get; set; } - /// Specifies the targeted region in which the namespace should be created. It can be any of the following values: Australia East, Australia Southeast, Central US, East US, East US 2, West US, North Central US, South Central US, East Asia, Southeast Asia, Brazil South, Japan East, Japan West, North Europe, West Europe. - public string Region { get; set; } - /// Identifier for Azure Insights metrics. - public string MetricId { get; } - /// Status of the namespace. It can be any of these values:1 = Created/Active2 = Creating3 = Suspended4 = Deleting. - public string Status { get; set; } - /// The time the namespace was created. - public DateTimeOffset? CreatedOn { get; set; } - /// The time the namespace was updated. - public DateTimeOffset? UpdatedOn { get; set; } - /// Endpoint you can use to perform NotificationHub operations. - public Uri ServiceBusEndpoint { get; set; } - /// The Id of the Azure subscription associated with the namespace. - public string SubscriptionId { get; set; } - /// ScaleUnit where the namespace gets created. - public string ScaleUnit { get; set; } - /// Whether or not the namespace is currently enabled. - public bool? IsEnabled { get; set; } - /// Whether or not the namespace is set as Critical. - public bool? IsCritical { get; set; } - /// Data center for the namespace. - public string DataCenter { get; set; } - /// The namespace type. - public NotificationHubNamespaceType? NamespaceType { get; set; } - /// The sku of the created namespace. + /// The Sku description for a namespace. public NotificationHubSku Sku { get; set; } + /// Represents namespace properties. + public NamespaceProperties Properties { get; set; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceResource.cs index 65dbf24a50c4..ed7b4d39a49e 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceResource.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceResource.cs @@ -93,11 +93,64 @@ 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 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 the notification hub. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName} + /// + /// + /// Operation Id + /// NotificationHubs_Get + /// + /// + /// + /// Notification Hub name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetNotificationHubAsync(string notificationHubName, CancellationToken cancellationToken = default) + { + return await GetNotificationHubs().GetAsync(notificationHubName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the notification hub. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName} + /// + /// + /// Operation Id + /// NotificationHubs_Get + /// + /// + /// + /// Notification Hub name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetNotificationHub(string notificationHubName, CancellationToken cancellationToken = default) + { + return GetNotificationHubs().Get(notificationHubName, cancellationToken); + } + + /// Gets a collection of NamespaceAuthorizationRuleResources in the NotificationHubNamespace. + /// An object representing collection of NamespaceAuthorizationRuleResources and their operations over a NamespaceAuthorizationRuleResource. + public virtual NamespaceAuthorizationRuleCollection GetNamespaceAuthorizationRules() + { + return GetCachedClient(Client => new NamespaceAuthorizationRuleCollection(Client, Id)); } /// @@ -105,7 +158,7 @@ public virtual NotificationHubNamespaceAuthorizationRuleCollection GetNotificati /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id @@ -113,14 +166,14 @@ public virtual NotificationHubNamespaceAuthorizationRuleCollection GetNotificati /// /// /// - /// Authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual async Task> GetNotificationHubNamespaceAuthorizationRuleAsync(string authorizationRuleName, CancellationToken cancellationToken = default) + public virtual async Task> GetNamespaceAuthorizationRuleAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { - return await GetNotificationHubNamespaceAuthorizationRules().GetAsync(authorizationRuleName, cancellationToken).ConfigureAwait(false); + return await GetNamespaceAuthorizationRules().GetAsync(authorizationRuleName, cancellationToken).ConfigureAwait(false); } /// @@ -128,7 +181,7 @@ public virtual async Task /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id @@ -136,71 +189,128 @@ public virtual async Task /// /// - /// Authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual Response GetNotificationHubNamespaceAuthorizationRule(string authorizationRuleName, CancellationToken cancellationToken = default) + public virtual Response GetNamespaceAuthorizationRule(string authorizationRuleName, CancellationToken cancellationToken = default) { - return GetNotificationHubNamespaceAuthorizationRules().Get(authorizationRuleName, cancellationToken); + return GetNamespaceAuthorizationRules().Get(authorizationRuleName, cancellationToken); } - /// 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 PrivateEndpointConnectionResources in the NotificationHubNamespace. + /// An object representing collection of PrivateEndpointConnectionResources and their operations over a PrivateEndpointConnectionResource. + public virtual PrivateEndpointConnectionResourceCollection GetPrivateEndpointConnectionResources() { - return GetCachedClient(Client => new NotificationHubCollection(Client, Id)); + return GetCachedClient(Client => new PrivateEndpointConnectionResourceCollection(Client, Id)); } /// - /// Lists the notification hubs associated with a namespace. + /// Returns a Private Endpoint Connection with a given name. + /// This is a public API that can be called directly by Notification Hubs users. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} /// /// /// Operation Id - /// NotificationHubs_Get + /// PrivateEndpointConnections_Get /// /// /// - /// The notification hub name. + /// Private Endpoint Connection Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. + /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] - public virtual async Task> GetNotificationHubAsync(string notificationHubName, CancellationToken cancellationToken = default) + public virtual async Task> GetPrivateEndpointConnectionResourceAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { - return await GetNotificationHubs().GetAsync(notificationHubName, cancellationToken).ConfigureAwait(false); + return await GetPrivateEndpointConnectionResources().GetAsync(privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); } /// - /// Lists the notification hubs associated with a namespace. + /// Returns a Private Endpoint Connection with a given name. + /// This is a public API that can be called directly by Notification Hubs users. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} /// /// /// Operation Id - /// NotificationHubs_Get + /// PrivateEndpointConnections_Get /// /// /// - /// The notification hub name. + /// Private Endpoint Connection Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. + /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] - public virtual Response GetNotificationHub(string notificationHubName, CancellationToken cancellationToken = default) + public virtual Response GetPrivateEndpointConnectionResource(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { - return GetNotificationHubs().Get(notificationHubName, cancellationToken); + return GetPrivateEndpointConnectionResources().Get(privateEndpointConnectionName, cancellationToken); + } + + /// Gets a collection of NotificationHubsPrivateLinkResources in the NotificationHubNamespace. + /// An object representing collection of NotificationHubsPrivateLinkResources and their operations over a NotificationHubsPrivateLinkResource. + public virtual NotificationHubsPrivateLinkResourceCollection GetNotificationHubsPrivateLinkResources() + { + return GetCachedClient(Client => new NotificationHubsPrivateLinkResourceCollection(Client, Id)); + } + + /// + /// 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. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateLinkResources/{subResourceName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_GetGroupId + /// + /// + /// + /// Name of the Private Link sub-resource. The only supported sub-resource is "namespace". + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetNotificationHubsPrivateLinkResourceAsync(string subResourceName, CancellationToken cancellationToken = default) + { + return await GetNotificationHubsPrivateLinkResources().GetAsync(subResourceName, cancellationToken).ConfigureAwait(false); } /// - /// Returns the description for the specified namespace. + /// 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. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateLinkResources/{subResourceName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_GetGroupId + /// + /// + /// + /// Name of the Private Link sub-resource. The only supported sub-resource is "namespace". + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetNotificationHubsPrivateLinkResource(string subResourceName, CancellationToken cancellationToken = default) + { + return GetNotificationHubsPrivateLinkResources().Get(subResourceName, cancellationToken); + } + + /// + /// Returns the given namespace. /// /// /// Request Path @@ -232,7 +342,7 @@ public virtual async Task> GetAsync(C } /// - /// Returns the description for the specified namespace. + /// Returns the given namespace. /// /// /// Request Path @@ -285,7 +395,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell try { var response = await _notificationHubNamespaceNamespacesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NotificationHubsArmOperation(_notificationHubNamespaceNamespacesClientDiagnostics, Pipeline, _notificationHubNamespaceNamespacesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var operation = new NotificationHubsArmOperation(response); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -319,7 +429,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel try { var response = _notificationHubNamespaceNamespacesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new NotificationHubsArmOperation(_notificationHubNamespaceNamespacesClientDiagnostics, Pipeline, _notificationHubNamespaceNamespacesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var operation = new NotificationHubsArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -332,7 +442,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Patches the existing namespace + /// Patches the existing namespace. /// /// /// Request Path @@ -340,11 +450,11 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// Namespaces_Patch + /// Namespaces_Update /// /// /// - /// Parameters supplied to patch a Namespace Resource. + /// Request content. /// The cancellation token to use. /// is null. public virtual async Task> UpdateAsync(NotificationHubNamespacePatch patch, CancellationToken cancellationToken = default) @@ -355,7 +465,7 @@ public virtual async Task> UpdateAsyn scope.Start(); try { - var response = await _notificationHubNamespaceNamespacesRestClient.PatchAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var response = await _notificationHubNamespaceNamespacesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); return Response.FromValue(new NotificationHubNamespaceResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -366,7 +476,7 @@ public virtual async Task> UpdateAsyn } /// - /// Patches the existing namespace + /// Patches the existing namespace. /// /// /// Request Path @@ -374,11 +484,11 @@ public virtual async Task> UpdateAsyn /// /// /// Operation Id - /// Namespaces_Patch + /// Namespaces_Update /// /// /// - /// Parameters supplied to patch a Namespace Resource. + /// Request content. /// The cancellation token to use. /// is null. public virtual Response Update(NotificationHubNamespacePatch patch, CancellationToken cancellationToken = default) @@ -389,7 +499,7 @@ public virtual Response Update(NotificationHub scope.Start(); try { - var response = _notificationHubNamespaceNamespacesRestClient.Patch(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var response = _notificationHubNamespaceNamespacesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); return Response.FromValue(new NotificationHubNamespaceResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -412,7 +522,7 @@ public virtual Response Update(NotificationHub /// /// /// - /// The notificationHub name. + /// Request content. /// The cancellation token to use. /// is null. public virtual async Task> CheckNotificationHubAvailabilityAsync(NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) @@ -446,7 +556,7 @@ public virtual async Task> CheckNoti /// /// /// - /// The notificationHub name. + /// Request content. /// The cancellation token to use. /// is null. public virtual Response CheckNotificationHubAvailability(NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) @@ -467,6 +577,66 @@ public virtual Response CheckNotificationHubA } } + /// + /// Lists the PNS credentials associated with a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/pnsCredentials + /// + /// + /// Operation Id + /// Namespaces_GetPnsCredentials + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetPnsCredentialsAsync(CancellationToken cancellationToken = default) + { + using var scope = _notificationHubNamespaceNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceResource.GetPnsCredentials"); + scope.Start(); + try + { + var response = await _notificationHubNamespaceNamespacesRestClient.GetPnsCredentialsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the PNS credentials associated with a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/pnsCredentials + /// + /// + /// Operation Id + /// Namespaces_GetPnsCredentials + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetPnsCredentials(CancellationToken cancellationToken = default) + { + using var scope = _notificationHubNamespaceNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceResource.GetPnsCredentials"); + scope.Start(); + try + { + var response = _notificationHubNamespaceNamespacesRestClient.GetPnsCredentials(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Add a tag to the current resource. /// diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubResource.cs index f0b407adc62e..0554314ea626 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubResource.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubResource.cs @@ -88,11 +88,11 @@ 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 NotificationHubAuthorizationRuleResources in the NotificationHub. - /// An object representing collection of NotificationHubAuthorizationRuleResources and their operations over a NotificationHubAuthorizationRuleResource. - public virtual NotificationHubAuthorizationRuleCollection GetNotificationHubAuthorizationRules() + /// Gets a collection of NamespaceNotificationHubAuthorizationRuleResources in the NotificationHub. + /// An object representing collection of NamespaceNotificationHubAuthorizationRuleResources and their operations over a NamespaceNotificationHubAuthorizationRuleResource. + public virtual NamespaceNotificationHubAuthorizationRuleCollection GetNamespaceNotificationHubAuthorizationRules() { - return GetCachedClient(Client => new NotificationHubAuthorizationRuleCollection(Client, Id)); + return GetCachedClient(Client => new NamespaceNotificationHubAuthorizationRuleCollection(Client, Id)); } /// @@ -100,7 +100,7 @@ public virtual NotificationHubAuthorizationRuleCollection GetNotificationHubAuth /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id @@ -108,14 +108,14 @@ public virtual NotificationHubAuthorizationRuleCollection GetNotificationHubAuth /// /// /// - /// authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual async Task> GetNotificationHubAuthorizationRuleAsync(string authorizationRuleName, CancellationToken cancellationToken = default) + public virtual async Task> GetNamespaceNotificationHubAuthorizationRuleAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { - return await GetNotificationHubAuthorizationRules().GetAsync(authorizationRuleName, cancellationToken).ConfigureAwait(false); + return await GetNamespaceNotificationHubAuthorizationRules().GetAsync(authorizationRuleName, cancellationToken).ConfigureAwait(false); } /// @@ -123,7 +123,7 @@ public virtual async Task> Ge /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName} /// /// /// Operation Id @@ -131,18 +131,18 @@ public virtual async Task> Ge /// /// /// - /// authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual Response GetNotificationHubAuthorizationRule(string authorizationRuleName, CancellationToken cancellationToken = default) + public virtual Response GetNamespaceNotificationHubAuthorizationRule(string authorizationRuleName, CancellationToken cancellationToken = default) { - return GetNotificationHubAuthorizationRules().Get(authorizationRuleName, cancellationToken); + return GetNamespaceNotificationHubAuthorizationRules().Get(authorizationRuleName, cancellationToken); } /// - /// Lists the notification hubs associated with a namespace. + /// Gets the notification hub. /// /// /// Request Path @@ -174,7 +174,7 @@ public virtual async Task> GetAsync(Cancellati } /// - /// Lists the notification hubs associated with a namespace. + /// Gets the notification hub. /// /// /// Request Path @@ -282,11 +282,11 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// NotificationHubs_Patch + /// NotificationHubs_Update /// /// /// - /// Parameters supplied to patch a NotificationHub Resource. + /// Request content. /// The cancellation token to use. /// is null. public virtual async Task> UpdateAsync(NotificationHubPatch patch, CancellationToken cancellationToken = default) @@ -297,7 +297,7 @@ public virtual async Task> UpdateAsync(Notific scope.Start(); try { - var response = await _notificationHubRestClient.PatchAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var response = await _notificationHubRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); return Response.FromValue(new NotificationHubResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -316,11 +316,11 @@ public virtual async Task> UpdateAsync(Notific /// /// /// Operation Id - /// NotificationHubs_Patch + /// NotificationHubs_Update /// /// /// - /// Parameters supplied to patch a NotificationHub Resource. + /// Request content. /// The cancellation token to use. /// is null. public virtual Response Update(NotificationHubPatch patch, CancellationToken cancellationToken = default) @@ -331,7 +331,7 @@ public virtual Response Update(NotificationHubPatch pat scope.Start(); try { - var response = _notificationHubRestClient.Patch(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); + var response = _notificationHubRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); return Response.FromValue(new NotificationHubResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -342,7 +342,7 @@ public virtual Response Update(NotificationHubPatch pat } /// - /// test send a push notification + /// Test send a push notification. /// /// /// Request Path @@ -354,15 +354,14 @@ public virtual Response Update(NotificationHubPatch pat /// /// /// - /// Debug send parameters. /// The cancellation token to use. - public virtual async Task> DebugSendAsync(BinaryData anyObject = null, CancellationToken cancellationToken = default) + public virtual async Task> DebugSendAsync(CancellationToken cancellationToken = default) { using var scope = _notificationHubClientDiagnostics.CreateScope("NotificationHubResource.DebugSend"); scope.Start(); try { - var response = await _notificationHubRestClient.DebugSendAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, anyObject, cancellationToken).ConfigureAwait(false); + var response = await _notificationHubRestClient.DebugSendAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -373,7 +372,7 @@ public virtual async Task> DebugSendAsyn } /// - /// test send a push notification + /// Test send a push notification. /// /// /// Request Path @@ -385,15 +384,14 @@ public virtual async Task> DebugSendAsyn /// /// /// - /// Debug send parameters. /// The cancellation token to use. - public virtual Response DebugSend(BinaryData anyObject = null, CancellationToken cancellationToken = default) + public virtual Response DebugSend(CancellationToken cancellationToken = default) { using var scope = _notificationHubClientDiagnostics.CreateScope("NotificationHubResource.DebugSend"); scope.Start(); try { - var response = _notificationHubRestClient.DebugSend(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, anyObject, cancellationToken); + var response = _notificationHubRestClient.DebugSend(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) @@ -404,7 +402,7 @@ public virtual Response DebugSend(BinaryData anyO } /// - /// Lists the PNS Credentials associated with a notification hub . + /// Lists the PNS Credentials associated with a notification hub. /// /// /// Request Path @@ -434,7 +432,7 @@ public virtual async Task> GetPnsCredent } /// - /// Lists the PNS Credentials associated with a notification hub . + /// Lists the PNS Credentials associated with a notification hub. /// /// /// Request Path @@ -500,7 +498,7 @@ public virtual async Task> AddTagAsync(string else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new NotificationHubPatch(current.Location); + var patch = new NotificationHubPatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -554,7 +552,7 @@ public virtual Response AddTag(string key, string value else { var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new NotificationHubPatch(current.Location); + var patch = new NotificationHubPatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -607,7 +605,7 @@ public virtual async Task> SetTagsAsync(IDicti else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new NotificationHubPatch(current.Location); + var patch = new NotificationHubPatch(); patch.Tags.ReplaceWith(tags); var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); return result; @@ -656,7 +654,7 @@ public virtual Response SetTags(IDictionary> RemoveTagAsync(stri else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new NotificationHubPatch(current.Location); + var patch = new NotificationHubPatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -756,7 +754,7 @@ public virtual Response RemoveTag(string key, Cancellat else { var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new NotificationHubPatch(current.Location); + var patch = new NotificationHubPatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResource.cs new file mode 100644 index 000000000000..0c320d67dc73 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResource.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NotificationHubs +{ + /// + /// A Class representing a NotificationHubsPrivateLinkResource along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetNotificationHubsPrivateLinkResource method. + /// Otherwise you can get one from its parent resource using the GetNotificationHubsPrivateLinkResource method. + /// + public partial class NotificationHubsPrivateLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string subResourceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateLinkResources/{subResourceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsClientDiagnostics; + private readonly PrivateEndpointConnectionsRestOperations _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsRestClient; + private readonly NotificationHubsPrivateLinkResourceData _data; + + /// Initializes a new instance of the class for mocking. + protected NotificationHubsPrivateLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal NotificationHubsPrivateLinkResource(ArmClient client, NotificationHubsPrivateLinkResourceData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal NotificationHubsPrivateLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NotificationHubs", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string notificationHubsPrivateLinkResourcePrivateEndpointConnectionsApiVersion); + _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsRestClient = new PrivateEndpointConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, notificationHubsPrivateLinkResourcePrivateEndpointConnectionsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NotificationHubs/namespaces/privateLinkResources"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual NotificationHubsPrivateLinkResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// 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. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateLinkResources/{subResourceName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_GetGroupId + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("NotificationHubsPrivateLinkResource.Get"); + scope.Start(); + try + { + var response = await _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsRestClient.GetGroupIdAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NotificationHubsPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// 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. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateLinkResources/{subResourceName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_GetGroupId + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("NotificationHubsPrivateLinkResource.Get"); + scope.Start(); + try + { + var response = _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsRestClient.GetGroupId(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NotificationHubsPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResourceCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResourceCollection.cs new file mode 100644 index 000000000000..96dd64202ee6 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResourceCollection.cs @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NotificationHubs +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetNotificationHubsPrivateLinkResources method from an instance of . + /// + public partial class NotificationHubsPrivateLinkResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsClientDiagnostics; + private readonly PrivateEndpointConnectionsRestOperations _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsRestClient; + + /// Initializes a new instance of the class for mocking. + protected NotificationHubsPrivateLinkResourceCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal NotificationHubsPrivateLinkResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NotificationHubs", NotificationHubsPrivateLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(NotificationHubsPrivateLinkResource.ResourceType, out string notificationHubsPrivateLinkResourcePrivateEndpointConnectionsApiVersion); + _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsRestClient = new PrivateEndpointConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, notificationHubsPrivateLinkResourcePrivateEndpointConnectionsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != NotificationHubNamespaceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NotificationHubNamespaceResource.ResourceType), nameof(id)); + } + + /// + /// 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. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateLinkResources/{subResourceName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_GetGroupId + /// + /// + /// + /// Name of the Private Link sub-resource. The only supported sub-resource is "namespace". + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string subResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subResourceName, nameof(subResourceName)); + + using var scope = _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("NotificationHubsPrivateLinkResourceCollection.Get"); + scope.Start(); + try + { + var response = await _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsRestClient.GetGroupIdAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, subResourceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NotificationHubsPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// 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. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateLinkResources/{subResourceName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_GetGroupId + /// + /// + /// + /// Name of the Private Link sub-resource. The only supported sub-resource is "namespace". + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string subResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subResourceName, nameof(subResourceName)); + + using var scope = _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("NotificationHubsPrivateLinkResourceCollection.Get"); + scope.Start(); + try + { + var response = _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsRestClient.GetGroupId(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, subResourceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NotificationHubsPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// 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. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateLinkResources + /// + /// + /// Operation Id + /// PrivateEndpointConnections_ListGroupIds + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + 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); + } + + /// + /// 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. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateLinkResources + /// + /// + /// Operation Id + /// PrivateEndpointConnections_ListGroupIds + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + 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); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateLinkResources/{subResourceName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_GetGroupId + /// + /// + /// + /// Name of the Private Link sub-resource. The only supported sub-resource is "namespace". + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string subResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subResourceName, nameof(subResourceName)); + + using var scope = _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("NotificationHubsPrivateLinkResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsRestClient.GetGroupIdAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, subResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateLinkResources/{subResourceName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_GetGroupId + /// + /// + /// + /// Name of the Private Link sub-resource. The only supported sub-resource is "namespace". + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string subResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subResourceName, nameof(subResourceName)); + + using var scope = _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("NotificationHubsPrivateLinkResourceCollection.Exists"); + scope.Start(); + try + { + var response = _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsRestClient.GetGroupId(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, subResourceName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateLinkResources/{subResourceName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_GetGroupId + /// + /// + /// + /// Name of the Private Link sub-resource. The only supported sub-resource is "namespace". + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string subResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subResourceName, nameof(subResourceName)); + + using var scope = _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("NotificationHubsPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsRestClient.GetGroupIdAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, subResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NotificationHubsPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateLinkResources/{subResourceName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_GetGroupId + /// + /// + /// + /// Name of the Private Link sub-resource. The only supported sub-resource is "namespace". + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string subResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subResourceName, nameof(subResourceName)); + + using var scope = _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("NotificationHubsPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _notificationHubsPrivateLinkResourcePrivateEndpointConnectionsRestClient.GetGroupId(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, subResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NotificationHubsPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResourceData.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResourceData.cs new file mode 100644 index 000000000000..768d3c5ae3b3 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResourceData.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NotificationHubs.Models; + +namespace Azure.ResourceManager.NotificationHubs +{ + /// + /// A class representing the NotificationHubsPrivateLinkResource data model. + /// A Private Link Arm Resource. + /// + public partial class NotificationHubsPrivateLinkResourceData : ResourceData + { + /// Initializes a new instance of NotificationHubsPrivateLinkResourceData. + public NotificationHubsPrivateLinkResourceData() + { + } + + /// Initializes a new instance of NotificationHubsPrivateLinkResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Represents properties of Private Link Resource. + internal NotificationHubsPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, NotificationHubsPrivateLinkResourceProperties properties) : base(id, name, resourceType, systemData) + { + Properties = properties; + } + + /// Represents properties of Private Link Resource. + public NotificationHubsPrivateLinkResourceProperties Properties { get; set; } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/PrivateEndpointConnectionResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/PrivateEndpointConnectionResource.cs new file mode 100644 index 000000000000..16e39c833425 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/PrivateEndpointConnectionResource.cs @@ -0,0 +1,303 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NotificationHubs +{ + /// + /// A Class representing a PrivateEndpointConnectionResource along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetPrivateEndpointConnectionResource method. + /// Otherwise you can get one from its parent resource using the GetPrivateEndpointConnectionResource method. + /// + public partial class PrivateEndpointConnectionResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics; + private readonly PrivateEndpointConnectionsRestOperations _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient; + private readonly PrivateEndpointConnectionResourceData _data; + + /// Initializes a new instance of the class for mocking. + protected PrivateEndpointConnectionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal PrivateEndpointConnectionResource(ArmClient client, PrivateEndpointConnectionResourceData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal PrivateEndpointConnectionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NotificationHubs", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string privateEndpointConnectionResourcePrivateEndpointConnectionsApiVersion); + _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient = new PrivateEndpointConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, privateEndpointConnectionResourcePrivateEndpointConnectionsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NotificationHubs/namespaces/privateEndpointConnections"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PrivateEndpointConnectionResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Returns a Private Endpoint Connection with a given name. + /// This is a public API that can be called directly by Notification Hubs users. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("PrivateEndpointConnectionResource.Get"); + scope.Start(); + try + { + var response = await _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns a Private Endpoint Connection with a given name. + /// This is a public API that can be called directly by Notification Hubs users. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("PrivateEndpointConnectionResource.Get"); + scope.Start(); + try + { + var response = _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the Private Endpoint Connection. + /// This is a public API that can be called directly by Notification Hubs users. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Delete + /// + /// + /// + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("PrivateEndpointConnectionResource.Delete"); + scope.Start(); + try + { + var response = await _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new NotificationHubsArmOperation(_privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics, Pipeline, _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the Private Endpoint Connection. + /// This is a public API that can be called directly by Notification Hubs users. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Delete + /// + /// + /// + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("PrivateEndpointConnectionResource.Delete"); + scope.Start(); + try + { + var response = _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new NotificationHubsArmOperation(_privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics, Pipeline, _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Approves or rejects Private Endpoint Connection. + /// This is a public API that can be called directly by Notification Hubs users. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Update + /// + /// + /// + /// 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. + /// Description of the Private Endpoint Connection resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PrivateEndpointConnectionResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("PrivateEndpointConnectionResource.Update"); + scope.Start(); + try + { + var response = await _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new NotificationHubsArmOperation(new PrivateEndpointConnectionResourceOperationSource(Client), _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics, Pipeline, _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Approves or rejects Private Endpoint Connection. + /// This is a public API that can be called directly by Notification Hubs users. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Update + /// + /// + /// + /// 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. + /// Description of the Private Endpoint Connection resource. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, PrivateEndpointConnectionResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("PrivateEndpointConnectionResource.Update"); + scope.Start(); + try + { + var response = _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new NotificationHubsArmOperation(new PrivateEndpointConnectionResourceOperationSource(Client), _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics, Pipeline, _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/PrivateEndpointConnectionResourceCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/PrivateEndpointConnectionResourceCollection.cs new file mode 100644 index 000000000000..ad600c332a8e --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/PrivateEndpointConnectionResourceCollection.cs @@ -0,0 +1,419 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NotificationHubs +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetPrivateEndpointConnectionResources method from an instance of . + /// + public partial class PrivateEndpointConnectionResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics; + private readonly PrivateEndpointConnectionsRestOperations _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient; + + /// Initializes a new instance of the class for mocking. + protected PrivateEndpointConnectionResourceCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal PrivateEndpointConnectionResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NotificationHubs", PrivateEndpointConnectionResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(PrivateEndpointConnectionResource.ResourceType, out string privateEndpointConnectionResourcePrivateEndpointConnectionsApiVersion); + _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient = new PrivateEndpointConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, privateEndpointConnectionResourcePrivateEndpointConnectionsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != NotificationHubNamespaceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NotificationHubNamespaceResource.ResourceType), nameof(id)); + } + + /// + /// Approves or rejects Private Endpoint Connection. + /// This is a public API that can be called directly by Notification Hubs users. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Update + /// + /// + /// + /// 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. + /// Private Endpoint Connection Name. + /// Description of the Private Endpoint Connection resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string privateEndpointConnectionName, PrivateEndpointConnectionResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("PrivateEndpointConnectionResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken).ConfigureAwait(false); + var operation = new NotificationHubsArmOperation(new PrivateEndpointConnectionResourceOperationSource(Client), _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics, Pipeline, _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Approves or rejects Private Endpoint Connection. + /// This is a public API that can be called directly by Notification Hubs users. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Update + /// + /// + /// + /// 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. + /// Private Endpoint Connection Name. + /// Description of the Private Endpoint Connection resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string privateEndpointConnectionName, PrivateEndpointConnectionResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("PrivateEndpointConnectionResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken); + var operation = new NotificationHubsArmOperation(new PrivateEndpointConnectionResourceOperationSource(Client), _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics, Pipeline, _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns a Private Endpoint Connection with a given name. + /// This is a public API that can be called directly by Notification Hubs users. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// Private Endpoint Connection Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("PrivateEndpointConnectionResourceCollection.Get"); + scope.Start(); + try + { + var response = await _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns a Private Endpoint Connection with a given name. + /// This is a public API that can be called directly by Notification Hubs users. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// Private Endpoint Connection Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("PrivateEndpointConnectionResourceCollection.Get"); + scope.Start(); + try + { + var response = _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// 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. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections + /// + /// + /// Operation Id + /// PrivateEndpointConnections_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new PrivateEndpointConnectionResource(Client, PrivateEndpointConnectionResourceData.DeserializePrivateEndpointConnectionResourceData(e)), _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics, Pipeline, "PrivateEndpointConnectionResourceCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// 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. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections + /// + /// + /// Operation Id + /// PrivateEndpointConnections_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new PrivateEndpointConnectionResource(Client, PrivateEndpointConnectionResourceData.DeserializePrivateEndpointConnectionResourceData(e)), _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics, Pipeline, "PrivateEndpointConnectionResourceCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// Private Endpoint Connection Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("PrivateEndpointConnectionResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// Private Endpoint Connection Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("PrivateEndpointConnectionResourceCollection.Exists"); + scope.Start(); + try + { + var response = _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// Private Endpoint Connection Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("PrivateEndpointConnectionResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// Private Endpoint Connection Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _privateEndpointConnectionResourcePrivateEndpointConnectionsClientDiagnostics.CreateScope("PrivateEndpointConnectionResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _privateEndpointConnectionResourcePrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/PrivateEndpointConnectionResourceData.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/PrivateEndpointConnectionResourceData.cs new file mode 100644 index 000000000000..dbf7bf933b35 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/PrivateEndpointConnectionResourceData.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NotificationHubs.Models; + +namespace Azure.ResourceManager.NotificationHubs +{ + /// + /// A class representing the PrivateEndpointConnectionResource data model. + /// Represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace. + /// + public partial class PrivateEndpointConnectionResourceData : ResourceData + { + /// Initializes a new instance of PrivateEndpointConnectionResourceData. + public PrivateEndpointConnectionResourceData() + { + } + + /// Initializes a new instance of PrivateEndpointConnectionResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Private Endpoint Connection properties. + internal PrivateEndpointConnectionResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PrivateEndpointConnectionProperties properties) : base(id, name, resourceType, systemData) + { + Properties = properties; + } + + /// Private Endpoint Connection properties. + public PrivateEndpointConnectionProperties Properties { get; set; } + } +} 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 798a14411c5c..7b37d409fdce 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/RestOperations/NamespacesRestOperations.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/RestOperations/NamespacesRestOperations.cs @@ -33,7 +33,7 @@ public NamespacesRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2017-04-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ 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. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The namespace name. + /// The ID of the target subscription. The value must be an UUID. + /// Request content. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. @@ -86,8 +86,8 @@ 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. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The namespace name. + /// The ID of the target subscription. The value must be an UUID. + /// Request content. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. @@ -112,11 +112,11 @@ public Response CheckAvailability(string subs } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespaceCreateOrUpdateContent content) + internal HttpMessage CreateGetRequest(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); @@ -128,79 +128,151 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; _userAgent.Apply(message); return message; } - /// Creates/Updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// Parameters supplied to create a Namespace Resource. + /// 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. /// 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> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespaceCreateOrUpdateContent content, 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(content, nameof(content)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, content); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: { NotificationHubNamespaceData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); 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); } } - /// Creates/Updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// Parameters supplied to create a Namespace Resource. + /// 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. /// 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 CreateOrUpdate(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespaceCreateOrUpdateContent content, 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(content, nameof(content)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, content); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: { NotificationHubNamespaceData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); 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 HttpMessage CreatePatchRequest(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespacePatch patch) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespaceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + 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.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); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// 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 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) + { + 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); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// 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 an empty string, and was expected to be non-empty. + 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 = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespacePatch patch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -225,21 +297,21 @@ internal HttpMessage CreatePatchRequest(string subscriptionId, string resourceGr } /// Patches the existing namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// Parameters supplied to patch a Namespace Resource. + /// 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 an empty string, and was expected to be non-empty. - public async Task> PatchAsync(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespacePatch patch, CancellationToken cancellationToken = default) + 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 = CreatePatchRequest(subscriptionId, resourceGroupName, namespaceName, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, namespaceName, patch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -256,21 +328,21 @@ public async Task> PatchAsync(string subs } /// Patches the existing namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// Parameters supplied to patch a Namespace Resource. + /// 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 an empty string, and was expected to be non-empty. - public Response Patch(string subscriptionId, string resourceGroupName, string namespaceName, NotificationHubNamespacePatch patch, CancellationToken cancellationToken = default) + 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 = CreatePatchRequest(subscriptionId, resourceGroupName, namespaceName, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, namespaceName, patch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -301,14 +373,15 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(namespaceName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } /// Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace 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. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -323,7 +396,6 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr switch (message.Response.Status) { case 200: - case 202: case 204: return message.Response; default: @@ -332,9 +404,9 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace 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. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -349,7 +421,6 @@ public Response Delete(string subscriptionId, string resourceGroupName, string n switch (message.Response.Status) { case 200: - case 202: case 204: return message.Response; default: @@ -357,7 +428,86 @@ public Response Delete(string subscriptionId, string resourceGroupName, string n } } - 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; + request.Method = RequestMethod.Get; + 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.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all the available namespaces within the subscription. + /// The ID of the target subscription. The value must be an UUID. + /// Skip token for subsequent requests. + /// Maximum number of results to return. + /// 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) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListAllRequest(subscriptionId, skipToken, top); + 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, default, cancellationToken).ConfigureAwait(false); + value = NotificationHubNamespaceListResult.DeserializeNotificationHubNamespaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the available namespaces within the subscription. + /// The ID of the target subscription. The value must be an UUID. + /// Skip token for subsequent requests. + /// Maximum number of results to return. + /// 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) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListAllRequest(subscriptionId, skipToken, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NotificationHubNamespaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NotificationHubNamespaceListResult.DeserializeNotificationHubNamespaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string skipToken, int? top) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -368,8 +518,15 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou 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); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -377,69 +534,65 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou return message; } - /// Returns the description for the specified namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. + /// 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. + /// 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) + /// 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)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, 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, default, 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 description for the specified namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. + /// 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. + /// 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) + /// 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)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, 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); - 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 HttpMessage CreateCreateOrUpdateAuthorizationRuleRequest(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateContent content) + internal HttpMessage CreateCreateOrUpdateAuthorizationRuleRequest(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, NotificationHubAuthorizationRuleData data) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -452,41 +605,42 @@ 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("/authorizationRules/", false); uri.AppendPath(authorizationRuleName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; _userAgent.Apply(message); return message; } /// Creates an authorization rule for a namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace 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 shared access authorization rule. + /// 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> CreateOrUpdateAuthorizationRuleAsync(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateContent content, 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(content, nameof(content)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName, content); + 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, default, cancellationToken).ConfigureAwait(false); @@ -499,27 +653,28 @@ public async Task> CreateOrUpdate } /// Creates an authorization rule for a namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace 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 shared access authorization rule. + /// 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 CreateOrUpdateAuthorizationRule(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateContent content, 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(content, nameof(content)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName, content); + 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); @@ -544,18 +699,19 @@ internal HttpMessage CreateDeleteAuthorizationRuleRequest(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"); _userAgent.Apply(message); return message; } /// Deletes a namespace authorization rule. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace 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 cancellation token to use. /// , , or is null. @@ -580,9 +736,9 @@ public async Task DeleteAuthorizationRuleAsync(string subscriptionId, } /// Deletes a namespace authorization rule. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace 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 cancellation token to use. /// , , or is null. @@ -619,7 +775,7 @@ internal HttpMessage CreateGetAuthorizationRuleRequest(string subscriptionId, st 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; @@ -629,10 +785,10 @@ internal HttpMessage CreateGetAuthorizationRuleRequest(string subscriptionId, st } /// Gets an authorization rule for a namespace by name. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// Authorization rule 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 cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -662,10 +818,10 @@ public async Task> GetAuthorizati } /// Gets an authorization rule for a namespace by name. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// Authorization rule 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 cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -694,7 +850,7 @@ public Response GetAuthorizationRule(strin } } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName) + internal HttpMessage CreateListAuthorizationRulesRequest(string subscriptionId, string resourceGroupName, string namespaceName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -705,7 +861,9 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces", false); + uri.AppendPath("/providers/Microsoft.NotificationHubs/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/authorizationRules", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -713,26 +871,28 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro return message; } - /// Lists the available namespaces within a resourceGroup. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. If resourceGroupName value is null the method lists all the namespaces within subscription. + /// 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. /// 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, 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)); - using var message = CreateListRequest(subscriptionId, resourceGroupName); + using var message = CreateListAuthorizationRulesRequest(subscriptionId, resourceGroupName, namespaceName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - NotificationHubNamespaceListResult value = default; + SharedAccessAuthorizationRuleListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = NotificationHubNamespaceListResult.DeserializeNotificationHubNamespaceListResult(document.RootElement); + value = SharedAccessAuthorizationRuleListResult.DeserializeSharedAccessAuthorizationRuleListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -740,93 +900,28 @@ public async Task> ListAsync(string } } - /// Lists the available namespaces within a resourceGroup. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. If resourceGroupName value is null the method lists all the namespaces within subscription. + /// 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. /// 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, 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)); - using var message = CreateListRequest(subscriptionId, resourceGroupName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NotificationHubNamespaceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = NotificationHubNamespaceListResult.DeserializeNotificationHubNamespaceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListAllRequest(string subscriptionId) - { - 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("/providers/Microsoft.NotificationHubs/namespaces", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists all the available namespaces within the subscription irrespective of the resourceGroups. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListAllAsync(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListAllRequest(subscriptionId); - 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, default, cancellationToken).ConfigureAwait(false); - value = NotificationHubNamespaceListResult.DeserializeNotificationHubNamespaceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists all the available namespaces within the subscription irrespective of the resourceGroups. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListAll(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListAllRequest(subscriptionId); + using var message = CreateListAuthorizationRulesRequest(subscriptionId, resourceGroupName, namespaceName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - NotificationHubNamespaceListResult value = default; + SharedAccessAuthorizationRuleListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = NotificationHubNamespaceListResult.DeserializeNotificationHubNamespaceListResult(document.RootElement); + value = SharedAccessAuthorizationRuleListResult.DeserializeSharedAccessAuthorizationRuleListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -834,11 +929,11 @@ public Response ListAll(string subscriptionI } } - internal HttpMessage CreateListAuthorizationRulesRequest(string subscriptionId, string resourceGroupName, string namespaceName) + internal HttpMessage CreateListKeysRequest(string subscriptionId, string resourceGroupName, string namespaceName, 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); @@ -847,7 +942,9 @@ 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.AppendPath("/listKeys", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -855,28 +952,30 @@ internal HttpMessage CreateListAuthorizationRulesRequest(string subscriptionId, return message; } - /// Gets the authorization rules for a namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. + /// 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 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> ListKeysAsync(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 = CreateListKeysRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - SharedAccessAuthorizationRuleListResult value = default; + NotificationHubResourceKeys value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = SharedAccessAuthorizationRuleListResult.DeserializeSharedAccessAuthorizationRuleListResult(document.RootElement); + value = NotificationHubResourceKeys.DeserializeNotificationHubResourceKeys(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -884,28 +983,30 @@ public async Task> ListAuthori } } - /// Gets the authorization rules for a namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. + /// 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 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 ListKeys(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 = CreateListKeysRequest(subscriptionId, resourceGroupName, namespaceName, 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); - value = SharedAccessAuthorizationRuleListResult.DeserializeSharedAccessAuthorizationRuleListResult(document.RootElement); + value = NotificationHubResourceKeys.DeserializeNotificationHubResourceKeys(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -913,7 +1014,7 @@ public Response ListAuthorizationRules( } } - internal HttpMessage CreateListKeysRequest(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName) + internal HttpMessage CreateRegenerateKeysRequest(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, PolicyKeyResource policyKeyResource) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -926,32 +1027,38 @@ internal HttpMessage CreateListKeysRequest(string subscriptionId, string resourc 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.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(policyKeyResource); + request.Content = content; _userAgent.Apply(message); return message; } - /// Gets the Primary and Secondary ConnectionStrings to the namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The connection string of the namespace for the specified authorizationRule. + /// 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. + /// 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 authorizationRuleName, CancellationToken cancellationToken = default) + public async Task> RegenerateKeysAsync(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, PolicyKeyResource policyKeyResource, 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(policyKeyResource, nameof(policyKeyResource)); - using var message = CreateListKeysRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); + using var message = CreateRegenerateKeysRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName, policyKeyResource); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -967,22 +1074,24 @@ public async Task> ListKeysAsync(string su } } - /// Gets the Primary and Secondary ConnectionStrings to the namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The connection string of the namespace for the specified authorizationRule. + /// 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. + /// 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 authorizationRuleName, CancellationToken cancellationToken = default) + public Response RegenerateKeys(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, PolicyKeyResource policyKeyResource, 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(policyKeyResource, nameof(policyKeyResource)); - using var message = CreateListKeysRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName); + using var message = CreateRegenerateKeysRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName, policyKeyResource); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -998,7 +1107,7 @@ public Response ListKeys(string subscriptionId, str } } - internal HttpMessage CreateRegenerateKeysRequest(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName, NotificationHubPolicyKey notificationHubPolicyKey) + internal HttpMessage CreateGetPnsCredentialsRequest(string subscriptionId, string resourceGroupName, string namespaceName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1011,46 +1120,36 @@ internal HttpMessage CreateRegenerateKeysRequest(string subscriptionId, string r 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("/regenerateKeys", false); + uri.AppendPath("/pnsCredentials", 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); - request.Content = content; _userAgent.Apply(message); return message; } - /// Regenerates the Primary/Secondary Keys to the Namespace Authorization Rule. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The connection string of the namespace for the specified authorizationRule. - /// Parameters supplied to regenerate the Namespace Authorization Rule Key. + /// Lists the PNS credentials 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. /// 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 authorizationRuleName, NotificationHubPolicyKey notificationHubPolicyKey, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetPnsCredentialsAsync(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(notificationHubPolicyKey, nameof(notificationHubPolicyKey)); - using var message = CreateRegenerateKeysRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName, notificationHubPolicyKey); + using var message = CreateGetPnsCredentialsRequest(subscriptionId, resourceGroupName, namespaceName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - NotificationHubResourceKeys value = default; + NotificationHubPnsCredentials value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = NotificationHubResourceKeys.DeserializeNotificationHubResourceKeys(document.RootElement); + value = NotificationHubPnsCredentials.DeserializeNotificationHubPnsCredentials(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -1058,32 +1157,28 @@ public async Task> RegenerateKeysAsync(str } } - /// Regenerates the Primary/Secondary Keys to the Namespace Authorization Rule. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The connection string of the namespace for the specified authorizationRule. - /// Parameters supplied to regenerate the Namespace Authorization Rule Key. + /// Lists the PNS credentials 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. /// 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 authorizationRuleName, NotificationHubPolicyKey notificationHubPolicyKey, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response GetPnsCredentials(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(notificationHubPolicyKey, nameof(notificationHubPolicyKey)); - using var message = CreateRegenerateKeysRequest(subscriptionId, resourceGroupName, namespaceName, authorizationRuleName, notificationHubPolicyKey); + using var message = CreateGetPnsCredentialsRequest(subscriptionId, resourceGroupName, namespaceName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - NotificationHubResourceKeys value = default; + NotificationHubPnsCredentials value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = NotificationHubResourceKeys.DeserializeNotificationHubResourceKeys(document.RootElement); + value = NotificationHubPnsCredentials.DeserializeNotificationHubPnsCredentials(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -1091,7 +1186,7 @@ public Response RegenerateKeys(string subscriptionI } } - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + internal HttpMessage CreateListAllNextPageRequest(string nextLink, string subscriptionId, string skipToken, int? top) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1105,20 +1200,20 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript return message; } - /// Lists the available namespaces within a resourceGroup. + /// Lists all the available namespaces within the subscription. /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. If resourceGroupName value is null the method lists all the namespaces within subscription. + /// The ID of the target subscription. The value must be an UUID. + /// 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> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListAllNextPageAsync(string nextLink, string subscriptionId, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName); + using var message = CreateListAllNextPageRequest(nextLink, subscriptionId, skipToken, top); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1134,20 +1229,20 @@ public async Task> ListNextPageAsyn } } - /// Lists the available namespaces within a resourceGroup. + /// Lists all the available namespaces within the subscription. /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. If resourceGroupName value is null the method lists all the namespaces within subscription. + /// The ID of the target subscription. The value must be an UUID. + /// 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 ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListAllNextPage(string nextLink, string subscriptionId, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName); + using var message = CreateListAllNextPageRequest(nextLink, subscriptionId, skipToken, top); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1163,7 +1258,7 @@ public Response ListNextPage(string nextLink } } - internal HttpMessage CreateListAllNextPageRequest(string nextLink, string subscriptionId) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string skipToken, int? top) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1177,18 +1272,22 @@ internal HttpMessage CreateListAllNextPageRequest(string nextLink, string subscr return message; } - /// Lists all the available namespaces within the subscription irrespective of the resourceGroups. + /// Lists the available namespaces within a resource group. /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// 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. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListAllNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + /// , 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 skipToken = null, int? top = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListAllNextPageRequest(nextLink, subscriptionId); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, skipToken, top); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1204,18 +1303,22 @@ public async Task> ListAllNextPageA } } - /// Lists all the available namespaces within the subscription irrespective of the resourceGroups. + /// Lists the available namespaces within a resource group. /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// 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. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListAllNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + /// , 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 skipToken = null, int? top = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListAllNextPageRequest(nextLink, subscriptionId); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, skipToken, top); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1247,9 +1350,9 @@ internal HttpMessage CreateListAuthorizationRulesNextPageRequest(string nextLink /// Gets the authorization rules for a namespace. /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace 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. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -1278,9 +1381,9 @@ public async Task> ListAuthori /// Gets the authorization rules for a namespace. /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace 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. /// 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 33bcc1e9ab10..e3e0ca4b9717 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/RestOperations/NotificationHubsRestOperations.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/RestOperations/NotificationHubsRestOperations.cs @@ -33,7 +33,7 @@ public NotificationHubsRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2017-04-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -63,10 +63,10 @@ internal HttpMessage CreateCheckNotificationHubAvailabilityRequest(string subscr } /// Checks the availability of the given notificationHub in a namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notificationHub 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. + /// Request content. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -94,10 +94,10 @@ public async Task> CheckNotification } /// Checks the availability of the given notificationHub in a namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notificationHub 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. + /// Request content. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -124,7 +124,95 @@ public Response CheckNotificationHubAvailabil } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, NotificationHubCreateOrUpdateContent content) + internal HttpMessage CreateGetRequest(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.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the notification hub. + /// 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> GetAsync(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 = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NotificationHubData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NotificationHubData.DeserializeNotificationHubData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NotificationHubData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the notification hub. + /// 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 Get(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 = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NotificationHubData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NotificationHubData.DeserializeNotificationHubData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NotificationHubData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, NotificationHubData data) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -143,31 +231,31 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; _userAgent.Apply(message); return message; } /// Creates/Update a NotificationHub in a namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub name. - /// Parameters supplied to the create/update a NotificationHub Resource. + /// 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. + /// 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> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, NotificationHubCreateOrUpdateContent content, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, NotificationHubData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, content); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -185,23 +273,23 @@ public async Task> CreateOrUpdateAsync(string subs } /// Creates/Update a NotificationHub in a namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub name. - /// Parameters supplied to the create/update a NotificationHub Resource. + /// 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. + /// 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 CreateOrUpdate(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, NotificationHubCreateOrUpdateContent content, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, NotificationHubData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, content); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -218,7 +306,7 @@ public Response CreateOrUpdate(string subscriptionId, strin } } - internal HttpMessage CreatePatchRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, NotificationHubPatch patch) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, NotificationHubPatch patch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -245,15 +333,15 @@ internal HttpMessage CreatePatchRequest(string subscriptionId, string resourceGr } /// Patch a NotificationHub in a namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub name. - /// Parameters supplied to patch a NotificationHub Resource. + /// 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. + /// 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> PatchAsync(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, NotificationHubPatch patch, CancellationToken cancellationToken = default) + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, NotificationHubPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -261,7 +349,7 @@ public async Task> PatchAsync(string subscriptionI Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreatePatchRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, patch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -278,15 +366,15 @@ public async Task> PatchAsync(string subscriptionI } /// Patch a NotificationHub in a namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub name. - /// Parameters supplied to patch a NotificationHub Resource. + /// 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. + /// Request content. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Patch(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, NotificationHubPatch patch, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, NotificationHubPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -294,7 +382,7 @@ public Response Patch(string subscriptionId, string resourc Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreatePatchRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, patch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -327,15 +415,16 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(notificationHubName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } /// Deletes a notification hub associated with a namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub 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 cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -351,6 +440,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr switch (message.Response.Status) { case 200: + case 204: return message.Response; default: throw new RequestFailedException(message.Response); @@ -358,10 +448,10 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes a notification hub associated with a namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub 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 cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -377,13 +467,14 @@ public Response Delete(string subscriptionId, string resourceGroupName, string n switch (message.Response.Status) { case 200: + case 204: return message.Response; default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string namespaceName, string skipToken, int? top) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -396,8 +487,15 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou 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("/notificationHubs", false); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -406,72 +504,68 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Lists the notification hubs associated with a namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub 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. + /// 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> GetAsync(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> 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)); - Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, namespaceName, skipToken, top); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - NotificationHubData value = default; + NotificationHubListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = NotificationHubData.DeserializeNotificationHubData(document.RootElement); + value = NotificationHubListResult.DeserializeNotificationHubListResult(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((NotificationHubData)null, message.Response); default: throw new RequestFailedException(message.Response); } } /// Lists the notification hubs associated with a namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub 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. + /// 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 Get(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 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)); - Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, namespaceName, skipToken, top); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - NotificationHubData value = default; + NotificationHubListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = NotificationHubData.DeserializeNotificationHubData(document.RootElement); + value = NotificationHubListResult.DeserializeNotificationHubListResult(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((NotificationHubData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateDebugSendRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, BinaryData anyObject) + internal HttpMessage CreateDebugSendRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -490,45 +584,30 @@ internal HttpMessage CreateDebugSendRequest(string subscriptionId, string resour uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - if (anyObject != null) - { - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); -#if NET6_0_OR_GREATER - content.JsonWriter.WriteRawValue(anyObject); -#else - using (JsonDocument document = JsonDocument.Parse(anyObject)) - { - JsonSerializer.Serialize(content.JsonWriter, document.RootElement); - } -#endif - request.Content = content; - } _userAgent.Apply(message); return message; } - /// test send a push notification. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub name. - /// Debug send parameters. + /// 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. /// 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, BinaryData anyObject = null, CancellationToken cancellationToken = default) + 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)); - using var message = CreateDebugSendRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, anyObject); + using var message = CreateDebugSendRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { - case 201: + case 200: { NotificationHubTestSendResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); @@ -540,27 +619,26 @@ public async Task> DebugSendAsync(string } } - /// test send a push notification. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub name. - /// Debug send parameters. + /// 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. /// 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, BinaryData anyObject = null, CancellationToken cancellationToken = default) + 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)); - using var message = CreateDebugSendRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, anyObject); + using var message = CreateDebugSendRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { - case 201: + case 200: { NotificationHubTestSendResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); @@ -572,7 +650,7 @@ public Response DebugSend(string subscriptionId, } } - internal HttpMessage CreateCreateOrUpdateAuthorizationRuleRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateContent content) + internal HttpMessage CreateCreateOrUpdateAuthorizationRuleRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, NotificationHubAuthorizationRuleData data) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -587,43 +665,44 @@ internal HttpMessage CreateCreateOrUpdateAuthorizationRuleRequest(string subscri uri.AppendPath(namespaceName, true); uri.AppendPath("/notificationHubs/", false); uri.AppendPath(notificationHubName, 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"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; _userAgent.Apply(message); return message; } /// Creates/Updates an authorization rule for a NotificationHub. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub 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. /// Authorization Rule Name. - /// The shared access authorization rule. + /// 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> CreateOrUpdateAuthorizationRuleAsync(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateContent content, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAuthorizationRuleAsync(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, NotificationHubAuthorizationRuleData data, 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(content, nameof(content)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, content); + using var message = CreateCreateOrUpdateAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, 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, default, cancellationToken).ConfigureAwait(false); @@ -636,29 +715,30 @@ public async Task> CreateOrUpdate } /// Creates/Updates an authorization rule for a NotificationHub. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub 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. /// Authorization Rule Name. - /// The shared access authorization rule. + /// 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 CreateOrUpdateAuthorizationRule(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateContent content, CancellationToken cancellationToken = default) + public Response CreateOrUpdateAuthorizationRule(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, NotificationHubAuthorizationRuleData data, 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(content, nameof(content)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, content); + using var message = CreateCreateOrUpdateAuthorizationRuleRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, 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); @@ -685,19 +765,20 @@ internal HttpMessage CreateDeleteAuthorizationRuleRequest(string subscriptionId, uri.AppendPath(namespaceName, true); uri.AppendPath("/notificationHubs/", false); uri.AppendPath(notificationHubName, 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"); _userAgent.Apply(message); return message; } /// Deletes a notificationHub authorization rule. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub 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. /// Authorization Rule Name. /// The cancellation token to use. /// , , , or is null. @@ -723,10 +804,10 @@ public async Task DeleteAuthorizationRuleAsync(string subscriptionId, } /// Deletes a notificationHub authorization rule. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub 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. /// Authorization Rule Name. /// The cancellation token to use. /// , , , or is null. @@ -766,7 +847,7 @@ internal HttpMessage CreateGetAuthorizationRuleRequest(string subscriptionId, st uri.AppendPath(namespaceName, true); uri.AppendPath("/notificationHubs/", false); uri.AppendPath(notificationHubName, true); - uri.AppendPath("/AuthorizationRules/", false); + uri.AppendPath("/authorizationRules/", false); uri.AppendPath(authorizationRuleName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; @@ -776,11 +857,11 @@ internal HttpMessage CreateGetAuthorizationRuleRequest(string subscriptionId, st } /// Gets an authorization rule for a NotificationHub by name. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub name. - /// authorization rule 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. + /// Authorization Rule Name. /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. @@ -811,11 +892,11 @@ public async Task> GetAuthorizati } /// Gets an authorization rule for a NotificationHub by name. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub name. - /// authorization rule 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. + /// Authorization Rule Name. /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. @@ -845,85 +926,6 @@ public Response GetAuthorizationRule(strin } } - 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("/notificationHubs", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists the notification hubs associated with a namespace. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The 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: - { - NotificationHubListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, 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. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The 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: - { - NotificationHubListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = NotificationHubListResult.DeserializeNotificationHubListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - internal HttpMessage CreateListAuthorizationRulesRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName) { var message = _pipeline.CreateMessage(); @@ -939,7 +941,7 @@ internal HttpMessage CreateListAuthorizationRulesRequest(string subscriptionId, uri.AppendPath(namespaceName, true); uri.AppendPath("/notificationHubs/", false); uri.AppendPath(notificationHubName, true); - uri.AppendPath("/AuthorizationRules", false); + uri.AppendPath("/authorizationRules", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -948,10 +950,10 @@ internal HttpMessage CreateListAuthorizationRulesRequest(string subscriptionId, } /// Gets the authorization rules for a NotificationHub. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub 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 cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -979,10 +981,10 @@ public async Task> ListAuthori } /// Gets the authorization rules for a NotificationHub. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub 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 cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -1024,7 +1026,7 @@ internal HttpMessage CreateListKeysRequest(string subscriptionId, string resourc uri.AppendPath(namespaceName, true); uri.AppendPath("/notificationHubs/", false); uri.AppendPath(notificationHubName, true); - uri.AppendPath("/AuthorizationRules/", false); + uri.AppendPath("/authorizationRules/", false); uri.AppendPath(authorizationRuleName, true); uri.AppendPath("/listKeys", false); uri.AppendQuery("api-version", _apiVersion, true); @@ -1035,11 +1037,11 @@ internal HttpMessage CreateListKeysRequest(string subscriptionId, string resourc } /// Gets the Primary and Secondary ConnectionStrings to the NotificationHub. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub name. - /// The connection string of the NotificationHub for the specified authorizationRule. + /// 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 cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. @@ -1068,11 +1070,11 @@ public async Task> ListKeysAsync(string su } /// Gets the Primary and Secondary ConnectionStrings to the NotificationHub. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub name. - /// The connection string of the NotificationHub for the specified authorizationRule. + /// 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 cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. @@ -1100,7 +1102,7 @@ public Response ListKeys(string subscriptionId, str } } - internal HttpMessage CreateRegenerateKeysRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, NotificationHubPolicyKey notificationHubPolicyKey) + internal HttpMessage CreateRegenerateKeysRequest(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, PolicyKeyResource policyKeyResource) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1115,7 +1117,7 @@ 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("/authorizationRules/", false); uri.AppendPath(authorizationRuleName, true); uri.AppendPath("/regenerateKeys", false); uri.AppendQuery("api-version", _apiVersion, true); @@ -1123,32 +1125,32 @@ internal HttpMessage CreateRegenerateKeysRequest(string subscriptionId, string r request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(notificationHubPolicyKey); + content.JsonWriter.WriteObjectValue(policyKeyResource); request.Content = content; _userAgent.Apply(message); return message; } /// Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub name. - /// The connection string of the NotificationHub for the specified authorizationRule. - /// Parameters supplied to regenerate the NotificationHub Authorization Rule Key. + /// 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 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) + public async Task> RegenerateKeysAsync(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, PolicyKeyResource policyKeyResource, 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)); + Argument.AssertNotNull(policyKeyResource, nameof(policyKeyResource)); - using var message = CreateRegenerateKeysRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, notificationHubPolicyKey); + using var message = CreateRegenerateKeysRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, policyKeyResource); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1165,25 +1167,25 @@ public async Task> RegenerateKeysAsync(str } /// Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub name. - /// The connection string of the NotificationHub for the specified authorizationRule. - /// Parameters supplied to regenerate the NotificationHub Authorization Rule Key. + /// 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 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) + public Response RegenerateKeys(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, PolicyKeyResource policyKeyResource, 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)); + Argument.AssertNotNull(policyKeyResource, nameof(policyKeyResource)); - using var message = CreateRegenerateKeysRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, notificationHubPolicyKey); + using var message = CreateRegenerateKeysRequest(subscriptionId, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, policyKeyResource); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1222,11 +1224,11 @@ internal HttpMessage CreateGetPnsCredentialsRequest(string subscriptionId, strin return message; } - /// Lists the PNS Credentials associated with a notification hub . - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub name. + /// Lists the PNS Credentials associated with a notification hub. + /// 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. @@ -1253,11 +1255,11 @@ public async Task> GetPnsCredentialsAsyn } } - /// Lists the PNS Credentials associated with a notification hub . - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub name. + /// Lists the PNS Credentials associated with a notification hub. + /// 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. @@ -1284,7 +1286,7 @@ public Response GetPnsCredentials(string subscrip } } - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string skipToken, int? top) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1300,20 +1302,22 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Lists the notification hubs associated with a namespace. /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace 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. + /// 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> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string skipToken = null, int? top = null, 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); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, namespaceName, skipToken, top); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1331,20 +1335,22 @@ public async Task> ListNextPageAsync(string /// Lists the notification hubs associated with a namespace. /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace 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. + /// 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 ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string skipToken = null, int? top = null, 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); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, namespaceName, skipToken, top); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1376,10 +1382,10 @@ internal HttpMessage CreateListAuthorizationRulesNextPageRequest(string nextLink /// Gets the authorization rules for a NotificationHub. /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub 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 cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -1409,10 +1415,10 @@ public async Task> ListAuthori /// Gets the authorization rules for a NotificationHub. /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. - /// The namespace name. - /// The notification hub 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 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 new file mode 100644 index 000000000000..c0b697fafe8e --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -0,0 +1,570 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NotificationHubs.Models; + +namespace Azure.ResourceManager.NotificationHubs +{ + internal partial class PrivateEndpointConnectionsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of PrivateEndpointConnectionsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-10-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, PrivateEndpointConnectionResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + 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.AppendPath(privateEndpointConnectionName, 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(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// + /// 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 an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, PrivateEndpointConnectionResourceData 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 = CreateUpdateRequest(subscriptionId, resourceGroupName, namespaceName, privateEndpointConnectionName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// + /// 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 an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName, PrivateEndpointConnectionResourceData 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 = CreateUpdateRequest(subscriptionId, resourceGroupName, namespaceName, privateEndpointConnectionName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + 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); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/privateEndpointConnections/", false); + uri.AppendPath(privateEndpointConnectionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// + /// 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. + /// The name of the resource group. The name is case insensitive. + /// Namespace name. + /// Private Endpoint Connection Name. + /// The cancellation token to use. + /// , , 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) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName, privateEndpointConnectionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// + /// 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. + /// The name of the resource group. The name is case insensitive. + /// Namespace name. + /// Private Endpoint Connection Name. + /// The cancellation token to use. + /// , , 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) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName, privateEndpointConnectionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName) + { + 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.AppendPath(privateEndpointConnectionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// + /// 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. + /// 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) + { + 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); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PrivateEndpointConnectionResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PrivateEndpointConnectionResourceData.DeserializePrivateEndpointConnectionResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PrivateEndpointConnectionResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// + /// 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. + /// 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) + { + 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); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PrivateEndpointConnectionResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PrivateEndpointConnectionResourceData.DeserializePrivateEndpointConnectionResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PrivateEndpointConnectionResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + 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, default, 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); + value = PrivateEndpointConnectionResourceListResult.DeserializePrivateEndpointConnectionResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetGroupIdRequest(string subscriptionId, string resourceGroupName, string namespaceName, string subResourceName) + { + 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.AppendPath(subResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// + /// 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. + /// Namespace name. + /// Name of the Private Link sub-resource. The only supported sub-resource is "namespace". + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetGroupIdAsync(string subscriptionId, string resourceGroupName, string namespaceName, string subResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(subResourceName, nameof(subResourceName)); + + using var message = CreateGetGroupIdRequest(subscriptionId, resourceGroupName, namespaceName, subResourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NotificationHubsPrivateLinkResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NotificationHubsPrivateLinkResourceData.DeserializeNotificationHubsPrivateLinkResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NotificationHubsPrivateLinkResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// + /// 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. + /// Namespace name. + /// Name of the Private Link sub-resource. The only supported sub-resource is "namespace". + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetGroupId(string subscriptionId, string resourceGroupName, string namespaceName, string subResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(subResourceName, nameof(subResourceName)); + + using var message = CreateGetGroupIdRequest(subscriptionId, resourceGroupName, namespaceName, subResourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NotificationHubsPrivateLinkResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NotificationHubsPrivateLinkResourceData.DeserializeNotificationHubsPrivateLinkResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NotificationHubsPrivateLinkResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListGroupIdsRequest(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); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// + /// 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. + /// 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> 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 = CreateListGroupIdsRequest(subscriptionId, resourceGroupName, namespaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NotificationHubsPrivateLinkResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NotificationHubsPrivateLinkResourceListResult.DeserializeNotificationHubsPrivateLinkResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// + /// 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. + /// Namespace name. + /// The cancellation token to use. + /// , 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) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListGroupIdsRequest(subscriptionId, resourceGroupName, namespaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NotificationHubsPrivateLinkResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NotificationHubsPrivateLinkResourceListResult.DeserializeNotificationHubsPrivateLinkResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/autorest.md b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/autorest.md index 1fcb8ca8c844..3800217e2703 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/bab2f4389eb5ca73cdf366ec0a4af3f3eb6e1f6d/specification/notificationhubs/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/notificationhubs/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: